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 881303002: [turbofan] Add missing deopt for the assignment in the for-in statement. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add test. 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/ia32/full-codegen-ia32.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 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 is_property_missing.Else(); 767 is_property_missing.Else();
768 is_property_missing.End(); 768 is_property_missing.End();
769 } 769 }
770 // Replace 'value' in environment. 770 // Replace 'value' in environment.
771 environment()->Push(res); 771 environment()->Push(res);
772 test_should_filter.Else(); 772 test_should_filter.Else();
773 test_should_filter.End(); 773 test_should_filter.End();
774 } 774 }
775 value = environment()->Pop(); 775 value = environment()->Pop();
776 // Bind value and do loop body. 776 // Bind value and do loop body.
777 VisitForInAssignment(stmt->each(), value); 777 VisitForInAssignment(stmt->each(), value, stmt->AssignmentId());
778 VisitIterationBody(stmt, &for_loop, 5); 778 VisitIterationBody(stmt, &for_loop, 5);
779 for_loop.EndBody(); 779 for_loop.EndBody();
780 // Inc counter and continue. 780 // Inc counter and continue.
781 Node* index_inc = 781 Node* index_inc =
782 NewNode(javascript()->Add(), index, jsgraph()->OneConstant()); 782 NewNode(javascript()->Add(), index, jsgraph()->OneConstant());
783 // TODO(jarin): provide real bailout id. 783 // TODO(jarin): provide real bailout id.
784 PrepareFrameState(index_inc, BailoutId::None()); 784 PrepareFrameState(index_inc, BailoutId::None());
785 environment()->Poke(0, index_inc); 785 environment()->Poke(0, index_inc);
786 for_loop.EndLoop(); 786 for_loop.EndLoop();
787 environment()->Drop(5); 787 environment()->Drop(5);
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 Node* store = NewNode(javascript()->StoreProperty(strict_mode()), literal, 1221 Node* store = NewNode(javascript()->StoreProperty(strict_mode()), literal,
1222 index, value); 1222 index, value);
1223 PrepareFrameState(store, expr->GetIdForElement(i)); 1223 PrepareFrameState(store, expr->GetIdForElement(i));
1224 } 1224 }
1225 1225
1226 environment()->Pop(); // Array literal index. 1226 environment()->Pop(); // Array literal index.
1227 ast_context()->ProduceValue(environment()->Pop()); 1227 ast_context()->ProduceValue(environment()->Pop());
1228 } 1228 }
1229 1229
1230 1230
1231 void AstGraphBuilder::VisitForInAssignment(Expression* expr, Node* value) { 1231 void AstGraphBuilder::VisitForInAssignment(Expression* expr, Node* value,
1232 BailoutId bailout_id) {
1232 DCHECK(expr->IsValidReferenceExpression()); 1233 DCHECK(expr->IsValidReferenceExpression());
1233 1234
1234 // Left-hand side can only be a property, a global or a variable slot. 1235 // Left-hand side can only be a property, a global or a variable slot.
1235 Property* property = expr->AsProperty(); 1236 Property* property = expr->AsProperty();
1236 LhsKind assign_type = DetermineLhsKind(expr); 1237 LhsKind assign_type = DetermineLhsKind(expr);
1237 1238
1238 // Evaluate LHS expression and store the value. 1239 // Evaluate LHS expression and store the value.
1239 switch (assign_type) { 1240 switch (assign_type) {
1240 case VARIABLE: { 1241 case VARIABLE: {
1241 Variable* var = expr->AsVariableProxy()->var(); 1242 Variable* var = expr->AsVariableProxy()->var();
1242 // TODO(jarin) Fill in the correct bailout id. 1243 BuildVariableAssignment(var, value, Token::ASSIGN, bailout_id);
1243 BuildVariableAssignment(var, value, Token::ASSIGN, BailoutId::None());
1244 break; 1244 break;
1245 } 1245 }
1246 case NAMED_PROPERTY: { 1246 case NAMED_PROPERTY: {
1247 environment()->Push(value); 1247 environment()->Push(value);
1248 VisitForValue(property->obj()); 1248 VisitForValue(property->obj());
1249 Node* object = environment()->Pop(); 1249 Node* object = environment()->Pop();
1250 value = environment()->Pop(); 1250 value = environment()->Pop();
1251 Unique<Name> name = 1251 Unique<Name> name =
1252 MakeUnique(property->key()->AsLiteral()->AsPropertyName()); 1252 MakeUnique(property->key()->AsLiteral()->AsPropertyName());
1253 Node* store = 1253 Node* store =
1254 NewNode(javascript()->StoreNamed(strict_mode(), name), object, value); 1254 NewNode(javascript()->StoreNamed(strict_mode(), name), object, value);
1255 // TODO(jarin) Fill in the correct bailout id. 1255 PrepareFrameState(store, bailout_id);
1256 PrepareFrameState(store, BailoutId::None());
1257 break; 1256 break;
1258 } 1257 }
1259 case KEYED_PROPERTY: { 1258 case KEYED_PROPERTY: {
1260 environment()->Push(value); 1259 environment()->Push(value);
1261 VisitForValue(property->obj()); 1260 VisitForValue(property->obj());
1262 VisitForValue(property->key()); 1261 VisitForValue(property->key());
1263 Node* key = environment()->Pop(); 1262 Node* key = environment()->Pop();
1264 Node* object = environment()->Pop(); 1263 Node* object = environment()->Pop();
1265 value = environment()->Pop(); 1264 value = environment()->Pop();
1266 Node* store = NewNode(javascript()->StoreProperty(strict_mode()), object, 1265 Node* store = NewNode(javascript()->StoreProperty(strict_mode()), object,
1267 key, value); 1266 key, value);
1268 // TODO(jarin) Fill in the correct bailout id. 1267 PrepareFrameState(store, bailout_id);
1269 PrepareFrameState(store, BailoutId::None());
1270 break; 1268 break;
1271 } 1269 }
1272 } 1270 }
1273 } 1271 }
1274 1272
1275 1273
1276 void AstGraphBuilder::VisitAssignment(Assignment* expr) { 1274 void AstGraphBuilder::VisitAssignment(Assignment* expr) {
1277 DCHECK(expr->target()->IsValidReferenceExpression()); 1275 DCHECK(expr->target()->IsValidReferenceExpression());
1278 1276
1279 // Left-hand side can only be a property, a global or a variable slot. 1277 // Left-hand side can only be a property, a global or a variable slot.
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
2438 2436
2439 BitVector* AstGraphBuilder::GetVariablesAssignedInLoop( 2437 BitVector* AstGraphBuilder::GetVariablesAssignedInLoop(
2440 IterationStatement* stmt) { 2438 IterationStatement* stmt) {
2441 if (loop_assignment_analysis_ == NULL) return NULL; 2439 if (loop_assignment_analysis_ == NULL) return NULL;
2442 return loop_assignment_analysis_->GetVariablesAssignedInLoop(stmt); 2440 return loop_assignment_analysis_->GetVariablesAssignedInLoop(stmt);
2443 } 2441 }
2444 2442
2445 } // namespace compiler 2443 } // namespace compiler
2446 } // namespace internal 2444 } // namespace internal
2447 } // namespace v8 2445 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ast-graph-builder.h ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698