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

Unified Diff: src/full-codegen/full-codegen.cc

Issue 2367693002: [fullcodegen] Refactor code that calls load ICs. (Closed)
Patch Set: Created 4 years, 3 months 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
« no previous file with comments | « src/full-codegen/full-codegen.h ('k') | src/full-codegen/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/full-codegen/full-codegen.cc
diff --git a/src/full-codegen/full-codegen.cc b/src/full-codegen/full-codegen.cc
index 1900d955f5cae62a453ba2f0a4e08987bf6ac725..93c1a1817efe376edf695824a1a33e3105897aa2 100644
--- a/src/full-codegen/full-codegen.cc
+++ b/src/full-codegen/full-codegen.cc
@@ -223,18 +223,18 @@ void FullCodeGenerator::PrepareForBailout(Expression* node,
PrepareForBailoutForId(node->id(), state);
}
-void FullCodeGenerator::CallLoadIC(TypeFeedbackId id) {
+void FullCodeGenerator::CallLoadIC(FeedbackVectorSlot slot, Handle<Object> name,
+ TypeFeedbackId id) {
+ DCHECK(name->IsName());
+ __ Move(LoadDescriptor::NameRegister(), name);
+
+ EmitLoadSlot(LoadDescriptor::SlotRegister(), slot);
+
Handle<Code> ic = CodeFactory::LoadIC(isolate()).code();
CallIC(ic, id);
if (FLAG_tf_load_ic_stub) RestoreContext();
}
-void FullCodeGenerator::CallLoadGlobalIC(TypeofMode typeof_mode,
- TypeFeedbackId id) {
- Handle<Code> ic = CodeFactory::LoadGlobalIC(isolate(), typeof_mode).code();
- CallIC(ic, id);
-}
-
void FullCodeGenerator::CallStoreIC(FeedbackVectorSlot slot,
Handle<Object> name, TypeFeedbackId id) {
DCHECK(name->IsName());
@@ -494,6 +494,19 @@ void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) {
EmitVariableLoad(expr);
}
+void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy,
+ TypeofMode typeof_mode) {
+#ifdef DEBUG
+ Variable* var = proxy->var();
+ DCHECK(var->IsUnallocated() ||
+ (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL));
+#endif
+ EmitLoadSlot(LoadGlobalDescriptor::SlotRegister(),
+ proxy->VariableFeedbackSlot());
+ Handle<Code> ic = CodeFactory::LoadGlobalIC(isolate(), typeof_mode).code();
+ CallIC(ic);
+}
+
void FullCodeGenerator::VisitSloppyBlockFunctionStatement(
SloppyBlockFunctionStatement* declaration) {
Visit(declaration->statement());
@@ -1093,10 +1106,7 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
DCHECK(!key->value()->IsSmi());
DCHECK(!prop->IsSuperAccess());
- __ Move(LoadDescriptor::NameRegister(), key->value());
- __ Move(LoadDescriptor::SlotRegister(),
- SmiFromSlot(prop->PropertyFeedbackSlot()));
- CallLoadIC();
+ CallLoadIC(prop->PropertyFeedbackSlot(), key->value());
}
void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) {
@@ -1112,9 +1122,10 @@ void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) {
void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
SetExpressionPosition(prop);
+
+ EmitLoadSlot(LoadDescriptor::SlotRegister(), prop->PropertyFeedbackSlot());
+
Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code();
- __ Move(LoadDescriptor::SlotRegister(),
- SmiFromSlot(prop->PropertyFeedbackSlot()));
CallIC(ic);
RestoreContext();
}
@@ -1558,9 +1569,7 @@ void FullCodeGenerator::VisitClassLiteral(ClassLiteral* lit) {
// Load the "prototype" from the constructor.
__ Move(LoadDescriptor::ReceiverRegister(), result_register());
- __ LoadRoot(LoadDescriptor::NameRegister(), Heap::kprototype_stringRootIndex);
- __ Move(LoadDescriptor::SlotRegister(), SmiFromSlot(lit->PrototypeSlot()));
- CallLoadIC();
+ CallLoadIC(lit->PrototypeSlot(), isolate()->factory()->prototype_string());
PrepareForBailoutForId(lit->PrototypeId(), BailoutState::TOS_REGISTER);
PushOperand(result_register());
« no previous file with comments | « src/full-codegen/full-codegen.h ('k') | src/full-codegen/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698