Revision: 22542
Author: [email protected]
Date: Wed Jul 23 07:48:19 2014 UTC
Log: X87: Introduce FLAG_vector_ics.
port r22500.
original commit message:
Introduce FLAG_vector_ics.
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=
[email protected]
Review URL: https://codereview.chromium.org/405343002
Patch from Chunyang Dai <[email protected]>.
http://code.google.com/p/v8/source/detail?r=22542
Modified:
/branches/bleeding_edge/src/x87/builtins-x87.cc
/branches/bleeding_edge/src/x87/full-codegen-x87.cc
/branches/bleeding_edge/src/x87/ic-x87.cc
/branches/bleeding_edge/src/x87/lithium-codegen-x87.cc
/branches/bleeding_edge/src/x87/lithium-x87.cc
/branches/bleeding_edge/src/x87/lithium-x87.h
=======================================
--- /branches/bleeding_edge/src/x87/builtins-x87.cc Wed Jul 2 07:07:22
2014 UTC
+++ /branches/bleeding_edge/src/x87/builtins-x87.cc Wed Jul 23 07:48:19
2014 UTC
@@ -1003,6 +1003,9 @@
__ mov(receiver, Operand(ebp, kArgumentsOffset)); // load arguments
// Use inline caching to speed up access to arguments.
+ if (FLAG_vector_ics) {
+ __ mov(LoadIC::SlotRegister(), Immediate(Smi::FromInt(0)));
+ }
Handle<Code> ic =
masm->isolate()->builtins()->KeyedLoadIC_Initialize();
__ call(ic, RelocInfo::CODE_TARGET);
// It is important that we do not have a test instruction after the
=======================================
--- /branches/bleeding_edge/src/x87/full-codegen-x87.cc Mon Jul 21 10:20:54
2014 UTC
+++ /branches/bleeding_edge/src/x87/full-codegen-x87.cc Wed Jul 23 07:48:19
2014 UTC
@@ -1284,7 +1284,7 @@
}
-void FullCodeGenerator::EmitLoadGlobalCheckExtensions(Variable* var,
+void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy,
TypeofState
typeof_state,
Label* slow) {
Register context = esi;
@@ -1335,7 +1335,12 @@
// All extension objects were empty and it is safe to use a global
// load IC call.
__ mov(LoadIC::ReceiverRegister(), GlobalObjectOperand());
- __ mov(LoadIC::NameRegister(), var->name());
+ __ mov(LoadIC::NameRegister(), proxy->var()->name());
+ if (FLAG_vector_ics) {
+ __ mov(LoadIC::SlotRegister(),
+ Immediate(Smi::FromInt(proxy->VariableFeedbackSlot())));
+ }
+
ContextualMode mode = (typeof_state == INSIDE_TYPEOF)
? NOT_CONTEXTUAL
: CONTEXTUAL;
@@ -1374,7 +1379,7 @@
}
-void FullCodeGenerator::EmitDynamicLookupFastCase(Variable* var,
+void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy,
TypeofState typeof_state,
Label* slow,
Label* done) {
@@ -1383,8 +1388,9 @@
// 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);
__ jmp(done);
} else if (var->mode() == DYNAMIC_LOCAL) {
Variable* local = var->local_if_not_shadowed();
@@ -1417,6 +1423,10 @@
Comment cmnt(masm_, "[ Global variable");
__ mov(LoadIC::ReceiverRegister(), GlobalObjectOperand());
__ mov(LoadIC::NameRegister(), var->name());
+ if (FLAG_vector_ics) {
+ __ mov(LoadIC::SlotRegister(),
+ Immediate(Smi::FromInt(proxy->VariableFeedbackSlot())));
+ }
CallLoadIC(CONTEXTUAL);
context()->Plug(eax);
break;
@@ -1492,7 +1502,7 @@
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);
__ push(esi); // Context.
__ push(Immediate(var->name()));
@@ -2016,6 +2026,10 @@
// result = receiver[f](arg);
__ bind(&l_call);
__ mov(load_receiver, Operand(esp, kPointerSize));
+ if (FLAG_vector_ics) {
+ __ mov(LoadIC::SlotRegister(),
+ Immediate(Smi::FromInt(expr->KeyedLoadFeedbackSlot())));
+ }
Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
CallIC(ic, TypeFeedbackId::None());
__ mov(edi, eax);
@@ -2032,6 +2046,10 @@
__ Move(load_receiver, eax); // result
__ mov(load_name,
isolate()->factory()->done_string()); // "done"
+ if (FLAG_vector_ics) {
+ __ mov(LoadIC::SlotRegister(),
+ Immediate(Smi::FromInt(expr->DoneFeedbackSlot())));
+ }
CallLoadIC(NOT_CONTEXTUAL); // result.done in
eax
Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate());
CallIC(bool_ic);
@@ -2042,6 +2060,10 @@
__ pop(load_receiver); // result
__ mov(load_name,
isolate()->factory()->value_string()); // "value"
+ if (FLAG_vector_ics) {
+ __ mov(LoadIC::SlotRegister(),
+ Immediate(Smi::FromInt(expr->ValueFeedbackSlot())));
+ }
CallLoadIC(NOT_CONTEXTUAL); // result.value
in eax
context()->DropAndPlug(2, eax); // drop iter and
g
break;
@@ -2202,14 +2224,26 @@
Literal* key = prop->key()->AsLiteral();
ASSERT(!key->value()->IsSmi());
__ mov(LoadIC::NameRegister(), Immediate(key->value()));
- CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId());
+ if (FLAG_vector_ics) {
+ __ mov(LoadIC::SlotRegister(),
+ Immediate(Smi::FromInt(prop->PropertyFeedbackSlot())));
+ CallLoadIC(NOT_CONTEXTUAL);
+ } else {
+ CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId());
+ }
}
void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
SetSourcePosition(prop->position());
Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
- CallIC(ic, prop->PropertyFeedbackId());
+ if (FLAG_vector_ics) {
+ __ mov(LoadIC::SlotRegister(),
+ Immediate(Smi::FromInt(prop->PropertyFeedbackSlot())));
+ CallIC(ic);
+ } else {
+ CallIC(ic, prop->PropertyFeedbackId());
+ }
}
@@ -2674,7 +2708,7 @@
{ 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);
// Call the runtime to find the function to call (returned in eax) and
@@ -4015,7 +4049,13 @@
// Load the function from the receiver.
__ mov(LoadIC::ReceiverRegister(), Operand(esp, 0));
__ mov(LoadIC::NameRegister(), Immediate(expr->name()));
- CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId());
+ if (FLAG_vector_ics) {
+ __ mov(LoadIC::SlotRegister(),
+ Immediate(Smi::FromInt(expr->CallRuntimeFeedbackSlot())));
+ CallLoadIC(NOT_CONTEXTUAL);
+ } else {
+ CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId());
+ }
// Push the target function under the receiver.
__ push(Operand(esp, 0));
@@ -4363,6 +4403,10 @@
Comment cmnt(masm_, "[ Global variable");
__ mov(LoadIC::ReceiverRegister(), GlobalObjectOperand());
__ mov(LoadIC::NameRegister(), Immediate(proxy->name()));
+ if (FLAG_vector_ics) {
+ __ mov(LoadIC::SlotRegister(),
+ Immediate(Smi::FromInt(proxy->VariableFeedbackSlot())));
+ }
// Use a regular load, not a contextual load, to avoid a reference
// error.
CallLoadIC(NOT_CONTEXTUAL);
@@ -4374,7 +4418,7 @@
// 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);
__ push(esi);
=======================================
--- /branches/bleeding_edge/src/x87/ic-x87.cc Mon Jul 21 02:57:42 2014 UTC
+++ /branches/bleeding_edge/src/x87/ic-x87.cc Wed Jul 23 07:48:19 2014 UTC
@@ -972,6 +972,18 @@
// IC register specifications
const Register LoadIC::ReceiverRegister() { return edx; }
const Register LoadIC::NameRegister() { return ecx; }
+
+
+const Register LoadIC::SlotRegister() {
+ ASSERT(FLAG_vector_ics);
+ return eax;
+}
+
+
+const Register LoadIC::VectorRegister() {
+ ASSERT(FLAG_vector_ics);
+ return ebx;
+}
const Register StoreIC::ReceiverRegister() { return edx; }
=======================================
--- /branches/bleeding_edge/src/x87/lithium-codegen-x87.cc Mon Jul 21
10:20:54 2014 UTC
+++ /branches/bleeding_edge/src/x87/lithium-codegen-x87.cc Wed Jul 23
07:48:19 2014 UTC
@@ -2971,6 +2971,15 @@
ASSERT(ToRegister(instr->result()).is(eax));
__ mov(LoadIC::NameRegister(), instr->name());
+ if (FLAG_vector_ics) {
+ Register vector = ToRegister(instr->temp_vector());
+ ASSERT(vector.is(LoadIC::VectorRegister()));
+ __ mov(vector, instr->hydrogen()->feedback_vector());
+ // No need to allocate this register.
+ ASSERT(LoadIC::SlotRegister().is(eax));
+ __ mov(LoadIC::SlotRegister(),
+ Immediate(Smi::FromInt(instr->hydrogen()->slot())));
+ }
ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL;
Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode);
CallCode(ic, RelocInfo::CODE_TARGET, instr);
@@ -3103,6 +3112,15 @@
ASSERT(ToRegister(instr->result()).is(eax));
__ mov(LoadIC::NameRegister(), instr->name());
+ if (FLAG_vector_ics) {
+ Register vector = ToRegister(instr->temp_vector());
+ ASSERT(vector.is(LoadIC::VectorRegister()));
+ __ mov(vector, instr->hydrogen()->feedback_vector());
+ // No need to allocate this register.
+ ASSERT(LoadIC::SlotRegister().is(eax));
+ __ mov(LoadIC::SlotRegister(),
+ Immediate(Smi::FromInt(instr->hydrogen()->slot())));
+ }
Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL);
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
@@ -3340,6 +3358,16 @@
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()));
+ __ mov(vector, instr->hydrogen()->feedback_vector());
+ // No need to allocate this register.
+ ASSERT(LoadIC::SlotRegister().is(eax));
+ __ mov(LoadIC::SlotRegister(),
+ Immediate(Smi::FromInt(instr->hydrogen()->slot())));
+ }
+
Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
=======================================
--- /branches/bleeding_edge/src/x87/lithium-x87.cc Fri Jul 18 03:15:48 2014
UTC
+++ /branches/bleeding_edge/src/x87/lithium-x87.cc Wed Jul 23 07:48:19 2014
UTC
@@ -2073,8 +2073,13 @@
LOperand* context = UseFixed(instr->context(), esi);
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, eax), instr);
}
@@ -2128,7 +2133,12 @@
LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) {
LOperand* context = UseFixed(instr->context(), esi);
LOperand* object = UseFixed(instr->object(), LoadIC::ReceiverRegister());
- LLoadNamedGeneric* result = new(zone()) LLoadNamedGeneric(context,
object);
+ LOperand* vector = NULL;
+ if (FLAG_vector_ics) {
+ vector = FixedTemp(LoadIC::VectorRegister());
+ }
+ LLoadNamedGeneric* result = new(zone()) LLoadNamedGeneric(
+ context, object, vector);
return MarkAsCall(DefineFixed(result, eax), instr);
}
@@ -2187,9 +2197,12 @@
LOperand* context = UseFixed(instr->context(), esi);
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());
+ }
LLoadKeyedGeneric* result =
- new(zone()) LLoadKeyedGeneric(context, object, key);
+ new(zone()) LLoadKeyedGeneric(context, object, key, vector);
return MarkAsCall(DefineFixed(result, eax), instr);
}
=======================================
--- /branches/bleeding_edge/src/x87/lithium-x87.h Fri Jul 18 03:15:48 2014
UTC
+++ /branches/bleeding_edge/src/x87/lithium-x87.h Wed Jul 23 07:48:19 2014
UTC
@@ -1593,15 +1593,17 @@
};
-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)
@@ -1682,19 +1684,23 @@
}
-class LLoadKeyedGeneric V8_FINAL : public LTemplateInstruction<1, 3, 0> {
+class LLoadKeyedGeneric V8_FINAL : public LTemplateInstruction<1, 3, 1> {
public:
- LLoadKeyedGeneric(LOperand* context, LOperand* obj, LOperand* key) {
+ LLoadKeyedGeneric(LOperand* context, LOperand* obj, LOperand* key,
+ LOperand* vector) {
inputs_[0] = context;
inputs_[1] = obj;
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)
};
@@ -1705,15 +1711,18 @@
};
-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)
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.