| Index: src/ia32/stub-cache-ia32.cc
|
| diff --git a/src/ia32/stub-cache-ia32.cc b/src/ia32/stub-cache-ia32.cc
|
| index 1c98c9876b7e2afcdaa2979cc54a37e0be8017f9..d799c3b4464770647c824352c88b51cc533127d9 100644
|
| --- a/src/ia32/stub-cache-ia32.cc
|
| +++ b/src/ia32/stub-cache-ia32.cc
|
| @@ -648,7 +648,7 @@ class CallInterceptorCompiler BASE_EMBEDDED {
|
| CallInterceptorCompiler(StubCompiler* stub_compiler,
|
| const ParameterCount& arguments,
|
| Register name,
|
| - Code::ExtraICState extra_state)
|
| + ExtraICState extra_state)
|
| : stub_compiler_(stub_compiler),
|
| arguments_(arguments),
|
| name_(name),
|
| @@ -833,7 +833,7 @@ class CallInterceptorCompiler BASE_EMBEDDED {
|
| StubCompiler* stub_compiler_;
|
| const ParameterCount& arguments_;
|
| Register name_;
|
| - Code::ExtraICState extra_state_;
|
| + ExtraICState extra_state_;
|
| };
|
|
|
|
|
| @@ -1602,26 +1602,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,
|
| @@ -1668,27 +1648,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),
|
| @@ -1699,12 +1662,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_)
|
| @@ -1713,9 +1671,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);
|
| @@ -1731,28 +1687,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);
|
| @@ -1760,8 +1704,7 @@ Handle<Code> CallStubCompiler::CompileArrayCodeCall(
|
| ArrayConstructorStub stub(isolate());
|
| __ TailCallStub(&stub);
|
|
|
| - __ bind(&miss);
|
| - GenerateMissBranch();
|
| + HandlerFrontendFooter(&miss);
|
|
|
| // Return the generated code.
|
| return GetCode(type, name);
|
| @@ -1775,14 +1718,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() ||
|
| @@ -1792,18 +1727,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));
|
| @@ -2021,8 +1947,7 @@ Handle<Code> CallStubCompiler::CompileArrayPushCall(
|
| 1);
|
| }
|
|
|
| - __ bind(&miss);
|
| - GenerateMissBranch();
|
| + HandlerFrontendFooter(&miss);
|
|
|
| // Return the generated code.
|
| return GetCode(type, name);
|
| @@ -2036,14 +1961,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() ||
|
| @@ -2053,16 +1970,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));
|
| @@ -2094,6 +2002,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);
|
| @@ -2106,8 +2015,7 @@ Handle<Code> CallStubCompiler::CompileArrayPopCall(
|
| argc + 1,
|
| 1);
|
|
|
| - __ bind(&miss);
|
| - GenerateMissBranch();
|
| + HandlerFrontendFooter(&miss);
|
|
|
| // Return the generated code.
|
| return GetCode(type, name);
|
| @@ -2121,14 +2029,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();
|
| @@ -2147,18 +2047,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;
|
| @@ -2207,14 +2096,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();
|
| @@ -2233,18 +2114,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;
|
| @@ -2295,14 +2165,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
|
| @@ -2312,18 +2174,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);
|
| }
|
|
|
| @@ -2356,9 +2210,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);
|
| @@ -2372,14 +2224,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();
|
| }
|
| @@ -2395,20 +2239,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);
|
| }
|
|
|
| @@ -2488,9 +2322,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);
|
| @@ -2504,14 +2336,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
|
| @@ -2521,20 +2345,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);
|
| }
|
|
|
| @@ -2597,9 +2411,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);
|
| @@ -2676,27 +2488,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
|
| @@ -2707,80 +2524,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;
|
| }
|
|
|
|
|
| @@ -2810,8 +2605,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);
|
| @@ -2821,13 +2619,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);
|
| @@ -2883,14 +2674,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),
|
| @@ -2900,18 +2683,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));
|
| @@ -2930,10 +2704,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);
|
| @@ -3037,13 +2808,12 @@ Handle<Code> StoreStubCompiler::CompileStoreInterceptor(
|
| __ push(receiver());
|
| __ push(this->name());
|
| __ push(value());
|
| - __ push(Immediate(Smi::FromInt(strict_mode())));
|
| __ push(scratch1()); // restore return address
|
|
|
| // Do tail-call to the runtime system.
|
| ExternalReference store_ic_property =
|
| ExternalReference(IC_Utility(IC::kStoreInterceptorProperty), isolate());
|
| - __ TailCallExternalReference(store_ic_property, 4, 1);
|
| + __ TailCallExternalReference(store_ic_property, 3, 1);
|
|
|
| // Return the generated code.
|
| return GetCode(kind(), Code::FAST, name);
|
|
|