From: paul.lind@imgtec.com Date: Mon, 21 Jul 2014 19:09:56 +0000 (+0000) Subject: MIPS: Introduce FLAG_vector_ics. X-Git-Tag: upstream/4.7.83~8127 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dc9d6e7a2505cde860b75757309bd9bd93fdfd4a;p=platform%2Fupstream%2Fv8.git MIPS: Introduce FLAG_vector_ics. Port r22500 (8fd2751) Original commit message: When FLAG_vector_ics is true, then AST nodes that use Load and KeyedLoad ICs will allocate a type vector slot to store feedback information. Full codegen will emit a load of the slot into a register if the flag is on. Support is incomplete, right now the IC doesn't know how to use the feedback slot. BUG= R=paul.lind@imgtec.com Review URL: https://codereview.chromium.org/403393008 Patch from Balazs Kilvady . git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22513 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc index 87f591e..b7fb4f3 100644 --- a/src/mips/full-codegen-mips.cc +++ b/src/mips/full-codegen-mips.cc @@ -1352,7 +1352,7 @@ void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) { } -void FullCodeGenerator::EmitLoadGlobalCheckExtensions(Variable* var, +void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, TypeofState typeof_state, Label* slow) { Register current = cp; @@ -1398,7 +1398,12 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(Variable* var, } __ lw(LoadIC::ReceiverRegister(), GlobalObjectOperand()); - __ li(LoadIC::NameRegister(), Operand(var->name())); + __ li(LoadIC::NameRegister(), Operand(proxy->var()->name())); + if (FLAG_vector_ics) { + __ li(LoadIC::SlotRegister(), + Operand(Smi::FromInt(proxy->VariableFeedbackSlot()))); + } + ContextualMode mode = (typeof_state == INSIDE_TYPEOF) ? NOT_CONTEXTUAL : CONTEXTUAL; @@ -1436,7 +1441,7 @@ MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, } -void FullCodeGenerator::EmitDynamicLookupFastCase(Variable* var, +void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy, TypeofState typeof_state, Label* slow, Label* done) { @@ -1445,8 +1450,9 @@ void FullCodeGenerator::EmitDynamicLookupFastCase(Variable* var, // introducing variables. In those cases, we do not want to // perform a runtime call for all variables in the scope // containing the eval. + Variable* var = proxy->var(); if (var->mode() == DYNAMIC_GLOBAL) { - EmitLoadGlobalCheckExtensions(var, typeof_state, slow); + EmitLoadGlobalCheckExtensions(proxy, typeof_state, slow); __ Branch(done); } else if (var->mode() == DYNAMIC_LOCAL) { Variable* local = var->local_if_not_shadowed(); @@ -1482,6 +1488,10 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) { Comment cmnt(masm_, "[ Global variable"); __ lw(LoadIC::ReceiverRegister(), GlobalObjectOperand()); __ li(LoadIC::NameRegister(), Operand(var->name())); + if (FLAG_vector_ics) { + __ li(LoadIC::SlotRegister(), + Operand(Smi::FromInt(proxy->VariableFeedbackSlot()))); + } CallLoadIC(CONTEXTUAL); context()->Plug(v0); break; @@ -1560,7 +1570,7 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) { Label done, slow; // Generate code for loading from variables potentially shadowed // by eval-introduced variables. - EmitDynamicLookupFastCase(var, NOT_INSIDE_TYPEOF, &slow, &done); + EmitDynamicLookupFastCase(proxy, NOT_INSIDE_TYPEOF, &slow, &done); __ bind(&slow); __ li(a1, Operand(var->name())); __ Push(cp, a1); // Context and name. @@ -2081,6 +2091,10 @@ void FullCodeGenerator::VisitYield(Yield* expr) { __ bind(&l_call); __ lw(load_receiver, MemOperand(sp, kPointerSize)); __ lw(load_name, MemOperand(sp, 2 * kPointerSize)); + if (FLAG_vector_ics) { + __ li(LoadIC::SlotRegister(), + Operand(Smi::FromInt(expr->KeyedLoadFeedbackSlot()))); + } Handle ic = isolate()->builtins()->KeyedLoadIC_Initialize(); CallIC(ic, TypeFeedbackId::None()); __ mov(a0, v0); @@ -2097,6 +2111,10 @@ void FullCodeGenerator::VisitYield(Yield* expr) { __ push(load_receiver); // save result __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done" + if (FLAG_vector_ics) { + __ li(LoadIC::SlotRegister(), + Operand(Smi::FromInt(expr->DoneFeedbackSlot()))); + } CallLoadIC(NOT_CONTEXTUAL); // v0=result.done __ mov(a0, v0); Handle bool_ic = ToBooleanStub::GetUninitialized(isolate()); @@ -2106,6 +2124,10 @@ void FullCodeGenerator::VisitYield(Yield* expr) { // result.value __ pop(load_receiver); // result __ LoadRoot(load_name, Heap::kvalue_stringRootIndex); // "value" + if (FLAG_vector_ics) { + __ li(LoadIC::SlotRegister(), + Operand(Smi::FromInt(expr->ValueFeedbackSlot()))); + } CallLoadIC(NOT_CONTEXTUAL); // v0=result.value context()->DropAndPlug(2, v0); // drop iter and g break; @@ -2269,16 +2291,26 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { SetSourcePosition(prop->position()); Literal* key = prop->key()->AsLiteral(); __ li(LoadIC::NameRegister(), Operand(key->value())); - // Call load IC. It has register arguments receiver and property. - CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); + if (FLAG_vector_ics) { + __ li(LoadIC::SlotRegister(), + Operand(Smi::FromInt(prop->PropertyFeedbackSlot()))); + CallLoadIC(NOT_CONTEXTUAL); + } else { + CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); + } } void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { SetSourcePosition(prop->position()); - // Call keyed load IC. It has register arguments receiver and key. Handle ic = isolate()->builtins()->KeyedLoadIC_Initialize(); - CallIC(ic, prop->PropertyFeedbackId()); + if (FLAG_vector_ics) { + __ li(LoadIC::SlotRegister(), + Operand(Smi::FromInt(prop->PropertyFeedbackSlot()))); + CallIC(ic); + } else { + CallIC(ic, prop->PropertyFeedbackId()); + } } @@ -2756,7 +2788,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { { PreservePositionScope scope(masm()->positions_recorder()); // Generate code for loading from variables potentially shadowed // by eval-introduced variables. - EmitDynamicLookupFastCase(proxy->var(), NOT_INSIDE_TYPEOF, &slow, &done); + EmitDynamicLookupFastCase(proxy, NOT_INSIDE_TYPEOF, &slow, &done); } __ bind(&slow); @@ -4086,7 +4118,13 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { // Load the function from the receiver. __ li(LoadIC::NameRegister(), Operand(expr->name())); - CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); + if (FLAG_vector_ics) { + __ li(LoadIC::SlotRegister(), + Operand(Smi::FromInt(expr->CallRuntimeFeedbackSlot()))); + CallLoadIC(NOT_CONTEXTUAL); + } else { + CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); + } // Push the target function under the receiver. __ lw(at, MemOperand(sp, 0)); @@ -4425,6 +4463,10 @@ void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { Comment cmnt(masm_, "[ Global variable"); __ lw(LoadIC::ReceiverRegister(), GlobalObjectOperand()); __ li(LoadIC::NameRegister(), Operand(proxy->name())); + if (FLAG_vector_ics) { + __ li(LoadIC::SlotRegister(), + Operand(Smi::FromInt(proxy->VariableFeedbackSlot()))); + } // Use a regular load, not a contextual load, to avoid a reference // error. CallLoadIC(NOT_CONTEXTUAL); @@ -4436,7 +4478,7 @@ void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { // Generate code for loading from variables potentially shadowed // by eval-introduced variables. - EmitDynamicLookupFastCase(proxy->var(), INSIDE_TYPEOF, &slow, &done); + EmitDynamicLookupFastCase(proxy, INSIDE_TYPEOF, &slow, &done); __ bind(&slow); __ li(a0, Operand(proxy->name())); diff --git a/src/mips/ic-mips.cc b/src/mips/ic-mips.cc index 4ae0be2..2986f25 100644 --- a/src/mips/ic-mips.cc +++ b/src/mips/ic-mips.cc @@ -512,6 +512,18 @@ const Register LoadIC::ReceiverRegister() { return a1; } const Register LoadIC::NameRegister() { return a2; } +const Register LoadIC::SlotRegister() { + ASSERT(FLAG_vector_ics); + return a0; +} + + +const Register LoadIC::VectorRegister() { + ASSERT(FLAG_vector_ics); + return a3; +} + + const Register StoreIC::ReceiverRegister() { return a1; } const Register StoreIC::NameRegister() { return a2; } const Register StoreIC::ValueRegister() { return a0; } diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc index f3b793d..7f31422 100644 --- a/src/mips/lithium-codegen-mips.cc +++ b/src/mips/lithium-codegen-mips.cc @@ -2913,6 +2913,15 @@ void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { ASSERT(ToRegister(instr->result()).is(v0)); __ li(LoadIC::NameRegister(), Operand(instr->name())); + if (FLAG_vector_ics) { + Register vector = ToRegister(instr->temp_vector()); + ASSERT(vector.is(LoadIC::VectorRegister())); + __ li(vector, instr->hydrogen()->feedback_vector()); + // No need to allocate this register. + ASSERT(LoadIC::SlotRegister().is(a0)); + __ li(LoadIC::SlotRegister(), + Operand(Smi::FromInt(instr->hydrogen()->slot()))); + } ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; Handle ic = LoadIC::initialize_stub(isolate(), mode); CallCode(ic, RelocInfo::CODE_TARGET, instr); @@ -3038,6 +3047,15 @@ void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { // Name is always in a2. __ li(LoadIC::NameRegister(), Operand(instr->name())); + if (FLAG_vector_ics) { + Register vector = ToRegister(instr->temp_vector()); + ASSERT(vector.is(LoadIC::VectorRegister())); + __ li(vector, instr->hydrogen()->feedback_vector()); + // No need to allocate this register. + ASSERT(LoadIC::SlotRegister().is(a0)); + __ li(LoadIC::SlotRegister(), + Operand(Smi::FromInt(instr->hydrogen()->slot()))); + } Handle ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); CallCode(ic, RelocInfo::CODE_TARGET, instr); } @@ -3359,6 +3377,16 @@ void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { ASSERT(ToRegister(instr->object()).is(LoadIC::ReceiverRegister())); ASSERT(ToRegister(instr->key()).is(LoadIC::NameRegister())); + if (FLAG_vector_ics) { + Register vector = ToRegister(instr->temp_vector()); + ASSERT(vector.is(LoadIC::VectorRegister())); + __ li(vector, instr->hydrogen()->feedback_vector()); + // No need to allocate this register. + ASSERT(LoadIC::SlotRegister().is(a0)); + __ li(LoadIC::SlotRegister(), + Operand(Smi::FromInt(instr->hydrogen()->slot()))); + } + Handle ic = isolate()->builtins()->KeyedLoadIC_Initialize(); CallCode(ic, RelocInfo::CODE_TARGET, instr); } diff --git a/src/mips/lithium-mips.cc b/src/mips/lithium-mips.cc index e284e9d..9e8fc1d 100644 --- a/src/mips/lithium-mips.cc +++ b/src/mips/lithium-mips.cc @@ -2033,8 +2033,12 @@ LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) { LOperand* context = UseFixed(instr->context(), cp); LOperand* global_object = UseFixed(instr->global_object(), LoadIC::ReceiverRegister()); + LOperand* vector = NULL; + if (FLAG_vector_ics) { + vector = FixedTemp(LoadIC::VectorRegister()); + } LLoadGlobalGeneric* result = - new(zone()) LLoadGlobalGeneric(context, global_object); + new(zone()) LLoadGlobalGeneric(context, global_object, vector); return MarkAsCall(DefineFixed(result, v0), instr); } @@ -2087,8 +2091,13 @@ LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) { LOperand* context = UseFixed(instr->context(), cp); LOperand* object = UseFixed(instr->object(), LoadIC::ReceiverRegister()); + LOperand* vector = NULL; + if (FLAG_vector_ics) { + vector = FixedTemp(LoadIC::VectorRegister()); + } + LInstruction* result = - DefineFixed(new(zone()) LLoadNamedGeneric(context, object), v0); + DefineFixed(new(zone()) LLoadNamedGeneric(context, object, vector), v0); return MarkAsCall(result, instr); } @@ -2148,9 +2157,14 @@ LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { LOperand* context = UseFixed(instr->context(), cp); LOperand* object = UseFixed(instr->object(), LoadIC::ReceiverRegister()); LOperand* key = UseFixed(instr->key(), LoadIC::NameRegister()); + LOperand* vector = NULL; + if (FLAG_vector_ics) { + vector = FixedTemp(LoadIC::VectorRegister()); + } LInstruction* result = - DefineFixed(new(zone()) LLoadKeyedGeneric(context, object, key), v0); + DefineFixed(new(zone()) LLoadKeyedGeneric(context, object, key, vector), + v0); return MarkAsCall(result, instr); } diff --git a/src/mips/lithium-mips.h b/src/mips/lithium-mips.h index 8c2a00a..3eabd74 100644 --- a/src/mips/lithium-mips.h +++ b/src/mips/lithium-mips.h @@ -1546,15 +1546,17 @@ class LLoadNamedField V8_FINAL : public LTemplateInstruction<1, 1, 0> { }; -class LLoadNamedGeneric V8_FINAL : public LTemplateInstruction<1, 2, 0> { +class LLoadNamedGeneric V8_FINAL : public LTemplateInstruction<1, 2, 1> { public: - LLoadNamedGeneric(LOperand* context, LOperand* object) { + LLoadNamedGeneric(LOperand* context, LOperand* object, LOperand* vector) { inputs_[0] = context; inputs_[1] = object; + temps_[0] = vector; } LOperand* context() { return inputs_[0]; } LOperand* object() { return inputs_[1]; } + LOperand* temp_vector() { return temps_[0]; } DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic") DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric) @@ -1615,19 +1617,23 @@ class LLoadKeyed V8_FINAL : public LTemplateInstruction<1, 2, 0> { }; -class LLoadKeyedGeneric V8_FINAL : public LTemplateInstruction<1, 3, 0> { +class LLoadKeyedGeneric V8_FINAL : public LTemplateInstruction<1, 3, 1> { public: - LLoadKeyedGeneric(LOperand* context, LOperand* object, LOperand* key) { + LLoadKeyedGeneric(LOperand* context, LOperand* object, LOperand* key, + LOperand* vector) { inputs_[0] = context; inputs_[1] = object; inputs_[2] = key; + temps_[0] = vector; } LOperand* context() { return inputs_[0]; } LOperand* object() { return inputs_[1]; } LOperand* key() { return inputs_[2]; } + LOperand* temp_vector() { return temps_[0]; } DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic") + DECLARE_HYDROGEN_ACCESSOR(LoadKeyedGeneric) }; @@ -1638,15 +1644,18 @@ class LLoadGlobalCell V8_FINAL : public LTemplateInstruction<1, 0, 0> { }; -class LLoadGlobalGeneric V8_FINAL : public LTemplateInstruction<1, 2, 0> { +class LLoadGlobalGeneric V8_FINAL : public LTemplateInstruction<1, 2, 1> { public: - LLoadGlobalGeneric(LOperand* context, LOperand* global_object) { + LLoadGlobalGeneric(LOperand* context, LOperand* global_object, + LOperand* vector) { inputs_[0] = context; inputs_[1] = global_object; + temps_[0] = vector; } LOperand* context() { return inputs_[0]; } LOperand* global_object() { return inputs_[1]; } + LOperand* temp_vector() { return temps_[0]; } DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic") DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric) diff --git a/src/mips64/full-codegen-mips64.cc b/src/mips64/full-codegen-mips64.cc index 4fa27b9..494cf1a 100644 --- a/src/mips64/full-codegen-mips64.cc +++ b/src/mips64/full-codegen-mips64.cc @@ -1347,7 +1347,7 @@ void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) { } -void FullCodeGenerator::EmitLoadGlobalCheckExtensions(Variable* var, +void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, TypeofState typeof_state, Label* slow) { Register current = cp; @@ -1393,7 +1393,12 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(Variable* var, } __ ld(LoadIC::ReceiverRegister(), GlobalObjectOperand()); - __ li(LoadIC::NameRegister(), Operand(var->name())); + __ li(LoadIC::NameRegister(), Operand(proxy->var()->name())); + if (FLAG_vector_ics) { + __ li(LoadIC::SlotRegister(), + Operand(Smi::FromInt(proxy->VariableFeedbackSlot()))); + } + ContextualMode mode = (typeof_state == INSIDE_TYPEOF) ? NOT_CONTEXTUAL : CONTEXTUAL; @@ -1431,7 +1436,7 @@ MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, } -void FullCodeGenerator::EmitDynamicLookupFastCase(Variable* var, +void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy, TypeofState typeof_state, Label* slow, Label* done) { @@ -1440,8 +1445,9 @@ void FullCodeGenerator::EmitDynamicLookupFastCase(Variable* var, // introducing variables. In those cases, we do not want to // perform a runtime call for all variables in the scope // containing the eval. + Variable* var = proxy->var(); if (var->mode() == DYNAMIC_GLOBAL) { - EmitLoadGlobalCheckExtensions(var, typeof_state, slow); + EmitLoadGlobalCheckExtensions(proxy, typeof_state, slow); __ Branch(done); } else if (var->mode() == DYNAMIC_LOCAL) { Variable* local = var->local_if_not_shadowed(); @@ -1479,6 +1485,10 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) { // object (receiver) in a0. __ ld(LoadIC::ReceiverRegister(), GlobalObjectOperand()); __ li(LoadIC::NameRegister(), Operand(var->name())); + if (FLAG_vector_ics) { + __ li(LoadIC::SlotRegister(), + Operand(Smi::FromInt(proxy->VariableFeedbackSlot()))); + } CallLoadIC(CONTEXTUAL); context()->Plug(v0); break; @@ -1557,7 +1567,7 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) { Label done, slow; // Generate code for loading from variables potentially shadowed // by eval-introduced variables. - EmitDynamicLookupFastCase(var, NOT_INSIDE_TYPEOF, &slow, &done); + EmitDynamicLookupFastCase(proxy, NOT_INSIDE_TYPEOF, &slow, &done); __ bind(&slow); __ li(a1, Operand(var->name())); __ Push(cp, a1); // Context and name. @@ -2076,6 +2086,10 @@ void FullCodeGenerator::VisitYield(Yield* expr) { __ bind(&l_call); __ ld(load_receiver, MemOperand(sp, kPointerSize)); __ ld(load_name, MemOperand(sp, 2 * kPointerSize)); + if (FLAG_vector_ics) { + __ li(LoadIC::SlotRegister(), + Operand(Smi::FromInt(expr->KeyedLoadFeedbackSlot()))); + } Handle ic = isolate()->builtins()->KeyedLoadIC_Initialize(); CallIC(ic, TypeFeedbackId::None()); __ mov(a0, v0); @@ -2090,8 +2104,12 @@ void FullCodeGenerator::VisitYield(Yield* expr) { // if (!result.done) goto l_try; __ Move(load_receiver, v0); - __ push(load_receiver); // save result + __ push(load_receiver); // save result __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done" + if (FLAG_vector_ics) { + __ li(LoadIC::SlotRegister(), + Operand(Smi::FromInt(expr->DoneFeedbackSlot()))); + } CallLoadIC(NOT_CONTEXTUAL); // v0=result.done __ mov(a0, v0); Handle bool_ic = ToBooleanStub::GetUninitialized(isolate()); @@ -2101,6 +2119,10 @@ void FullCodeGenerator::VisitYield(Yield* expr) { // result.value __ pop(load_receiver); // result __ LoadRoot(load_name, Heap::kvalue_stringRootIndex); // "value" + if (FLAG_vector_ics) { + __ li(LoadIC::SlotRegister(), + Operand(Smi::FromInt(expr->ValueFeedbackSlot()))); + } CallLoadIC(NOT_CONTEXTUAL); // v0=result.value context()->DropAndPlug(2, v0); // drop iter and g break; @@ -2266,8 +2288,13 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { SetSourcePosition(prop->position()); Literal* key = prop->key()->AsLiteral(); __ li(LoadIC::NameRegister(), Operand(key->value())); - // Call load IC. It has register arguments receiver and property. - CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); + if (FLAG_vector_ics) { + __ li(LoadIC::SlotRegister(), + Operand(Smi::FromInt(prop->PropertyFeedbackSlot()))); + CallLoadIC(NOT_CONTEXTUAL); + } else { + CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); + } } @@ -2275,7 +2302,13 @@ void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { SetSourcePosition(prop->position()); // Call keyed load IC. It has register arguments receiver and key. Handle ic = isolate()->builtins()->KeyedLoadIC_Initialize(); - CallIC(ic, prop->PropertyFeedbackId()); + if (FLAG_vector_ics) { + __ li(LoadIC::SlotRegister(), + Operand(Smi::FromInt(prop->PropertyFeedbackSlot()))); + CallIC(ic); + } else { + CallIC(ic, prop->PropertyFeedbackId()); + } } @@ -2753,7 +2786,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { { PreservePositionScope scope(masm()->positions_recorder()); // Generate code for loading from variables potentially shadowed // by eval-introduced variables. - EmitDynamicLookupFastCase(proxy->var(), NOT_INSIDE_TYPEOF, &slow, &done); + EmitDynamicLookupFastCase(proxy, NOT_INSIDE_TYPEOF, &slow, &done); } __ bind(&slow); @@ -4083,7 +4116,13 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { // Load the function from the receiver. __ li(LoadIC::NameRegister(), Operand(expr->name())); - CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); + if (FLAG_vector_ics) { + __ li(LoadIC::SlotRegister(), + Operand(Smi::FromInt(expr->CallRuntimeFeedbackSlot()))); + CallLoadIC(NOT_CONTEXTUAL); + } else { + CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); + } // Push the target function under the receiver. __ ld(at, MemOperand(sp, 0)); @@ -4422,6 +4461,10 @@ void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { Comment cmnt(masm_, "[ Global variable"); __ ld(LoadIC::ReceiverRegister(), GlobalObjectOperand()); __ li(LoadIC::NameRegister(), Operand(proxy->name())); + if (FLAG_vector_ics) { + __ li(LoadIC::SlotRegister(), + Operand(Smi::FromInt(proxy->VariableFeedbackSlot()))); + } // Use a regular load, not a contextual load, to avoid a reference // error. CallLoadIC(NOT_CONTEXTUAL); @@ -4433,7 +4476,7 @@ void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { // Generate code for loading from variables potentially shadowed // by eval-introduced variables. - EmitDynamicLookupFastCase(proxy->var(), INSIDE_TYPEOF, &slow, &done); + EmitDynamicLookupFastCase(proxy, INSIDE_TYPEOF, &slow, &done); __ bind(&slow); __ li(a0, Operand(proxy->name())); diff --git a/src/mips64/ic-mips64.cc b/src/mips64/ic-mips64.cc index ba7272a..1107b4c 100644 --- a/src/mips64/ic-mips64.cc +++ b/src/mips64/ic-mips64.cc @@ -511,7 +511,19 @@ const Register LoadIC::ReceiverRegister() { return a1; } const Register LoadIC::NameRegister() { return a2; } -const Register StoreIC::ReceiverRegister() { return a1; } +const Register LoadIC::SlotRegister() { + ASSERT(FLAG_vector_ics); + return a0; +} + + +const Register LoadIC::VectorRegister() { + ASSERT(FLAG_vector_ics); + return a3; +} + + + const Register StoreIC::ReceiverRegister() { return a1; } const Register StoreIC::NameRegister() { return a2; } const Register StoreIC::ValueRegister() { return a0; } diff --git a/src/mips64/lithium-codegen-mips64.cc b/src/mips64/lithium-codegen-mips64.cc index c4a392e..159e576 100644 --- a/src/mips64/lithium-codegen-mips64.cc +++ b/src/mips64/lithium-codegen-mips64.cc @@ -2881,6 +2881,15 @@ void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { ASSERT(ToRegister(instr->result()).is(v0)); __ li(LoadIC::NameRegister(), Operand(instr->name())); + if (FLAG_vector_ics) { + Register vector = ToRegister(instr->temp_vector()); + ASSERT(vector.is(LoadIC::VectorRegister())); + __ li(vector, instr->hydrogen()->feedback_vector()); + // No need to allocate this register. + ASSERT(LoadIC::SlotRegister().is(a0)); + __ li(LoadIC::SlotRegister(), + Operand(Smi::FromInt(instr->hydrogen()->slot()))); + } ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; Handle ic = LoadIC::initialize_stub(isolate(), mode); CallCode(ic, RelocInfo::CODE_TARGET, instr); @@ -3020,6 +3029,15 @@ void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { // Name is always in a2. __ li(LoadIC::NameRegister(), Operand(instr->name())); + if (FLAG_vector_ics) { + Register vector = ToRegister(instr->temp_vector()); + ASSERT(vector.is(LoadIC::VectorRegister())); + __ li(vector, instr->hydrogen()->feedback_vector()); + // No need to allocate this register. + ASSERT(LoadIC::SlotRegister().is(a0)); + __ li(LoadIC::SlotRegister(), + Operand(Smi::FromInt(instr->hydrogen()->slot()))); + } Handle ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); CallCode(ic, RelocInfo::CODE_TARGET, instr); } @@ -3382,6 +3400,16 @@ void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { ASSERT(ToRegister(instr->object()).is(LoadIC::ReceiverRegister())); ASSERT(ToRegister(instr->key()).is(LoadIC::NameRegister())); + if (FLAG_vector_ics) { + Register vector = ToRegister(instr->temp_vector()); + ASSERT(vector.is(LoadIC::VectorRegister())); + __ li(vector, instr->hydrogen()->feedback_vector()); + // No need to allocate this register. + ASSERT(LoadIC::SlotRegister().is(a0)); + __ li(LoadIC::SlotRegister(), + Operand(Smi::FromInt(instr->hydrogen()->slot()))); + } + Handle ic = isolate()->builtins()->KeyedLoadIC_Initialize(); CallCode(ic, RelocInfo::CODE_TARGET, instr); } diff --git a/src/mips64/lithium-mips64.cc b/src/mips64/lithium-mips64.cc index 8ecd154..1f5f578 100644 --- a/src/mips64/lithium-mips64.cc +++ b/src/mips64/lithium-mips64.cc @@ -2030,8 +2030,12 @@ LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) { LOperand* context = UseFixed(instr->context(), cp); LOperand* global_object = UseFixed(instr->global_object(), LoadIC::ReceiverRegister()); + LOperand* vector = NULL; + if (FLAG_vector_ics) { + vector = FixedTemp(LoadIC::VectorRegister()); + } LLoadGlobalGeneric* result = - new(zone()) LLoadGlobalGeneric(context, global_object); + new(zone()) LLoadGlobalGeneric(context, global_object, vector); return MarkAsCall(DefineFixed(result, v0), instr); } @@ -2084,8 +2088,13 @@ LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) { LOperand* context = UseFixed(instr->context(), cp); LOperand* object = UseFixed(instr->object(), LoadIC::ReceiverRegister()); + LOperand* vector = NULL; + if (FLAG_vector_ics) { + vector = FixedTemp(LoadIC::VectorRegister()); + } + LInstruction* result = - DefineFixed(new(zone()) LLoadNamedGeneric(context, object), v0); + DefineFixed(new(zone()) LLoadNamedGeneric(context, object, vector), v0); return MarkAsCall(result, instr); } @@ -2146,9 +2155,14 @@ LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { LOperand* context = UseFixed(instr->context(), cp); LOperand* object = UseFixed(instr->object(), LoadIC::ReceiverRegister()); LOperand* key = UseFixed(instr->key(), LoadIC::NameRegister()); + LOperand* vector = NULL; + if (FLAG_vector_ics) { + vector = FixedTemp(LoadIC::VectorRegister()); + } LInstruction* result = - DefineFixed(new(zone()) LLoadKeyedGeneric(context, object, key), v0); + DefineFixed(new(zone()) LLoadKeyedGeneric(context, object, key, vector), + v0); return MarkAsCall(result, instr); } diff --git a/src/mips64/lithium-mips64.h b/src/mips64/lithium-mips64.h index d74d14b..f58f0da 100644 --- a/src/mips64/lithium-mips64.h +++ b/src/mips64/lithium-mips64.h @@ -1545,15 +1545,17 @@ class LLoadNamedField V8_FINAL : public LTemplateInstruction<1, 1, 0> { }; -class LLoadNamedGeneric V8_FINAL : public LTemplateInstruction<1, 2, 0> { +class LLoadNamedGeneric V8_FINAL : public LTemplateInstruction<1, 2, 1> { public: - LLoadNamedGeneric(LOperand* context, LOperand* object) { + LLoadNamedGeneric(LOperand* context, LOperand* object, LOperand* vector) { inputs_[0] = context; inputs_[1] = object; + temps_[0] = vector; } LOperand* context() { return inputs_[0]; } LOperand* object() { return inputs_[1]; } + LOperand* temp_vector() { return temps_[0]; } DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic") DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric) @@ -1614,19 +1616,23 @@ class LLoadKeyed V8_FINAL : public LTemplateInstruction<1, 2, 0> { }; -class LLoadKeyedGeneric V8_FINAL : public LTemplateInstruction<1, 3, 0> { +class LLoadKeyedGeneric V8_FINAL : public LTemplateInstruction<1, 3, 1> { public: - LLoadKeyedGeneric(LOperand* context, LOperand* object, LOperand* key) { + LLoadKeyedGeneric(LOperand* context, LOperand* object, LOperand* key, + LOperand* vector) { inputs_[0] = context; inputs_[1] = object; inputs_[2] = key; + temps_[0] = vector; } LOperand* context() { return inputs_[0]; } LOperand* object() { return inputs_[1]; } LOperand* key() { return inputs_[2]; } + LOperand* temp_vector() { return temps_[0]; } DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic") + DECLARE_HYDROGEN_ACCESSOR(LoadKeyedGeneric) }; @@ -1637,15 +1643,18 @@ class LLoadGlobalCell V8_FINAL : public LTemplateInstruction<1, 0, 0> { }; -class LLoadGlobalGeneric V8_FINAL : public LTemplateInstruction<1, 2, 0> { +class LLoadGlobalGeneric V8_FINAL : public LTemplateInstruction<1, 2, 1> { public: - LLoadGlobalGeneric(LOperand* context, LOperand* global_object) { + LLoadGlobalGeneric(LOperand* context, LOperand* global_object, + LOperand* vector) { inputs_[0] = context; inputs_[1] = global_object; + temps_[0] = vector; } LOperand* context() { return inputs_[0]; } LOperand* global_object() { return inputs_[1]; } + LOperand* temp_vector() { return temps_[0]; } DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic") DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric)