Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Representing JS objects in DOM bindings
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Boris Zbarsky  
View profile  
 More options Jun 23 2012, 2:29 am
Newsgroups: mozilla.dev.tech.js-engine
From: Boris Zbarsky <bzbar...@mit.edu>
Date: Sat, 23 Jun 2012 02:29:50 -0400
Local: Sat, Jun 23 2012 2:29 am
Subject: Representing JS objects in DOM bindings
I've been looking into how we represent JS objects (needed in various
cases like callbacks) in DOM bindings.  Right now we extract a JSObject*
from the JS::Value and then pass it into the C++ method.  This is
clearly suboptimal in the moving GC world.

I believe I have several options at this point:

1)  Just pass in the JS::Value& (after verifying that it's isObject()).
  Pros: it's already rooted, nothing else to do.  Cons: On the callee
side it's not obvious that this is guaranteed to be an ObjectValue.  Or
maybe it's an ObjectOrNullValue?  The callee has to rely on some sort of
out-of-band information to tell.

2)  Put a RootedObject on the stack and pass a HandleObject to my
callee.  This incurs a bit more of a performance penalty, and it's still
not clear how I make a distinction between "object" and "object or null".

Any others?

Does it make any sense to make things like ObjectValue subclasses of
Value instead of just functions, so I could use ObjectValue& or
ObjectOrNullValue& or whatnot as an argument?  Or should I just stick
with RootedObject?  If I do that, what are my options for being able to
distinguish between nullable and non-nullable objects?

-Boris


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jeff Walden  
View profile  
 More options Jun 28 2012, 7:04 pm
Newsgroups: mozilla.dev.tech.js-engine
From: Jeff Walden <jwalden+...@mit.edu>
Date: Thu, 28 Jun 2012 16:04:00 -0700
Subject: Re: Representing JS objects in DOM bindings
On 06/22/2012 11:29 PM, Boris Zbarsky wrote:

> Does it make any sense to make things like ObjectValue subclasses of Value instead of just functions, so I could use ObjectValue& or ObjectOrNullValue& or whatnot as an argument?

This sounds good to me.  Keeping everything as a Value as long as possible in general -- not just for this particular circumstance -- might even be a very minor performance win, in terms of not unboxing things until absolutely necessary.

Jeff


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »