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

Unified Diff: src/compiler/ast-graph-builder.cc

Issue 633423002: Teach TurboFan to call vector-based ICs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Patch One. Created 6 years, 2 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
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
index fa3e88bc53634ce40f03273c19d376899bb26438..818d06367635fb88f224710f7445627b4014714a 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -20,6 +20,7 @@ namespace compiler {
AstGraphBuilder::AstGraphBuilder(CompilationInfo* info, JSGraph* jsgraph)
: StructuredGraphBuilder(jsgraph->graph(), jsgraph->common()),
info_(info),
+ vector_(handle(info->shared_info()->feedback_vector())),
jsgraph_(jsgraph),
globals_(0, info->zone()),
breakable_(NULL),
@@ -837,7 +838,7 @@ void AstGraphBuilder::VisitConditional(Conditional* expr) {
void AstGraphBuilder::VisitVariableProxy(VariableProxy* expr) {
- Node* value = BuildVariableLoad(expr->var(), expr->id());
+ Node* value = BuildVariableLoad(expr, expr->id());
ast_context()->ProduceValue(value);
}
@@ -1091,15 +1092,17 @@ void AstGraphBuilder::VisitAssignment(Assignment* expr) {
Node* old_value = NULL;
switch (assign_type) {
case VARIABLE: {
- Variable* variable = expr->target()->AsVariableProxy()->var();
- old_value = BuildVariableLoad(variable, expr->target()->id());
+ VariableProxy* proxy = expr->target()->AsVariableProxy();
+ old_value = BuildVariableLoad(proxy, expr->target()->id());
break;
}
case NAMED_PROPERTY: {
Node* object = environment()->Top();
Unique<Name> name =
MakeUnique(property->key()->AsLiteral()->AsPropertyName());
- old_value = NewNode(javascript()->LoadNamed(name), object);
+ int slot = property->PropertyFeedbackSlot();
+ old_value = NewNode(
+ javascript()->LoadNamed(name, LoadNamedFeedback(slot)), object);
PrepareFrameState(old_value, property->LoadId(),
OutputFrameStateCombine::Push());
break;
@@ -1107,7 +1110,10 @@ void AstGraphBuilder::VisitAssignment(Assignment* expr) {
case KEYED_PROPERTY: {
Node* key = environment()->Top();
Node* object = environment()->Peek(1);
- old_value = NewNode(javascript()->LoadProperty(), object, key);
+ int slot = property->PropertyFeedbackSlot();
+ old_value =
+ NewNode(javascript()->LoadProperty(LoadPropertyFeedback(slot)),
+ object, key);
PrepareFrameState(old_value, property->LoadId(),
OutputFrameStateCombine::Push());
break;
@@ -1179,17 +1185,20 @@ void AstGraphBuilder::VisitThrow(Throw* expr) {
void AstGraphBuilder::VisitProperty(Property* expr) {
Node* value;
+ int slot = expr->PropertyFeedbackSlot();
if (expr->key()->IsPropertyName()) {
VisitForValue(expr->obj());
Node* object = environment()->Pop();
Unique<Name> name = MakeUnique(expr->key()->AsLiteral()->AsPropertyName());
- value = NewNode(javascript()->LoadNamed(name), object);
+ value =
+ NewNode(javascript()->LoadNamed(name, LoadNamedFeedback(slot)), object);
} else {
VisitForValue(expr->obj());
VisitForValue(expr->key());
Node* key = environment()->Pop();
Node* object = environment()->Pop();
- value = NewNode(javascript()->LoadProperty(), object, key);
+ value = NewNode(javascript()->LoadProperty(LoadPropertyFeedback(slot)),
+ object, key);
}
PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine());
ast_context()->ProduceValue(value);
@@ -1208,8 +1217,8 @@ void AstGraphBuilder::VisitCall(Call* expr) {
bool possibly_eval = false;
switch (call_type) {
case Call::GLOBAL_CALL: {
- Variable* variable = callee->AsVariableProxy()->var();
- callee_value = BuildVariableLoad(variable, expr->expression()->id());
+ VariableProxy* proxy = callee->AsVariableProxy();
+ callee_value = BuildVariableLoad(proxy, expr->expression()->id());
receiver_value = jsgraph()->UndefinedConstant();
break;
}
@@ -1231,14 +1240,18 @@ void AstGraphBuilder::VisitCall(Call* expr) {
Property* property = callee->AsProperty();
VisitForValue(property->obj());
Node* object = environment()->Top();
+ int slot = property->PropertyFeedbackSlot();
if (property->key()->IsPropertyName()) {
Unique<Name> name =
MakeUnique(property->key()->AsLiteral()->AsPropertyName());
- callee_value = NewNode(javascript()->LoadNamed(name), object);
+ callee_value = NewNode(
+ javascript()->LoadNamed(name, LoadNamedFeedback(slot)), object);
} else {
VisitForValue(property->key());
Node* key = environment()->Pop();
- callee_value = NewNode(javascript()->LoadProperty(), object, key);
+ callee_value =
+ NewNode(javascript()->LoadProperty(LoadPropertyFeedback(slot)),
+ object, key);
}
PrepareFrameState(callee_value, property->LoadId(),
OutputFrameStateCombine::Push());
@@ -1326,7 +1339,9 @@ void AstGraphBuilder::VisitCallJSRuntime(CallRuntime* expr) {
CallFunctionFlags flags = NO_CALL_FUNCTION_FLAGS;
Node* receiver_value = BuildLoadBuiltinsObject();
Unique<String> unique = MakeUnique(name);
- Node* callee_value = NewNode(javascript()->LoadNamed(unique), receiver_value);
+ int slot = expr->CallRuntimeFeedbackSlot();
+ Node* callee_value = NewNode(
+ javascript()->LoadNamed(unique, LoadNamedFeedback(slot)), receiver_value);
// TODO(jarin): Find/create a bailout id to deoptimize to (crankshaft
// refuses to optimize functions with jsruntime calls).
PrepareFrameState(callee_value, BailoutId::None(),
@@ -1401,8 +1416,8 @@ void AstGraphBuilder::VisitCountOperation(CountOperation* expr) {
int stack_depth = -1;
switch (assign_type) {
case VARIABLE: {
- Variable* variable = expr->expression()->AsVariableProxy()->var();
- old_value = BuildVariableLoad(variable, expr->expression()->id());
+ VariableProxy* proxy = expr->expression()->AsVariableProxy();
+ old_value = BuildVariableLoad(proxy, expr->expression()->id());
stack_depth = 0;
break;
}
@@ -1411,7 +1426,9 @@ void AstGraphBuilder::VisitCountOperation(CountOperation* expr) {
Node* object = environment()->Top();
Unique<Name> name =
MakeUnique(property->key()->AsLiteral()->AsPropertyName());
- old_value = NewNode(javascript()->LoadNamed(name), object);
+ int slot = property->PropertyFeedbackSlot();
+ old_value = NewNode(
+ javascript()->LoadNamed(name, LoadNamedFeedback(slot)), object);
PrepareFrameState(old_value, property->LoadId(),
OutputFrameStateCombine::Push());
stack_depth = 1;
@@ -1422,7 +1439,9 @@ void AstGraphBuilder::VisitCountOperation(CountOperation* expr) {
VisitForValue(property->key());
Node* key = environment()->Top();
Node* object = environment()->Peek(1);
- old_value = NewNode(javascript()->LoadProperty(), object, key);
+ int slot = property->PropertyFeedbackSlot();
+ old_value = NewNode(
+ javascript()->LoadProperty(LoadPropertyFeedback(slot)), object, key);
PrepareFrameState(old_value, property->LoadId(),
OutputFrameStateCombine::Push());
stack_depth = 2;
@@ -1632,9 +1651,9 @@ void AstGraphBuilder::VisitTypeof(UnaryOperation* expr) {
if (expr->expression()->IsVariableProxy()) {
// Typeof does not throw a reference error on global variables, hence we
// perform a non-contextual load in case the operand is a variable proxy.
- Variable* variable = expr->expression()->AsVariableProxy()->var();
+ VariableProxy* proxy = expr->expression()->AsVariableProxy();
operand =
- BuildVariableLoad(variable, expr->expression()->id(), NOT_CONTEXTUAL);
+ BuildVariableLoad(proxy, expr->expression()->id(), NOT_CONTEXTUAL);
} else {
VisitForValue(expr->expression());
operand = environment()->Pop();
@@ -1777,9 +1796,11 @@ Node* AstGraphBuilder::BuildHoleCheckThrow(Node* value, Variable* variable,
}
-Node* AstGraphBuilder::BuildVariableLoad(Variable* variable,
+Node* AstGraphBuilder::BuildVariableLoad(VariableProxy* proxy,
BailoutId bailout_id,
ContextualMode contextual_mode) {
+ Variable* variable = proxy->var();
+ int slot = proxy->VariableFeedbackSlot();
Node* the_hole = jsgraph()->TheHoleConstant();
VariableMode mode = variable->mode();
switch (variable->location()) {
@@ -1787,7 +1808,8 @@ Node* AstGraphBuilder::BuildVariableLoad(Variable* variable,
// Global var, const, or let variable.
Node* global = BuildLoadGlobalObject();
Unique<Name> name = MakeUnique(variable->name());
- const Operator* op = javascript()->LoadNamed(name, contextual_mode);
+ const Operator* op = javascript()->LoadNamed(
+ name, LoadNamedFeedback(slot), contextual_mode);
Node* node = NewNode(op, global);
PrepareFrameState(node, bailout_id, OutputFrameStateCombine::Push());
return node;

Powered by Google App Engine
This is Rietveld 408576698