diff options
| author | Ben Murdoch <benm@google.com> | 2011-11-30 16:04:58 +0000 |
|---|---|---|
| committer | Ben Murdoch <benm@google.com> | 2011-12-02 17:28:30 +0000 |
| commit | 589d6979ff2ef66fca2d8fa51404c369ca5e9250 (patch) | |
| tree | 1d9032fcae9d18a05430a4ba9c14e5c635c4096e /src/proxy.js | |
| parent | 69a99ed0b2b2ef69d393c371b03db3a98aaf880e (diff) | |
| download | android_external_v8-589d6979ff2ef66fca2d8fa51404c369ca5e9250.tar.gz android_external_v8-589d6979ff2ef66fca2d8fa51404c369ca5e9250.tar.bz2 android_external_v8-589d6979ff2ef66fca2d8fa51404c369ca5e9250.zip | |
Upgrade to V8 3.6
Merge V8 at 3.6.6.11
Simple merge required updates to makefiles only.
Bug: 5688872
Change-Id: Ib38b7ffbcd409585f6cb6fccc59c767029cecc77
Diffstat (limited to 'src/proxy.js')
| -rw-r--r-- | src/proxy.js | 51 |
1 files changed, 21 insertions, 30 deletions
diff --git a/src/proxy.js b/src/proxy.js index 28391595..4e44cd4e 100644 --- a/src/proxy.js +++ b/src/proxy.js @@ -29,36 +29,6 @@ global.Proxy = new $Object(); var $Proxy = global.Proxy -var fundamentalTraps = [ - "getOwnPropertyDescriptor", - "getPropertyDescriptor", - "getOwnPropertyNames", - "getPropertyNames", - "defineProperty", - "delete", - "fix", -] - -var derivedTraps = [ - "has", - "hasOwn", - "get", - "set", - "enumerate", - "keys", -] - -var functionTraps = [ - "callTrap", - "constructTrap", -] - -$Proxy.createFunction = function(handler, callTrap, constructTrap) { - handler.callTrap = callTrap - handler.constructTrap = constructTrap - $Proxy.create(handler) -} - $Proxy.create = function(handler, proto) { if (!IS_SPEC_OBJECT(handler)) throw MakeTypeError("handler_non_object", ["create"]) @@ -66,6 +36,20 @@ $Proxy.create = function(handler, proto) { return %CreateJSProxy(handler, proto) } +$Proxy.createFunction = function(handler, callTrap, constructTrap) { + if (!IS_SPEC_OBJECT(handler)) + throw MakeTypeError("handler_non_object", ["create"]) + if (!IS_SPEC_FUNCTION(callTrap)) + throw MakeTypeError("trap_function_expected", ["createFunction", "call"]) + if (IS_UNDEFINED(constructTrap)) { + constructTrap = callTrap + } else if (!IS_SPEC_FUNCTION(constructTrap)) { + throw MakeTypeError("trap_function_expected", + ["createFunction", "construct"]) + } + return %CreateJSFunctionProxy( + handler, callTrap, constructTrap, $Function.prototype) +} @@ -73,6 +57,13 @@ $Proxy.create = function(handler, proto) { // Builtins //////////////////////////////////////////////////////////////////////////////// +function DelegateCallAndConstruct(callTrap, constructTrap) { + return function() { + return %Apply(%_IsConstructCall() ? constructTrap : callTrap, + this, arguments, 0, %_ArgumentsLength()) + } +} + function DerivedGetTrap(receiver, name) { var desc = this.getPropertyDescriptor(name) if (IS_UNDEFINED(desc)) { return desc } |
