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

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

Issue 1416673009: X87: 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/full-codegen/x87/full-codegen-x87.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x87/code-stubs-x87.cc
diff --git a/src/x87/code-stubs-x87.cc b/src/x87/code-stubs-x87.cc
index 1db96051f87df59d03978f1d1d1201c6c093e074..053d7e09cb1c2e52ab4692189f2ee7b1a5b7bb0a 100644
--- a/src/x87/code-stubs-x87.cc
+++ b/src/x87/code-stubs-x87.cc
@@ -1736,121 +1736,6 @@ static void GenerateRecordCallTarget(MacroAssembler* masm, bool is_super) {
}
-static void EmitContinueIfStrictOrNative(MacroAssembler* masm, Label* cont) {
- // ----------- S t a t e -------------
- // -- edi : the function to call
- // -- edx : the function's shared function info
- // -----------------------------------
- // Do not transform the receiver for strict mode functions.
- __ test_b(FieldOperand(edx, SharedFunctionInfo::kStrictModeByteOffset),
- 1 << SharedFunctionInfo::kStrictModeBitWithinByte);
- __ j(not_equal, cont);
-
- // Do not transform the receiver for natives (shared already in ecx).
- __ test_b(FieldOperand(edx, SharedFunctionInfo::kNativeByteOffset),
- 1 << SharedFunctionInfo::kNativeBitWithinByte);
- __ j(not_equal, cont);
-}
-
-
-static void EmitSlowCase(Isolate* isolate, MacroAssembler* masm, int argc) {
- __ Set(eax, argc);
- __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
-}
-
-
-static void EmitWrapCase(MacroAssembler* masm, int argc, Label* cont) {
- // Wrap the receiver and patch it back onto the stack.
- { FrameScope frame_scope(masm, StackFrame::INTERNAL);
- __ push(edi);
- ToObjectStub stub(masm->isolate());
- __ CallStub(&stub);
- __ pop(edi);
- }
- __ mov(Operand(esp, (argc + 1) * kPointerSize), eax);
- __ jmp(cont);
-}
-
-
-static void EmitClassConstructorCallCheck(MacroAssembler* masm) {
- // ----------- S t a t e -------------
- // -- edi : the function to call
- // -- edx : 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.
- __ test_b(FieldOperand(edx, SharedFunctionInfo::kFunctionKindByteOffset),
- 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) {
- // edi : the function to call
- Label slow, wrap, cont;
-
- if (needs_checks) {
- // Check that the function really is a JavaScript function.
- __ JumpIfSmi(edi, &slow);
-
- // Goto slow case if we do not have a function.
- __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx);
- __ j(not_equal, &slow);
- }
-
- __ mov(edx, FieldOperand(edi, 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.
- __ mov(eax, Operand(esp, (argc + 1) * kPointerSize));
-
- if (needs_checks) {
- __ JumpIfSmi(eax, &wrap);
-
- __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx);
- __ j(below, &wrap);
- } else {
- __ jmp(&wrap);
- }
-
- __ bind(&cont);
- }
-
- __ InvokeFunction(edi, actual, JUMP_FUNCTION, NullCallWrapper());
-
- if (needs_checks) {
- // Slow-case: Non-function called.
- __ bind(&slow);
- EmitSlowCase(masm->isolate(), masm, argc);
- }
-
- if (call_as_method) {
- __ bind(&wrap);
- EmitWrapCase(masm, argc, &cont);
- }
-}
-
-
-void CallFunctionStub::Generate(MacroAssembler* masm) {
- CallFunctionNoFeedback(masm, argc(), NeedsChecks(), CallAsMethod());
-}
-
-
void CallConstructStub::Generate(MacroAssembler* masm) {
// eax : number of arguments
// ebx : feedback vector
@@ -1943,9 +1828,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();
ParameterCount actual(argc);
@@ -1979,40 +1862,15 @@ void CallICStub::Generate(MacroAssembler* masm) {
FixedArray::kHeaderSize + kPointerSize),
Immediate(Smi::FromInt(CallICNexus::kCallCountIncrement)));
- __ bind(&have_js_function);
-
- __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
- EmitClassConstructorCallCheck(masm);
-
- if (CallAsMethod()) {
- EmitContinueIfStrictOrNative(masm, &cont);
-
- // Load the receiver from the stack.
- __ mov(eax, Operand(esp, (argc + 1) * kPointerSize));
-
- __ JumpIfSmi(eax, &wrap);
-
- __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx);
- __ j(below, &wrap);
-
- __ bind(&cont);
- }
-
- __ InvokeFunction(edi, actual, JUMP_FUNCTION, NullCallWrapper());
-
- __ bind(&slow);
- EmitSlowCase(isolate, masm, argc);
-
- if (CallAsMethod()) {
- __ bind(&wrap);
- EmitWrapCase(masm, argc, &cont);
- }
+ __ bind(&call);
+ __ Set(eax, argc);
+ __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
__ bind(&extra_checks_or_miss);
Label uninitialized, miss, not_allocation_site;
__ cmp(ecx, Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate)));
- __ j(equal, &slow_start);
+ __ j(equal, &call);
// Check if we have an allocation site.
__ CompareRoot(FieldOperand(ecx, HeapObject::kMapOffset),
@@ -2044,7 +1902,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
// We have to update statistics for runtime profiling.
__ sub(FieldOperand(ebx, with_types_offset), Immediate(Smi::FromInt(1)));
__ add(FieldOperand(ebx, generic_offset), Immediate(Smi::FromInt(1)));
- __ jmp(&slow_start);
+ __ jmp(&call);
__ bind(&uninitialized);
@@ -2081,23 +1939,14 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ pop(edi);
}
- __ 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 the function really is a JavaScript function.
- __ JumpIfSmi(edi, &slow);
-
- // Goto slow case if we do not have a function.
- __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx);
- __ j(not_equal, &slow);
- __ jmp(&have_js_function);
+ __ jmp(&call);
// Unreachable
__ int3();
« no previous file with comments | « src/full-codegen/x87/full-codegen-x87.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698