OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/full-codegen/full-codegen.h" | 5 #include "src/full-codegen/full-codegen.h" |
6 | 6 |
7 #include "src/ast/ast-numbering.h" | 7 #include "src/ast/ast-numbering.h" |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/ast/prettyprinter.h" | 9 #include "src/ast/prettyprinter.h" |
10 #include "src/ast/scopeinfo.h" | 10 #include "src/ast/scopeinfo.h" |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 void FullCodeGenerator::SetStatementPosition( | 645 void FullCodeGenerator::SetStatementPosition( |
646 Statement* stmt, FullCodeGenerator::InsertBreak insert_break) { | 646 Statement* stmt, FullCodeGenerator::InsertBreak insert_break) { |
647 if (stmt->position() == RelocInfo::kNoPosition) return; | 647 if (stmt->position() == RelocInfo::kNoPosition) return; |
648 bool recorded = RecordStatementPosition(masm_, stmt->position()); | 648 bool recorded = RecordStatementPosition(masm_, stmt->position()); |
649 if (recorded && insert_break == INSERT_BREAK && info_->is_debug() && | 649 if (recorded && insert_break == INSERT_BREAK && info_->is_debug() && |
650 !stmt->IsDebuggerStatement()) { | 650 !stmt->IsDebuggerStatement()) { |
651 DebugCodegen::GenerateSlot(masm_, RelocInfo::DEBUG_BREAK_SLOT_AT_POSITION); | 651 DebugCodegen::GenerateSlot(masm_, RelocInfo::DEBUG_BREAK_SLOT_AT_POSITION); |
652 } | 652 } |
653 } | 653 } |
654 | 654 |
655 | 655 void FullCodeGenerator::SetExpressionPosition(Expression* expr) { |
656 void FullCodeGenerator::SetExpressionPosition( | |
657 Expression* expr, FullCodeGenerator::InsertBreak insert_break) { | |
658 if (expr->position() == RelocInfo::kNoPosition) return; | 656 if (expr->position() == RelocInfo::kNoPosition) return; |
659 bool recorded = RecordPosition(masm_, expr->position()); | 657 RecordPosition(masm_, expr->position()); |
660 if (recorded && insert_break == INSERT_BREAK && info_->is_debug()) { | |
661 DebugCodegen::GenerateSlot(masm_, RelocInfo::DEBUG_BREAK_SLOT_AT_POSITION); | |
662 } | |
663 } | 658 } |
664 | 659 |
665 | 660 |
666 void FullCodeGenerator::SetExpressionAsStatementPosition(Expression* expr) { | 661 void FullCodeGenerator::SetExpressionAsStatementPosition(Expression* expr) { |
667 if (expr->position() == RelocInfo::kNoPosition) return; | 662 if (expr->position() == RelocInfo::kNoPosition) return; |
668 bool recorded = RecordStatementPosition(masm_, expr->position()); | 663 bool recorded = RecordStatementPosition(masm_, expr->position()); |
669 if (recorded && info_->is_debug()) { | 664 if (recorded && info_->is_debug()) { |
670 DebugCodegen::GenerateSlot(masm_, RelocInfo::DEBUG_BREAK_SLOT_AT_POSITION); | 665 DebugCodegen::GenerateSlot(masm_, RelocInfo::DEBUG_BREAK_SLOT_AT_POSITION); |
671 } | 666 } |
672 } | 667 } |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1224 } | 1219 } |
1225 | 1220 |
1226 | 1221 |
1227 void FullCodeGenerator::VisitForOfStatement(ForOfStatement* stmt) { | 1222 void FullCodeGenerator::VisitForOfStatement(ForOfStatement* stmt) { |
1228 Comment cmnt(masm_, "[ ForOfStatement"); | 1223 Comment cmnt(masm_, "[ ForOfStatement"); |
1229 | 1224 |
1230 Iteration loop_statement(this, stmt); | 1225 Iteration loop_statement(this, stmt); |
1231 increment_loop_depth(); | 1226 increment_loop_depth(); |
1232 | 1227 |
1233 // var iterator = iterable[Symbol.iterator](); | 1228 // var iterator = iterable[Symbol.iterator](); |
| 1229 SetExpressionAsStatementPosition(stmt->assign_iterator()); |
1234 VisitForEffect(stmt->assign_iterator()); | 1230 VisitForEffect(stmt->assign_iterator()); |
1235 | 1231 |
1236 // Loop entry. | 1232 // Loop entry. |
1237 __ bind(loop_statement.continue_label()); | 1233 __ bind(loop_statement.continue_label()); |
1238 | 1234 |
1239 // result = iterator.next() | 1235 // result = iterator.next() |
1240 SetExpressionAsStatementPosition(stmt->next_result()); | 1236 SetExpressionAsStatementPosition(stmt->next_result()); |
1241 VisitForEffect(stmt->next_result()); | 1237 VisitForEffect(stmt->next_result()); |
1242 | 1238 |
1243 // if (result.done) break; | 1239 // if (result.done) break; |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1940 return var->scope()->is_nonlinear() || | 1936 return var->scope()->is_nonlinear() || |
1941 var->initializer_position() >= proxy->position(); | 1937 var->initializer_position() >= proxy->position(); |
1942 } | 1938 } |
1943 | 1939 |
1944 | 1940 |
1945 #undef __ | 1941 #undef __ |
1946 | 1942 |
1947 | 1943 |
1948 } // namespace internal | 1944 } // namespace internal |
1949 } // namespace v8 | 1945 } // namespace v8 |
OLD | NEW |