Index: src/full-codegen/full-codegen.cc |
diff --git a/src/full-codegen/full-codegen.cc b/src/full-codegen/full-codegen.cc |
index af7d00f58bda96828afbddfef382a73eec76f99f..486b00584c1c8ae3df291da83014ed8de813ac0a 100644 |
--- a/src/full-codegen/full-codegen.cc |
+++ b/src/full-codegen/full-codegen.cc |
@@ -1366,9 +1366,23 @@ void FullCodeGenerator::VisitClassLiteral(ClassLiteral* lit) { |
__ CallRuntime(Runtime::kDefineClass); |
PrepareForBailoutForId(lit->CreateLiteralId(), TOS_REG); |
+ __ Push(result_register()); |
+ |
+ // Load the "prototype" from the constructor. |
+ __ Move(LoadDescriptor::ReceiverRegister(), result_register()); |
+ __ LoadRoot(LoadDescriptor::NameRegister(), |
+ Heap::kprototype_stringRootIndex); |
+ __ Move(LoadDescriptor::SlotRegister(), SmiFromSlot(lit->PrototypeSlot())); |
+ CallLoadIC(NOT_INSIDE_TYPEOF); |
+ PrepareForBailoutForId(lit->PrototypeId(), TOS_REG); |
+ __ Push(result_register()); |
EmitClassDefineProperties(lit); |
+ // Set both the prototype and constructor to have fast properties, and also |
+ // freeze them in strong mode. |
+ __ CallRuntime(Runtime::kFinalizeClassDefinition); |
+ |
if (lit->class_variable_proxy() != nullptr) { |
EmitVariableAssignment(lit->class_variable_proxy()->var(), Token::INIT, |
lit->ProxySlot()); |