Index: src/ia32/stub-cache-ia32.cc |
diff --git a/src/ia32/stub-cache-ia32.cc b/src/ia32/stub-cache-ia32.cc |
index d26210d69c0fe83fb7f1ed5550c8b070d21ed181..5ed80e651c3da1a4ef0fdcc2c423d48414a93c34 100644 |
--- a/src/ia32/stub-cache-ia32.cc |
+++ b/src/ia32/stub-cache-ia32.cc |
@@ -1609,26 +1609,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()); |
- |
- // Get the number of arguments. |
- const int argc = arguments().immediate(); |
- |
- // Get the receiver from the stack. |
- __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); |
- |
- |
- // Check that the maps haven't changed. |
- __ JumpIfSmi(edx, miss); |
- CheckPrototypes(IC::CurrentTypeOf(object, isolate()), edx, holder, |
- ebx, eax, edi, name, miss); |
-} |
- |
- |
void CallStubCompiler::GenerateLoadFunctionFromCell( |
Handle<Cell> cell, |
Handle<JSFunction> function, |
@@ -1675,27 +1655,10 @@ Handle<Code> CallStubCompiler::CompileCallField(Handle<JSObject> object, |
Handle<JSObject> holder, |
PropertyIndex index, |
Handle<Name> name) { |
- // ----------- S t a t e ------------- |
- // -- ecx : name |
- // -- esp[0] : return address |
- // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
- // -- ... |
- // -- esp[(argc + 1) * 4] : receiver |
- // ----------------------------------- |
Label miss; |
- GenerateNameCheck(name, &miss); |
- |
- // Get the receiver from the stack. |
- const int argc = arguments().immediate(); |
- __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); |
- |
- // Check that the receiver isn't a smi. |
- __ JumpIfSmi(edx, &miss); |
- |
- // Do the right check and compute the holder register. |
- Register reg = CheckPrototypes(IC::CurrentTypeOf(object, isolate()), edx, |
- holder, ebx, eax, edi, name, &miss); |
+ Register reg = HandlerFrontendHeader( |
+ object, holder, name, RECEIVER_MAP_CHECK, &miss); |
GenerateFastPropertyLoad( |
masm(), edi, reg, index.is_inobject(holder), |
@@ -1706,12 +1669,7 @@ Handle<Code> CallStubCompiler::CompileCallField(Handle<JSObject> object, |
__ CmpObjectType(edi, JS_FUNCTION_TYPE, ebx); |
__ j(not_equal, &miss); |
- // Patch the receiver on the stack with the global proxy if |
- // necessary. |
- if (object->IsGlobalObject()) { |
- __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset)); |
- __ mov(Operand(esp, (argc + 1) * kPointerSize), edx); |
- } |
+ PatchGlobalProxy(object); |
// Invoke the function. |
CallKind call_kind = CallICBase::Contextual::decode(extra_state_) |
@@ -1720,9 +1678,7 @@ Handle<Code> CallStubCompiler::CompileCallField(Handle<JSObject> object, |
__ InvokeFunction(edi, arguments(), JUMP_FUNCTION, |
NullCallWrapper(), call_kind); |
- // Handle call cache miss. |
- __ bind(&miss); |
- GenerateMissBranch(); |
+ HandlerFrontendFooter(&miss); |
// Return the generated code. |
return GetCode(Code::FAST, name); |
@@ -1738,28 +1694,16 @@ Handle<Code> CallStubCompiler::CompileArrayCodeCall( |
Code::StubType type) { |
Label miss; |
- // Check that function is still array |
- const int argc = arguments().immediate(); |
- GenerateNameCheck(name, &miss); |
- |
- if (cell.is_null()) { |
- // Get the receiver from the stack. |
- __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); |
- |
- // Check that the receiver isn't a smi. |
- __ JumpIfSmi(edx, &miss); |
- CheckPrototypes(IC::CurrentTypeOf(object, isolate()), edx, holder, |
- ebx, eax, edi, 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(); |
__ mov(eax, Immediate(argc)); |
__ mov(ebx, site_feedback_cell); |
__ mov(edi, function); |
@@ -1767,8 +1711,7 @@ Handle<Code> CallStubCompiler::CompileArrayCodeCall( |
ArrayConstructorStub stub(isolate()); |
__ TailCallStub(&stub); |
- __ bind(&miss); |
- GenerateMissBranch(); |
+ HandlerFrontendFooter(&miss); |
// Return the generated code. |
return GetCode(type, name); |
@@ -1782,14 +1725,6 @@ Handle<Code> CallStubCompiler::CompileArrayPushCall( |
Handle<JSFunction> function, |
Handle<String> name, |
Code::StubType type) { |
- // ----------- S t a t e ------------- |
- // -- ecx : name |
- // -- esp[0] : return address |
- // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
- // -- ... |
- // -- esp[(argc + 1) * 4] : receiver |
- // ----------------------------------- |
- |
// If object is not an array or is observed, bail out to regular call. |
if (!object->IsJSArray() || |
!cell.is_null() || |
@@ -1799,18 +1734,9 @@ Handle<Code> CallStubCompiler::CompileArrayPushCall( |
Label miss; |
- GenerateNameCheck(name, &miss); |
+ HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss); |
- // Get the receiver from the stack. |
const int argc = arguments().immediate(); |
- __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); |
- |
- // Check that the receiver isn't a smi. |
- __ JumpIfSmi(edx, &miss); |
- |
- CheckPrototypes(IC::CurrentTypeOf(object, isolate()), edx, holder, |
- ebx, eax, edi, name, &miss); |
- |
if (argc == 0) { |
// Noop, return the length. |
__ mov(eax, FieldOperand(edx, JSArray::kLengthOffset)); |
@@ -2028,8 +1954,7 @@ Handle<Code> CallStubCompiler::CompileArrayPushCall( |
1); |
} |
- __ bind(&miss); |
- GenerateMissBranch(); |
+ HandlerFrontendFooter(&miss); |
// Return the generated code. |
return GetCode(type, name); |
@@ -2043,14 +1968,6 @@ Handle<Code> CallStubCompiler::CompileArrayPopCall( |
Handle<JSFunction> function, |
Handle<String> name, |
Code::StubType type) { |
- // ----------- S t a t e ------------- |
- // -- ecx : name |
- // -- esp[0] : return address |
- // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
- // -- ... |
- // -- esp[(argc + 1) * 4] : receiver |
- // ----------------------------------- |
- |
// If object is not an array or is observed, bail out to regular call. |
if (!object->IsJSArray() || |
!cell.is_null() || |
@@ -2060,16 +1977,7 @@ Handle<Code> CallStubCompiler::CompileArrayPopCall( |
Label miss, return_undefined, call_builtin; |
- GenerateNameCheck(name, &miss); |
- |
- // Get the receiver from the stack. |
- const int argc = arguments().immediate(); |
- __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); |
- |
- // Check that the receiver isn't a smi. |
- __ JumpIfSmi(edx, &miss); |
- CheckPrototypes(IC::CurrentTypeOf(object, isolate()), edx, holder, |
- ebx, eax, edi, name, &miss); |
+ HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss); |
// Get the elements array of the object. |
__ mov(ebx, FieldOperand(edx, JSArray::kElementsOffset)); |
@@ -2101,6 +2009,7 @@ Handle<Code> CallStubCompiler::CompileArrayPopCall( |
ecx, times_half_pointer_size, |
FixedArray::kHeaderSize), |
Immediate(factory()->the_hole_value())); |
+ const int argc = arguments().immediate(); |
__ ret((argc + 1) * kPointerSize); |
__ bind(&return_undefined); |
@@ -2113,8 +2022,7 @@ Handle<Code> CallStubCompiler::CompileArrayPopCall( |
argc + 1, |
1); |
- __ bind(&miss); |
- GenerateMissBranch(); |
+ HandlerFrontendFooter(&miss); |
// Return the generated code. |
return GetCode(type, name); |
@@ -2128,14 +2036,6 @@ Handle<Code> CallStubCompiler::CompileStringCharCodeAtCall( |
Handle<JSFunction> function, |
Handle<String> name, |
Code::StubType type) { |
- // ----------- S t a t e ------------- |
- // -- ecx : function name |
- // -- esp[0] : return address |
- // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
- // -- ... |
- // -- esp[(argc + 1) * 4] : receiver |
- // ----------------------------------- |
- |
// If object is not a string, bail out to regular call. |
if (!object->IsString() || !cell.is_null()) { |
return Handle<Code>::null(); |
@@ -2154,18 +2054,7 @@ Handle<Code> CallStubCompiler::CompileStringCharCodeAtCall( |
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, |
- eax, |
- &miss); |
- ASSERT(!object.is_identical_to(holder)); |
- Handle<Object> prototype(object->GetPrototype(isolate()), isolate()); |
- CheckPrototypes( |
- IC::CurrentTypeOf(prototype, isolate()), |
- eax, holder, ebx, edx, edi, name, &miss); |
+ HandlerFrontendHeader(object, holder, name, STRING_CHECK, &name_miss); |
Register receiver = ebx; |
Register index = edi; |
@@ -2214,14 +2103,6 @@ Handle<Code> CallStubCompiler::CompileStringCharAtCall( |
Handle<JSFunction> function, |
Handle<String> name, |
Code::StubType type) { |
- // ----------- S t a t e ------------- |
- // -- ecx : function name |
- // -- esp[0] : return address |
- // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
- // -- ... |
- // -- esp[(argc + 1) * 4] : receiver |
- // ----------------------------------- |
- |
// If object is not a string, bail out to regular call. |
if (!object->IsString() || !cell.is_null()) { |
return Handle<Code>::null(); |
@@ -2240,18 +2121,7 @@ Handle<Code> CallStubCompiler::CompileStringCharAtCall( |
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, |
- eax, |
- &miss); |
- ASSERT(!object.is_identical_to(holder)); |
- Handle<Object> prototype(object->GetPrototype(isolate()), isolate()); |
- CheckPrototypes( |
- IC::CurrentTypeOf(prototype, isolate()), |
- eax, holder, ebx, edx, edi, name, &miss); |
+ HandlerFrontendHeader(object, holder, name, STRING_CHECK, &name_miss); |
Register receiver = eax; |
Register index = edi; |
@@ -2302,14 +2172,6 @@ Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall( |
Handle<JSFunction> function, |
Handle<String> name, |
Code::StubType type) { |
- // ----------- S t a t e ------------- |
- // -- ecx : function name |
- // -- esp[0] : return address |
- // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
- // -- ... |
- // -- esp[(argc + 1) * 4] : receiver |
- // ----------------------------------- |
- |
const int argc = arguments().immediate(); |
// If the object is not a JSObject or we got an unexpected number of |
@@ -2319,18 +2181,10 @@ Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall( |
} |
Label miss; |
- GenerateNameCheck(name, &miss); |
- if (cell.is_null()) { |
- __ mov(edx, Operand(esp, 2 * kPointerSize)); |
- STATIC_ASSERT(kSmiTag == 0); |
- __ JumpIfSmi(edx, &miss); |
- CheckPrototypes(IC::CurrentTypeOf(object, isolate()), edx, holder, |
- ebx, eax, edi, 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); |
} |
@@ -2363,9 +2217,7 @@ Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall( |
__ InvokeFunction(function, expected, arguments(), |
JUMP_FUNCTION, NullCallWrapper(), call_kind); |
- __ bind(&miss); |
- // ecx: function name. |
- GenerateMissBranch(); |
+ HandlerFrontendFooter(&miss); |
// Return the generated code. |
return GetCode(type, name); |
@@ -2379,14 +2231,6 @@ Handle<Code> CallStubCompiler::CompileMathFloorCall( |
Handle<JSFunction> function, |
Handle<String> name, |
Code::StubType type) { |
- // ----------- S t a t e ------------- |
- // -- ecx : name |
- // -- esp[0] : return address |
- // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
- // -- ... |
- // -- esp[(argc + 1) * 4] : receiver |
- // ----------------------------------- |
- |
if (!CpuFeatures::IsSupported(SSE2)) { |
return Handle<Code>::null(); |
} |
@@ -2402,20 +2246,10 @@ Handle<Code> CallStubCompiler::CompileMathFloorCall( |
} |
Label miss; |
- GenerateNameCheck(name, &miss); |
- |
- if (cell.is_null()) { |
- __ mov(edx, Operand(esp, 2 * kPointerSize)); |
- STATIC_ASSERT(kSmiTag == 0); |
- __ JumpIfSmi(edx, &miss); |
- |
- CheckPrototypes(IC::CurrentTypeOf(object, isolate()), edx, holder, |
- ebx, eax, edi, 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); |
} |
@@ -2495,9 +2329,7 @@ Handle<Code> CallStubCompiler::CompileMathFloorCall( |
__ InvokeFunction(function, expected, arguments(), |
JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); |
- __ bind(&miss); |
- // ecx: function name. |
- GenerateMissBranch(); |
+ HandlerFrontendFooter(&miss); |
// Return the generated code. |
return GetCode(type, name); |
@@ -2511,14 +2343,6 @@ Handle<Code> CallStubCompiler::CompileMathAbsCall( |
Handle<JSFunction> function, |
Handle<String> name, |
Code::StubType type) { |
- // ----------- S t a t e ------------- |
- // -- ecx : name |
- // -- esp[0] : return address |
- // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
- // -- ... |
- // -- esp[(argc + 1) * 4] : receiver |
- // ----------------------------------- |
- |
const int argc = arguments().immediate(); |
// If the object is not a JSObject or we got an unexpected number of |
@@ -2528,20 +2352,10 @@ Handle<Code> CallStubCompiler::CompileMathAbsCall( |
} |
Label miss; |
- GenerateNameCheck(name, &miss); |
- if (cell.is_null()) { |
- __ mov(edx, Operand(esp, 2 * kPointerSize)); |
- |
- STATIC_ASSERT(kSmiTag == 0); |
- __ JumpIfSmi(edx, &miss); |
- |
- CheckPrototypes(IC::CurrentTypeOf(object, isolate()), edx, holder, |
- ebx, eax, edi, 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); |
} |
@@ -2604,9 +2418,7 @@ Handle<Code> CallStubCompiler::CompileMathAbsCall( |
__ InvokeFunction(function, expected, arguments(), |
JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); |
- __ bind(&miss); |
- // ecx: function name. |
- GenerateMissBranch(); |
+ HandlerFrontendFooter(&miss); |
// Return the generated code. |
return GetCode(type, name); |
@@ -2683,27 +2495,32 @@ 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 ------------- |
- // -- ecx : name |
- // -- esp[0] : return address |
- // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
- // -- ... |
- // -- esp[(argc + 1) * 4] : receiver |
- // ----------------------------------- |
- Label miss; |
- GenerateNameCheck(name, &miss); |
+void CallStubCompiler::PatchGlobalProxy(Handle<Object> object) { |
+ if (object->IsGlobalObject()) { |
+ const int argc = arguments().immediate(); |
+ const int receiver_offset = (argc + 1) * kPointerSize; |
+ __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset)); |
+ __ mov(Operand(esp, receiver_offset), edx); |
+ } |
+} |
+ |
+ |
+Register CallStubCompiler::HandlerFrontendHeader(Handle<Object> object, |
+ Handle<JSObject> holder, |
+ Handle<Name> name, |
+ CheckType check, |
+ Label* miss) { |
+ GenerateNameCheck(name, miss); |
+ |
+ Register reg = edx; |
- // Get the receiver from the stack. |
const int argc = arguments().immediate(); |
- __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); |
+ const int receiver_offset = (argc + 1) * kPointerSize; |
+ __ mov(reg, Operand(esp, receiver_offset)); |
// Check that the receiver isn't a smi. |
if (check != NUMBER_CHECK) { |
- __ JumpIfSmi(edx, &miss); |
+ __ JumpIfSmi(reg, miss); |
} |
// Make sure that it's okay not to patch the on stack receiver |
@@ -2714,80 +2531,58 @@ void CallStubCompiler::CompileHandlerFrontend(Handle<Object> object, |
__ IncrementCounter(isolate()->counters()->call_const(), 1); |
// Check that the maps haven't changed. |
- CheckPrototypes(IC::CurrentTypeOf(object, isolate()), edx, holder, |
- ebx, eax, edi, name, &miss); |
- |
- // Patch the receiver on the stack with the global proxy if |
- // necessary. |
- if (object->IsGlobalObject()) { |
- __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset)); |
- __ mov(Operand(esp, (argc + 1) * kPointerSize), edx); |
- } |
+ reg = CheckPrototypes(IC::CurrentTypeOf(object, isolate()), reg, holder, |
+ ebx, eax, edi, name, miss); |
+ |
break; |
case STRING_CHECK: { |
// Check that the object is a string. |
- __ CmpObjectType(edx, FIRST_NONSTRING_TYPE, eax); |
- __ j(above_equal, &miss); |
+ __ CmpObjectType(reg, FIRST_NONSTRING_TYPE, eax); |
+ __ j(above_equal, miss); |
// Check that the maps starting from the prototype haven't changed. |
GenerateDirectLoadGlobalFunctionPrototype( |
- masm(), Context::STRING_FUNCTION_INDEX, eax, &miss); |
- Handle<Object> prototype(object->GetPrototype(isolate()), isolate()); |
- CheckPrototypes( |
- IC::CurrentTypeOf(prototype, isolate()), |
- eax, holder, ebx, edx, edi, name, &miss); |
+ masm(), Context::STRING_FUNCTION_INDEX, eax, miss); |
break; |
} |
case SYMBOL_CHECK: { |
// Check that the object is a symbol. |
- __ CmpObjectType(edx, SYMBOL_TYPE, eax); |
- __ j(not_equal, &miss); |
+ __ CmpObjectType(reg, SYMBOL_TYPE, eax); |
+ __ j(not_equal, miss); |
// Check that the maps starting from the prototype haven't changed. |
GenerateDirectLoadGlobalFunctionPrototype( |
- masm(), Context::SYMBOL_FUNCTION_INDEX, eax, &miss); |
- Handle<Object> prototype(object->GetPrototype(isolate()), isolate()); |
- CheckPrototypes( |
- IC::CurrentTypeOf(prototype, isolate()), |
- eax, holder, ebx, edx, edi, name, &miss); |
+ masm(), Context::SYMBOL_FUNCTION_INDEX, eax, miss); |
break; |
} |
case NUMBER_CHECK: { |
Label fast; |
// Check that the object is a smi or a heap number. |
- __ JumpIfSmi(edx, &fast); |
- __ CmpObjectType(edx, HEAP_NUMBER_TYPE, eax); |
- __ j(not_equal, &miss); |
+ __ JumpIfSmi(reg, &fast); |
+ __ CmpObjectType(reg, HEAP_NUMBER_TYPE, eax); |
+ __ j(not_equal, miss); |
__ bind(&fast); |
// Check that the maps starting from the prototype haven't changed. |
GenerateDirectLoadGlobalFunctionPrototype( |
- masm(), Context::NUMBER_FUNCTION_INDEX, eax, &miss); |
- Handle<Object> prototype(object->GetPrototype(isolate()), isolate()); |
- CheckPrototypes( |
- IC::CurrentTypeOf(prototype, isolate()), |
- eax, holder, ebx, edx, edi, name, &miss); |
+ masm(), Context::NUMBER_FUNCTION_INDEX, eax, miss); |
break; |
} |
case BOOLEAN_CHECK: { |
- GenerateBooleanCheck(edx, &miss); |
+ GenerateBooleanCheck(reg, miss); |
// Check that the maps starting from the prototype haven't changed. |
GenerateDirectLoadGlobalFunctionPrototype( |
- masm(), Context::BOOLEAN_FUNCTION_INDEX, eax, &miss); |
- Handle<Object> prototype(object->GetPrototype(isolate()), isolate()); |
- CheckPrototypes( |
- IC::CurrentTypeOf(prototype, isolate()), |
- eax, holder, ebx, edx, edi, name, &miss); |
+ masm(), Context::BOOLEAN_FUNCTION_INDEX, eax, 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()), |
+ eax, holder, ebx, edx, edi, name, miss); |
+ } |
- __ bind(&success); |
+ return reg; |
} |
@@ -2817,8 +2612,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); |
@@ -2828,13 +2626,6 @@ Handle<Code> CallStubCompiler::CompileCallConstant( |
Handle<Code> CallStubCompiler::CompileCallInterceptor(Handle<JSObject> object, |
Handle<JSObject> holder, |
Handle<Name> name) { |
- // ----------- S t a t e ------------- |
- // -- ecx : name |
- // -- esp[0] : return address |
- // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
- // -- ... |
- // -- esp[(argc + 1) * 4] : receiver |
- // ----------------------------------- |
Label miss; |
GenerateNameCheck(name, &miss); |
@@ -2890,14 +2681,6 @@ Handle<Code> CallStubCompiler::CompileCallGlobal( |
Handle<PropertyCell> cell, |
Handle<JSFunction> function, |
Handle<Name> name) { |
- // ----------- S t a t e ------------- |
- // -- ecx : name |
- // -- esp[0] : return address |
- // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
- // -- ... |
- // -- esp[(argc + 1) * 4] : receiver |
- // ----------------------------------- |
- |
if (HasCustomCallGenerator(function)) { |
Handle<Code> code = CompileCustomCall( |
object, holder, cell, function, Handle<String>::cast(name), |
@@ -2907,18 +2690,9 @@ Handle<Code> CallStubCompiler::CompileCallGlobal( |
} |
Label miss; |
- GenerateNameCheck(name, &miss); |
- |
- // Get the number of arguments. |
- const int argc = arguments().immediate(); |
- 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()) { |
- __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset)); |
- __ mov(Operand(esp, (argc + 1) * kPointerSize), edx); |
- } |
+ PatchGlobalProxy(object); |
// Set up the context (function already in edi). |
__ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); |
@@ -2937,10 +2711,7 @@ Handle<Code> CallStubCompiler::CompileCallGlobal( |
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); |