Upgrade to V8 3.6
Merge V8 at 3.6.6.11
Simple merge required updates to makefiles only.
Bug: 5688872
Change-Id: Ib38b7ffbcd409585f6cb6fccc59c767029cecc77
diff --git a/src/runtime.js b/src/runtime.js
index 4b600df..14ff1b6 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -48,6 +48,7 @@
const $Function = global.Function;
const $Boolean = global.Boolean;
const $NaN = 0/0;
+const builtins = this;
// ECMA-262 Section 11.9.3.
function EQUALS(y) {
@@ -365,7 +366,7 @@
// an expensive ToBoolean conversion in the generated code.
function INSTANCE_OF(F) {
var V = this;
- if (!IS_FUNCTION(F)) {
+ if (!IS_SPEC_FUNCTION(F)) {
throw %MakeTypeError('instanceof_function_expected', [V]);
}
@@ -407,7 +408,7 @@
if (!IS_FUNCTION(delegate)) {
throw %MakeTypeError('called_non_callable', [typeof this]);
}
- return delegate.apply(this, arguments);
+ return %Apply(delegate, this, arguments, 0, %_ArgumentsLength());
}
@@ -416,7 +417,32 @@
if (!IS_FUNCTION(delegate)) {
throw %MakeTypeError('called_non_callable', [typeof this]);
}
- return delegate.apply(this, arguments);
+ return %Apply(delegate, this, arguments, 0, %_ArgumentsLength());
+}
+
+
+function CALL_FUNCTION_PROXY() {
+ var arity = %_ArgumentsLength() - 1;
+ var proxy = %_Arguments(arity); // The proxy comes in as an additional arg.
+ var trap = %GetCallTrap(proxy);
+ return %Apply(trap, this, arguments, 0, arity);
+}
+
+
+function CALL_FUNCTION_PROXY_AS_CONSTRUCTOR(proxy) {
+ var arity = %_ArgumentsLength() - 1;
+ 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);
}
@@ -427,7 +453,8 @@
// that takes care of more eventualities.
if (IS_ARRAY(args)) {
length = args.length;
- if (%_IsSmi(length) && length >= 0 && length < 0x800000 && IS_FUNCTION(this)) {
+ if (%_IsSmi(length) && length >= 0 && length < 0x800000 &&
+ IS_SPEC_FUNCTION(this)) {
return length;
}
}
@@ -441,7 +468,7 @@
throw %MakeRangeError('stack_overflow', []);
}
- if (!IS_FUNCTION(this)) {
+ if (!IS_SPEC_FUNCTION(this)) {
throw %MakeTypeError('apply_non_function', [ %ToString(this), typeof this ]);
}
@@ -609,13 +636,13 @@
// ECMA-262, section 8.6.2.6, page 28.
function DefaultNumber(x) {
var valueOf = x.valueOf;
- if (IS_FUNCTION(valueOf)) {
+ if (IS_SPEC_FUNCTION(valueOf)) {
var v = %_CallFunction(x, valueOf);
if (%IsPrimitive(v)) return v;
}
var toString = x.toString;
- if (IS_FUNCTION(toString)) {
+ if (IS_SPEC_FUNCTION(toString)) {
var s = %_CallFunction(x, toString);
if (%IsPrimitive(s)) return s;
}
@@ -627,13 +654,13 @@
// ECMA-262, section 8.6.2.6, page 28.
function DefaultString(x) {
var toString = x.toString;
- if (IS_FUNCTION(toString)) {
+ if (IS_SPEC_FUNCTION(toString)) {
var s = %_CallFunction(x, toString);
if (%IsPrimitive(s)) return s;
}
var valueOf = x.valueOf;
- if (IS_FUNCTION(valueOf)) {
+ if (IS_SPEC_FUNCTION(valueOf)) {
var v = %_CallFunction(x, valueOf);
if (%IsPrimitive(v)) return v;
}