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

Unified Diff: src/interpreter/bytecode-generator.cc

Issue 2755973002: [type profile] Collect return types. (Closed)
Patch Set: Rebase. Created 3 years, 9 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/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-generator.cc
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc
index f67e7b927c28e4a9502c50b1ae98b1c652d48cf9..a3ef2471b6c207c43c35ec6b03e0565821395436 100644
--- a/src/interpreter/bytecode-generator.cc
+++ b/src/interpreter/bytecode-generator.cc
@@ -1093,6 +1093,12 @@ void BytecodeGenerator::VisitReturnStatement(ReturnStatement* stmt) {
builder()->SetStatementPosition(stmt);
VisitForAccumulatorValue(stmt->expression());
+ if (stmt->HasTypeProfileSlot()) {
+ FeedbackSlot collect_type_feedback_slot = stmt->TypeProfileSlot();
+ builder()->CollectTypeProfile(stmt->position(),
+ feedback_index(collect_type_feedback_slot));
+ }
+
if (stmt->is_async_return()) {
execution_control()->AsyncReturnAccumulator();
} else {
@@ -2211,34 +2217,18 @@ void BytecodeGenerator::VisitAssignment(Assignment* expr) {
LhsKind assign_type = Property::GetAssignType(property);
// Evaluate LHS expression.
- Register lhs_name;
- if (expr->HasTypeProfileSlot()) {
- lhs_name = register_allocator()->NewRegister();
- }
-
switch (assign_type) {
case VARIABLE:
- if (expr->HasTypeProfileSlot()) {
- builder()
- ->LoadLiteral(expr->target()->AsVariableProxy()->var()->raw_name())
- .StoreAccumulatorInRegister(lhs_name);
- }
// Nothing to do to evaluate variable assignment LHS.
break;
case NAMED_PROPERTY: {
object = VisitForRegisterValue(property->obj());
name = property->key()->AsLiteral()->AsRawPropertyName();
- if (expr->HasTypeProfileSlot()) {
- builder()->LoadLiteral(name).StoreAccumulatorInRegister(lhs_name);
- }
break;
}
case KEYED_PROPERTY: {
object = VisitForRegisterValue(property->obj());
key = VisitForRegisterValue(property->key());
- if (expr->HasTypeProfileSlot()) {
- builder()->StoreAccumulatorInRegister(lhs_name);
- }
break;
}
case NAMED_SUPER_PROPERTY: {
@@ -2251,9 +2241,6 @@ void BytecodeGenerator::VisitAssignment(Assignment* expr) {
builder()
->LoadLiteral(property->key()->AsLiteral()->AsRawPropertyName())
.StoreAccumulatorInRegister(super_property_args[2]);
- if (expr->HasTypeProfileSlot()) {
- builder()->StoreAccumulatorInRegister(lhs_name);
- }
break;
}
case KEYED_SUPER_PROPERTY: {
@@ -2264,10 +2251,6 @@ void BytecodeGenerator::VisitAssignment(Assignment* expr) {
VisitForRegisterValue(super_property->home_object(),
super_property_args[1]);
VisitForRegisterValue(property->key(), super_property_args[2]);
- if (expr->HasTypeProfileSlot()) {
- builder()->StoreAccumulatorInRegister(lhs_name);
- }
-
break;
}
}
@@ -2358,10 +2341,12 @@ void BytecodeGenerator::VisitAssignment(Assignment* expr) {
}
// Value is in accumulator.
- if (expr->HasTypeProfileSlot()) {
+ // TODO(franzih): Collect type profile once we can handle more than just
+ // return statements.
+ if (false && expr->HasTypeProfileSlot()) {
FeedbackSlot collect_type_feedback_slot = expr->TypeProfileSlot();
- builder()->CollectTypeProfile(lhs_name,
+ builder()->CollectTypeProfile(expr->position(),
feedback_index(collect_type_feedback_slot));
}
}
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698