From 1257ba358cf309e10e53ac40ac61817225f9923b Mon Sep 17 00:00:00 2001 From: "verwaest@chromium.org" Date: Tue, 14 Jan 2014 14:36:24 +0000 Subject: [PATCH] Remove CALL_AS_FUNCTION and CALL_AS_METHOD. BUG= R=dcarney@chromium.org Review URL: https://codereview.chromium.org/136403005 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18590 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/arm/builtins-arm.cc | 30 ++++++------------ src/arm/code-stubs-arm.cc | 12 ++------ src/arm/full-codegen-arm.cc | 6 +--- src/arm/ic-arm.cc | 12 ++------ src/arm/lithium-codegen-arm.cc | 16 ++-------- src/arm/lithium-codegen-arm.h | 1 - src/arm/macro-assembler-arm.cc | 50 +++++++----------------------- src/arm/macro-assembler-arm.h | 23 ++++---------- src/arm/stub-cache-arm.cc | 7 ++--- src/ast.cc | 4 +-- src/ast.h | 3 +- src/hydrogen.cc | 24 ++++----------- src/hydrogen.h | 3 +- src/ia32/builtins-ia32.cc | 25 +++------------ src/ia32/code-stubs-ia32.cc | 12 ++------ src/ia32/full-codegen-ia32.cc | 7 +---- src/ia32/ic-ia32.cc | 12 ++------ src/ia32/lithium-codegen-ia32.cc | 16 ++-------- src/ia32/lithium-codegen-ia32.h | 1 - src/ia32/macro-assembler-ia32.cc | 53 ++++++++------------------------ src/ia32/macro-assembler-ia32.h | 28 +++++------------ src/ia32/stub-cache-ia32.cc | 7 ++--- src/stub-cache.cc | 11 ++----- src/stub-cache.h | 2 -- src/type-info.cc | 6 +--- src/type-info.h | 2 +- src/typing.cc | 9 ++---- src/v8globals.h | 8 ----- src/x64/builtins-x64.cc | 26 +++------------- src/x64/code-stubs-x64.cc | 12 ++------ src/x64/full-codegen-x64.cc | 6 +--- src/x64/ic-x64.cc | 12 ++------ src/x64/lithium-codegen-x64.cc | 16 ++-------- src/x64/lithium-codegen-x64.h | 1 - src/x64/macro-assembler-x64.cc | 52 ++++++++----------------------- src/x64/macro-assembler-x64.h | 23 ++++---------- src/x64/stub-cache-x64.cc | 7 ++--- 37 files changed, 125 insertions(+), 420 deletions(-) diff --git a/src/arm/builtins-arm.cc b/src/arm/builtins-arm.cc index ca3c8ea21..7f15dd90c 100644 --- a/src/arm/builtins-arm.cc +++ b/src/arm/builtins-arm.cc @@ -295,12 +295,10 @@ static void CallRuntimePassFunction( FrameScope scope(masm, StackFrame::INTERNAL); // Push a copy of the function onto the stack. __ push(r1); - // Push call kind information and function as parameter to the runtime call. - __ Push(r5, r1); + // Push function as parameter to the runtime call. + __ Push(r1); __ CallRuntime(function_id, 1); - // Restore call kind information. - __ pop(r5); // Restore receiver. __ pop(r1); } @@ -609,11 +607,10 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, masm->isolate()->builtins()->HandleApiCallConstruct(); ParameterCount expected(0); __ InvokeCode(code, expected, expected, - RelocInfo::CODE_TARGET, CALL_FUNCTION, CALL_AS_METHOD); + RelocInfo::CODE_TARGET, CALL_FUNCTION); } else { ParameterCount actual(r0); - __ InvokeFunction(r1, actual, CALL_FUNCTION, - NullCallWrapper(), CALL_AS_METHOD); + __ InvokeFunction(r1, actual, CALL_FUNCTION, NullCallWrapper()); } // Store offset of return address for deoptimizer. @@ -750,8 +747,7 @@ static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, __ CallStub(&stub); } else { ParameterCount actual(r0); - __ InvokeFunction(r1, actual, CALL_FUNCTION, - NullCallWrapper(), CALL_AS_METHOD); + __ InvokeFunction(r1, actual, CALL_FUNCTION, NullCallWrapper()); } // Exit the JS frame and remove the parameters (except function), and // return. @@ -783,14 +779,12 @@ static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) { FrameScope scope(masm, StackFrame::INTERNAL); // Push a copy of the function onto the stack. __ push(r1); - // Push call kind information and function as parameter to the runtime call. - __ Push(r5, r1); + // Push function as parameter to the runtime call. + __ Push(r1); // Whether to compile in a background thread. __ Push(masm->isolate()->factory()->ToBoolean(concurrent)); __ CallRuntime(Runtime::kCompileOptimized, 2); - // Restore call kind information. - __ pop(r5); // Restore receiver. __ pop(r1); } @@ -1151,7 +1145,6 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) { __ b(eq, &function); // Expected number of arguments is 0 for CALL_NON_FUNCTION. __ mov(r2, Operand::Zero()); - __ SetCallKind(r5, CALL_AS_METHOD); __ cmp(r4, Operand(1)); __ b(ne, &non_proxy); @@ -1178,15 +1171,13 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) { FieldMemOperand(r3, SharedFunctionInfo::kFormalParameterCountOffset)); __ SmiUntag(r2); __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); - __ SetCallKind(r5, CALL_AS_FUNCTION); __ cmp(r2, r0); // Check formal and actual parameter counts. __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), RelocInfo::CODE_TARGET, ne); ParameterCount expected(0); - __ InvokeCode(r3, expected, expected, JUMP_FUNCTION, - NullCallWrapper(), CALL_AS_FUNCTION); + __ InvokeCode(r3, expected, expected, JUMP_FUNCTION, NullCallWrapper()); } @@ -1324,8 +1315,7 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) { __ ldr(r1, MemOperand(fp, kFunctionOffset)); __ CompareObjectType(r1, r2, r2, JS_FUNCTION_TYPE); __ b(ne, &call_proxy); - __ InvokeFunction(r1, actual, CALL_FUNCTION, - NullCallWrapper(), CALL_AS_FUNCTION); + __ InvokeFunction(r1, actual, CALL_FUNCTION, NullCallWrapper()); frame_scope.GenerateLeaveFrame(); __ add(sp, sp, Operand(3 * kPointerSize)); @@ -1336,7 +1326,6 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) { __ push(r1); // add function proxy as last argument __ add(r0, r0, Operand(1)); __ mov(r2, Operand::Zero()); - __ SetCallKind(r5, CALL_AS_FUNCTION); __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY); __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), RelocInfo::CODE_TARGET); @@ -1380,7 +1369,6 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { // -- r1 : function (passed through to callee) // -- r2 : expected number of arguments // -- r3 : code entry to call - // -- r5 : call kind information // ----------------------------------- Label invoke, dont_adapt_arguments; diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc index 8a744ae6c..3f13ebe00 100644 --- a/src/arm/code-stubs-arm.cc +++ b/src/arm/code-stubs-arm.cc @@ -3198,11 +3198,7 @@ void CallFunctionStub::Generate(MacroAssembler* masm) { // r1: pushed function ParameterCount actual(argc_); - __ InvokeFunction(r1, - actual, - JUMP_FUNCTION, - NullCallWrapper(), - CALL_AS_FUNCTION); + __ InvokeFunction(r1, actual, JUMP_FUNCTION, NullCallWrapper()); // Slow-case: Non-function called. __ bind(&slow); @@ -3222,7 +3218,6 @@ void CallFunctionStub::Generate(MacroAssembler* masm) { __ mov(r0, Operand(argc_ + 1, RelocInfo::NONE32)); __ mov(r2, Operand::Zero()); __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY); - __ SetCallKind(r5, CALL_AS_FUNCTION); { Handle adaptor = masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); @@ -3236,7 +3231,6 @@ void CallFunctionStub::Generate(MacroAssembler* masm) { __ mov(r0, Operand(argc_)); // Set up the number of arguments. __ mov(r2, Operand::Zero()); __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); - __ SetCallKind(r5, CALL_AS_FUNCTION); __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), RelocInfo::CODE_TARGET); } @@ -3280,7 +3274,6 @@ void CallConstructStub::Generate(MacroAssembler* masm) { __ bind(&do_call); // Set expected number of arguments to zero (not changing r0). __ mov(r2, Operand::Zero()); - __ SetCallKind(r5, CALL_AS_METHOD); __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), RelocInfo::CODE_TARGET); } @@ -5424,8 +5417,7 @@ void StubFailureTailCallTrampolineStub::Generate(MacroAssembler* masm) { __ sub(r0, r0, Operand(1)); masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); ParameterCount argument_count(r0); - __ InvokeFunction( - r1, argument_count, JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); + __ InvokeFunction(r1, argument_count, JUMP_FUNCTION, NullCallWrapper()); } diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc index 8a500e203..33c26bd9a 100644 --- a/src/arm/full-codegen-arm.cc +++ b/src/arm/full-codegen-arm.cc @@ -149,9 +149,6 @@ void FullCodeGenerator::Generate() { // object). if (info->is_classic_mode() && !info->is_native()) { Label ok; - __ cmp(r5, Operand::Zero()); - __ b(eq, &ok); - int receiver_offset = info->scope()->num_parameters() * kPointerSize; __ ldr(r2, MemOperand(sp, receiver_offset)); __ CompareRoot(r2, Heap::kUndefinedValueRootIndex); @@ -3729,8 +3726,7 @@ void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { // InvokeFunction requires the function in r1. Move it in there. __ mov(r1, result_register()); ParameterCount count(arg_count); - __ InvokeFunction(r1, count, CALL_FUNCTION, - NullCallWrapper(), CALL_AS_FUNCTION); + __ InvokeFunction(r1, count, CALL_FUNCTION, NullCallWrapper()); __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); __ jmp(&done); diff --git a/src/arm/ic-arm.cc b/src/arm/ic-arm.cc index adfef24d0..c43012a7b 100644 --- a/src/arm/ic-arm.cc +++ b/src/arm/ic-arm.cc @@ -415,8 +415,7 @@ static void GenerateFunctionTailCall(MacroAssembler* masm, // Invoke the function. ParameterCount actual(argc); - __ InvokeFunction(r1, actual, JUMP_FUNCTION, - NullCallWrapper(), CALL_AS_METHOD); + __ InvokeFunction(r1, actual, JUMP_FUNCTION, NullCallWrapper()); } @@ -497,15 +496,8 @@ void CallICBase::GenerateMiss(MacroAssembler* masm, } // Invoke the function. - CallKind call_kind = CallICBase::Contextual::decode(extra_state) - ? CALL_AS_FUNCTION - : CALL_AS_METHOD; ParameterCount actual(argc); - __ InvokeFunction(r1, - actual, - JUMP_FUNCTION, - NullCallWrapper(), - call_kind); + __ InvokeFunction(r1, actual, JUMP_FUNCTION, NullCallWrapper()); } diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc index 02342c04c..6292ccfaf 100644 --- a/src/arm/lithium-codegen-arm.cc +++ b/src/arm/lithium-codegen-arm.cc @@ -154,9 +154,6 @@ bool LCodeGen::GeneratePrologue() { info_->is_classic_mode() && !info_->is_native()) { Label ok; - __ cmp(r5, Operand::Zero()); - __ b(eq, &ok); - int receiver_offset = info_->scope()->num_parameters() * kPointerSize; __ ldr(r2, MemOperand(sp, receiver_offset)); __ CompareRoot(r2, Heap::kUndefinedValueRootIndex); @@ -3568,8 +3565,7 @@ void LCodeGen::DoApplyArguments(LApplyArguments* instr) { // The number of arguments is stored in receiver which is r0, as expected // by InvokeFunction. ParameterCount actual(receiver); - __ InvokeFunction(function, actual, CALL_FUNCTION, - safepoint_generator, CALL_AS_FUNCTION); + __ InvokeFunction(function, actual, CALL_FUNCTION, safepoint_generator); } @@ -3644,7 +3640,6 @@ void LCodeGen::CallKnownFunction(Handle function, int formal_parameter_count, int arity, LInstruction* instr, - CallKind call_kind, R1State r1_state) { bool dont_adapt_arguments = formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel; @@ -3668,7 +3663,6 @@ void LCodeGen::CallKnownFunction(Handle function, } // Invoke function. - __ SetCallKind(r5, call_kind); __ ldr(ip, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); __ Call(ip); @@ -3678,8 +3672,7 @@ void LCodeGen::CallKnownFunction(Handle function, SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); ParameterCount count(arity); ParameterCount expected(formal_parameter_count); - __ InvokeFunction( - function, expected, count, CALL_FUNCTION, generator, call_kind); + __ InvokeFunction(function, expected, count, CALL_FUNCTION, generator); } } @@ -3690,7 +3683,6 @@ void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) { instr->hydrogen()->formal_parameter_count(), instr->arity(), instr, - CALL_AS_FUNCTION, R1_UNINITIALIZED); } @@ -3968,13 +3960,12 @@ void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) { LPointerMap* pointers = instr->pointer_map(); SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); ParameterCount count(instr->arity()); - __ InvokeFunction(r1, count, CALL_FUNCTION, generator, CALL_AS_FUNCTION); + __ InvokeFunction(r1, count, CALL_FUNCTION, generator); } else { CallKnownFunction(known_function, instr->hydrogen()->formal_parameter_count(), instr->arity(), instr, - CALL_AS_FUNCTION, R1_CONTAINS_TARGET); } } @@ -4037,7 +4028,6 @@ void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { instr->hydrogen()->formal_parameter_count(), instr->arity(), instr, - CALL_AS_FUNCTION, R1_UNINITIALIZED); } diff --git a/src/arm/lithium-codegen-arm.h b/src/arm/lithium-codegen-arm.h index 8d9be3ac3..5251b85fa 100644 --- a/src/arm/lithium-codegen-arm.h +++ b/src/arm/lithium-codegen-arm.h @@ -246,7 +246,6 @@ class LCodeGen: public LCodeGenBase { int formal_parameter_count, int arity, LInstruction* instr, - CallKind call_kind, R1State r1_state); void RecordSafepointWithLazyDeopt(LInstruction* instr, diff --git a/src/arm/macro-assembler-arm.cc b/src/arm/macro-assembler-arm.cc index 38ab0e9a1..89e6f83df 100644 --- a/src/arm/macro-assembler-arm.cc +++ b/src/arm/macro-assembler-arm.cc @@ -1096,20 +1096,6 @@ void MacroAssembler::MovFromFloatParameter(DwVfpRegister dst) { } -void MacroAssembler::SetCallKind(Register dst, CallKind call_kind) { - // This macro takes the dst register to make the code more readable - // at the call sites. However, the dst register has to be r5 to - // follow the calling convention which requires the call type to be - // in r5. - ASSERT(dst.is(r5)); - if (call_kind == CALL_AS_FUNCTION) { - mov(dst, Operand(Smi::FromInt(1))); - } else { - mov(dst, Operand(Smi::FromInt(0))); - } -} - - void MacroAssembler::InvokePrologue(const ParameterCount& expected, const ParameterCount& actual, Handle code_constant, @@ -1117,8 +1103,7 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected, Label* done, bool* definitely_mismatches, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind) { + const CallWrapper& call_wrapper) { bool definitely_matches = false; *definitely_mismatches = false; Label regular_invoke; @@ -1176,14 +1161,12 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected, isolate()->builtins()->ArgumentsAdaptorTrampoline(); if (flag == CALL_FUNCTION) { call_wrapper.BeforeCall(CallSize(adaptor)); - SetCallKind(r5, call_kind); Call(adaptor); call_wrapper.AfterCall(); if (!*definitely_mismatches) { b(done); } } else { - SetCallKind(r5, call_kind); Jump(adaptor, RelocInfo::CODE_TARGET); } bind(®ular_invoke); @@ -1195,8 +1178,7 @@ void MacroAssembler::InvokeCode(Register code, const ParameterCount& expected, const ParameterCount& actual, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind) { + const CallWrapper& call_wrapper) { // You can't call a function without a valid frame. ASSERT(flag == JUMP_FUNCTION || has_frame()); @@ -1204,16 +1186,14 @@ void MacroAssembler::InvokeCode(Register code, bool definitely_mismatches = false; InvokePrologue(expected, actual, Handle::null(), code, &done, &definitely_mismatches, flag, - call_wrapper, call_kind); + call_wrapper); if (!definitely_mismatches) { if (flag == CALL_FUNCTION) { call_wrapper.BeforeCall(CallSize(code)); - SetCallKind(r5, call_kind); Call(code); call_wrapper.AfterCall(); } else { ASSERT(flag == JUMP_FUNCTION); - SetCallKind(r5, call_kind); Jump(code); } @@ -1228,8 +1208,7 @@ void MacroAssembler::InvokeCode(Handle code, const ParameterCount& expected, const ParameterCount& actual, RelocInfo::Mode rmode, - InvokeFlag flag, - CallKind call_kind) { + InvokeFlag flag) { // You can't call a function without a valid frame. ASSERT(flag == JUMP_FUNCTION || has_frame()); @@ -1237,13 +1216,11 @@ void MacroAssembler::InvokeCode(Handle code, bool definitely_mismatches = false; InvokePrologue(expected, actual, code, no_reg, &done, &definitely_mismatches, flag, - NullCallWrapper(), call_kind); + NullCallWrapper()); if (!definitely_mismatches) { if (flag == CALL_FUNCTION) { - SetCallKind(r5, call_kind); Call(code, rmode); } else { - SetCallKind(r5, call_kind); Jump(code, rmode); } @@ -1257,8 +1234,7 @@ void MacroAssembler::InvokeCode(Handle code, void MacroAssembler::InvokeFunction(Register fun, const ParameterCount& actual, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind) { + const CallWrapper& call_wrapper) { // You can't call a function without a valid frame. ASSERT(flag == JUMP_FUNCTION || has_frame()); @@ -1278,7 +1254,7 @@ void MacroAssembler::InvokeFunction(Register fun, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); ParameterCount expected(expected_reg); - InvokeCode(code_reg, expected, actual, flag, call_wrapper, call_kind); + InvokeCode(code_reg, expected, actual, flag, call_wrapper); } @@ -1286,8 +1262,7 @@ void MacroAssembler::InvokeFunction(Register function, const ParameterCount& expected, const ParameterCount& actual, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind) { + const CallWrapper& call_wrapper) { // You can't call a function without a valid frame. ASSERT(flag == JUMP_FUNCTION || has_frame()); @@ -1301,7 +1276,7 @@ void MacroAssembler::InvokeFunction(Register function, // allow recompilation to take effect without changing any of the // call sites. ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); - InvokeCode(r3, expected, actual, flag, call_wrapper, call_kind); + InvokeCode(r3, expected, actual, flag, call_wrapper); } @@ -1309,10 +1284,9 @@ void MacroAssembler::InvokeFunction(Handle function, const ParameterCount& expected, const ParameterCount& actual, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind) { + const CallWrapper& call_wrapper) { Move(r1, function); - InvokeFunction(r1, expected, actual, flag, call_wrapper, call_kind); + InvokeFunction(r1, expected, actual, flag, call_wrapper); } @@ -2759,12 +2733,10 @@ void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, GetBuiltinEntry(r2, id); if (flag == CALL_FUNCTION) { call_wrapper.BeforeCall(CallSize(r2)); - SetCallKind(r5, CALL_AS_METHOD); Call(r2); call_wrapper.AfterCall(); } else { ASSERT(flag == JUMP_FUNCTION); - SetCallKind(r5, CALL_AS_METHOD); Jump(r2); } } diff --git a/src/arm/macro-assembler-arm.h b/src/arm/macro-assembler-arm.h index 5ed7540a0..393527cba 100644 --- a/src/arm/macro-assembler-arm.h +++ b/src/arm/macro-assembler-arm.h @@ -594,47 +594,37 @@ class MacroAssembler: public Assembler { // --------------------------------------------------------------------------- // JavaScript invokes - // Set up call kind marking in ecx. The method takes ecx as an - // explicit first parameter to make the code more readable at the - // call sites. - void SetCallKind(Register dst, CallKind kind); - // Invoke the JavaScript function code by either calling or jumping. void InvokeCode(Register code, const ParameterCount& expected, const ParameterCount& actual, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind); + const CallWrapper& call_wrapper); void InvokeCode(Handle code, const ParameterCount& expected, const ParameterCount& actual, RelocInfo::Mode rmode, - InvokeFlag flag, - CallKind call_kind); + InvokeFlag flag); // Invoke the JavaScript function in the given register. Changes the // current context to the context in the function before invoking. void InvokeFunction(Register function, const ParameterCount& actual, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind); + const CallWrapper& call_wrapper); void InvokeFunction(Register function, const ParameterCount& expected, const ParameterCount& actual, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind); + const CallWrapper& call_wrapper); void InvokeFunction(Handle function, const ParameterCount& expected, const ParameterCount& actual, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind); + const CallWrapper& call_wrapper); void IsObjectJSObjectType(Register heap_object, Register map, @@ -1455,8 +1445,7 @@ class MacroAssembler: public Assembler { Label* done, bool* definitely_mismatches, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind); + const CallWrapper& call_wrapper); void InitializeNewString(Register string, Register length, diff --git a/src/arm/stub-cache-arm.cc b/src/arm/stub-cache-arm.cc index f26f834e5..a20702c22 100644 --- a/src/arm/stub-cache-arm.cc +++ b/src/arm/stub-cache-arm.cc @@ -2447,8 +2447,7 @@ void CallStubCompiler::GenerateJumpFunction(Handle object, PatchImplicitReceiver(object); // Invoke the function. - __ InvokeFunction(r1, arguments(), JUMP_FUNCTION, - NullCallWrapper(), call_kind()); + __ InvokeFunction(r1, arguments(), JUMP_FUNCTION, NullCallWrapper()); } @@ -2583,7 +2582,7 @@ void StoreStubCompiler::GenerateStoreViaSetter( ParameterCount actual(1); ParameterCount expected(setter); __ InvokeFunction(setter, expected, actual, - CALL_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); + CALL_FUNCTION, NullCallWrapper()); } else { // If we generate a global code snippet for deoptimization only, remember // the place to continue after deoptimization. @@ -2718,7 +2717,7 @@ void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm, ParameterCount actual(0); ParameterCount expected(getter); __ InvokeFunction(getter, expected, actual, - CALL_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); + CALL_FUNCTION, NullCallWrapper()); } else { // If we generate a global code snippet for deoptimization only, remember // the place to continue after deoptimization. diff --git a/src/ast.cc b/src/ast.cc index 6c0ef7c5a..042371f72 100644 --- a/src/ast.cc +++ b/src/ast.cc @@ -697,7 +697,7 @@ Handle Call::GetPrototypeForPrimitiveCheck( void Call::RecordTypeFeedback(TypeFeedbackOracle* oracle, - CallKind call_kind) { + ContextualMode contextual_mode) { is_monomorphic_ = oracle->CallIsMonomorphic(CallFeedbackId()); Property* property = expression()->AsProperty(); if (property == NULL) { @@ -712,7 +712,7 @@ void Call::RecordTypeFeedback(TypeFeedbackOracle* oracle, receiver_types_.Clear(); if (check_type_ == RECEIVER_MAP_CHECK) { oracle->CallReceiverTypes(CallFeedbackId(), - name, arguments()->length(), call_kind, &receiver_types_); + name, arguments()->length(), contextual_mode, &receiver_types_); is_monomorphic_ = is_monomorphic_ && receiver_types_.length() > 0; } else { holder_ = GetPrototypeForPrimitiveCheck(check_type_, oracle->isolate()); diff --git a/src/ast.h b/src/ast.h index 97ef4ff5b..ebd9fcf44 100644 --- a/src/ast.h +++ b/src/ast.h @@ -1737,7 +1737,8 @@ class Call V8_FINAL : public Expression { // Type feedback information. TypeFeedbackId CallFeedbackId() const { return reuse(id()); } - void RecordTypeFeedback(TypeFeedbackOracle* oracle, CallKind call_kind); + void RecordTypeFeedback(TypeFeedbackOracle* oracle, + ContextualMode contextual_mode); virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE { return &receiver_types_; } diff --git a/src/hydrogen.cc b/src/hydrogen.cc index db53cef43..7d6df4f83 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -7069,8 +7069,7 @@ int HOptimizedGraphBuilder::InliningAstSize(Handle target) { } -bool HOptimizedGraphBuilder::TryInline(CallKind call_kind, - Handle target, +bool HOptimizedGraphBuilder::TryInline(Handle target, int arguments_count, HValue* implicit_return_value, BailoutId ast_id, @@ -7353,14 +7352,7 @@ bool HOptimizedGraphBuilder::TryInline(CallKind call_kind, bool HOptimizedGraphBuilder::TryInlineCall(Call* expr, bool drop_extra) { - // The function call we are inlining is a method call if the call - // is a property call. - CallKind call_kind = (expr->expression()->AsProperty() == NULL) - ? CALL_AS_FUNCTION - : CALL_AS_METHOD; - - return TryInline(call_kind, - expr->target(), + return TryInline(expr->target(), expr->arguments()->length(), NULL, expr->id(), @@ -7371,8 +7363,7 @@ bool HOptimizedGraphBuilder::TryInlineCall(Call* expr, bool drop_extra) { bool HOptimizedGraphBuilder::TryInlineConstruct(CallNew* expr, HValue* implicit_return_value) { - return TryInline(CALL_AS_FUNCTION, - expr->target(), + return TryInline(expr->target(), expr->arguments()->length(), implicit_return_value, expr->id(), @@ -7384,8 +7375,7 @@ bool HOptimizedGraphBuilder::TryInlineConstruct(CallNew* expr, bool HOptimizedGraphBuilder::TryInlineGetter(Handle getter, BailoutId ast_id, BailoutId return_id) { - return TryInline(CALL_AS_METHOD, - getter, + return TryInline(getter, 0, NULL, ast_id, @@ -7398,8 +7388,7 @@ bool HOptimizedGraphBuilder::TryInlineSetter(Handle setter, BailoutId id, BailoutId assignment_id, HValue* implicit_return_value) { - return TryInline(CALL_AS_METHOD, - setter, + return TryInline(setter, 1, implicit_return_value, id, assignment_id, @@ -7410,8 +7399,7 @@ bool HOptimizedGraphBuilder::TryInlineSetter(Handle setter, bool HOptimizedGraphBuilder::TryInlineApply(Handle function, Call* expr, int arguments_count) { - return TryInline(CALL_AS_METHOD, - function, + return TryInline(function, arguments_count, NULL, expr->id(), diff --git a/src/hydrogen.h b/src/hydrogen.h index db305c4f9..22394dcb5 100644 --- a/src/hydrogen.h +++ b/src/hydrogen.h @@ -2198,8 +2198,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { Handle target); int InliningAstSize(Handle target); - bool TryInline(CallKind call_kind, - Handle target, + bool TryInline(Handle target, int arguments_count, HValue* implicit_return_value, BailoutId ast_id, diff --git a/src/ia32/builtins-ia32.cc b/src/ia32/builtins-ia32.cc index 1c95fa9eb..027df6c7f 100644 --- a/src/ia32/builtins-ia32.cc +++ b/src/ia32/builtins-ia32.cc @@ -80,14 +80,10 @@ static void CallRuntimePassFunction( FrameScope scope(masm, StackFrame::INTERNAL); // Push a copy of the function. __ push(edi); - // Push call kind information. - __ push(ecx); // Function is also the parameter to the runtime call. __ push(edi); __ CallRuntime(function_id, 1); - // Restore call kind information. - __ pop(ecx); // Restore receiver. __ pop(edi); } @@ -370,11 +366,11 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, masm->isolate()->builtins()->HandleApiCallConstruct(); ParameterCount expected(0); __ InvokeCode(code, expected, expected, RelocInfo::CODE_TARGET, - CALL_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); + CALL_FUNCTION, NullCallWrapper()); } else { ParameterCount actual(eax); __ InvokeFunction(edi, actual, CALL_FUNCTION, - NullCallWrapper(), CALL_AS_METHOD); + NullCallWrapper()); } // Store offset of return address for deoptimizer. @@ -487,7 +483,7 @@ static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, } else { ParameterCount actual(eax); __ InvokeFunction(edi, actual, CALL_FUNCTION, - NullCallWrapper(), CALL_AS_METHOD); + NullCallWrapper()); } // Exit the internal frame. Notice that this also removes the empty. @@ -519,16 +515,12 @@ static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) { FrameScope scope(masm, StackFrame::INTERNAL); // Push a copy of the function. __ push(edi); - // Push call kind information. - __ push(ecx); // Function is also the parameter to the runtime call. __ push(edi); // Whether to compile in a background thread. __ Push(masm->isolate()->factory()->ToBoolean(concurrent)); __ CallRuntime(Runtime::kCompileOptimized, 2); - // Restore call kind information. - __ pop(ecx); // Restore receiver. __ pop(edi); } @@ -834,13 +826,11 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) { __ push(edi); // re-add proxy object as additional argument __ push(edx); __ inc(eax); - __ SetCallKind(ecx, CALL_AS_FUNCTION); __ GetBuiltinEntry(edx, Builtins::CALL_FUNCTION_PROXY); __ jmp(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), RelocInfo::CODE_TARGET); __ bind(&non_proxy); - __ SetCallKind(ecx, CALL_AS_METHOD); __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION); __ jmp(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), RelocInfo::CODE_TARGET); @@ -855,14 +845,12 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) { FieldOperand(edx, SharedFunctionInfo::kFormalParameterCountOffset)); __ mov(edx, FieldOperand(edi, JSFunction::kCodeEntryOffset)); __ SmiUntag(ebx); - __ SetCallKind(ecx, CALL_AS_FUNCTION); __ cmp(eax, ebx); __ j(not_equal, masm->isolate()->builtins()->ArgumentsAdaptorTrampoline()); ParameterCount expected(0); - __ InvokeCode(edx, expected, expected, JUMP_FUNCTION, NullCallWrapper(), - CALL_AS_FUNCTION); + __ InvokeCode(edx, expected, expected, JUMP_FUNCTION, NullCallWrapper()); } @@ -999,8 +987,7 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) { __ mov(edi, Operand(ebp, kFunctionOffset)); __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); __ j(not_equal, &call_proxy); - __ InvokeFunction(edi, actual, CALL_FUNCTION, - NullCallWrapper(), CALL_AS_FUNCTION); + __ InvokeFunction(edi, actual, CALL_FUNCTION, NullCallWrapper()); frame_scope.GenerateLeaveFrame(); __ ret(3 * kPointerSize); // remove this, receiver, and arguments @@ -1010,7 +997,6 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) { __ push(edi); // add function proxy as last argument __ inc(eax); __ Set(ebx, Immediate(0)); - __ SetCallKind(ecx, CALL_AS_FUNCTION); __ GetBuiltinEntry(edx, Builtins::CALL_FUNCTION_PROXY); __ call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), RelocInfo::CODE_TARGET); @@ -1245,7 +1231,6 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { // ----------- S t a t e ------------- // -- eax : actual number of arguments // -- ebx : expected number of arguments - // -- ecx : call kind information // -- edx : code entry to call // ----------------------------------- diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc index 7e396e1fc..7c077b64c 100644 --- a/src/ia32/code-stubs-ia32.cc +++ b/src/ia32/code-stubs-ia32.cc @@ -2531,11 +2531,7 @@ void CallFunctionStub::Generate(MacroAssembler* masm) { // Fast-case: Just invoke the function. ParameterCount actual(argc_); - __ InvokeFunction(edi, - actual, - JUMP_FUNCTION, - NullCallWrapper(), - CALL_AS_FUNCTION); + __ InvokeFunction(edi, actual, JUMP_FUNCTION, NullCallWrapper()); // Slow-case: Non-function called. __ bind(&slow); @@ -2554,7 +2550,6 @@ void CallFunctionStub::Generate(MacroAssembler* masm) { __ push(ecx); __ Set(eax, Immediate(argc_ + 1)); __ Set(ebx, Immediate(0)); - __ SetCallKind(ecx, CALL_AS_FUNCTION); __ GetBuiltinEntry(edx, Builtins::CALL_FUNCTION_PROXY); { Handle adaptor = isolate->builtins()->ArgumentsAdaptorTrampoline(); @@ -2567,7 +2562,6 @@ void CallFunctionStub::Generate(MacroAssembler* masm) { __ mov(Operand(esp, (argc_ + 1) * kPointerSize), edi); __ Set(eax, Immediate(argc_)); __ Set(ebx, Immediate(0)); - __ SetCallKind(ecx, CALL_AS_FUNCTION); __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION); Handle adaptor = isolate->builtins()->ArgumentsAdaptorTrampoline(); __ jmp(adaptor, RelocInfo::CODE_TARGET); @@ -2615,7 +2609,6 @@ void CallConstructStub::Generate(MacroAssembler* masm) { __ Set(ebx, Immediate(0)); Handle arguments_adaptor = masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); - __ SetCallKind(ecx, CALL_AS_METHOD); __ jmp(arguments_adaptor, RelocInfo::CODE_TARGET); } @@ -5314,8 +5307,7 @@ void StubFailureTailCallTrampolineStub::Generate(MacroAssembler* masm) { __ sub(eax, Immediate(1)); masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); ParameterCount argument_count(eax); - __ InvokeFunction( - edi, argument_count, JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); + __ InvokeFunction(edi, argument_count, JUMP_FUNCTION, NullCallWrapper()); } diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc index eac3f5a50..b30daa64a 100644 --- a/src/ia32/full-codegen-ia32.cc +++ b/src/ia32/full-codegen-ia32.cc @@ -107,7 +107,6 @@ class JumpPatchSite BASE_EMBEDDED { // formal parameter count expected by the function. // // The live registers are: -// o ecx: CallKind // o edi: the JS function object being called (i.e. ourselves) // o esi: our context // o ebp: our caller's frame pointer @@ -138,9 +137,6 @@ void FullCodeGenerator::Generate() { // object). if (info->is_classic_mode() && !info->is_native()) { Label ok; - __ test(ecx, ecx); - __ j(zero, &ok, Label::kNear); - // +1 for return address. int receiver_offset = (info->scope()->num_parameters() + 1) * kPointerSize; __ mov(ecx, Operand(esp, receiver_offset)); @@ -3693,8 +3689,7 @@ void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { // InvokeFunction requires the function in edi. Move it in there. __ mov(edi, result_register()); ParameterCount count(arg_count); - __ InvokeFunction(edi, count, CALL_FUNCTION, - NullCallWrapper(), CALL_AS_FUNCTION); + __ InvokeFunction(edi, count, CALL_FUNCTION, NullCallWrapper()); __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); __ jmp(&done); diff --git a/src/ia32/ic-ia32.cc b/src/ia32/ic-ia32.cc index b034e494e..047e5f7b2 100644 --- a/src/ia32/ic-ia32.cc +++ b/src/ia32/ic-ia32.cc @@ -1028,8 +1028,7 @@ static void GenerateFunctionTailCall(MacroAssembler* masm, // Invoke the function. ParameterCount actual(argc); - __ InvokeFunction(edi, actual, JUMP_FUNCTION, - NullCallWrapper(), CALL_AS_METHOD); + __ InvokeFunction(edi, actual, JUMP_FUNCTION, NullCallWrapper()); } @@ -1119,15 +1118,8 @@ void CallICBase::GenerateMiss(MacroAssembler* masm, } // Invoke the function. - CallKind call_kind = CallICBase::Contextual::decode(extra_state) - ? CALL_AS_FUNCTION - : CALL_AS_METHOD; ParameterCount actual(argc); - __ InvokeFunction(edi, - actual, - JUMP_FUNCTION, - NullCallWrapper(), - call_kind); + __ InvokeFunction(edi, actual, JUMP_FUNCTION, NullCallWrapper()); } diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc index b1c083fad..a9ccfeaaf 100644 --- a/src/ia32/lithium-codegen-ia32.cc +++ b/src/ia32/lithium-codegen-ia32.cc @@ -182,9 +182,6 @@ bool LCodeGen::GeneratePrologue() { info_->is_classic_mode() && !info_->is_native()) { Label ok; - __ test(ecx, ecx); - __ j(zero, &ok, Label::kNear); - // +1 for return address. int receiver_offset = (scope()->num_parameters() + 1) * kPointerSize; __ mov(ecx, Operand(esp, receiver_offset)); @@ -3726,8 +3723,7 @@ void LCodeGen::DoApplyArguments(LApplyArguments* instr) { SafepointGenerator safepoint_generator( this, pointers, Safepoint::kLazyDeopt); ParameterCount actual(eax); - __ InvokeFunction(function, actual, CALL_FUNCTION, - safepoint_generator, CALL_AS_FUNCTION); + __ InvokeFunction(function, actual, CALL_FUNCTION, safepoint_generator); } @@ -3800,7 +3796,6 @@ void LCodeGen::CallKnownFunction(Handle function, int formal_parameter_count, int arity, LInstruction* instr, - CallKind call_kind, EDIState edi_state) { bool dont_adapt_arguments = formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel; @@ -3822,7 +3817,6 @@ void LCodeGen::CallKnownFunction(Handle function, } // Invoke function directly. - __ SetCallKind(ecx, call_kind); if (function.is_identical_to(info()->closure())) { __ CallSelf(); } else { @@ -3836,8 +3830,7 @@ void LCodeGen::CallKnownFunction(Handle function, this, pointers, Safepoint::kLazyDeopt); ParameterCount count(arity); ParameterCount expected(formal_parameter_count); - __ InvokeFunction( - function, expected, count, CALL_FUNCTION, generator, call_kind); + __ InvokeFunction(function, expected, count, CALL_FUNCTION, generator); } } @@ -3848,7 +3841,6 @@ void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) { instr->hydrogen()->formal_parameter_count(), instr->arity(), instr, - CALL_AS_FUNCTION, EDI_UNINITIALIZED); } @@ -4209,13 +4201,12 @@ void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) { SafepointGenerator generator( this, pointers, Safepoint::kLazyDeopt); ParameterCount count(instr->arity()); - __ InvokeFunction(edi, count, CALL_FUNCTION, generator, CALL_AS_FUNCTION); + __ InvokeFunction(edi, count, CALL_FUNCTION, generator); } else { CallKnownFunction(known_function, instr->hydrogen()->formal_parameter_count(), instr->arity(), instr, - CALL_AS_FUNCTION, EDI_CONTAINS_TARGET); } } @@ -4279,7 +4270,6 @@ void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { instr->hydrogen()->formal_parameter_count(), instr->arity(), instr, - CALL_AS_FUNCTION, EDI_UNINITIALIZED); } diff --git a/src/ia32/lithium-codegen-ia32.h b/src/ia32/lithium-codegen-ia32.h index a12ad2d15..fa5e88b03 100644 --- a/src/ia32/lithium-codegen-ia32.h +++ b/src/ia32/lithium-codegen-ia32.h @@ -257,7 +257,6 @@ class LCodeGen: public LCodeGenBase { int formal_parameter_count, int arity, LInstruction* instr, - CallKind call_kind, EDIState edi_state); void RecordSafepointWithLazyDeopt(LInstruction* instr, diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc index 52d42f6ca..6c3b2cc0c 100644 --- a/src/ia32/macro-assembler-ia32.cc +++ b/src/ia32/macro-assembler-ia32.cc @@ -2455,23 +2455,6 @@ void MacroAssembler::JumpToExternalReference(const ExternalReference& ext) { } -void MacroAssembler::SetCallKind(Register dst, CallKind call_kind) { - // This macro takes the dst register to make the code more readable - // at the call sites. However, the dst register has to be ecx to - // follow the calling convention which requires the call type to be - // in ecx. - ASSERT(dst.is(ecx)); - if (call_kind == CALL_AS_FUNCTION) { - // Set to some non-zero smi by updating the least significant - // byte. - mov_b(dst, 1 << kSmiTagSize); - } else { - // Set to smi zero by clearing the register. - xor_(dst, dst); - } -} - - void MacroAssembler::InvokePrologue(const ParameterCount& expected, const ParameterCount& actual, Handle code_constant, @@ -2480,8 +2463,7 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected, bool* definitely_mismatches, InvokeFlag flag, Label::Distance done_near, - const CallWrapper& call_wrapper, - CallKind call_kind) { + const CallWrapper& call_wrapper) { bool definitely_matches = false; *definitely_mismatches = false; Label invoke; @@ -2534,14 +2516,12 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected, if (flag == CALL_FUNCTION) { call_wrapper.BeforeCall(CallSize(adaptor, RelocInfo::CODE_TARGET)); - SetCallKind(ecx, call_kind); call(adaptor, RelocInfo::CODE_TARGET); call_wrapper.AfterCall(); if (!*definitely_mismatches) { jmp(done, done_near); } } else { - SetCallKind(ecx, call_kind); jmp(adaptor, RelocInfo::CODE_TARGET); } bind(&invoke); @@ -2553,8 +2533,7 @@ void MacroAssembler::InvokeCode(const Operand& code, const ParameterCount& expected, const ParameterCount& actual, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind) { + const CallWrapper& call_wrapper) { // You can't call a function without a valid frame. ASSERT(flag == JUMP_FUNCTION || has_frame()); @@ -2562,16 +2541,14 @@ void MacroAssembler::InvokeCode(const Operand& code, bool definitely_mismatches = false; InvokePrologue(expected, actual, Handle::null(), code, &done, &definitely_mismatches, flag, Label::kNear, - call_wrapper, call_kind); + call_wrapper); if (!definitely_mismatches) { if (flag == CALL_FUNCTION) { call_wrapper.BeforeCall(CallSize(code)); - SetCallKind(ecx, call_kind); call(code); call_wrapper.AfterCall(); } else { ASSERT(flag == JUMP_FUNCTION); - SetCallKind(ecx, call_kind); jmp(code); } bind(&done); @@ -2584,8 +2561,7 @@ void MacroAssembler::InvokeCode(Handle code, const ParameterCount& actual, RelocInfo::Mode rmode, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind) { + const CallWrapper& call_wrapper) { // You can't call a function without a valid frame. ASSERT(flag == JUMP_FUNCTION || has_frame()); @@ -2593,16 +2569,14 @@ void MacroAssembler::InvokeCode(Handle code, Operand dummy(eax, 0); bool definitely_mismatches = false; InvokePrologue(expected, actual, code, dummy, &done, &definitely_mismatches, - flag, Label::kNear, call_wrapper, call_kind); + flag, Label::kNear, call_wrapper); if (!definitely_mismatches) { if (flag == CALL_FUNCTION) { call_wrapper.BeforeCall(CallSize(code, rmode)); - SetCallKind(ecx, call_kind); call(code, rmode); call_wrapper.AfterCall(); } else { ASSERT(flag == JUMP_FUNCTION); - SetCallKind(ecx, call_kind); jmp(code, rmode); } bind(&done); @@ -2613,8 +2587,7 @@ void MacroAssembler::InvokeCode(Handle code, void MacroAssembler::InvokeFunction(Register fun, const ParameterCount& actual, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind) { + const CallWrapper& call_wrapper) { // You can't call a function without a valid frame. ASSERT(flag == JUMP_FUNCTION || has_frame()); @@ -2626,7 +2599,7 @@ void MacroAssembler::InvokeFunction(Register fun, ParameterCount expected(ebx); InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), - expected, actual, flag, call_wrapper, call_kind); + expected, actual, flag, call_wrapper); } @@ -2634,8 +2607,7 @@ void MacroAssembler::InvokeFunction(Register fun, const ParameterCount& expected, const ParameterCount& actual, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind) { + const CallWrapper& call_wrapper) { // You can't call a function without a valid frame. ASSERT(flag == JUMP_FUNCTION || has_frame()); @@ -2643,7 +2615,7 @@ void MacroAssembler::InvokeFunction(Register fun, mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), - expected, actual, flag, call_wrapper, call_kind); + expected, actual, flag, call_wrapper); } @@ -2651,10 +2623,9 @@ void MacroAssembler::InvokeFunction(Handle function, const ParameterCount& expected, const ParameterCount& actual, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind) { + const CallWrapper& call_wrapper) { LoadHeapObject(edi, function); - InvokeFunction(edi, expected, actual, flag, call_wrapper, call_kind); + InvokeFunction(edi, expected, actual, flag, call_wrapper); } @@ -2670,7 +2641,7 @@ void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, ParameterCount expected(0); GetBuiltinFunction(edi, id); InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), - expected, expected, flag, call_wrapper, CALL_AS_METHOD); + expected, expected, flag, call_wrapper); } diff --git a/src/ia32/macro-assembler-ia32.h b/src/ia32/macro-assembler-ia32.h index 054b16484..148716342 100644 --- a/src/ia32/macro-assembler-ia32.h +++ b/src/ia32/macro-assembler-ia32.h @@ -311,57 +311,46 @@ class MacroAssembler: public Assembler { // --------------------------------------------------------------------------- // JavaScript invokes - // Set up call kind marking in ecx. The method takes ecx as an - // explicit first parameter to make the code more readable at the - // call sites. - void SetCallKind(Register dst, CallKind kind); - // Invoke the JavaScript function code by either calling or jumping. void InvokeCode(Register code, const ParameterCount& expected, const ParameterCount& actual, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind) { - InvokeCode(Operand(code), expected, actual, flag, call_wrapper, call_kind); + const CallWrapper& call_wrapper) { + InvokeCode(Operand(code), expected, actual, flag, call_wrapper); } void InvokeCode(const Operand& code, const ParameterCount& expected, const ParameterCount& actual, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind); + const CallWrapper& call_wrapper); void InvokeCode(Handle code, const ParameterCount& expected, const ParameterCount& actual, RelocInfo::Mode rmode, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind); + const CallWrapper& call_wrapper); // Invoke the JavaScript function in the given register. Changes the // current context to the context in the function before invoking. void InvokeFunction(Register function, const ParameterCount& actual, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind); + const CallWrapper& call_wrapper); void InvokeFunction(Register function, const ParameterCount& expected, const ParameterCount& actual, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind); + const CallWrapper& call_wrapper); void InvokeFunction(Handle function, const ParameterCount& expected, const ParameterCount& actual, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind); + const CallWrapper& call_wrapper); // Invoke specified builtin JavaScript function. Adds an entry to // the unresolved list if the name does not resolve. @@ -1010,8 +999,7 @@ class MacroAssembler: public Assembler { bool* definitely_mismatches, InvokeFlag flag, Label::Distance done_distance, - const CallWrapper& call_wrapper = NullCallWrapper(), - CallKind call_kind = CALL_AS_METHOD); + const CallWrapper& call_wrapper = NullCallWrapper()); void EnterExitFramePrologue(); void EnterExitFrameEpilogue(int argc, bool save_doubles); diff --git a/src/ia32/stub-cache-ia32.cc b/src/ia32/stub-cache-ia32.cc index 464cc9589..d974940d7 100644 --- a/src/ia32/stub-cache-ia32.cc +++ b/src/ia32/stub-cache-ia32.cc @@ -2569,8 +2569,7 @@ void CallStubCompiler::GenerateJumpFunction(Handle object, PatchImplicitReceiver(object); // Invoke the function. - __ InvokeFunction(edi, arguments(), JUMP_FUNCTION, - NullCallWrapper(), call_kind()); + __ InvokeFunction(edi, arguments(), JUMP_FUNCTION, NullCallWrapper()); } @@ -2703,7 +2702,7 @@ void StoreStubCompiler::GenerateStoreViaSetter( ParameterCount actual(1); ParameterCount expected(setter); __ InvokeFunction(setter, expected, actual, - CALL_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); + CALL_FUNCTION, NullCallWrapper()); } else { // If we generate a global code snippet for deoptimization only, remember // the place to continue after deoptimization. @@ -2846,7 +2845,7 @@ void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm, ParameterCount actual(0); ParameterCount expected(getter); __ InvokeFunction(getter, expected, actual, - CALL_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); + CALL_FUNCTION, NullCallWrapper()); } else { // If we generate a global code snippet for deoptimization only, remember // the place to continue after deoptimization. diff --git a/src/stub-cache.cc b/src/stub-cache.cc index 4b55d2e19..43375b050 100644 --- a/src/stub-cache.cc +++ b/src/stub-cache.cc @@ -1268,13 +1268,6 @@ void StubCompiler::LookupPostInterceptor(Handle holder, #define __ ACCESS_MASM(masm()) -CallKind CallStubCompiler::call_kind() { - return CallICBase::Contextual::decode(extra_state()) - ? CALL_AS_FUNCTION - : CALL_AS_METHOD; -} - - void CallStubCompiler::HandlerFrontendFooter(Label* miss) { __ bind(miss); GenerateMissBranch(); @@ -1285,7 +1278,7 @@ void CallStubCompiler::GenerateJumpFunctionIgnoreReceiver( Handle function) { ParameterCount expected(function); __ InvokeFunction(function, expected, arguments(), - JUMP_FUNCTION, NullCallWrapper(), call_kind()); + JUMP_FUNCTION, NullCallWrapper()); } @@ -1302,7 +1295,7 @@ void CallStubCompiler::GenerateJumpFunction(Handle object, PatchImplicitReceiver(object); ParameterCount expected(function); __ InvokeFunction(actual_closure, expected, arguments(), - JUMP_FUNCTION, NullCallWrapper(), call_kind()); + JUMP_FUNCTION, NullCallWrapper()); } diff --git a/src/stub-cache.h b/src/stub-cache.h index 360bbfb5a..954c249e6 100644 --- a/src/stub-cache.h +++ b/src/stub-cache.h @@ -1000,8 +1000,6 @@ class CallStubCompiler: public StubCompiler { Handle function, Handle name); - CallKind call_kind(); - Handle GetCode(Code::StubType type, Handle name); Handle GetCode(Handle function); diff --git a/src/type-info.cc b/src/type-info.cc index 15e454b21..883cdba33 100644 --- a/src/type-info.cc +++ b/src/type-info.cc @@ -178,16 +178,12 @@ KeyedAccessStoreMode TypeFeedbackOracle::GetStoreMode( void TypeFeedbackOracle::CallReceiverTypes(TypeFeedbackId id, Handle name, int arity, - CallKind call_kind, + ContextualMode contextual_mode, SmallMapList* types) { // Note: Currently we do not take string extra ic data into account // here. - ContextualMode contextual_mode = call_kind == CALL_AS_FUNCTION - ? CONTEXTUAL - : NOT_CONTEXTUAL; ExtraICState extra_ic_state = CallIC::Contextual::encode(contextual_mode); - Code::Flags flags = Code::ComputeMonomorphicFlags( Code::CALL_IC, extra_ic_state, OWN_MAP, Code::NORMAL, arity); CollectReceiverTypes(id, name, flags, types); diff --git a/src/type-info.h b/src/type-info.h index 6e6c67d16..34270ab93 100644 --- a/src/type-info.h +++ b/src/type-info.h @@ -68,7 +68,7 @@ class TypeFeedbackOracle: public ZoneObject { void CallReceiverTypes(TypeFeedbackId id, Handle name, int arity, - CallKind call_kind, + ContextualMode contextual_mode, SmallMapList* types); void PropertyReceiverTypes(TypeFeedbackId id, Handle name, diff --git a/src/typing.cc b/src/typing.cc index 30e0b9205..57b494d76 100644 --- a/src/typing.cc +++ b/src/typing.cc @@ -530,14 +530,11 @@ void AstTyper::VisitProperty(Property* expr) { void AstTyper::VisitCall(Call* expr) { - // Collect type feedback. Expression* callee = expr->expression(); Property* prop = callee->AsProperty(); - if (prop != NULL) { - expr->RecordTypeFeedback(oracle(), CALL_AS_METHOD); - } else { - expr->RecordTypeFeedback(oracle(), CALL_AS_FUNCTION); - } + ContextualMode contextual_mode = prop == NULL ? CONTEXTUAL : NOT_CONTEXTUAL; + // Collect type feedback. + expr->RecordTypeFeedback(oracle(), contextual_mode); RECURSE(Visit(expr->expression())); ZoneList* args = expr->arguments(); diff --git a/src/v8globals.h b/src/v8globals.h index a85c828c7..ac05ca9d8 100644 --- a/src/v8globals.h +++ b/src/v8globals.h @@ -444,14 +444,6 @@ enum SmiCheckType { }; -// Used to specify whether a receiver is implicitly or explicitly -// provided to a call. -enum CallKind { - CALL_AS_METHOD, - CALL_AS_FUNCTION -}; - - enum ScopeType { EVAL_SCOPE, // The top-level scope for an eval source. FUNCTION_SCOPE, // The top-level scope for a function. diff --git a/src/x64/builtins-x64.cc b/src/x64/builtins-x64.cc index 940d262eb..514cec8c1 100644 --- a/src/x64/builtins-x64.cc +++ b/src/x64/builtins-x64.cc @@ -79,14 +79,10 @@ static void CallRuntimePassFunction( FrameScope scope(masm, StackFrame::INTERNAL); // Push a copy of the function onto the stack. __ push(rdi); - // Push call kind information. - __ push(rcx); // Function is also the parameter to the runtime call. __ push(rdi); __ CallRuntime(function_id, 1); - // Restore call kind information. - __ pop(rcx); // Restore receiver. __ pop(rdi); } @@ -375,11 +371,10 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, masm->isolate()->builtins()->HandleApiCallConstruct(); ParameterCount expected(0); __ InvokeCode(code, expected, expected, RelocInfo::CODE_TARGET, - CALL_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); + CALL_FUNCTION, NullCallWrapper()); } else { ParameterCount actual(rax); - __ InvokeFunction(rdi, actual, CALL_FUNCTION, - NullCallWrapper(), CALL_AS_METHOD); + __ InvokeFunction(rdi, actual, CALL_FUNCTION, NullCallWrapper()); } // Store offset of return address for deoptimizer. @@ -549,8 +544,7 @@ static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, } else { ParameterCount actual(rax); // Function must be in rdi. - __ InvokeFunction(rdi, actual, CALL_FUNCTION, - NullCallWrapper(), CALL_AS_METHOD); + __ InvokeFunction(rdi, actual, CALL_FUNCTION, NullCallWrapper()); } // Exit the internal frame. Notice that this also removes the empty // context and the function left on the stack by the code @@ -583,16 +577,12 @@ static void CallCompileOptimized(MacroAssembler* masm, FrameScope scope(masm, StackFrame::INTERNAL); // Push a copy of the function onto the stack. __ push(rdi); - // Push call kind information. - __ push(rcx); // Function is also the parameter to the runtime call. __ push(rdi); // Whether to compile in a background thread. __ Push(masm->isolate()->factory()->ToBoolean(concurrent)); __ CallRuntime(Runtime::kCompileOptimized, 2); - // Restore call kind information. - __ pop(rcx); // Restore receiver. __ pop(rdi); } @@ -890,7 +880,6 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) { __ testq(rdx, rdx); __ j(zero, &function); __ Set(rbx, 0); - __ SetCallKind(rcx, CALL_AS_METHOD); __ cmpq(rdx, Immediate(1)); __ j(not_equal, &non_proxy); @@ -917,15 +906,13 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) { FieldOperand(rdx, SharedFunctionInfo::kFormalParameterCountOffset)); __ movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); - __ SetCallKind(rcx, CALL_AS_FUNCTION); __ cmpq(rax, rbx); __ j(not_equal, masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), RelocInfo::CODE_TARGET); ParameterCount expected(0); - __ InvokeCode(rdx, expected, expected, JUMP_FUNCTION, - NullCallWrapper(), CALL_AS_FUNCTION); + __ InvokeCode(rdx, expected, expected, JUMP_FUNCTION, NullCallWrapper()); } @@ -1069,8 +1056,7 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) { __ movq(rdi, Operand(rbp, kFunctionOffset)); __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); __ j(not_equal, &call_proxy); - __ InvokeFunction(rdi, actual, CALL_FUNCTION, - NullCallWrapper(), CALL_AS_FUNCTION); + __ InvokeFunction(rdi, actual, CALL_FUNCTION, NullCallWrapper()); frame_scope.GenerateLeaveFrame(); __ ret(3 * kPointerSize); // remove this, receiver, and arguments @@ -1080,7 +1066,6 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) { __ push(rdi); // add function proxy as last argument __ incq(rax); __ Set(rbx, 0); - __ SetCallKind(rcx, CALL_AS_FUNCTION); __ GetBuiltinEntry(rdx, Builtins::CALL_FUNCTION_PROXY); __ call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), RelocInfo::CODE_TARGET); @@ -1318,7 +1303,6 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { // ----------- S t a t e ------------- // -- rax : actual number of arguments // -- rbx : expected number of arguments - // -- rcx : call kind information // -- rdx : code entry to call // ----------------------------------- diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc index d196d0e85..9ffb6720c 100644 --- a/src/x64/code-stubs-x64.cc +++ b/src/x64/code-stubs-x64.cc @@ -2364,11 +2364,7 @@ void CallFunctionStub::Generate(MacroAssembler* masm) { // Fast-case: Just invoke the function. ParameterCount actual(argc_); - __ InvokeFunction(rdi, - actual, - JUMP_FUNCTION, - NullCallWrapper(), - CALL_AS_FUNCTION); + __ InvokeFunction(rdi, actual, JUMP_FUNCTION, NullCallWrapper()); // Slow-case: Non-function called. __ bind(&slow); @@ -2387,7 +2383,6 @@ void CallFunctionStub::Generate(MacroAssembler* masm) { __ PushReturnAddressFrom(rcx); __ Set(rax, argc_ + 1); __ Set(rbx, 0); - __ SetCallKind(rcx, CALL_AS_FUNCTION); __ GetBuiltinEntry(rdx, Builtins::CALL_FUNCTION_PROXY); { Handle adaptor = @@ -2401,7 +2396,6 @@ void CallFunctionStub::Generate(MacroAssembler* masm) { __ movq(args.GetReceiverOperand(), rdi); __ Set(rax, argc_); __ Set(rbx, 0); - __ SetCallKind(rcx, CALL_AS_FUNCTION); __ GetBuiltinEntry(rdx, Builtins::CALL_NON_FUNCTION); Handle adaptor = isolate->builtins()->ArgumentsAdaptorTrampoline(); @@ -2448,7 +2442,6 @@ void CallConstructStub::Generate(MacroAssembler* masm) { __ 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); } @@ -5111,8 +5104,7 @@ void StubFailureTailCallTrampolineStub::Generate(MacroAssembler* masm) { __ subl(rax, Immediate(1)); masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); ParameterCount argument_count(rax); - __ InvokeFunction( - rdi, argument_count, JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); + __ InvokeFunction(rdi, argument_count, JUMP_FUNCTION, NullCallWrapper()); } diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc index c9581479c..8d197d88d 100644 --- a/src/x64/full-codegen-x64.cc +++ b/src/x64/full-codegen-x64.cc @@ -137,9 +137,6 @@ void FullCodeGenerator::Generate() { // object). if (info->is_classic_mode() && !info->is_native()) { Label ok; - __ testq(rcx, rcx); - __ j(zero, &ok, Label::kNear); - // +1 for return address. StackArgumentsAccessor args(rsp, info->scope()->num_parameters()); __ movq(rcx, args.GetReceiverOperand()); @@ -3667,8 +3664,7 @@ void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { // InvokeFunction requires the function in rdi. Move it in there. __ movq(rdi, result_register()); ParameterCount count(arg_count); - __ InvokeFunction(rdi, count, CALL_FUNCTION, - NullCallWrapper(), CALL_AS_FUNCTION); + __ InvokeFunction(rdi, count, CALL_FUNCTION, NullCallWrapper()); __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); __ jmp(&done); diff --git a/src/x64/ic-x64.cc b/src/x64/ic-x64.cc index cea2b80cf..7c1d8a416 100644 --- a/src/x64/ic-x64.cc +++ b/src/x64/ic-x64.cc @@ -910,8 +910,7 @@ static void GenerateFunctionTailCall(MacroAssembler* masm, // Invoke the function. ParameterCount actual(argc); - __ InvokeFunction(rdi, actual, JUMP_FUNCTION, - NullCallWrapper(), CALL_AS_METHOD); + __ InvokeFunction(rdi, actual, JUMP_FUNCTION, NullCallWrapper()); } @@ -1004,15 +1003,8 @@ void CallICBase::GenerateMiss(MacroAssembler* masm, } // Invoke the function. - CallKind call_kind = CallICBase::Contextual::decode(extra_state) - ? CALL_AS_FUNCTION - : CALL_AS_METHOD; ParameterCount actual(argc); - __ InvokeFunction(rdi, - actual, - JUMP_FUNCTION, - NullCallWrapper(), - call_kind); + __ InvokeFunction(rdi, actual, JUMP_FUNCTION, NullCallWrapper()); } diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc index b3b64beee..af5bf45a3 100644 --- a/src/x64/lithium-codegen-x64.cc +++ b/src/x64/lithium-codegen-x64.cc @@ -162,9 +162,6 @@ bool LCodeGen::GeneratePrologue() { info_->is_classic_mode() && !info_->is_native()) { Label ok; - __ testq(rcx, rcx); - __ j(zero, &ok, Label::kNear); - StackArgumentsAccessor args(rsp, scope()->num_parameters()); __ movq(rcx, args.GetReceiverOperand()); @@ -3302,8 +3299,7 @@ void LCodeGen::DoApplyArguments(LApplyArguments* instr) { SafepointGenerator safepoint_generator( this, pointers, Safepoint::kLazyDeopt); ParameterCount actual(rax); - __ InvokeFunction(function, actual, CALL_FUNCTION, - safepoint_generator, CALL_AS_FUNCTION); + __ InvokeFunction(function, actual, CALL_FUNCTION, safepoint_generator); } @@ -3371,7 +3367,6 @@ void LCodeGen::CallKnownFunction(Handle function, int formal_parameter_count, int arity, LInstruction* instr, - CallKind call_kind, RDIState rdi_state) { bool dont_adapt_arguments = formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel; @@ -3395,7 +3390,6 @@ void LCodeGen::CallKnownFunction(Handle function, } // Invoke function. - __ SetCallKind(rcx, call_kind); if (function.is_identical_to(info()->closure())) { __ CallSelf(); } else { @@ -3410,8 +3404,7 @@ void LCodeGen::CallKnownFunction(Handle function, this, pointers, Safepoint::kLazyDeopt); ParameterCount count(arity); ParameterCount expected(formal_parameter_count); - __ InvokeFunction( - function, expected, count, CALL_FUNCTION, generator, call_kind); + __ InvokeFunction(function, expected, count, CALL_FUNCTION, generator); } } @@ -3422,7 +3415,6 @@ void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) { instr->hydrogen()->formal_parameter_count(), instr->arity(), instr, - CALL_AS_FUNCTION, RDI_UNINITIALIZED); } @@ -3781,13 +3773,12 @@ void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) { LPointerMap* pointers = instr->pointer_map(); SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); ParameterCount count(instr->arity()); - __ InvokeFunction(rdi, count, CALL_FUNCTION, generator, CALL_AS_FUNCTION); + __ InvokeFunction(rdi, count, CALL_FUNCTION, generator); } else { CallKnownFunction(known_function, instr->hydrogen()->formal_parameter_count(), instr->arity(), instr, - CALL_AS_FUNCTION, RDI_CONTAINS_TARGET); } } @@ -3850,7 +3841,6 @@ void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { instr->hydrogen()->formal_parameter_count(), instr->arity(), instr, - CALL_AS_FUNCTION, RDI_UNINITIALIZED); } diff --git a/src/x64/lithium-codegen-x64.h b/src/x64/lithium-codegen-x64.h index 2241faf4d..0f1a9cdb7 100644 --- a/src/x64/lithium-codegen-x64.h +++ b/src/x64/lithium-codegen-x64.h @@ -213,7 +213,6 @@ class LCodeGen: public LCodeGenBase { int formal_parameter_count, int arity, LInstruction* instr, - CallKind call_kind, RDIState rdi_state); void RecordSafepointWithLazyDeopt(LInstruction* instr, diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc index e160dbb77..b0711bcd5 100644 --- a/src/x64/macro-assembler-x64.cc +++ b/src/x64/macro-assembler-x64.cc @@ -848,7 +848,7 @@ void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, // parameter count to avoid emitting code to do the check. ParameterCount expected(0); GetBuiltinEntry(rdx, id); - InvokeCode(rdx, expected, expected, flag, call_wrapper, CALL_AS_METHOD); + InvokeCode(rdx, expected, expected, flag, call_wrapper); } @@ -3472,26 +3472,11 @@ void MacroAssembler::DebugBreak() { #endif // ENABLE_DEBUGGER_SUPPORT -void MacroAssembler::SetCallKind(Register dst, CallKind call_kind) { - // This macro takes the dst register to make the code more readable - // at the call sites. However, the dst register has to be rcx to - // follow the calling convention which requires the call type to be - // in rcx. - ASSERT(dst.is(rcx)); - if (call_kind == CALL_AS_FUNCTION) { - LoadSmiConstant(dst, Smi::FromInt(1)); - } else { - LoadSmiConstant(dst, Smi::FromInt(0)); - } -} - - void MacroAssembler::InvokeCode(Register code, const ParameterCount& expected, const ParameterCount& actual, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind) { + const CallWrapper& call_wrapper) { // You can't call a function without a valid frame. ASSERT(flag == JUMP_FUNCTION || has_frame()); @@ -3505,17 +3490,14 @@ void MacroAssembler::InvokeCode(Register code, &definitely_mismatches, flag, Label::kNear, - call_wrapper, - call_kind); + call_wrapper); if (!definitely_mismatches) { if (flag == CALL_FUNCTION) { call_wrapper.BeforeCall(CallSize(code)); - SetCallKind(rcx, call_kind); call(code); call_wrapper.AfterCall(); } else { ASSERT(flag == JUMP_FUNCTION); - SetCallKind(rcx, call_kind); jmp(code); } bind(&done); @@ -3528,8 +3510,7 @@ void MacroAssembler::InvokeCode(Handle code, const ParameterCount& actual, RelocInfo::Mode rmode, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind) { + const CallWrapper& call_wrapper) { // You can't call a function without a valid frame. ASSERT(flag == JUMP_FUNCTION || has_frame()); @@ -3544,17 +3525,14 @@ void MacroAssembler::InvokeCode(Handle code, &definitely_mismatches, flag, Label::kNear, - call_wrapper, - call_kind); + call_wrapper); if (!definitely_mismatches) { if (flag == CALL_FUNCTION) { call_wrapper.BeforeCall(CallSize(code)); - SetCallKind(rcx, call_kind); Call(code, rmode); call_wrapper.AfterCall(); } else { ASSERT(flag == JUMP_FUNCTION); - SetCallKind(rcx, call_kind); Jump(code, rmode); } bind(&done); @@ -3565,8 +3543,7 @@ void MacroAssembler::InvokeCode(Handle code, void MacroAssembler::InvokeFunction(Register function, const ParameterCount& actual, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind) { + const CallWrapper& call_wrapper) { // You can't call a function without a valid frame. ASSERT(flag == JUMP_FUNCTION || has_frame()); @@ -3580,7 +3557,7 @@ void MacroAssembler::InvokeFunction(Register function, movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); ParameterCount expected(rbx); - InvokeCode(rdx, expected, actual, flag, call_wrapper, call_kind); + InvokeCode(rdx, expected, actual, flag, call_wrapper); } @@ -3588,8 +3565,7 @@ void MacroAssembler::InvokeFunction(Register function, const ParameterCount& expected, const ParameterCount& actual, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind) { + const CallWrapper& call_wrapper) { // You can't call a function without a valid frame. ASSERT(flag == JUMP_FUNCTION || has_frame()); @@ -3599,7 +3575,7 @@ void MacroAssembler::InvokeFunction(Register function, // the executable code. movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); - InvokeCode(rdx, expected, actual, flag, call_wrapper, call_kind); + InvokeCode(rdx, expected, actual, flag, call_wrapper); } @@ -3607,10 +3583,9 @@ void MacroAssembler::InvokeFunction(Handle function, const ParameterCount& expected, const ParameterCount& actual, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind) { + const CallWrapper& call_wrapper) { Move(rdi, function); - InvokeFunction(rdi, expected, actual, flag, call_wrapper, call_kind); + InvokeFunction(rdi, expected, actual, flag, call_wrapper); } @@ -3622,8 +3597,7 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected, bool* definitely_mismatches, InvokeFlag flag, Label::Distance near_jump, - const CallWrapper& call_wrapper, - CallKind call_kind) { + const CallWrapper& call_wrapper) { bool definitely_matches = false; *definitely_mismatches = false; Label invoke; @@ -3675,14 +3649,12 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected, if (flag == CALL_FUNCTION) { call_wrapper.BeforeCall(CallSize(adaptor)); - SetCallKind(rcx, call_kind); Call(adaptor, RelocInfo::CODE_TARGET); call_wrapper.AfterCall(); if (!*definitely_mismatches) { jmp(done, near_jump); } } else { - SetCallKind(rcx, call_kind); Jump(adaptor, RelocInfo::CODE_TARGET); } bind(&invoke); diff --git a/src/x64/macro-assembler-x64.h b/src/x64/macro-assembler-x64.h index e69cb6e00..b9eb7fef5 100644 --- a/src/x64/macro-assembler-x64.h +++ b/src/x64/macro-assembler-x64.h @@ -342,48 +342,38 @@ class MacroAssembler: public Assembler { // --------------------------------------------------------------------------- // JavaScript invokes - // Set up call kind marking in rcx. The method takes rcx as an - // explicit first parameter to make the code more readable at the - // call sites. - void SetCallKind(Register dst, CallKind kind); - // Invoke the JavaScript function code by either calling or jumping. void InvokeCode(Register code, const ParameterCount& expected, const ParameterCount& actual, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind); + const CallWrapper& call_wrapper); void InvokeCode(Handle code, const ParameterCount& expected, const ParameterCount& actual, RelocInfo::Mode rmode, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind); + const CallWrapper& call_wrapper); // Invoke the JavaScript function in the given register. Changes the // current context to the context in the function before invoking. void InvokeFunction(Register function, const ParameterCount& actual, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind); + const CallWrapper& call_wrapper); void InvokeFunction(Register function, const ParameterCount& expected, const ParameterCount& actual, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind); + const CallWrapper& call_wrapper); void InvokeFunction(Handle function, const ParameterCount& expected, const ParameterCount& actual, InvokeFlag flag, - const CallWrapper& call_wrapper, - CallKind call_kind); + const CallWrapper& call_wrapper); // Invoke specified builtin JavaScript function. Adds an entry to // the unresolved list if the name does not resolve. @@ -1490,8 +1480,7 @@ class MacroAssembler: public Assembler { bool* definitely_mismatches, InvokeFlag flag, Label::Distance near_jump = Label::kFar, - const CallWrapper& call_wrapper = NullCallWrapper(), - CallKind call_kind = CALL_AS_METHOD); + const CallWrapper& call_wrapper = NullCallWrapper()); void EnterExitFramePrologue(bool save_rax); diff --git a/src/x64/stub-cache-x64.cc b/src/x64/stub-cache-x64.cc index 0d1630178..b0bdf70a4 100644 --- a/src/x64/stub-cache-x64.cc +++ b/src/x64/stub-cache-x64.cc @@ -2475,8 +2475,7 @@ void CallStubCompiler::GenerateJumpFunction(Handle object, PatchImplicitReceiver(object); // Invoke the function. - __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION, - NullCallWrapper(), call_kind()); + __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION, NullCallWrapper()); } @@ -2607,7 +2606,7 @@ void StoreStubCompiler::GenerateStoreViaSetter( ParameterCount actual(1); ParameterCount expected(setter); __ InvokeFunction(setter, expected, actual, - CALL_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); + CALL_FUNCTION, NullCallWrapper()); } else { // If we generate a global code snippet for deoptimization only, remember // the place to continue after deoptimization. @@ -2762,7 +2761,7 @@ void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm, ParameterCount actual(0); ParameterCount expected(getter); __ InvokeFunction(getter, expected, actual, - CALL_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); + CALL_FUNCTION, NullCallWrapper()); } else { // If we generate a global code snippet for deoptimization only, remember // the place to continue after deoptimization. -- 2.34.1