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

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

Issue 1235983002: [strong] class objects created in strong mode have their prototype frozen (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 unified diff | Download patch
« no previous file with comments | « src/arm64/full-codegen-arm64.cc ('k') | src/full-codegen.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 1623 matching lines...) Expand 10 before | Expand all | Expand 10 after
1634 break; 1634 break;
1635 } 1635 }
1636 } 1636 }
1637 } 1637 }
1638 1638
1639 // Transform both the class literal and the prototype to fast properties. 1639 // Transform both the class literal and the prototype to fast properties.
1640 const Operator* op = javascript()->CallRuntime(Runtime::kToFastProperties, 1); 1640 const Operator* op = javascript()->CallRuntime(Runtime::kToFastProperties, 1);
1641 NewNode(op, environment()->Pop()); // prototype 1641 NewNode(op, environment()->Pop()); // prototype
1642 NewNode(op, environment()->Pop()); // literal 1642 NewNode(op, environment()->Pop()); // literal
1643 if (is_strong(language_mode())) { 1643 if (is_strong(language_mode())) {
1644 proto =
1645 NewNode(javascript()->CallRuntime(Runtime::kObjectFreeze, 1), proto);
1646 // Freezing the class prototype should never deopt.
1647 PrepareFrameState(proto, BailoutId::None());
1648
1644 // TODO(conradw): It would be more efficient to define the properties with 1649 // TODO(conradw): It would be more efficient to define the properties with
rossberg 2015/07/14 07:45:22 Nit: move this comment before the proto freeze (ap
conradw 2015/07/14 11:21:27 Done.
1645 // the right attributes the first time round. 1650 // the right attributes the first time round.
1646 literal = 1651 literal =
1647 NewNode(javascript()->CallRuntime(Runtime::kObjectFreeze, 1), literal); 1652 NewNode(javascript()->CallRuntime(Runtime::kObjectFreeze, 1), literal);
1648 // Freezing the class object should never deopt. 1653 // Freezing the class object should never deopt.
1649 PrepareFrameState(literal, BailoutId::None()); 1654 PrepareFrameState(literal, BailoutId::None());
1650 } 1655 }
1651 1656
1652 // Assign to class variable. 1657 // Assign to class variable.
1653 if (expr->scope() != NULL) { 1658 if (expr->scope() != NULL) {
1654 DCHECK_NOT_NULL(expr->class_variable_proxy()); 1659 DCHECK_NOT_NULL(expr->class_variable_proxy());
(...skipping 2590 matching lines...) Expand 10 before | Expand all | Expand 10 after
4245 // Phi does not exist yet, introduce one. 4250 // Phi does not exist yet, introduce one.
4246 value = NewPhi(inputs, value, control); 4251 value = NewPhi(inputs, value, control);
4247 value->ReplaceInput(inputs - 1, other); 4252 value->ReplaceInput(inputs - 1, other);
4248 } 4253 }
4249 return value; 4254 return value;
4250 } 4255 }
4251 4256
4252 } // namespace compiler 4257 } // namespace compiler
4253 } // namespace internal 4258 } // namespace internal
4254 } // namespace v8 4259 } // namespace v8
OLDNEW
« no previous file with comments | « src/arm64/full-codegen-arm64.cc ('k') | src/full-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698