Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(412)

Unified Diff: src/ic/ia32/handler-compiler-ia32.cc

Issue 767743002: Hydrogen code stubs for vector-based ICs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Patch One. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/ic/ia32/handler-compiler-ia32.cc
diff --git a/src/ic/ia32/handler-compiler-ia32.cc b/src/ic/ia32/handler-compiler-ia32.cc
index d0b940bcc550b38711f3b28fde0eaa337d0a3ac5..f438dad19b78e1aed4425a83fd79e445e59a48ec 100644
--- a/src/ic/ia32/handler-compiler-ia32.cc
+++ b/src/ic/ia32/handler-compiler-ia32.cc
@@ -47,6 +47,41 @@ void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
}
+void PropertyHandlerCompiler::PushVectorAndSlot() {
+ MacroAssembler* masm = this->masm();
+ __ push(VectorLoadICDescriptor::VectorRegister());
+ __ push(VectorLoadICDescriptor::SlotRegister());
+}
+
+
+void PropertyHandlerCompiler::PopVectorAndSlot() {
+ MacroAssembler* masm = this->masm();
+ __ pop(VectorLoadICDescriptor::SlotRegister());
+ __ pop(VectorLoadICDescriptor::VectorRegister());
+}
+
+
+void PropertyHandlerCompiler::PushVectorAndSlot(Register vector,
+ Register slot) {
+ MacroAssembler* masm = this->masm();
+ __ push(vector);
+ __ push(slot);
+}
+
+
+void PropertyHandlerCompiler::PopVectorAndSlot(Register vector, Register slot) {
+ MacroAssembler* masm = this->masm();
+ __ pop(slot);
+ __ pop(vector);
+}
+
+
+void PropertyHandlerCompiler::DiscardVectorAndSlot() {
+ MacroAssembler* masm = this->masm();
+ __ add(esp, Immediate(2 * kPointerSize)); // remove vector and slot
Jakob Kummerow 2014/12/02 08:43:07 nit: Capitalization and punctuation, please.
mvstanton 2014/12/03 11:48:30 Done.
+}
+
+
void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup(
MacroAssembler* masm, Label* miss_label, Register receiver,
Handle<Name> name, Register scratch0, Register scratch1) {
@@ -110,6 +145,7 @@ void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype(
void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(
MacroAssembler* masm, Register receiver, Register scratch1,
Register scratch2, Label* miss_label) {
+ DCHECK(!FLAG_vector_ics);
__ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label);
__ mov(eax, scratch1);
__ ret(0);
@@ -467,6 +503,10 @@ void NamedLoadHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
Label success;
__ jmp(&success);
__ bind(miss);
+ if (FLAG_vector_ics) {
+ DCHECK(kind() == Code::LOAD_IC);
+ PopVectorAndSlot();
+ }
TailCallBuiltin(masm(), MissBuiltin(kind()));
__ bind(&success);
}
@@ -566,7 +606,15 @@ void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup(
}
__ push(holder_reg);
__ push(this->name());
-
+ if (FLAG_vector_ics &&
+ (kind() == Code::LOAD_IC || kind() == Code::KEYED_LOAD_IC)) {
Jakob Kummerow 2014/12/02 08:43:07 Again, can we re-use IC::ICUseVector() instead of
mvstanton 2014/12/03 11:48:30 Done.
+ // The vector and slot values are already saved on the stack.
+ if (!holder_reg.is(receiver())) {
+ PushVectorAndSlot(scratch2(), scratch3());
Jakob Kummerow 2014/12/02 08:43:07 Why the case distinction? Pushing scratch register
mvstanton 2014/12/03 11:48:30 My earlier lengthy comment and the code changes an
+ } else {
+ PushVectorAndSlot();
+ }
+ }
// Invoke an interceptor. Note: map checks from receiver to
// interceptor's holder has been compiled before (see a caller
// of this method.)
@@ -590,6 +638,14 @@ void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup(
__ mov(this->name(), Immediate(bit_cast<int32_t>(kZapValue)));
}
+ if (FLAG_vector_ics &&
+ (kind() == Code::LOAD_IC || kind() == Code::KEYED_LOAD_IC)) {
+ if (!holder_reg.is(receiver())) {
+ PopVectorAndSlot(scratch2(), scratch3());
+ } else {
+ PopVectorAndSlot();
+ }
+ }
__ pop(this->name());
__ pop(holder_reg);
if (must_preserve_receiver_reg) {
@@ -668,7 +724,10 @@ Register NamedStoreHandlerCompiler::value() {
Handle<Code> NamedLoadHandlerCompiler::CompileLoadGlobal(
Handle<PropertyCell> cell, Handle<Name> name, bool is_configurable) {
Label miss;
-
+ if (FLAG_vector_ics &&
+ (kind() == Code::LOAD_IC || kind() == Code::KEYED_LOAD_IC)) {
+ PushVectorAndSlot();
+ }
FrontendHeader(receiver(), name, &miss);
// Get the value from the cell.
Register result = StoreDescriptor::ValueRegister();
@@ -691,6 +750,10 @@ Handle<Code> NamedLoadHandlerCompiler::CompileLoadGlobal(
Counters* counters = isolate()->counters();
__ IncrementCounter(counters->named_load_global_stub(), 1);
// The code above already loads the result into the return register.
+ if (FLAG_vector_ics &&
+ (kind() == Code::LOAD_IC || kind() == Code::KEYED_LOAD_IC)) {
+ DiscardVectorAndSlot();
+ }
__ ret(0);
FrontendFooter(name, &miss);

Powered by Google App Engine
This is Rietveld 408576698