summaryrefslogtreecommitdiffstats
path: root/src/runtime.js
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2012-04-12 10:51:47 +0100
committerBen Murdoch <benm@google.com>2012-04-16 16:41:38 +0100
commit3ef787dbeca8a5fb1086949cda830dccee07bfbd (patch)
tree0a22edd97aa148abffdd405c585b22213fccbc82 /src/runtime.js
parent85b71799222b55eb5dd74ea26efe0c64ab655c8c (diff)
downloadandroid_external_v8-3ef787dbeca8a5fb1086949cda830dccee07bfbd.tar.gz
android_external_v8-3ef787dbeca8a5fb1086949cda830dccee07bfbd.tar.bz2
android_external_v8-3ef787dbeca8a5fb1086949cda830dccee07bfbd.zip
Merge V8 at 3.9.24.13
Bug: 5688872 Change-Id: Id0aa8d23375030494d3189c31774059c0f5398fc
Diffstat (limited to 'src/runtime.js')
-rw-r--r--src/runtime.js56
1 files changed, 23 insertions, 33 deletions
diff --git a/src/runtime.js b/src/runtime.js
index 14ff1b69..53d9a397 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -39,16 +39,16 @@
-----------------------------------
*/
-// The following const declarations are shared with other native JS files.
-// They are all declared at this one spot to avoid const redeclaration errors.
-const $Object = global.Object;
-const $Array = global.Array;
-const $String = global.String;
-const $Number = global.Number;
-const $Function = global.Function;
-const $Boolean = global.Boolean;
-const $NaN = 0/0;
-const builtins = this;
+// The following declarations are shared with other native JS files.
+// They are all declared at this one spot to avoid redeclaration errors.
+var $Object = global.Object;
+var $Array = global.Array;
+var $String = global.String;
+var $Number = global.Number;
+var $Function = global.Function;
+var $Boolean = global.Boolean;
+var $NaN = 0/0;
+var builtins = this;
// ECMA-262 Section 11.9.3.
function EQUALS(y) {
@@ -355,7 +355,7 @@ function IN(x) {
if (!IS_SPEC_OBJECT(x)) {
throw %MakeTypeError('invalid_in_operator_use', [this, x]);
}
- return %_IsNonNegativeSmi(this) && !%IsJSProxy(x) ?
+ return %_IsNonNegativeSmi(this) ?
%HasElement(x, this) : %HasProperty(x, %ToString(this));
}
@@ -375,6 +375,12 @@ function INSTANCE_OF(F) {
return 1;
}
+ // Check if function is bound, if so, get [[BoundFunction]] from it
+ // and use that instead of F.
+ var bindings = %BoundFunctionGetBindings(F);
+ if (bindings) {
+ F = bindings[kBoundFunctionIndex]; // Always a non-bound function.
+ }
// Get the prototype of F; if it is not an object, throw an error.
var O = F.prototype;
if (!IS_SPEC_OBJECT(O)) {
@@ -386,13 +392,6 @@ function INSTANCE_OF(F) {
}
-// Get an array of property keys for the given object. Used in
-// for-in statements.
-function GET_KEYS() {
- return %GetPropertyNames(this);
-}
-
-
// Filter a given key against an object by checking if the object
// has a property with the given key; return the key as a string if
// it has. Otherwise returns 0 (smi). Used in for-in statements.
@@ -429,20 +428,10 @@ function CALL_FUNCTION_PROXY() {
}
-function CALL_FUNCTION_PROXY_AS_CONSTRUCTOR(proxy) {
- var arity = %_ArgumentsLength() - 1;
+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 %Apply(trap, this, arguments, 1, arity);
+ return %Apply(trap, this, arguments, 0, %_ArgumentsLength());
}
@@ -469,11 +458,12 @@ function APPLY_PREPARE(args) {
}
if (!IS_SPEC_FUNCTION(this)) {
- throw %MakeTypeError('apply_non_function', [ %ToString(this), typeof this ]);
+ throw %MakeTypeError('apply_non_function',
+ [ %ToString(this), typeof this ]);
}
// Make sure the arguments list has the right type.
- if (args != null && !IS_ARRAY(args) && !IS_ARGUMENTS(args)) {
+ if (args != null && !IS_SPEC_OBJECT(args)) {
throw %MakeTypeError('apply_wrong_args', []);
}