Reviewers: Weiliang, mvstanton,
Message:
PTAL.
thanks
Description:
X87: Continue learning for calls in crankshaft.
port 7d363783e14433032a4e8dd426fe0e27d1637fe5.
original commit message:
Continue learning for calls in crankshaft.
The type feedback vector makes this easy to do.
This is a re-land of https://codereview.chromium.org/868453005/
with a fix for the DCHECK failure.
BUG=
Please review this at https://codereview.chromium.org/904373002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+55, -5 lines):
M src/x87/lithium-codegen-x87.cc
M src/x87/lithium-x87.h
M src/x87/lithium-x87.cc
Index: src/x87/lithium-codegen-x87.cc
diff --git a/src/x87/lithium-codegen-x87.cc b/src/x87/lithium-codegen-x87.cc
index
833768995f5022e4e404156f8d06c8358cfb3a51..6a3936a87fa0f73d85c6e6bc16ed37b427bd87f2
100644
--- a/src/x87/lithium-codegen-x87.cc
+++ b/src/x87/lithium-codegen-x87.cc
@@ -4364,8 +4364,30 @@ void LCodeGen::DoCallFunction(LCallFunction* instr) {
DCHECK(ToRegister(instr->result()).is(eax));
int arity = instr->arity();
- CallFunctionStub stub(isolate(), arity,
instr->hydrogen()->function_flags());
- CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
+ CallFunctionFlags flags = instr->hydrogen()->function_flags();
+ if (instr->hydrogen()->HasVectorAndSlot()) {
+ Register slot_register = ToRegister(instr->temp_slot());
+ Register vector_register = ToRegister(instr->temp_vector());
+ DCHECK(slot_register.is(edx));
+ DCHECK(vector_register.is(ebx));
+
+ AllowDeferredHandleDereference vector_structure_check;
+ Handle<TypeFeedbackVector> vector =
instr->hydrogen()->feedback_vector();
+ int index = vector->GetIndex(instr->hydrogen()->slot());
+
+ __ mov(vector_register, vector);
+ __ mov(slot_register, Immediate(Smi::FromInt(index)));
+
+ CallICState::CallType call_type =
+ (flags & CALL_AS_METHOD) ? CallICState::METHOD :
CallICState::FUNCTION;
+
+ Handle<Code> ic =
+ CodeFactory::CallICInOptimizedCode(isolate(), arity,
call_type).code();
+ CallCode(ic, RelocInfo::CODE_TARGET, instr);
+ } else {
+ CallFunctionStub stub(isolate(), arity, flags);
+ CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
+ }
}
Index: src/x87/lithium-x87.cc
diff --git a/src/x87/lithium-x87.cc b/src/x87/lithium-x87.cc
index
a0e98e57194dedd09e1df2ee4ac7b3f87972b0eb..eeccd1bcff10f2b4c417d10d275e7761c8482345
100644
--- a/src/x87/lithium-x87.cc
+++ b/src/x87/lithium-x87.cc
@@ -285,6 +285,20 @@ void LInnerAllocatedObject::PrintDataTo(StringStream*
stream) {
}
+void LCallFunction::PrintDataTo(StringStream* stream) {
+ context()->PrintTo(stream);
+ stream->Add(" ");
+ function()->PrintTo(stream);
+ if (hydrogen()->HasVectorAndSlot()) {
+ stream->Add(" (type-feedback-vector ");
+ temp_vector()->PrintTo(stream);
+ stream->Add(" ");
+ temp_slot()->PrintTo(stream);
+ stream->Add(")");
+ }
+}
+
+
void LCallJSFunction::PrintDataTo(StringStream* stream) {
stream->Add("= ");
function()->PrintTo(stream);
@@ -1291,7 +1305,15 @@ LInstruction*
LChunkBuilder::DoCallNewArray(HCallNewArray* instr) {
LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) {
LOperand* context = UseFixed(instr->context(), esi);
LOperand* function = UseFixed(instr->function(), edi);
- LCallFunction* call = new(zone()) LCallFunction(context, function);
+ LOperand* slot = NULL;
+ LOperand* vector = NULL;
+ if (instr->HasVectorAndSlot()) {
+ slot = FixedTemp(edx);
+ vector = FixedTemp(ebx);
+ }
+
+ LCallFunction* call =
+ new (zone()) LCallFunction(context, function, slot, vector);
return MarkAsCall(DefineFixed(call, eax), instr);
}
Index: src/x87/lithium-x87.h
diff --git a/src/x87/lithium-x87.h b/src/x87/lithium-x87.h
index
3c3bb9fa81bb1b1090b7dff3e6d5fe65b81a3cff..c8c83835a96e4306f2ee1132563918b3f9708523
100644
--- a/src/x87/lithium-x87.h
+++ b/src/x87/lithium-x87.h
@@ -1957,19 +1957,25 @@ class LInvokeFunction FINAL : public
LTemplateInstruction<1, 2, 0> {
};
-class LCallFunction FINAL : public LTemplateInstruction<1, 2, 0> {
+class LCallFunction FINAL : public LTemplateInstruction<1, 2, 2> {
public:
- explicit LCallFunction(LOperand* context, LOperand* function) {
+ LCallFunction(LOperand* context, LOperand* function, LOperand* slot,
+ LOperand* vector) {
inputs_[0] = context;
inputs_[1] = function;
+ temps_[0] = slot;
+ temps_[1] = vector;
}
LOperand* context() { return inputs_[0]; }
LOperand* function() { return inputs_[1]; }
+ LOperand* temp_slot() { return temps_[0]; }
+ LOperand* temp_vector() { return temps_[1]; }
DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
DECLARE_HYDROGEN_ACCESSOR(CallFunction)
+ void PrintDataTo(StringStream* stream) OVERRIDE;
int arity() const { return hydrogen()->argument_count() - 1; }
};
--
--
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.