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

Side by Side Diff: src/compiler/ast-graph-builder.cc

Issue 2423053002: Install the 'name' property in classes at runtime (Closed)
Patch Set: Avoid a runtime call for anonymous classes Created 4 years, 1 month 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
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/ast/compile-time-value.h" 7 #include "src/ast/compile-time-value.h"
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/compilation-info.h" 9 #include "src/compilation-info.h"
10 #include "src/compiler.h" 10 #include "src/compiler.h"
(...skipping 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after
1665 NewNode(op, receiver, key, value, attr); 1665 NewNode(op, receiver, key, value, attr);
1666 break; 1666 break;
1667 } 1667 }
1668 case ClassLiteral::Property::FIELD: { 1668 case ClassLiteral::Property::FIELD: {
1669 UNREACHABLE(); 1669 UNREACHABLE();
1670 break; 1670 break;
1671 } 1671 }
1672 } 1672 }
1673 } 1673 }
1674 1674
1675 // Set the constructor to have fast properties.
1676 prototype = environment()->Pop(); 1675 prototype = environment()->Pop();
1677 literal = environment()->Pop(); 1676 literal = environment()->Pop();
1677
1678 // ES6 section 14.5.16 class expression evaluation, step 5
1679 DCHECK(expr->constructor()->raw_name() != nullptr);
1680 if (!expr->constructor()->raw_name()->IsEmpty()) {
1681 Node* value = jsgraph()->Constant(expr->constructor()->name());
1682 const Operator* op =
1683 javascript()->CallRuntime(Runtime::kDefineClassNameProperty);
1684 literal = NewNode(op, literal, value);
1685 PrepareFrameState(literal, BailoutId::None());
1686 }
1687
1688 // Set the constructor to have fast properties.
1678 const Operator* op = javascript()->CallRuntime(Runtime::kToFastProperties); 1689 const Operator* op = javascript()->CallRuntime(Runtime::kToFastProperties);
1679 literal = NewNode(op, literal); 1690 literal = NewNode(op, literal);
1680 1691
1681 // Assign to class variable. 1692 // Assign to class variable.
1682 if (expr->class_variable_proxy() != nullptr) { 1693 if (expr->class_variable_proxy() != nullptr) {
1683 Variable* var = expr->class_variable_proxy()->var(); 1694 Variable* var = expr->class_variable_proxy()->var();
1684 VectorSlotPair feedback = CreateVectorSlotPair( 1695 VectorSlotPair feedback = CreateVectorSlotPair(
1685 expr->NeedsProxySlot() ? expr->ProxySlot() 1696 expr->NeedsProxySlot() ? expr->ProxySlot()
1686 : FeedbackVectorSlot::Invalid()); 1697 : FeedbackVectorSlot::Invalid());
1687 BuildVariableAssignment(var, literal, Token::INIT, feedback, 1698 BuildVariableAssignment(var, literal, Token::INIT, feedback,
(...skipping 2667 matching lines...) Expand 10 before | Expand all | Expand 10 after
4355 // Phi does not exist yet, introduce one. 4366 // Phi does not exist yet, introduce one.
4356 value = NewPhi(inputs, value, control); 4367 value = NewPhi(inputs, value, control);
4357 value->ReplaceInput(inputs - 1, other); 4368 value->ReplaceInput(inputs - 1, other);
4358 } 4369 }
4359 return value; 4370 return value;
4360 } 4371 }
4361 4372
4362 } // namespace compiler 4373 } // namespace compiler
4363 } // namespace internal 4374 } // namespace internal
4364 } // namespace v8 4375 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/contexts.h » ('j') | src/full-codegen/x64/full-codegen-x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698