Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(738)

Unified Diff: src/x64/code-stubs-x64.cc

Issue 1407373007: Remove CallFunctionStub, always call through the Call builtin (also from CallIC) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/mips64/code-stubs-mips64.cc ('k') | test/mjsunit/call-cross-realm.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/code-stubs-x64.cc
diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc
index fcc7460d3450662f6af49c02576356da11b8e426..1d6db90f2ead8b0bb3a08b6582d7ff102f871ccb 100644
--- a/src/x64/code-stubs-x64.cc
+++ b/src/x64/code-stubs-x64.cc
@@ -1875,130 +1875,6 @@ static void GenerateRecordCallTarget(MacroAssembler* masm, bool is_super) {
}
-static void EmitContinueIfStrictOrNative(MacroAssembler* masm, Label* cont) {
- // ----------- S t a t e -------------
- // -- rdi : the function to call
- // -- rdx : the function's shared function info
- // -----------------------------------
- // Assume that SharedFunctionInfo is already loaded into rdx.
- // Do not transform the receiver for strict mode functions.
- __ testb(FieldOperand(rdx, SharedFunctionInfo::kStrictModeByteOffset),
- Immediate(1 << SharedFunctionInfo::kStrictModeBitWithinByte));
- __ j(not_equal, cont);
-
- // Do not transform the receiver for natives.
- __ testb(FieldOperand(rdx, SharedFunctionInfo::kNativeByteOffset),
- Immediate(1 << SharedFunctionInfo::kNativeBitWithinByte));
- __ j(not_equal, cont);
-}
-
-
-static void EmitSlowCase(MacroAssembler* masm, StackArgumentsAccessor* args,
- int argc) {
- __ Set(rax, argc);
- __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
-}
-
-
-static void EmitWrapCase(MacroAssembler* masm,
- StackArgumentsAccessor* args,
- Label* cont) {
- // Wrap the receiver and patch it back onto the stack.
- { FrameScope frame_scope(masm, StackFrame::INTERNAL);
- __ Push(rdi);
- ToObjectStub stub(masm->isolate());
- __ CallStub(&stub);
- __ Pop(rdi);
- }
- __ movp(args->GetReceiverOperand(), rax);
- __ jmp(cont);
-}
-
-
-static void EmitClassConstructorCallCheck(MacroAssembler* masm) {
- // ----------- S t a t e -------------
- // -- rdi : the function to call
- // -- rdx : the function's shared function info
- // -----------------------------------
- // ClassConstructor Check: ES6 section 9.2.1 [[Call]]
- Label non_class_constructor;
- // Check whether the current function is a classConstructor
- __ testb(FieldOperand(rdx, SharedFunctionInfo::kFunctionKindByteOffset),
- Immediate(SharedFunctionInfo::kClassConstructorBitsWithinByte));
- __ j(zero, &non_class_constructor, Label::kNear);
- // If we call a classConstructor Function throw a TypeError
- // indirectly via the CallFunction builtin.
- __ Jump(masm->isolate()->builtins()->CallFunction(), RelocInfo::CODE_TARGET);
- __ bind(&non_class_constructor);
-}
-
-
-static void CallFunctionNoFeedback(MacroAssembler* masm,
- int argc, bool needs_checks,
- bool call_as_method) {
- // ----------- S t a t e -------------
- // -- rdi : the function to call
- // -----------------------------------
-
- // wrap_and_call can only be true if we are compiling a monomorphic method.
- Label slow, wrap, cont;
- StackArgumentsAccessor args(rsp, argc);
-
- if (needs_checks) {
- // Check that the function really is a JavaScript function.
- __ JumpIfSmi(rdi, &slow);
-
- // Goto slow case if we do not have a function.
- __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx);
- __ j(not_equal, &slow);
- }
-
- __ movp(rdx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset));
- EmitClassConstructorCallCheck(masm);
-
- // Fast-case: Just invoke the function.
- ParameterCount actual(argc);
-
- if (call_as_method) {
- if (needs_checks) {
- EmitContinueIfStrictOrNative(masm, &cont);
- }
-
- // Load the receiver from the stack.
- __ movp(rax, args.GetReceiverOperand());
-
- if (needs_checks) {
- __ JumpIfSmi(rax, &wrap);
-
- __ CmpObjectType(rax, FIRST_SPEC_OBJECT_TYPE, rcx);
- __ j(below, &wrap);
- } else {
- __ jmp(&wrap);
- }
-
- __ bind(&cont);
- }
-
- __ InvokeFunction(rdi, actual, JUMP_FUNCTION, NullCallWrapper());
-
- if (needs_checks) {
- // Slow-case: Non-function called.
- __ bind(&slow);
- EmitSlowCase(masm, &args, argc);
- }
-
- if (call_as_method) {
- __ bind(&wrap);
- EmitWrapCase(masm, &args, &cont);
- }
-}
-
-
-void CallFunctionStub::Generate(MacroAssembler* masm) {
- CallFunctionNoFeedback(masm, argc(), NeedsChecks(), CallAsMethod());
-}
-
-
void CallConstructStub::Generate(MacroAssembler* masm) {
// rax : number of arguments
// rbx : feedback vector
@@ -2083,9 +1959,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex);
const int generic_offset =
FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex);
- Label extra_checks_or_miss, slow_start;
- Label slow, wrap, cont;
- Label have_js_function;
+ Label extra_checks_or_miss, call;
int argc = arg_count();
StackArgumentsAccessor args(rsp, argc);
ParameterCount actual(argc);
@@ -2121,40 +1995,15 @@ void CallICStub::Generate(MacroAssembler* masm) {
FixedArray::kHeaderSize + kPointerSize),
Smi::FromInt(CallICNexus::kCallCountIncrement));
- __ bind(&have_js_function);
-
- __ movp(rdx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset));
- EmitClassConstructorCallCheck(masm);
-
- if (CallAsMethod()) {
- EmitContinueIfStrictOrNative(masm, &cont);
-
- // Load the receiver from the stack.
- __ movp(rax, args.GetReceiverOperand());
-
- __ JumpIfSmi(rax, &wrap);
-
- __ CmpObjectType(rax, FIRST_SPEC_OBJECT_TYPE, rcx);
- __ j(below, &wrap);
-
- __ bind(&cont);
- }
-
- __ InvokeFunction(rdi, actual, JUMP_FUNCTION, NullCallWrapper());
-
- __ bind(&slow);
- EmitSlowCase(masm, &args, argc);
-
- if (CallAsMethod()) {
- __ bind(&wrap);
- EmitWrapCase(masm, &args, &cont);
- }
+ __ bind(&call);
+ __ Set(rax, argc);
+ __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
__ bind(&extra_checks_or_miss);
Label uninitialized, miss, not_allocation_site;
__ Cmp(rcx, TypeFeedbackVector::MegamorphicSentinel(isolate));
- __ j(equal, &slow_start);
+ __ j(equal, &call);
// Check if we have an allocation site.
__ CompareRoot(FieldOperand(rcx, HeapObject::kMapOffset),
@@ -2185,7 +2034,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
// We have to update statistics for runtime profiling.
__ SmiAddConstant(FieldOperand(rbx, with_types_offset), Smi::FromInt(-1));
__ SmiAddConstant(FieldOperand(rbx, generic_offset), Smi::FromInt(1));
- __ jmp(&slow_start);
+ __ jmp(&call);
__ bind(&uninitialized);
@@ -2224,21 +2073,14 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ Pop(rdi);
}
- __ jmp(&have_js_function);
+ __ jmp(&call);
// We are here because tracing is on or we encountered a MISS case we can't
// handle here.
__ bind(&miss);
GenerateMiss(masm);
- // the slow case
- __ bind(&slow_start);
- // Check that function is not a smi.
- __ JumpIfSmi(rdi, &slow);
- // Check that function is a JSFunction.
- __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx);
- __ j(not_equal, &slow);
- __ jmp(&have_js_function);
+ __ jmp(&call);
// Unreachable
__ int3();
« no previous file with comments | « src/mips64/code-stubs-mips64.cc ('k') | test/mjsunit/call-cross-realm.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698