| Index: src/ia32/ic-ia32.cc
|
| ===================================================================
|
| --- src/ia32/ic-ia32.cc (revision 9808)
|
| +++ src/ia32/ic-ia32.cc (working copy)
|
| @@ -860,10 +860,10 @@
|
|
|
| // The generated code does not accept smi keys.
|
| // The generated code falls through if both probes miss.
|
| -static void GenerateMonomorphicCacheProbe(MacroAssembler* masm,
|
| - int argc,
|
| - Code::Kind kind,
|
| - Code::ExtraICState extra_ic_state) {
|
| +void CallICBase::GenerateMonomorphicCacheProbe(MacroAssembler* masm,
|
| + int argc,
|
| + Code::Kind kind,
|
| + Code::ExtraICState extra_state) {
|
| // ----------- S t a t e -------------
|
| // -- ecx : name
|
| // -- edx : receiver
|
| @@ -873,11 +873,11 @@
|
| // Probe the stub cache.
|
| Code::Flags flags = Code::ComputeFlags(kind,
|
| MONOMORPHIC,
|
| - extra_ic_state,
|
| + extra_state,
|
| NORMAL,
|
| argc);
|
| - Isolate::Current()->stub_cache()->GenerateProbe(masm, flags, edx, ecx, ebx,
|
| - eax);
|
| + Isolate* isolate = masm->isolate();
|
| + isolate->stub_cache()->GenerateProbe(masm, flags, edx, ecx, ebx, eax);
|
|
|
| // If the stub cache probing failed, the receiver might be a value.
|
| // For value objects, we use the map of the prototype objects for
|
| @@ -903,9 +903,9 @@
|
|
|
| // Check for boolean.
|
| __ bind(&non_string);
|
| - __ cmp(edx, FACTORY->true_value());
|
| + __ cmp(edx, isolate->factory()->true_value());
|
| __ j(equal, &boolean);
|
| - __ cmp(edx, FACTORY->false_value());
|
| + __ cmp(edx, isolate->factory()->false_value());
|
| __ j(not_equal, &miss);
|
| __ bind(&boolean);
|
| StubCompiler::GenerateLoadGlobalFunctionPrototype(
|
| @@ -913,8 +913,7 @@
|
|
|
| // Probe the stub cache for the value object.
|
| __ bind(&probe);
|
| - Isolate::Current()->stub_cache()->GenerateProbe(masm, flags, edx, ecx, ebx,
|
| - no_reg);
|
| + isolate->stub_cache()->GenerateProbe(masm, flags, edx, ecx, ebx, no_reg);
|
| __ bind(&miss);
|
| }
|
|
|
| @@ -944,8 +943,9 @@
|
| NullCallWrapper(), CALL_AS_METHOD);
|
| }
|
|
|
| +
|
| // The generated code falls through if the call should be handled by runtime.
|
| -static void GenerateCallNormal(MacroAssembler* masm, int argc) {
|
| +void CallICBase::GenerateNormal(MacroAssembler* masm, int argc) {
|
| // ----------- S t a t e -------------
|
| // -- ecx : name
|
| // -- esp[0] : return address
|
| @@ -969,10 +969,10 @@
|
| }
|
|
|
|
|
| -static void GenerateCallMiss(MacroAssembler* masm,
|
| - int argc,
|
| - IC::UtilityId id,
|
| - Code::ExtraICState extra_ic_state) {
|
| +void CallICBase::GenerateMiss(MacroAssembler* masm,
|
| + int argc,
|
| + IC::UtilityId id,
|
| + Code::ExtraICState extra_state) {
|
| // ----------- S t a t e -------------
|
| // -- ecx : name
|
| // -- esp[0] : return address
|
| @@ -1029,7 +1029,7 @@
|
| }
|
|
|
| // Invoke the function.
|
| - CallKind call_kind = CallICBase::Contextual::decode(extra_ic_state)
|
| + CallKind call_kind = CallICBase::Contextual::decode(extra_state)
|
| ? CALL_AS_FUNCTION
|
| : CALL_AS_METHOD;
|
| ParameterCount actual(argc);
|
| @@ -1043,7 +1043,7 @@
|
|
|
| void CallIC::GenerateMegamorphic(MacroAssembler* masm,
|
| int argc,
|
| - Code::ExtraICState extra_ic_state) {
|
| + Code::ExtraICState extra_state) {
|
| // ----------- S t a t e -------------
|
| // -- ecx : name
|
| // -- esp[0] : return address
|
| @@ -1054,41 +1054,13 @@
|
|
|
| // Get the receiver of the function from the stack; 1 ~ return address.
|
| __ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
|
| - GenerateMonomorphicCacheProbe(masm, argc, Code::CALL_IC, extra_ic_state);
|
| + CallICBase::GenerateMonomorphicCacheProbe(masm, argc, Code::CALL_IC,
|
| + extra_state);
|
|
|
| - GenerateMiss(masm, argc, extra_ic_state);
|
| + GenerateMiss(masm, argc, extra_state);
|
| }
|
|
|
|
|
| -void CallIC::GenerateNormal(MacroAssembler* masm, int argc) {
|
| - // ----------- S t a t e -------------
|
| - // -- ecx : name
|
| - // -- esp[0] : return address
|
| - // -- esp[(argc - n) * 4] : arg[n] (zero-based)
|
| - // -- ...
|
| - // -- esp[(argc + 1) * 4] : receiver
|
| - // -----------------------------------
|
| -
|
| - GenerateCallNormal(masm, argc);
|
| - GenerateMiss(masm, argc, Code::kNoExtraICState);
|
| -}
|
| -
|
| -
|
| -void CallIC::GenerateMiss(MacroAssembler* masm,
|
| - int argc,
|
| - Code::ExtraICState extra_ic_state) {
|
| - // ----------- S t a t e -------------
|
| - // -- ecx : name
|
| - // -- esp[0] : return address
|
| - // -- esp[(argc - n) * 4] : arg[n] (zero-based)
|
| - // -- ...
|
| - // -- esp[(argc + 1) * 4] : receiver
|
| - // -----------------------------------
|
| -
|
| - GenerateCallMiss(masm, argc, IC::kCallIC_Miss, extra_ic_state);
|
| -}
|
| -
|
| -
|
| void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
|
| // ----------- S t a t e -------------
|
| // -- ecx : name
|
| @@ -1187,10 +1159,8 @@
|
|
|
| __ bind(&lookup_monomorphic_cache);
|
| __ IncrementCounter(counters->keyed_call_generic_lookup_cache(), 1);
|
| - GenerateMonomorphicCacheProbe(masm,
|
| - argc,
|
| - Code::KEYED_CALL_IC,
|
| - Code::kNoExtraICState);
|
| + CallICBase::GenerateMonomorphicCacheProbe(masm, argc, Code::KEYED_CALL_IC,
|
| + Code::kNoExtraICState);
|
| // Fall through on miss.
|
|
|
| __ bind(&slow_call);
|
| @@ -1253,25 +1223,12 @@
|
| __ JumpIfSmi(ecx, &miss);
|
| Condition cond = masm->IsObjectStringType(ecx, eax, eax);
|
| __ j(NegateCondition(cond), &miss);
|
| - GenerateCallNormal(masm, argc);
|
| + CallICBase::GenerateNormal(masm, argc);
|
| __ bind(&miss);
|
| GenerateMiss(masm, argc);
|
| }
|
|
|
|
|
| -void KeyedCallIC::GenerateMiss(MacroAssembler* masm, int argc) {
|
| - // ----------- S t a t e -------------
|
| - // -- ecx : name
|
| - // -- esp[0] : return address
|
| - // -- esp[(argc - n) * 4] : arg[n] (zero-based)
|
| - // -- ...
|
| - // -- esp[(argc + 1) * 4] : receiver
|
| - // -----------------------------------
|
| -
|
| - GenerateCallMiss(masm, argc, IC::kKeyedCallIC_Miss, Code::kNoExtraICState);
|
| -}
|
| -
|
| -
|
| void LoadIC::GenerateMegamorphic(MacroAssembler* masm) {
|
| // ----------- S t a t e -------------
|
| // -- eax : receiver
|
| @@ -1580,6 +1537,51 @@
|
| }
|
|
|
|
|
| +void KeyedStoreIC::GenerateTransitionElementsSmiToDouble(MacroAssembler* masm) {
|
| + // ----------- S t a t e -------------
|
| + // -- ebx : target map
|
| + // -- edx : receiver
|
| + // -- esp[0] : return address
|
| + // -----------------------------------
|
| + // Must return the modified receiver in eax.
|
| + if (!FLAG_trace_elements_transitions) {
|
| + Label fail;
|
| + ElementsTransitionGenerator::GenerateSmiOnlyToDouble(masm, &fail);
|
| + __ mov(eax, edx);
|
| + __ Ret();
|
| + __ bind(&fail);
|
| + }
|
| +
|
| + __ pop(ebx);
|
| + __ push(edx);
|
| + __ push(ebx); // return address
|
| + __ TailCallRuntime(Runtime::kTransitionElementsSmiToDouble, 1, 1);
|
| +}
|
| +
|
| +
|
| +void KeyedStoreIC::GenerateTransitionElementsDoubleToObject(
|
| + MacroAssembler* masm) {
|
| + // ----------- S t a t e -------------
|
| + // -- ebx : target map
|
| + // -- edx : receiver
|
| + // -- esp[0] : return address
|
| + // -----------------------------------
|
| + // Must return the modified receiver in eax.
|
| + if (!FLAG_trace_elements_transitions) {
|
| + Label fail;
|
| + ElementsTransitionGenerator::GenerateDoubleToObject(masm, &fail);
|
| + __ mov(eax, edx);
|
| + __ Ret();
|
| + __ bind(&fail);
|
| + }
|
| +
|
| + __ pop(ebx);
|
| + __ push(edx);
|
| + __ push(ebx); // return address
|
| + __ TailCallRuntime(Runtime::kTransitionElementsDoubleToObject, 1, 1);
|
| +}
|
| +
|
| +
|
| #undef __
|
|
|
|
|
| @@ -1591,11 +1593,9 @@
|
| case Token::LT:
|
| return less;
|
| case Token::GT:
|
| - // Reverse left and right operands to obtain ECMA-262 conversion order.
|
| - return less;
|
| + return greater;
|
| case Token::LTE:
|
| - // Reverse left and right operands to obtain ECMA-262 conversion order.
|
| - return greater_equal;
|
| + return less_equal;
|
| case Token::GTE:
|
| return greater_equal;
|
| default:
|
|
|