Index: src/runtime.js |
diff --git a/src/runtime.js b/src/runtime.js |
index ce6b4a3ccf347a65ab27eda9527cdfd3755d62bf..a76f3b6e81fc408721ed5e2777b8891a1aa7dbd1 100644 |
--- a/src/runtime.js |
+++ b/src/runtime.js |
@@ -405,11 +405,7 @@ function FILTER_KEY(key) { |
function CALL_NON_FUNCTION() { |
var delegate = %GetFunctionDelegate(this); |
if (!IS_FUNCTION(delegate)) { |
- if (%IsJSFunctionProxy(this)) { |
- delegate = %GetCallTrap(this); |
- } else { |
- throw %MakeTypeError('called_non_callable', [typeof this]); |
- } |
+ throw %MakeTypeError('called_non_callable', [typeof this]); |
} |
return delegate.apply(this, arguments); |
} |
@@ -418,11 +414,7 @@ function CALL_NON_FUNCTION() { |
function CALL_NON_FUNCTION_AS_CONSTRUCTOR() { |
var delegate = %GetConstructorDelegate(this); |
if (!IS_FUNCTION(delegate)) { |
- if (%IsJSFunctionProxy(this)) { |
- delegate = %GetConstructTrap(this); |
- } else { |
- throw %MakeTypeError('called_non_callable', [typeof this]); |
- } |
+ throw %MakeTypeError('called_non_callable', [typeof this]); |
} |
return delegate.apply(this, arguments); |
} |
@@ -434,25 +426,16 @@ function CALL_FUNCTION_PROXY() { |
var trap = %GetCallTrap(proxy); |
// TODO(rossberg): hm, shouldn't I be using $Function and friends? |
// But how do I get it in a builtin? |
- return global.Function.prototype.apply.call( |
- trap, this, global.Array.prototype.slice.call(arguments, 0, arity)); |
+ return Function.prototype.apply.call( |
+ trap, this, Array.prototype.slice.call(arguments, 0, arity)); |
} |
-function CALL_FUNCTION_PROXY_AS_CONSTRUCTOR(proxy) { |
+function CALL_FUNCTION_PROXY_AS_CONSTRUCTOR() { |
+ var proxy = this; |
var trap = %GetConstructTrap(proxy); |
- var receiver = void 0; |
- if (!IS_UNDEFINED(trap)) { |
- trap = %GetCallTrap(proxy); |
- var proto = proxy.prototype; |
- if (!IS_SPEC_OBJECT(proto) && proto !== null) { |
- throw MakeTypeError("proto_object_or_null", [proto]); |
- } |
- receiver = new global.Object(); |
- receiver.__proto__ = proto; |
- } |
- return global.Function.prototype.apply.call( |
- trap, this, global.Array.prototype.shift.call(arguments)); |
+ // TODO(rossberg): should be using $Function or a builtin somehow. |
+ return Function.prototype.apply.call(trap, this, arguments); |
} |