Commit 43a09146 authored by ishell's avatar ishell Committed by Commit bot

[fullcodegen] Refactor code that calls load ICs.

BUG=v8:5408

Review-Url: https://codereview.chromium.org/2367693002
Cr-Commit-Position: refs/heads/master@{#39707}
parent 13b8a123
...@@ -1270,20 +1270,6 @@ void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy, ...@@ -1270,20 +1270,6 @@ void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy,
} }
} }
void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy,
TypeofMode typeof_mode) {
#ifdef DEBUG
Variable* var = proxy->var();
DCHECK(var->IsUnallocated() ||
(var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL));
#endif
__ mov(LoadGlobalDescriptor::SlotRegister(),
Operand(SmiFromSlot(proxy->VariableFeedbackSlot())));
CallLoadGlobalIC(typeof_mode);
}
void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy,
TypeofMode typeof_mode) { TypeofMode typeof_mode) {
// Record position before possible IC call. // Record position before possible IC call.
......
...@@ -1257,20 +1257,6 @@ void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy, ...@@ -1257,20 +1257,6 @@ void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy,
} }
} }
void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy,
TypeofMode typeof_mode) {
#ifdef DEBUG
Variable* var = proxy->var();
DCHECK(var->IsUnallocated() ||
(var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL));
#endif
__ Mov(LoadGlobalDescriptor::SlotRegister(),
SmiFromSlot(proxy->VariableFeedbackSlot()));
CallLoadGlobalIC(typeof_mode);
}
void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy,
TypeofMode typeof_mode) { TypeofMode typeof_mode) {
// Record position before possible IC call. // Record position before possible IC call.
......
...@@ -223,18 +223,18 @@ void FullCodeGenerator::PrepareForBailout(Expression* node, ...@@ -223,18 +223,18 @@ void FullCodeGenerator::PrepareForBailout(Expression* node,
PrepareForBailoutForId(node->id(), state); 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(); Handle<Code> ic = CodeFactory::LoadIC(isolate()).code();
CallIC(ic, id); CallIC(ic, id);
if (FLAG_tf_load_ic_stub) RestoreContext(); 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, void FullCodeGenerator::CallStoreIC(FeedbackVectorSlot slot,
Handle<Object> name, TypeFeedbackId id) { Handle<Object> name, TypeFeedbackId id) {
DCHECK(name->IsName()); DCHECK(name->IsName());
...@@ -494,6 +494,19 @@ void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) { ...@@ -494,6 +494,19 @@ void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) {
EmitVariableLoad(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( void FullCodeGenerator::VisitSloppyBlockFunctionStatement(
SloppyBlockFunctionStatement* declaration) { SloppyBlockFunctionStatement* declaration) {
Visit(declaration->statement()); Visit(declaration->statement());
...@@ -1094,10 +1107,7 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { ...@@ -1094,10 +1107,7 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
DCHECK(!key->value()->IsSmi()); DCHECK(!key->value()->IsSmi());
DCHECK(!prop->IsSuperAccess()); DCHECK(!prop->IsSuperAccess());
__ Move(LoadDescriptor::NameRegister(), key->value()); CallLoadIC(prop->PropertyFeedbackSlot(), key->value());
__ Move(LoadDescriptor::SlotRegister(),
SmiFromSlot(prop->PropertyFeedbackSlot()));
CallLoadIC();
} }
void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) {
...@@ -1113,9 +1123,10 @@ void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { ...@@ -1113,9 +1123,10 @@ void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) {
void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
SetExpressionPosition(prop); SetExpressionPosition(prop);
EmitLoadSlot(LoadDescriptor::SlotRegister(), prop->PropertyFeedbackSlot());
Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code();
__ Move(LoadDescriptor::SlotRegister(),
SmiFromSlot(prop->PropertyFeedbackSlot()));
CallIC(ic); CallIC(ic);
RestoreContext(); RestoreContext();
} }
...@@ -1559,9 +1570,7 @@ void FullCodeGenerator::VisitClassLiteral(ClassLiteral* lit) { ...@@ -1559,9 +1570,7 @@ void FullCodeGenerator::VisitClassLiteral(ClassLiteral* lit) {
// Load the "prototype" from the constructor. // Load the "prototype" from the constructor.
__ Move(LoadDescriptor::ReceiverRegister(), result_register()); __ Move(LoadDescriptor::ReceiverRegister(), result_register());
__ LoadRoot(LoadDescriptor::NameRegister(), Heap::kprototype_stringRootIndex); CallLoadIC(lit->PrototypeSlot(), isolate()->factory()->prototype_string());
__ Move(LoadDescriptor::SlotRegister(), SmiFromSlot(lit->PrototypeSlot()));
CallLoadIC();
PrepareForBailoutForId(lit->PrototypeId(), BailoutState::TOS_REGISTER); PrepareForBailoutForId(lit->PrototypeId(), BailoutState::TOS_REGISTER);
PushOperand(result_register()); PushOperand(result_register());
......
...@@ -621,9 +621,7 @@ class FullCodeGenerator final : public AstVisitor<FullCodeGenerator> { ...@@ -621,9 +621,7 @@ class FullCodeGenerator final : public AstVisitor<FullCodeGenerator> {
void CallIC(Handle<Code> code, void CallIC(Handle<Code> code,
TypeFeedbackId id = TypeFeedbackId::None()); TypeFeedbackId id = TypeFeedbackId::None());
void CallLoadIC(TypeFeedbackId id = TypeFeedbackId::None()); void CallLoadIC(FeedbackVectorSlot slot, Handle<Object> name,
// Inside typeof reference errors are never thrown.
void CallLoadGlobalIC(TypeofMode typeof_mode,
TypeFeedbackId id = TypeFeedbackId::None()); TypeFeedbackId id = TypeFeedbackId::None());
void CallStoreIC(FeedbackVectorSlot slot, Handle<Object> name, void CallStoreIC(FeedbackVectorSlot slot, Handle<Object> name,
TypeFeedbackId id = TypeFeedbackId::None()); TypeFeedbackId id = TypeFeedbackId::None());
......
...@@ -1189,20 +1189,6 @@ void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy, ...@@ -1189,20 +1189,6 @@ void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy,
} }
} }
void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy,
TypeofMode typeof_mode) {
#ifdef DEBUG
Variable* var = proxy->var();
DCHECK(var->IsUnallocated() ||
(var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL));
#endif
__ mov(LoadGlobalDescriptor::SlotRegister(),
Immediate(SmiFromSlot(proxy->VariableFeedbackSlot())));
CallLoadGlobalIC(typeof_mode);
}
void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy,
TypeofMode typeof_mode) { TypeofMode typeof_mode) {
SetExpressionPosition(proxy); SetExpressionPosition(proxy);
......
...@@ -1266,20 +1266,6 @@ void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy, ...@@ -1266,20 +1266,6 @@ void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy,
} }
} }
void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy,
TypeofMode typeof_mode) {
#ifdef DEBUG
Variable* var = proxy->var();
DCHECK(var->IsUnallocated() ||
(var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL));
#endif
__ li(LoadGlobalDescriptor::SlotRegister(),
Operand(SmiFromSlot(proxy->VariableFeedbackSlot())));
CallLoadGlobalIC(typeof_mode);
}
void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy,
TypeofMode typeof_mode) { TypeofMode typeof_mode) {
// Record position before possible IC call. // Record position before possible IC call.
......
...@@ -1267,20 +1267,6 @@ void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy, ...@@ -1267,20 +1267,6 @@ void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy,
} }
} }
void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy,
TypeofMode typeof_mode) {
#ifdef DEBUG
Variable* var = proxy->var();
DCHECK(var->IsUnallocated() ||
(var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL));
#endif
__ li(LoadGlobalDescriptor::SlotRegister(),
Operand(SmiFromSlot(proxy->VariableFeedbackSlot())));
CallLoadGlobalIC(typeof_mode);
}
void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy,
TypeofMode typeof_mode) { TypeofMode typeof_mode) {
// Record position before possible IC call. // Record position before possible IC call.
......
...@@ -1235,20 +1235,6 @@ void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy, ...@@ -1235,20 +1235,6 @@ void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy,
} }
} }
void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy,
TypeofMode typeof_mode) {
#ifdef DEBUG
Variable* var = proxy->var();
DCHECK(var->IsUnallocated() ||
(var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL));
#endif
__ mov(LoadGlobalDescriptor::SlotRegister(),
Operand(SmiFromSlot(proxy->VariableFeedbackSlot())));
CallLoadGlobalIC(typeof_mode);
}
void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy,
TypeofMode typeof_mode) { TypeofMode typeof_mode) {
// Record position before possible IC call. // Record position before possible IC call.
......
...@@ -1199,18 +1199,6 @@ void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy, ...@@ -1199,18 +1199,6 @@ void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy,
} }
} }
void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy,
TypeofMode typeof_mode) {
#ifdef DEBUG
Variable* var = proxy->var();
DCHECK(var->IsUnallocated() ||
(var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL));
#endif
__ mov(LoadGlobalDescriptor::SlotRegister(),
Operand(SmiFromSlot(proxy->VariableFeedbackSlot())));
CallLoadGlobalIC(typeof_mode);
}
void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy,
TypeofMode typeof_mode) { TypeofMode typeof_mode) {
// Record position before possible IC call. // Record position before possible IC call.
......
...@@ -1218,20 +1218,6 @@ void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy, ...@@ -1218,20 +1218,6 @@ void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy,
} }
} }
void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy,
TypeofMode typeof_mode) {
#ifdef DEBUG
Variable* var = proxy->var();
DCHECK(var->IsUnallocated() ||
(var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL));
#endif
__ Move(LoadGlobalDescriptor::SlotRegister(),
SmiFromSlot(proxy->VariableFeedbackSlot()));
CallLoadGlobalIC(typeof_mode);
}
void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy,
TypeofMode typeof_mode) { TypeofMode typeof_mode) {
// Record position before possible IC call. // Record position before possible IC call.
......
...@@ -1181,20 +1181,6 @@ void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy, ...@@ -1181,20 +1181,6 @@ void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy,
} }
} }
void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy,
TypeofMode typeof_mode) {
#ifdef DEBUG
Variable* var = proxy->var();
DCHECK(var->IsUnallocated() ||
(var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL));
#endif
__ mov(LoadGlobalDescriptor::SlotRegister(),
Immediate(SmiFromSlot(proxy->VariableFeedbackSlot())));
CallLoadGlobalIC(typeof_mode);
}
void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy,
TypeofMode typeof_mode) { TypeofMode typeof_mode) {
SetExpressionPosition(proxy); SetExpressionPosition(proxy);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment