| Index: src/x64/builtins-x64.cc
|
| diff --git a/src/x64/builtins-x64.cc b/src/x64/builtins-x64.cc
|
| index 4833e03c8e896a61f7ebfe150363ad4aa5b8aee6..6122da068780def22f76f5240a675cad9644bf5e 100644
|
| --- a/src/x64/builtins-x64.cc
|
| +++ b/src/x64/builtins-x64.cc
|
| @@ -73,49 +73,14 @@ void Builtins::Generate_Adaptor(MacroAssembler* masm,
|
| }
|
|
|
|
|
| -void Builtins::Generate_JSConstructCall(MacroAssembler* masm) {
|
| +static void Generate_JSConstructStubHelper(MacroAssembler* masm,
|
| + bool is_api_function,
|
| + bool count_constructions) {
|
| // ----------- S t a t e -------------
|
| // -- rax: number of arguments
|
| // -- rdi: constructor function
|
| // -----------------------------------
|
|
|
| - 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, &slow);
|
| -
|
| - // Jump to the function-specific construct stub.
|
| - __ movq(rbx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset));
|
| - __ movq(rbx, FieldOperand(rbx, SharedFunctionInfo::kConstructStubOffset));
|
| - __ lea(rbx, FieldOperand(rbx, Code::kHeaderSize));
|
| - __ jmp(rbx);
|
| -
|
| - // 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);
|
| - __ SetCallKind(rcx, CALL_AS_METHOD);
|
| - __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
|
| - RelocInfo::CODE_TARGET);
|
| -}
|
| -
|
| -
|
| -static void Generate_JSConstructStubHelper(MacroAssembler* masm,
|
| - bool is_api_function,
|
| - bool count_constructions) {
|
| // Should never count constructions for api objects.
|
| ASSERT(!is_api_function || !count_constructions);
|
|
|
| @@ -515,8 +480,8 @@ static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm,
|
| // Invoke the code.
|
| if (is_construct) {
|
| // Expects rdi to hold function pointer.
|
| - __ Call(masm->isolate()->builtins()->JSConstructCall(),
|
| - RelocInfo::CODE_TARGET);
|
| + CallConstructStub stub(NO_CALL_FUNCTION_FLAGS);
|
| + __ CallStub(&stub);
|
| } else {
|
| ParameterCount actual(rax);
|
| // Function must be in rdi.
|
|
|