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

Unified Diff: src/full-codegen/full-codegen.cc

Issue 1679813002: [compiler] Remove the special case "prototype" load in class literals. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix mips. Created 4 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
« no previous file with comments | « src/full-codegen/arm64/full-codegen-arm64.cc ('k') | src/full-codegen/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « src/full-codegen/arm64/full-codegen-arm64.cc ('k') | src/full-codegen/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698