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

Side by Side 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, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/compiler/linkage.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/ast-graph-builder.h" 5 #include "src/compiler/ast-graph-builder.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 #include "src/compiler/ast-loop-assignment-analyzer.h" 8 #include "src/compiler/ast-loop-assignment-analyzer.h"
9 #include "src/compiler/control-builders.h" 9 #include "src/compiler/control-builders.h"
10 #include "src/compiler/js-type-feedback.h" 10 #include "src/compiler/js-type-feedback.h"
(...skipping 1621 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 case ObjectLiteral::Property::SETTER: { 1632 case ObjectLiteral::Property::SETTER: {
1633 Node* attr = jsgraph()->Constant(DONT_ENUM); 1633 Node* attr = jsgraph()->Constant(DONT_ENUM);
1634 const Operator* op = javascript()->CallRuntime( 1634 const Operator* op = javascript()->CallRuntime(
1635 Runtime::kDefineSetterPropertyUnchecked, 4); 1635 Runtime::kDefineSetterPropertyUnchecked, 4);
1636 NewNode(op, receiver, key, value, attr); 1636 NewNode(op, receiver, key, value, attr);
1637 break; 1637 break;
1638 } 1638 }
1639 } 1639 }
1640 } 1640 }
1641 1641
1642 // Transform both the class literal and the prototype to fast properties. 1642 // Set both the prototype and constructor to have fast properties, and also
1643 const Operator* op = javascript()->CallRuntime(Runtime::kToFastProperties, 1); 1643 // freeze them in strong mode.
1644 NewNode(op, environment()->Pop()); // prototype 1644 environment()->Pop(); // proto
1645 NewNode(op, environment()->Pop()); // literal 1645 environment()->Pop(); // literal
1646 if (is_strong(language_mode())) { 1646 const Operator* op = javascript()->CallRuntime(
1647 // TODO(conradw): It would be more efficient to define the properties with 1647 is_strong(language_mode()) ? Runtime::kFinalizeClassDefinitionStrong
1648 // the right attributes the first time round. 1648 : Runtime::kFinalizeClassDefinition,
1649 // Freeze the prototype. 1649 2);
1650 proto = 1650 literal = NewNode(op, literal, proto);
1651 NewNode(javascript()->CallRuntime(Runtime::kObjectFreeze, 1), proto);
1652 // Freezing the prototype should never deopt.
1653 PrepareFrameState(proto, BailoutId::None());
1654 // Freeze the constructor.
1655 literal =
1656 NewNode(javascript()->CallRuntime(Runtime::kObjectFreeze, 1), literal);
1657 // Freezing the constructor should never deopt.
1658 PrepareFrameState(literal, BailoutId::None());
1659 }
1660 1651
1661 // Assign to class variable. 1652 // Assign to class variable.
1662 if (expr->scope() != NULL) { 1653 if (expr->scope() != NULL) {
1663 DCHECK_NOT_NULL(expr->class_variable_proxy()); 1654 DCHECK_NOT_NULL(expr->class_variable_proxy());
1664 Variable* var = expr->class_variable_proxy()->var(); 1655 Variable* var = expr->class_variable_proxy()->var();
1665 FrameStateBeforeAndAfter states(this, BailoutId::None()); 1656 FrameStateBeforeAndAfter states(this, BailoutId::None());
1666 VectorSlotPair feedback = 1657 VectorSlotPair feedback =
1667 CreateVectorSlotPair(FLAG_vector_stores && var->IsUnallocated() 1658 CreateVectorSlotPair(FLAG_vector_stores && var->IsUnallocated()
1668 ? expr->GetNthSlot(store_slot_index++) 1659 ? expr->GetNthSlot(store_slot_index++)
1669 : FeedbackVectorICSlot::Invalid()); 1660 : FeedbackVectorICSlot::Invalid());
(...skipping 2644 matching lines...) Expand 10 before | Expand all | Expand 10 after
4314 // Phi does not exist yet, introduce one. 4305 // Phi does not exist yet, introduce one.
4315 value = NewPhi(inputs, value, control); 4306 value = NewPhi(inputs, value, control);
4316 value->ReplaceInput(inputs - 1, other); 4307 value->ReplaceInput(inputs - 1, other);
4317 } 4308 }
4318 return value; 4309 return value;
4319 } 4310 }
4320 4311
4321 } // namespace compiler 4312 } // namespace compiler
4322 } // namespace internal 4313 } // namespace internal
4323 } // namespace v8 4314 } // namespace v8
OLDNEW
« 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