Index: src/x64/stub-cache-x64.cc |
diff --git a/src/x64/stub-cache-x64.cc b/src/x64/stub-cache-x64.cc |
index 57c6a353c14ae6c16d641be7d8bc4681751d6d67..b3a032a16d48facb893ab176ba1ee0df5f409b5f 100644 |
--- a/src/x64/stub-cache-x64.cc |
+++ b/src/x64/stub-cache-x64.cc |
@@ -1549,23 +1549,6 @@ void CallStubCompiler::GenerateNameCheck(Handle<Name> name, Label* miss) { |
} |
-void CallStubCompiler::GenerateGlobalReceiverCheck(Handle<JSObject> object, |
- Handle<JSObject> holder, |
- Handle<Name> name, |
- Label* miss) { |
- ASSERT(holder->IsGlobalObject()); |
- |
- StackArgumentsAccessor args(rsp, arguments()); |
- __ movq(rdx, args.GetReceiverOperand()); |
- |
- |
- // Check that the maps haven't changed. |
- __ JumpIfSmi(rdx, miss); |
- CheckPrototypes(IC::CurrentTypeOf(object, isolate()), rdx, holder, |
- rbx, rax, rdi, name, miss); |
-} |
- |
- |
void CallStubCompiler::GenerateLoadFunctionFromCell( |
Handle<Cell> cell, |
Handle<JSFunction> function, |
@@ -1608,28 +1591,10 @@ Handle<Code> CallStubCompiler::CompileCallField(Handle<JSObject> object, |
Handle<JSObject> holder, |
PropertyIndex index, |
Handle<Name> name) { |
- // ----------- S t a t e ------------- |
- // rcx : function name |
- // rsp[0] : return address |
- // rsp[8] : argument argc |
- // rsp[16] : argument argc - 1 |
- // ... |
- // rsp[argc * 8] : argument 1 |
- // rsp[(argc + 1) * 8] : argument 0 = receiver |
- // ----------------------------------- |
Label miss; |
- GenerateNameCheck(name, &miss); |
- |
- StackArgumentsAccessor args(rsp, arguments()); |
- __ movq(rdx, args.GetReceiverOperand()); |
- |
- // Check that the receiver isn't a smi. |
- __ JumpIfSmi(rdx, &miss); |
- |
- // Do the right check and compute the holder register. |
- Register reg = CheckPrototypes(IC::CurrentTypeOf(object, isolate()), rdx, |
- holder, rbx, rax, rdi, name, &miss); |
+ Register reg = HandlerFrontendHeader( |
+ object, holder, name, RECEIVER_MAP_CHECK, &miss); |
GenerateFastPropertyLoad(masm(), rdi, reg, index.is_inobject(holder), |
index.translate(holder), Representation::Tagged()); |
@@ -1639,12 +1604,7 @@ Handle<Code> CallStubCompiler::CompileCallField(Handle<JSObject> object, |
__ CmpObjectType(rdi, JS_FUNCTION_TYPE, rbx); |
__ j(not_equal, &miss); |
- // Patch the receiver on the stack with the global proxy if |
- // necessary. |
- if (object->IsGlobalObject()) { |
- __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); |
- __ movq(args.GetReceiverOperand(), rdx); |
- } |
+ PatchGlobalProxy(object); |
// Invoke the function. |
CallKind call_kind = CallICBase::Contextual::decode(extra_state_) |
@@ -1653,9 +1613,7 @@ Handle<Code> CallStubCompiler::CompileCallField(Handle<JSObject> object, |
__ InvokeFunction(rdi, arguments(), JUMP_FUNCTION, |
NullCallWrapper(), call_kind); |
- // Handle call cache miss. |
- __ bind(&miss); |
- GenerateMissBranch(); |
+ HandlerFrontendFooter(&miss); |
// Return the generated code. |
return GetCode(Code::FAST, name); |
@@ -1671,28 +1629,16 @@ Handle<Code> CallStubCompiler::CompileArrayCodeCall( |
Code::StubType type) { |
Label miss; |
- // Check that function is still array |
- const int argc = arguments().immediate(); |
- StackArgumentsAccessor args(rsp, argc); |
- GenerateNameCheck(name, &miss); |
- |
- if (cell.is_null()) { |
- __ movq(rdx, args.GetReceiverOperand()); |
- |
- // Check that the receiver isn't a smi. |
- __ JumpIfSmi(rdx, &miss); |
- CheckPrototypes(IC::CurrentTypeOf(object, isolate()), rdx, holder, |
- rbx, rax, rdi, name, &miss); |
- } else { |
+ HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss); |
+ if (!cell.is_null()) { |
ASSERT(cell->value() == *function); |
- GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name, |
- &miss); |
GenerateLoadFunctionFromCell(cell, function, &miss); |
} |
Handle<AllocationSite> site = isolate()->factory()->NewAllocationSite(); |
site->SetElementsKind(GetInitialFastElementsKind()); |
Handle<Cell> site_feedback_cell = isolate()->factory()->NewCell(site); |
+ const int argc = arguments().immediate(); |
__ movq(rax, Immediate(argc)); |
__ Move(rbx, site_feedback_cell); |
__ Move(rdi, function); |
@@ -1700,8 +1646,7 @@ Handle<Code> CallStubCompiler::CompileArrayCodeCall( |
ArrayConstructorStub stub(isolate()); |
__ TailCallStub(&stub); |
- __ bind(&miss); |
- GenerateMissBranch(); |
+ HandlerFrontendFooter(&miss); |
// Return the generated code. |
return GetCode(type, name); |
@@ -1731,18 +1676,11 @@ Handle<Code> CallStubCompiler::CompileArrayPushCall( |
} |
Label miss; |
- GenerateNameCheck(name, &miss); |
+ |
+ HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss); |
const int argc = arguments().immediate(); |
StackArgumentsAccessor args(rsp, argc); |
- __ movq(rdx, args.GetReceiverOperand()); |
- |
- // Check that the receiver isn't a smi. |
- __ JumpIfSmi(rdx, &miss); |
- |
- CheckPrototypes(IC::CurrentTypeOf(object, isolate()), rdx, holder, |
- rbx, rax, rdi, name, &miss); |
- |
if (argc == 0) { |
// Noop, return the length. |
__ movq(rax, FieldOperand(rdx, JSArray::kLengthOffset)); |
@@ -1955,8 +1893,7 @@ Handle<Code> CallStubCompiler::CompileArrayPushCall( |
1); |
} |
- __ bind(&miss); |
- GenerateMissBranch(); |
+ HandlerFrontendFooter(&miss); |
// Return the generated code. |
return GetCode(type, name); |
@@ -1970,14 +1907,6 @@ Handle<Code> CallStubCompiler::CompileArrayPopCall( |
Handle<JSFunction> function, |
Handle<String> name, |
Code::StubType type) { |
- // ----------- S t a t e ------------- |
- // -- rcx : name |
- // -- rsp[0] : return address |
- // -- rsp[(argc - n) * 8] : arg[n] (zero-based) |
- // -- ... |
- // -- rsp[(argc + 1) * 8] : receiver |
- // ----------------------------------- |
- |
// If object is not an array or is observed, bail out to regular call. |
if (!object->IsJSArray() || |
!cell.is_null() || |
@@ -1986,17 +1915,8 @@ Handle<Code> CallStubCompiler::CompileArrayPopCall( |
} |
Label miss, return_undefined, call_builtin; |
- GenerateNameCheck(name, &miss); |
- |
- const int argc = arguments().immediate(); |
- StackArgumentsAccessor args(rsp, argc); |
- __ movq(rdx, args.GetReceiverOperand()); |
- |
- // Check that the receiver isn't a smi. |
- __ JumpIfSmi(rdx, &miss); |
- CheckPrototypes(IC::CurrentTypeOf(object, isolate()), rdx, holder, |
- rbx, rax, rdi, name, &miss); |
+ HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss); |
// Get the elements array of the object. |
__ movq(rbx, FieldOperand(rdx, JSArray::kElementsOffset)); |
@@ -2029,6 +1949,7 @@ Handle<Code> CallStubCompiler::CompileArrayPopCall( |
rcx, times_pointer_size, |
FixedArray::kHeaderSize), |
r9); |
+ const int argc = arguments().immediate(); |
__ ret((argc + 1) * kPointerSize); |
__ bind(&return_undefined); |
@@ -2041,8 +1962,7 @@ Handle<Code> CallStubCompiler::CompileArrayPopCall( |
argc + 1, |
1); |
- __ bind(&miss); |
- GenerateMissBranch(); |
+ HandlerFrontendFooter(&miss); |
// Return the generated code. |
return GetCode(type, name); |
@@ -2056,20 +1976,9 @@ Handle<Code> CallStubCompiler::CompileStringCharCodeAtCall( |
Handle<JSFunction> function, |
Handle<String> name, |
Code::StubType type) { |
- // ----------- S t a t e ------------- |
- // -- rcx : function name |
- // -- rsp[0] : return address |
- // -- rsp[(argc - n) * 8] : arg[n] (zero-based) |
- // -- ... |
- // -- rsp[(argc + 1) * 8] : receiver |
- // ----------------------------------- |
- |
// If object is not a string, bail out to regular call. |
if (!object->IsString() || !cell.is_null()) return Handle<Code>::null(); |
- const int argc = arguments().immediate(); |
- StackArgumentsAccessor args(rsp, argc); |
- |
Label miss; |
Label name_miss; |
Label index_out_of_range; |
@@ -2079,22 +1988,15 @@ Handle<Code> CallStubCompiler::CompileStringCharCodeAtCall( |
DEFAULT_STRING_STUB)) { |
index_out_of_range_label = &miss; |
} |
- GenerateNameCheck(name, &name_miss); |
- |
- // Check that the maps starting from the prototype haven't changed. |
- GenerateDirectLoadGlobalFunctionPrototype(masm(), |
- Context::STRING_FUNCTION_INDEX, |
- rax, |
- &miss); |
- ASSERT(!object.is_identical_to(holder)); |
- Handle<Object> prototype(object->GetPrototype(isolate()), isolate()); |
- CheckPrototypes( |
- IC::CurrentTypeOf(prototype, isolate()), |
- rax, holder, rbx, rdx, rdi, name, &miss); |
+ |
+ HandlerFrontendHeader(object, holder, name, STRING_CHECK, &name_miss); |
Register receiver = rbx; |
Register index = rdi; |
Register result = rax; |
+ const int argc = arguments().immediate(); |
+ StackArgumentsAccessor args(rsp, argc); |
+ |
__ movq(receiver, args.GetReceiverOperand()); |
if (argc > 0) { |
__ movq(index, args.GetArgumentOperand(1)); |
@@ -2139,14 +2041,6 @@ Handle<Code> CallStubCompiler::CompileStringCharAtCall( |
Handle<JSFunction> function, |
Handle<String> name, |
Code::StubType type) { |
- // ----------- S t a t e ------------- |
- // -- rcx : function name |
- // -- rsp[0] : return address |
- // -- rsp[(argc - n) * 8] : arg[n] (zero-based) |
- // -- ... |
- // -- rsp[(argc + 1) * 8] : receiver |
- // ----------------------------------- |
- |
// If object is not a string, bail out to regular call. |
if (!object->IsString() || !cell.is_null()) return Handle<Code>::null(); |
@@ -2162,18 +2056,8 @@ Handle<Code> CallStubCompiler::CompileStringCharAtCall( |
DEFAULT_STRING_STUB)) { |
index_out_of_range_label = &miss; |
} |
- GenerateNameCheck(name, &name_miss); |
- |
- // Check that the maps starting from the prototype haven't changed. |
- GenerateDirectLoadGlobalFunctionPrototype(masm(), |
- Context::STRING_FUNCTION_INDEX, |
- rax, |
- &miss); |
- ASSERT(!object.is_identical_to(holder)); |
- Handle<Object> prototype(object->GetPrototype(isolate()), isolate()); |
- CheckPrototypes( |
- IC::CurrentTypeOf(prototype, isolate()), |
- rax, holder, rbx, rdx, rdi, name, &miss); |
+ |
+ HandlerFrontendHeader(object, holder, name, STRING_CHECK, &name_miss); |
Register receiver = rax; |
Register index = rdi; |
@@ -2223,14 +2107,6 @@ Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall( |
Handle<JSFunction> function, |
Handle<String> name, |
Code::StubType type) { |
- // ----------- S t a t e ------------- |
- // -- rcx : function name |
- // -- rsp[0] : return address |
- // -- rsp[(argc - n) * 8] : arg[n] (zero-based) |
- // -- ... |
- // -- rsp[(argc + 1) * 8] : receiver |
- // ----------------------------------- |
- |
// If the object is not a JSObject or we got an unexpected number of |
// arguments, bail out to the regular call. |
const int argc = arguments().immediate(); |
@@ -2238,17 +2114,10 @@ Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall( |
if (!object->IsJSObject() || argc != 1) return Handle<Code>::null(); |
Label miss; |
- GenerateNameCheck(name, &miss); |
- if (cell.is_null()) { |
- __ movq(rdx, args.GetReceiverOperand()); |
- __ JumpIfSmi(rdx, &miss); |
- CheckPrototypes(IC::CurrentTypeOf(object, isolate()), rdx, holder, |
- rbx, rax, rdi, name, &miss); |
- } else { |
+ HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss); |
+ if (!cell.is_null()) { |
ASSERT(cell->value() == *function); |
- GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name, |
- &miss); |
GenerateLoadFunctionFromCell(cell, function, &miss); |
} |
@@ -2280,9 +2149,7 @@ Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall( |
__ InvokeFunction(function, expected, arguments(), |
JUMP_FUNCTION, NullCallWrapper(), call_kind); |
- __ bind(&miss); |
- // rcx: function name. |
- GenerateMissBranch(); |
+ HandlerFrontendFooter(&miss); |
// Return the generated code. |
return GetCode(type, name); |
@@ -2296,13 +2163,6 @@ Handle<Code> CallStubCompiler::CompileMathFloorCall( |
Handle<JSFunction> function, |
Handle<String> name, |
Code::StubType type) { |
- // ----------- S t a t e ------------- |
- // -- rcx : name |
- // -- rsp[0] : return address |
- // -- rsp[(argc - n) * 4] : arg[n] (zero-based) |
- // -- ... |
- // -- rsp[(argc + 1) * 4] : receiver |
- // ----------------------------------- |
const int argc = arguments().immediate(); |
StackArgumentsAccessor args(rsp, argc); |
@@ -2312,21 +2172,11 @@ Handle<Code> CallStubCompiler::CompileMathFloorCall( |
return Handle<Code>::null(); |
} |
- Label miss; |
- GenerateNameCheck(name, &miss); |
- |
- if (cell.is_null()) { |
- __ movq(rdx, args.GetReceiverOperand()); |
+ Label miss, slow; |
- STATIC_ASSERT(kSmiTag == 0); |
- __ JumpIfSmi(rdx, &miss); |
- |
- CheckPrototypes(IC::CurrentTypeOf(object, isolate()), rdx, holder, |
- rbx, rax, rdi, name, &miss); |
- } else { |
+ HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss); |
+ if (!cell.is_null()) { |
ASSERT(cell->value() == *function); |
- GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name, |
- &miss); |
GenerateLoadFunctionFromCell(cell, function, &miss); |
} |
@@ -2339,7 +2189,6 @@ Handle<Code> CallStubCompiler::CompileMathFloorCall( |
__ JumpIfSmi(rax, &smi); |
// Check if the argument is a heap number and load its value into xmm0. |
- Label slow; |
__ CheckMap(rax, factory()->heap_number_map(), &slow, DONT_DO_SMI_CHECK); |
__ movsd(xmm0, FieldOperand(rax, HeapNumber::kValueOffset)); |
@@ -2408,9 +2257,7 @@ Handle<Code> CallStubCompiler::CompileMathFloorCall( |
__ InvokeFunction(function, expected, arguments(), |
JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); |
- __ bind(&miss); |
- // rcx: function name. |
- GenerateMissBranch(); |
+ HandlerFrontendFooter(&miss); |
// Return the generated code. |
return GetCode(type, name); |
@@ -2424,14 +2271,6 @@ Handle<Code> CallStubCompiler::CompileMathAbsCall( |
Handle<JSFunction> function, |
Handle<String> name, |
Code::StubType type) { |
- // ----------- S t a t e ------------- |
- // -- rcx : function name |
- // -- rsp[0] : return address |
- // -- rsp[(argc - n) * 8] : arg[n] (zero-based) |
- // -- ... |
- // -- rsp[(argc + 1) * 8] : receiver |
- // ----------------------------------- |
- |
// If the object is not a JSObject or we got an unexpected number of |
// arguments, bail out to the regular call. |
const int argc = arguments().immediate(); |
@@ -2439,19 +2278,13 @@ Handle<Code> CallStubCompiler::CompileMathAbsCall( |
if (!object->IsJSObject() || argc != 1) return Handle<Code>::null(); |
Label miss; |
- GenerateNameCheck(name, &miss); |
- if (cell.is_null()) { |
- __ movq(rdx, args.GetReceiverOperand()); |
- __ JumpIfSmi(rdx, &miss); |
- CheckPrototypes(IC::CurrentTypeOf(object, isolate()), rdx, holder, |
- rbx, rax, rdi, name, &miss); |
- } else { |
+ HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss); |
+ if (!cell.is_null()) { |
ASSERT(cell->value() == *function); |
- GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name, |
- &miss); |
GenerateLoadFunctionFromCell(cell, function, &miss); |
} |
+ |
// Load the (only) argument into rax. |
__ movq(rax, args.GetArgumentOperand(1)); |
@@ -2513,9 +2346,7 @@ Handle<Code> CallStubCompiler::CompileMathAbsCall( |
__ InvokeFunction(function, expected, arguments(), |
JUMP_FUNCTION, NullCallWrapper(), call_kind); |
- __ bind(&miss); |
- // rcx: function name. |
- GenerateMissBranch(); |
+ HandlerFrontendFooter(&miss); |
// Return the generated code. |
return GetCode(type, name); |
@@ -2590,28 +2421,30 @@ void StubCompiler::GenerateBooleanCheck(Register object, Label* miss) { |
} |
-void CallStubCompiler::CompileHandlerFrontend(Handle<Object> object, |
- Handle<JSObject> holder, |
- Handle<Name> name, |
- CheckType check) { |
- // ----------- S t a t e ------------- |
- // rcx : function name |
- // rsp[0] : return address |
- // rsp[8] : argument argc |
- // rsp[16] : argument argc - 1 |
- // ... |
- // rsp[argc * 8] : argument 1 |
- // rsp[(argc + 1) * 8] : argument 0 = receiver |
- // ----------------------------------- |
- Label miss; |
- GenerateNameCheck(name, &miss); |
+void CallStubCompiler::PatchGlobalProxy(Handle<Object> object) { |
+ if (object->IsGlobalObject()) { |
+ StackArgumentsAccessor args(rsp, arguments()); |
+ __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); |
+ __ movq(args.GetReceiverOperand(), rdx); |
+ } |
+} |
+ |
+ |
+Register CallStubCompiler::HandlerFrontendHeader(Handle<Object> object, |
+ Handle<JSObject> holder, |
+ Handle<Name> name, |
+ CheckType check, |
+ Label* miss) { |
+ GenerateNameCheck(name, miss); |
+ |
+ Register reg = rdx; |
StackArgumentsAccessor args(rsp, arguments()); |
- __ movq(rdx, args.GetReceiverOperand()); |
+ __ movq(reg, args.GetReceiverOperand()); |
// Check that the receiver isn't a smi. |
if (check != NUMBER_CHECK) { |
- __ JumpIfSmi(rdx, &miss); |
+ __ JumpIfSmi(reg, miss); |
} |
// Make sure that it's okay not to patch the on stack receiver |
@@ -2624,80 +2457,57 @@ void CallStubCompiler::CompileHandlerFrontend(Handle<Object> object, |
__ IncrementCounter(counters->call_const(), 1); |
// Check that the maps haven't changed. |
- CheckPrototypes(IC::CurrentTypeOf(object, isolate()), rdx, holder, |
- rbx, rax, rdi, name, &miss); |
- |
- // Patch the receiver on the stack with the global proxy if |
- // necessary. |
- if (object->IsGlobalObject()) { |
- __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); |
- __ movq(args.GetReceiverOperand(), rdx); |
- } |
+ reg = CheckPrototypes(IC::CurrentTypeOf(object, isolate()), reg, holder, |
+ rbx, rax, rdi, name, miss); |
break; |
case STRING_CHECK: { |
// Check that the object is a string. |
- __ CmpObjectType(rdx, FIRST_NONSTRING_TYPE, rax); |
- __ j(above_equal, &miss); |
+ __ CmpObjectType(reg, FIRST_NONSTRING_TYPE, rax); |
+ __ j(above_equal, miss); |
// Check that the maps starting from the prototype haven't changed. |
GenerateDirectLoadGlobalFunctionPrototype( |
- masm(), Context::STRING_FUNCTION_INDEX, rax, &miss); |
- Handle<Object> prototype(object->GetPrototype(isolate()), isolate()); |
- CheckPrototypes( |
- IC::CurrentTypeOf(prototype, isolate()), |
- rax, holder, rbx, rdx, rdi, name, &miss); |
+ masm(), Context::STRING_FUNCTION_INDEX, rax, miss); |
break; |
} |
case SYMBOL_CHECK: { |
// Check that the object is a symbol. |
- __ CmpObjectType(rdx, SYMBOL_TYPE, rax); |
- __ j(not_equal, &miss); |
+ __ CmpObjectType(reg, SYMBOL_TYPE, rax); |
+ __ j(not_equal, miss); |
// Check that the maps starting from the prototype haven't changed. |
GenerateDirectLoadGlobalFunctionPrototype( |
- masm(), Context::SYMBOL_FUNCTION_INDEX, rax, &miss); |
- Handle<Object> prototype(object->GetPrototype(isolate()), isolate()); |
- CheckPrototypes( |
- IC::CurrentTypeOf(prototype, isolate()), |
- rax, holder, rbx, rdx, rdi, name, &miss); |
+ masm(), Context::SYMBOL_FUNCTION_INDEX, rax, miss); |
break; |
} |
case NUMBER_CHECK: { |
Label fast; |
// Check that the object is a smi or a heap number. |
- __ JumpIfSmi(rdx, &fast); |
- __ CmpObjectType(rdx, HEAP_NUMBER_TYPE, rax); |
- __ j(not_equal, &miss); |
+ __ JumpIfSmi(reg, &fast); |
+ __ CmpObjectType(reg, HEAP_NUMBER_TYPE, rax); |
+ __ j(not_equal, miss); |
__ bind(&fast); |
// Check that the maps starting from the prototype haven't changed. |
GenerateDirectLoadGlobalFunctionPrototype( |
- masm(), Context::NUMBER_FUNCTION_INDEX, rax, &miss); |
- Handle<Object> prototype(object->GetPrototype(isolate()), isolate()); |
- CheckPrototypes( |
- IC::CurrentTypeOf(prototype, isolate()), |
- rax, holder, rbx, rdx, rdi, name, &miss); |
+ masm(), Context::NUMBER_FUNCTION_INDEX, rax, miss); |
break; |
} |
case BOOLEAN_CHECK: { |
- GenerateBooleanCheck(rdx, &miss); |
+ GenerateBooleanCheck(reg, miss); |
// Check that the maps starting from the prototype haven't changed. |
GenerateDirectLoadGlobalFunctionPrototype( |
- masm(), Context::BOOLEAN_FUNCTION_INDEX, rax, &miss); |
- Handle<Object> prototype(object->GetPrototype(isolate()), isolate()); |
- CheckPrototypes( |
- IC::CurrentTypeOf(prototype, isolate()), |
- rax, holder, rbx, rdx, rdi, name, &miss); |
+ masm(), Context::BOOLEAN_FUNCTION_INDEX, rax, miss); |
break; |
} |
} |
- Label success; |
- __ jmp(&success); |
- |
- // Handle call cache miss. |
- __ bind(&miss); |
- GenerateMissBranch(); |
+ if (check != RECEIVER_MAP_CHECK) { |
+ Handle<Object> prototype(object->GetPrototype(isolate()), isolate()); |
+ reg = CheckPrototypes( |
+ IC::CurrentTypeOf(prototype, isolate()), |
+ rax, holder, rbx, rdx, rdi, name, miss); |
+ } |
- __ bind(&success); |
+ return reg; |
} |
@@ -2726,8 +2536,11 @@ Handle<Code> CallStubCompiler::CompileCallConstant( |
if (!code.is_null()) return code; |
} |
- CompileHandlerFrontend(object, holder, name, check); |
+ Label miss; |
+ HandlerFrontendHeader(object, holder, name, check, &miss); |
+ PatchGlobalProxy(object); |
CompileHandlerBackend(function); |
+ HandlerFrontendFooter(&miss); |
// Return the generated code. |
return GetCode(function); |
@@ -2737,19 +2550,9 @@ Handle<Code> CallStubCompiler::CompileCallConstant( |
Handle<Code> CallStubCompiler::CompileCallInterceptor(Handle<JSObject> object, |
Handle<JSObject> holder, |
Handle<Name> name) { |
- // ----------- S t a t e ------------- |
- // rcx : function name |
- // rsp[0] : return address |
- // rsp[8] : argument argc |
- // rsp[16] : argument argc - 1 |
- // ... |
- // rsp[argc * 8] : argument 1 |
- // rsp[(argc + 1) * 8] : argument 0 = receiver |
- // ----------------------------------- |
Label miss; |
GenerateNameCheck(name, &miss); |
- |
LookupResult lookup(isolate()); |
LookupPostInterceptor(holder, name, &lookup); |
@@ -2799,16 +2602,6 @@ Handle<Code> CallStubCompiler::CompileCallGlobal( |
Handle<PropertyCell> cell, |
Handle<JSFunction> function, |
Handle<Name> name) { |
- // ----------- S t a t e ------------- |
- // rcx : function name |
- // rsp[0] : return address |
- // rsp[8] : argument argc |
- // rsp[16] : argument argc - 1 |
- // ... |
- // rsp[argc * 8] : argument 1 |
- // rsp[(argc + 1) * 8] : argument 0 = receiver |
- // ----------------------------------- |
- |
if (HasCustomCallGenerator(function)) { |
Handle<Code> code = CompileCustomCall( |
object, holder, cell, function, Handle<String>::cast(name), |
@@ -2818,17 +2611,9 @@ Handle<Code> CallStubCompiler::CompileCallGlobal( |
} |
Label miss; |
- GenerateNameCheck(name, &miss); |
- |
- StackArgumentsAccessor args(rsp, arguments()); |
- GenerateGlobalReceiverCheck(object, holder, name, &miss); |
+ HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss); |
GenerateLoadFunctionFromCell(cell, function, &miss); |
- |
- // Patch the receiver on the stack with the global proxy. |
- if (object->IsGlobalObject()) { |
- __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); |
- __ movq(args.GetReceiverOperand(), rdx); |
- } |
+ PatchGlobalProxy(object); |
// Set up the context (function already in rdi). |
__ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); |
@@ -2847,10 +2632,7 @@ Handle<Code> CallStubCompiler::CompileCallGlobal( |
__ InvokeCode(rdx, expected, arguments(), JUMP_FUNCTION, |
NullCallWrapper(), call_kind); |
- // Handle call cache miss. |
- __ bind(&miss); |
- __ IncrementCounter(counters->call_global_inline_miss(), 1); |
- GenerateMissBranch(); |
+ HandlerFrontendFooter(&miss); |
// Return the generated code. |
return GetCode(Code::NORMAL, name); |