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

Unified Diff: src/compiler/ast-graph-builder.cc

Issue 1266573003: Move final parts of class literal setup into a single runtime call (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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 | « no previous file | src/compiler/linkage.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
index a9a767817515558621ffdf381352033aaf5a367d..f32d630eff435865260fc395eedaa71e7e9c74df 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -1639,24 +1639,15 @@ void AstGraphBuilder::VisitClassLiteralContents(ClassLiteral* expr) {
}
}
- // Transform both the class literal and the prototype to fast properties.
- const Operator* op = javascript()->CallRuntime(Runtime::kToFastProperties, 1);
- NewNode(op, environment()->Pop()); // prototype
- NewNode(op, environment()->Pop()); // literal
- if (is_strong(language_mode())) {
- // TODO(conradw): It would be more efficient to define the properties with
- // the right attributes the first time round.
- // Freeze the prototype.
- proto =
- NewNode(javascript()->CallRuntime(Runtime::kObjectFreeze, 1), proto);
- // Freezing the prototype should never deopt.
- PrepareFrameState(proto, BailoutId::None());
- // Freeze the constructor.
- literal =
- NewNode(javascript()->CallRuntime(Runtime::kObjectFreeze, 1), literal);
- // Freezing the constructor should never deopt.
- PrepareFrameState(literal, BailoutId::None());
- }
+ // Set both the prototype and constructor to have fast properties, and also
+ // freeze them in strong mode.
+ environment()->Pop(); // proto
+ environment()->Pop(); // literal
+ const Operator* op = javascript()->CallRuntime(
+ is_strong(language_mode()) ? Runtime::kFinalizeClassDefinitionStrong
+ : Runtime::kFinalizeClassDefinition,
+ 2);
+ literal = NewNode(op, literal, proto);
// Assign to class variable.
if (expr->scope() != NULL) {
« no previous file with comments | « no previous file | src/compiler/linkage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698