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/interpreter/bytecode-generator.cc

Issue 2423053002: Install the 'name' property in classes at runtime (Closed)
Patch Set: Move computed property names check to parser and runtime function Created 4 years, 1 month 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 c67e5d43f706b797a63f5fe9b77257d0fefefe69..c0b3df0f3f8c3e400c1c72846e2c90b9c73df7a0 100644
--- a/src/interpreter/bytecode-generator.cc
+++ b/src/interpreter/bytecode-generator.cc
@@ -1392,6 +1392,7 @@ void BytecodeGenerator::VisitClassLiteral(ClassLiteral* expr) {
.StoreAccumulatorInRegister(prototype);
VisitClassLiteralProperties(expr, literal, prototype);
+ BuildClassLiteralNameProperty(expr, literal);
builder()->CallRuntime(Runtime::kToFastProperties, literal);
// Assign to class variable.
if (expr->class_variable_proxy() != nullptr) {
@@ -1493,6 +1494,19 @@ void BytecodeGenerator::VisitClassLiteralProperties(ClassLiteral* expr,
}
}
+void BytecodeGenerator::BuildClassLiteralNameProperty(ClassLiteral* expr,
+ Register literal) {
+ if (!expr->has_name_static_property() &&
+ !expr->constructor()->raw_name()->IsEmpty()) {
+ RegisterList args = register_allocator()->NewRegisterList(2);
+ builder()
+ ->MoveRegister(literal, args[0])
+ .LoadBoolean(expr->has_static_computed_names())
+ .StoreAccumulatorInRegister(args[1])
rmcilroy 2016/11/29 13:05:23 Rather than storing a compile time known boolean a
+ .CallRuntime(Runtime::kInstallClassNameAccessor, args);
+ }
+}
+
void BytecodeGenerator::VisitNativeFunctionLiteral(
NativeFunctionLiteral* expr) {
size_t entry = builder()->AllocateConstantPoolEntry();

Powered by Google App Engine
This is Rietveld 408576698