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

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

Issue 2707873002: Collect type profile for DevTools. (Closed)
Patch Set: Use constructor name if available. Created 3 years, 10 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/interpreter/bytecode-generator.cc
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc
index d6ed4a0a67d40bf6d38ba2d21196c6cdaff4d5f0..bdd91b688f1c0573a3ceec9c79d341182fcf1072 100644
--- a/src/interpreter/bytecode-generator.cc
+++ b/src/interpreter/bytecode-generator.cc
@@ -921,6 +921,7 @@ void BytecodeGenerator::VisitVariableDeclaration(VariableDeclaration* decl) {
->LoadLiteral(variable->raw_name())
.StoreAccumulatorInRegister(name)
.CallRuntime(Runtime::kDeclareEvalVar, name);
+
break;
}
case VariableLocation::MODULE:
@@ -2214,18 +2215,31 @@ void BytecodeGenerator::VisitAssignment(Assignment* expr) {
LhsKind assign_type = Property::GetAssignType(property);
// Evaluate LHS expression.
+ Register lhs_name = register_allocator()->NewRegister();
+
switch (assign_type) {
case VARIABLE:
+ if (FLAG_type_profile) {
Yang 2017/02/22 10:39:28 The issue with this flag and snapshot is: if the f
+ 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 (FLAG_type_profile) {
+ builder()->LoadLiteral(name).StoreAccumulatorInRegister(lhs_name);
+ }
break;
}
case KEYED_PROPERTY: {
object = VisitForRegisterValue(property->obj());
key = VisitForRegisterValue(property->key());
+ if (FLAG_type_profile) {
+ builder()->StoreAccumulatorInRegister(lhs_name);
+ }
break;
}
case NAMED_SUPER_PROPERTY: {
@@ -2238,6 +2252,9 @@ void BytecodeGenerator::VisitAssignment(Assignment* expr) {
builder()
->LoadLiteral(property->key()->AsLiteral()->AsRawPropertyName())
.StoreAccumulatorInRegister(super_property_args[2]);
+ if (FLAG_type_profile) {
+ builder()->StoreAccumulatorInRegister(lhs_name);
+ }
break;
}
case KEYED_SUPER_PROPERTY: {
@@ -2248,6 +2265,10 @@ void BytecodeGenerator::VisitAssignment(Assignment* expr) {
VisitForRegisterValue(super_property->home_object(),
super_property_args[1]);
VisitForRegisterValue(property->key(), super_property_args[2]);
+ if (FLAG_type_profile) {
+ builder()->StoreAccumulatorInRegister(lhs_name);
+ }
+
break;
}
}
@@ -2336,6 +2357,17 @@ void BytecodeGenerator::VisitAssignment(Assignment* expr) {
break;
}
}
+
+ // Value is in accumulator.
+ if (FLAG_type_profile) {
+ Register value = register_allocator()->NewRegister();
+ builder()->StoreAccumulatorInRegister(value);
+
+ FeedbackSlot collect_type_feedback_slot = expr->CollectTypeProfileSlot();
+
+ builder()->CollectTypeProfile(lhs_name, value,
Yang 2017/02/22 10:39:28 We would at some point need a mapping from feedbac
+ feedback_index(collect_type_feedback_slot));
+ }
}
void BytecodeGenerator::VisitYield(Yield* expr) {

Powered by Google App Engine
This is Rietveld 408576698