Index: src/x64/builtins-x64.cc |
diff --git a/src/x64/builtins-x64.cc b/src/x64/builtins-x64.cc |
index 8976ff82d7df4cc4f8b125163cca6fb4cd42278d..530aec60f5ee753db0d289dbbcbf2261e4e60003 100644 |
--- a/src/x64/builtins-x64.cc |
+++ b/src/x64/builtins-x64.cc |
@@ -79,12 +79,12 @@ void Builtins::Generate_JSConstructCall(MacroAssembler* masm) { |
// -- rdi: constructor function |
// ----------------------------------- |
- Label non_function_call; |
+ Label slow, non_function_call; |
// Check that function is not a smi. |
__ JumpIfSmi(rdi, &non_function_call); |
// Check that function is a JSFunction. |
__ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); |
- __ j(not_equal, &non_function_call); |
+ __ j(not_equal, &slow); |
// Jump to the function-specific construct stub. |
__ movq(rbx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); |
@@ -94,10 +94,19 @@ void Builtins::Generate_JSConstructCall(MacroAssembler* masm) { |
// rdi: called object |
// rax: number of arguments |
+ // rcx: object map |
+ Label do_call; |
+ __ bind(&slow); |
+ __ CmpInstanceType(rcx, JS_FUNCTION_PROXY_TYPE); |
+ __ j(not_equal, &non_function_call); |
+ __ GetBuiltinEntry(rdx, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR); |
+ __ jmp(&do_call); |
+ |
__ bind(&non_function_call); |
+ __ GetBuiltinEntry(rdx, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); |
+ __ bind(&do_call); |
// Set expected number of arguments to zero (not changing rax). |
__ Set(rbx, 0); |
- __ GetBuiltinEntry(rdx, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); |
__ SetCallKind(rcx, CALL_AS_METHOD); |
__ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
RelocInfo::CODE_TARGET); |