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(); |