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

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

Issue 880963002: Add missing FrameState to JSToName nodes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Ported to other architectures. Created 5 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 unified diff | Download patch
« no previous file with comments | « src/compiler/ast-graph-builder.h ('k') | src/compiler/operator-properties.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/machine-operator.h" 10 #include "src/compiler/machine-operator.h"
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 // during evaluation of the method values. 892 // during evaluation of the method values.
893 environment()->Push(literal); 893 environment()->Push(literal);
894 environment()->Push(proto); 894 environment()->Push(proto);
895 895
896 // Create nodes to store method values into the literal. 896 // Create nodes to store method values into the literal.
897 for (int i = 0; i < expr->properties()->length(); i++) { 897 for (int i = 0; i < expr->properties()->length(); i++) {
898 ObjectLiteral::Property* property = expr->properties()->at(i); 898 ObjectLiteral::Property* property = expr->properties()->at(i);
899 environment()->Push(property->is_static() ? literal : proto); 899 environment()->Push(property->is_static() ? literal : proto);
900 900
901 VisitForValue(property->key()); 901 VisitForValue(property->key());
902 environment()->Push(BuildToName(environment()->Pop())); 902 environment()->Push(
903 BuildToName(environment()->Pop(), expr->GetIdForProperty(i)));
903 VisitForValue(property->value()); 904 VisitForValue(property->value());
904 Node* value = environment()->Pop(); 905 Node* value = environment()->Pop();
905 Node* key = environment()->Pop(); 906 Node* key = environment()->Pop();
906 Node* receiver = environment()->Pop(); 907 Node* receiver = environment()->Pop();
907 switch (property->kind()) { 908 switch (property->kind()) {
908 case ObjectLiteral::Property::CONSTANT: 909 case ObjectLiteral::Property::CONSTANT:
909 case ObjectLiteral::Property::MATERIALIZED_LITERAL: 910 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
910 case ObjectLiteral::Property::PROTOTYPE: 911 case ObjectLiteral::Property::PROTOTYPE:
911 UNREACHABLE(); 912 UNREACHABLE();
912 case ObjectLiteral::Property::COMPUTED: { 913 case ObjectLiteral::Property::COMPUTED: {
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 // its right. All the code from above initializes the static component of the 1125 // its right. All the code from above initializes the static component of the
1125 // object literal, and arranges for the map of the result to reflect the 1126 // object literal, and arranges for the map of the result to reflect the
1126 // static order in which the keys appear. For the dynamic properties, we 1127 // static order in which the keys appear. For the dynamic properties, we
1127 // compile them into a series of "SetOwnProperty" runtime calls. This will 1128 // compile them into a series of "SetOwnProperty" runtime calls. This will
1128 // preserve insertion order. 1129 // preserve insertion order.
1129 for (; property_index < expr->properties()->length(); property_index++) { 1130 for (; property_index < expr->properties()->length(); property_index++) {
1130 ObjectLiteral::Property* property = expr->properties()->at(property_index); 1131 ObjectLiteral::Property* property = expr->properties()->at(property_index);
1131 1132
1132 environment()->Push(literal); // Duplicate receiver. 1133 environment()->Push(literal); // Duplicate receiver.
1133 VisitForValue(property->key()); 1134 VisitForValue(property->key());
1134 environment()->Push(BuildToName(environment()->Pop())); 1135 environment()->Push(BuildToName(environment()->Pop(),
1136 expr->GetIdForProperty(property_index)));
1135 // TODO(mstarzinger): For ObjectLiteral::Property::PROTOTYPE the key should 1137 // TODO(mstarzinger): For ObjectLiteral::Property::PROTOTYPE the key should
1136 // not be on the operand stack while the value is being evaluated. Come up 1138 // not be on the operand stack while the value is being evaluated. Come up
1137 // with a repro for this and fix it. Also find a nice way to do so. :) 1139 // with a repro for this and fix it. Also find a nice way to do so. :)
1138 VisitForValue(property->value()); 1140 VisitForValue(property->value());
1139 Node* value = environment()->Pop(); 1141 Node* value = environment()->Pop();
1140 Node* key = environment()->Pop(); 1142 Node* key = environment()->Pop();
1141 Node* receiver = environment()->Pop(); 1143 Node* receiver = environment()->Pop();
1142 1144
1143 switch (property->kind()) { 1145 switch (property->kind()) {
1144 case ObjectLiteral::Property::CONSTANT: 1146 case ObjectLiteral::Property::CONSTANT:
(...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after
2317 } 2319 }
2318 if (NodeProperties::IsTyped(input)) { 2320 if (NodeProperties::IsTyped(input)) {
2319 Type* upper = NodeProperties::GetBounds(input).upper; 2321 Type* upper = NodeProperties::GetBounds(input).upper;
2320 if (upper->Is(Type::Boolean())) return input; 2322 if (upper->Is(Type::Boolean())) return input;
2321 } 2323 }
2322 2324
2323 return NewNode(javascript()->ToBoolean(), input); 2325 return NewNode(javascript()->ToBoolean(), input);
2324 } 2326 }
2325 2327
2326 2328
2327 Node* AstGraphBuilder::BuildToName(Node* input) { 2329 Node* AstGraphBuilder::BuildToName(Node* input, BailoutId bailout_id) {
2328 // TODO(turbofan): Possible optimization is to NOP on name constants. But the 2330 // TODO(turbofan): Possible optimization is to NOP on name constants. But the
2329 // same caveat as with BuildToBoolean applies, and it should be factored out 2331 // same caveat as with BuildToBoolean applies, and it should be factored out
2330 // into a JSOperatorReducer. 2332 // into a JSOperatorReducer.
2331 return NewNode(javascript()->ToName(), input); 2333 Node* name = NewNode(javascript()->ToName(), input);
2334 PrepareFrameState(name, bailout_id);
2335 return name;
2332 } 2336 }
2333 2337
2334 2338
2335 Node* AstGraphBuilder::BuildThrowReferenceError(Variable* variable, 2339 Node* AstGraphBuilder::BuildThrowReferenceError(Variable* variable,
2336 BailoutId bailout_id) { 2340 BailoutId bailout_id) {
2337 // TODO(mstarzinger): Should be unified with the VisitThrow implementation. 2341 // TODO(mstarzinger): Should be unified with the VisitThrow implementation.
2338 Node* variable_name = jsgraph()->Constant(variable->name()); 2342 Node* variable_name = jsgraph()->Constant(variable->name());
2339 const Operator* op = 2343 const Operator* op =
2340 javascript()->CallRuntime(Runtime::kThrowReferenceError, 1); 2344 javascript()->CallRuntime(Runtime::kThrowReferenceError, 1);
2341 Node* call = NewNode(op, variable_name); 2345 Node* call = NewNode(op, variable_name);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
2434 2438
2435 BitVector* AstGraphBuilder::GetVariablesAssignedInLoop( 2439 BitVector* AstGraphBuilder::GetVariablesAssignedInLoop(
2436 IterationStatement* stmt) { 2440 IterationStatement* stmt) {
2437 if (loop_assignment_analysis_ == NULL) return NULL; 2441 if (loop_assignment_analysis_ == NULL) return NULL;
2438 return loop_assignment_analysis_->GetVariablesAssignedInLoop(stmt); 2442 return loop_assignment_analysis_->GetVariablesAssignedInLoop(stmt);
2439 } 2443 }
2440 2444
2441 } // namespace compiler 2445 } // namespace compiler
2442 } // namespace internal 2446 } // namespace internal
2443 } // namespace v8 2447 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ast-graph-builder.h ('k') | src/compiler/operator-properties.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698