| Index: src/ia32/ic-ia32.cc
|
| diff --git a/src/ia32/ic-ia32.cc b/src/ia32/ic-ia32.cc
|
| index e93353e5dd660ee7d59474c62544fc17d9a24cb0..f006b83b6d4ca02bb2c961bf0483519838f5b8db 100644
|
| --- a/src/ia32/ic-ia32.cc
|
| +++ b/src/ia32/ic-ia32.cc
|
| @@ -918,6 +918,7 @@ void CallICBase::GenerateMonomorphicCacheProbe(MacroAssembler* masm,
|
|
|
| static void GenerateFunctionTailCall(MacroAssembler* masm,
|
| int argc,
|
| + Code::ExtraICState extra_state,
|
| Label* miss) {
|
| // ----------- S t a t e -------------
|
| // -- ecx : name
|
| @@ -936,14 +937,21 @@ static void GenerateFunctionTailCall(MacroAssembler* masm,
|
| __ j(not_equal, miss);
|
|
|
| // Invoke the function.
|
| - ParameterCount actual(argc);
|
| - __ InvokeFunction(edi, actual, JUMP_FUNCTION,
|
| - NullCallWrapper(), CALL_AS_METHOD);
|
| + if (CallICBase::ConstructCall::decode(extra_state)) {
|
| + ParameterCount actual(argc);
|
| + __ InvokeConstruct(edi, actual);
|
| + } else {
|
| + ParameterCount actual(argc);
|
| + __ InvokeFunction(edi, actual, JUMP_FUNCTION,
|
| + NullCallWrapper(), CALL_AS_METHOD);
|
| + }
|
| }
|
|
|
|
|
| // The generated code falls through if the call should be handled by runtime.
|
| -void CallICBase::GenerateNormal(MacroAssembler* masm, int argc) {
|
| +void CallICBase::GenerateNormal(MacroAssembler* masm,
|
| + int argc,
|
| + Code::ExtraICState extra_state) {
|
| // ----------- S t a t e -------------
|
| // -- ecx : name
|
| // -- esp[0] : return address
|
| @@ -961,7 +969,7 @@ void CallICBase::GenerateNormal(MacroAssembler* masm, int argc) {
|
| // eax: elements
|
| // Search the dictionary placing the result in edi.
|
| GenerateDictionaryLoad(masm, &miss, eax, ecx, edi, ebx, edi);
|
| - GenerateFunctionTailCall(masm, argc, &miss);
|
| + GenerateFunctionTailCall(masm, argc, extra_state, &miss);
|
|
|
| __ bind(&miss);
|
| }
|
| @@ -1027,15 +1035,20 @@ void CallICBase::GenerateMiss(MacroAssembler* masm,
|
| }
|
|
|
| // Invoke the function.
|
| - CallKind call_kind = CallICBase::Contextual::decode(extra_state)
|
| - ? CALL_AS_FUNCTION
|
| - : CALL_AS_METHOD;
|
| - ParameterCount actual(argc);
|
| - __ InvokeFunction(edi,
|
| - actual,
|
| - JUMP_FUNCTION,
|
| - NullCallWrapper(),
|
| - call_kind);
|
| + if (CallICBase::ConstructCall::decode(extra_state)) {
|
| + ParameterCount actual(argc);
|
| + __ InvokeConstruct(edi, actual);
|
| + } else {
|
| + CallKind call_kind = CallICBase::Contextual::decode(extra_state)
|
| + ? CALL_AS_FUNCTION
|
| + : CALL_AS_METHOD;
|
| + ParameterCount actual(argc);
|
| + __ InvokeFunction(edi,
|
| + actual,
|
| + JUMP_FUNCTION,
|
| + NullCallWrapper(),
|
| + call_kind);
|
| + }
|
| }
|
|
|
|
|
| @@ -1059,7 +1072,9 @@ void CallIC::GenerateMegamorphic(MacroAssembler* masm,
|
| }
|
|
|
|
|
| -void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
|
| +void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm,
|
| + int argc,
|
| + Code::ExtraICState extra_state) {
|
| // ----------- S t a t e -------------
|
| // -- ecx : name
|
| // -- esp[0] : return address
|
| @@ -1095,7 +1110,7 @@ void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
|
| // receiver in edx is not used after this point.
|
| // ecx: key
|
| // edi: function
|
| - GenerateFunctionTailCall(masm, argc, &slow_call);
|
| + GenerateFunctionTailCall(masm, argc, extra_state, &slow_call);
|
|
|
| __ bind(&check_number_dictionary);
|
| // eax: elements
|
| @@ -1158,7 +1173,7 @@ void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
|
| __ bind(&lookup_monomorphic_cache);
|
| __ IncrementCounter(counters->keyed_call_generic_lookup_cache(), 1);
|
| CallICBase::GenerateMonomorphicCacheProbe(masm, argc, Code::KEYED_CALL_IC,
|
| - Code::kNoExtraICState);
|
| + extra_state);
|
| // Fall through on miss.
|
|
|
| __ bind(&slow_call);
|
| @@ -1169,7 +1184,7 @@ void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
|
| // - there is hope that the runtime will create a monomorphic call stub
|
| // that will get fetched next time.
|
| __ IncrementCounter(counters->keyed_call_generic_slow(), 1);
|
| - GenerateMiss(masm, argc);
|
| + GenerateMiss(masm, argc, extra_state);
|
|
|
| __ bind(&index_string);
|
| __ IndexFromHash(ebx, ecx);
|
| @@ -1179,7 +1194,8 @@ void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
|
|
|
|
|
| void KeyedCallIC::GenerateNonStrictArguments(MacroAssembler* masm,
|
| - int argc) {
|
| + int argc,
|
| + Code::ExtraICState extra_state) {
|
| // ----------- S t a t e -------------
|
| // -- ecx : name
|
| // -- esp[0] : return address
|
| @@ -1193,7 +1209,7 @@ void KeyedCallIC::GenerateNonStrictArguments(MacroAssembler* masm,
|
| Operand mapped_location =
|
| GenerateMappedArgumentsLookup(masm, edx, ecx, ebx, eax, ¬in, &slow);
|
| __ mov(edi, mapped_location);
|
| - GenerateFunctionTailCall(masm, argc, &slow);
|
| + GenerateFunctionTailCall(masm, argc, extra_state, &slow);
|
| __ bind(¬in);
|
| // The unmapped lookup expects that the parameter map is in ebx.
|
| Operand unmapped_location =
|
| @@ -1201,13 +1217,15 @@ void KeyedCallIC::GenerateNonStrictArguments(MacroAssembler* masm,
|
| __ cmp(unmapped_location, factory->the_hole_value());
|
| __ j(equal, &slow);
|
| __ mov(edi, unmapped_location);
|
| - GenerateFunctionTailCall(masm, argc, &slow);
|
| + GenerateFunctionTailCall(masm, argc, extra_state, &slow);
|
| __ bind(&slow);
|
| - GenerateMiss(masm, argc);
|
| + GenerateMiss(masm, argc, extra_state);
|
| }
|
|
|
|
|
| -void KeyedCallIC::GenerateNormal(MacroAssembler* masm, int argc) {
|
| +void KeyedCallIC::GenerateNormal(MacroAssembler* masm,
|
| + int argc,
|
| + Code::ExtraICState extra_state) {
|
| // ----------- S t a t e -------------
|
| // -- ecx : name
|
| // -- esp[0] : return address
|
| @@ -1221,9 +1239,9 @@ void KeyedCallIC::GenerateNormal(MacroAssembler* masm, int argc) {
|
| __ JumpIfSmi(ecx, &miss);
|
| Condition cond = masm->IsObjectStringType(ecx, eax, eax);
|
| __ j(NegateCondition(cond), &miss);
|
| - CallICBase::GenerateNormal(masm, argc);
|
| + CallICBase::GenerateNormal(masm, argc, extra_state);
|
| __ bind(&miss);
|
| - GenerateMiss(masm, argc);
|
| + GenerateMiss(masm, argc, extra_state);
|
| }
|
|
|
|
|
|
|