[fullcodegen] Refactor code that calls load ICs.
BUG=v8:5408 Review-Url: https://codereview.chromium.org/2367693002 Cr-Commit-Position: refs/heads/master@{#39707}
This commit is contained in:
parent
13b8a1238b
commit
43a09146bb
@ -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,
|
||||
TypeofMode typeof_mode) {
|
||||
// Record position before possible IC call.
|
||||
|
@ -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,
|
||||
TypeofMode typeof_mode) {
|
||||
// Record position before possible IC call.
|
||||
|
@ -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());
|
||||
@ -1094,10 +1107,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) {
|
||||
@ -1113,9 +1123,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();
|
||||
}
|
||||
@ -1559,9 +1570,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());
|
||||
|
||||
|
@ -621,10 +621,8 @@ class FullCodeGenerator final : public AstVisitor<FullCodeGenerator> {
|
||||
void CallIC(Handle<Code> code,
|
||||
TypeFeedbackId id = TypeFeedbackId::None());
|
||||
|
||||
void CallLoadIC(TypeFeedbackId id = TypeFeedbackId::None());
|
||||
// Inside typeof reference errors are never thrown.
|
||||
void CallLoadGlobalIC(TypeofMode typeof_mode,
|
||||
TypeFeedbackId id = TypeFeedbackId::None());
|
||||
void CallLoadIC(FeedbackVectorSlot slot, Handle<Object> name,
|
||||
TypeFeedbackId id = TypeFeedbackId::None());
|
||||
void CallStoreIC(FeedbackVectorSlot slot, Handle<Object> name,
|
||||
TypeFeedbackId id = TypeFeedbackId::None());
|
||||
void CallKeyedStoreIC(FeedbackVectorSlot slot);
|
||||
|
@ -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,
|
||||
TypeofMode typeof_mode) {
|
||||
SetExpressionPosition(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,
|
||||
TypeofMode typeof_mode) {
|
||||
// Record position before possible IC call.
|
||||
|
@ -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,
|
||||
TypeofMode typeof_mode) {
|
||||
// Record position before possible IC call.
|
||||
|
@ -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,
|
||||
TypeofMode typeof_mode) {
|
||||
// Record position before possible IC call.
|
||||
|
@ -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,
|
||||
TypeofMode typeof_mode) {
|
||||
// Record position before possible IC call.
|
||||
|
@ -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,
|
||||
TypeofMode typeof_mode) {
|
||||
// Record position before possible IC call.
|
||||
|
@ -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,
|
||||
TypeofMode typeof_mode) {
|
||||
SetExpressionPosition(proxy);
|
||||
|
Loading…
Reference in New Issue
Block a user