Index: src/mips/builtins-mips.cc |
diff --git a/src/mips/builtins-mips.cc b/src/mips/builtins-mips.cc |
index 9d1473d938c7b7b2ed573baa6a45eac2109d0b50..74720d7beadb937f066b7165d0c6e4fb79c15a74 100644 |
--- a/src/mips/builtins-mips.cc |
+++ b/src/mips/builtins-mips.cc |
@@ -1761,8 +1761,14 @@ void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { |
// the JSFunction on which new was invoked initially) |
// ----------------------------------- |
- // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. |
- __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
+ // Call into the Runtime for Proxy [[Construct]]. |
+ __ Push(a1); |
+ __ Push(a3); |
+ // Include the pushed new_target, constructor and the receiver. |
+ __ Addu(a0, a0, 3); |
+ // Tail-call to the runtime. |
+ __ JumpToExternalReference( |
+ ExternalReference(Runtime::kJSProxyConstruct, masm->isolate())); |
} |
@@ -1784,14 +1790,16 @@ void Builtins::Generate_Construct(MacroAssembler* masm) { |
__ lbu(t2, FieldMemOperand(t1, Map::kInstanceTypeOffset)); |
__ Jump(masm->isolate()->builtins()->ConstructFunction(), |
RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE)); |
- __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, |
- eq, t2, Operand(JS_PROXY_TYPE)); |
// Check if target has a [[Construct]] internal method. |
__ lbu(t2, FieldMemOperand(t1, Map::kBitFieldOffset)); |
__ And(t2, t2, Operand(1 << Map::kIsCallable)); |
__ Branch(&non_constructor, eq, t2, Operand(zero_reg)); |
+ // Only dispatch to proxies after checking whether they are constructors. |
+ __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, |
+ eq, t2, Operand(JS_PROXY_TYPE)); |
+ |
// Called Construct on an exotic Object with a [[Construct]] internal method. |
{ |
// Overwrite the original receiver with the (original) target. |