On 12/3/13 8:10 AM, Andreas Schlegel wrote:
> I understand you. If the proxies differ in behavior, they should not be 
> transparent. But for our case we have multiple proxies representing the same 
> target, only with different contracts. These contracts should e.g. give 
> different access rights to the target.

Then the proxies differ in behavior!

Throwing an exception instead of returning a value is an observable
difference in behavior. As Sam mentioned, so is nontermination.


> I've found the Algorithm for SameValue in the Interpreter.cpp. But where is 
> the implementation for SameValueZero?

Watch out --- the JS engine isn't a word-for-word transliteration of the
spec!

Value::operator== in js/public/Value.h is also a SameValue
implementation. StrictlyEqual must change too. And I'm sure the JITs
emit machine code for ===, so for a prototype you'll have to disable the
JITs and for production you'll have to change them to emit different
code (including a slow path for proxies).

I think SameValueZero is only used for Map and Set. So there may
actually be just a single implementation of that. See
HashableValue::hash() and HashableValue::operator==() in
js/src/builtin/MapObject.cpp.

My point was, you can search *the spec* for SameValue and the like, in
order to find parts of the JS language which rely on object identity.
Then each corresponding place in the JS engine must be modified. This
change cuts across many things.

>> * BaseProxyHandler::nativeCall should delegate to the target object 
> (instead of throwing an exception), if the proxy is transparent. This 
> will make non-generic methods work. 
>
> What do you mean with non-generic methods?

See the paragraph of that email that started "Non-generic methods, such
as the Number methods (but also Date, Map ...)"


>  I see the derived method nativeCall of the DirectProxyHandler is implemented 
> to get the target.
> I don't understand in which case I have a 
> DirectProxyHandler/ScriptedDirectProxyHandler or ScriptedIndirectProxyHandler 
> and the parent BaseProxyHandler?

You always have a ScriptedDirectProxyHandler.

There are other kinds of proxy in SpiderMonkey. They're used to
implement security membranes, certain strangely-behaved DOM objects, and
so on. You don't have to worry about them.

> Have I to change something in the "const Class js::ObjectProxyObject::class_"?

No. You can leave Class alone.

-j

_______________________________________________
dev-tech-js-engine-internals mailing list
dev-tech-js-engine-internals@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals

Reply via email to