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

Side by Side Diff: runtime/vm/kernel_binary_flowgraph.cc

Issue 3004693002: [kernel] Add offset to SwitchContinueStatement; add debugging test (Closed)
Patch Set: ... Created 3 years, 3 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 | « runtime/observatory/tests/service/step_through_switch_with_continue_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/kernel_binary_flowgraph.h" 5 #include "vm/kernel_binary_flowgraph.h"
6 #include "vm/compiler.h" 6 #include "vm/compiler.h"
7 #include "vm/longjump.h" 7 #include "vm/longjump.h"
8 #include "vm/object_store.h" 8 #include "vm/object_store.h"
9 9
10 #if !defined(DART_PRECOMPILED_RUNTIME) 10 #if !defined(DART_PRECOMPILED_RUNTIME)
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1289 for (intptr_t j = 0; j < expression_count; ++j) { 1289 for (intptr_t j = 0; j < expression_count; ++j) {
1290 builder_->ReadPosition(); // read jth position. 1290 builder_->ReadPosition(); // read jth position.
1291 VisitExpression(); // read jth expression. 1291 VisitExpression(); // read jth expression.
1292 } 1292 }
1293 builder_->ReadBool(); // read is_default. 1293 builder_->ReadBool(); // read is_default.
1294 VisitStatement(); // read body. 1294 VisitStatement(); // read body.
1295 } 1295 }
1296 return; 1296 return;
1297 } 1297 }
1298 case kContinueSwitchStatement: 1298 case kContinueSwitchStatement:
1299 builder_->ReadUInt(); // read target_index. 1299 builder_->ReadPosition(); // read position.
1300 builder_->ReadUInt(); // read target_index.
1300 return; 1301 return;
1301 case kIfStatement: 1302 case kIfStatement:
1302 VisitExpression(); // read condition. 1303 VisitExpression(); // read condition.
1303 VisitStatement(); // read then. 1304 VisitStatement(); // read then.
1304 VisitStatement(); // read otherwise. 1305 VisitStatement(); // read otherwise.
1305 return; 1306 return;
1306 case kReturnStatement: { 1307 case kReturnStatement: {
1307 if ((depth_.function_ == 0) && (depth_.finally_ > 0) && 1308 if ((depth_.function_ == 0) && (depth_.finally_ > 0) &&
1308 (result_->finally_return_variable == NULL)) { 1309 (result_->finally_return_variable == NULL)) {
1309 const String& name = H.DartSymbol(":try_finally_return_value"); 1310 const String& name = H.DartSymbol(":try_finally_return_value");
(...skipping 3262 matching lines...) Expand 10 before | Expand all | Expand 10 after
4572 for (intptr_t j = 0; j < expression_count; ++j) { 4573 for (intptr_t j = 0; j < expression_count; ++j) {
4573 ReadPosition(); // read jth position. 4574 ReadPosition(); // read jth position.
4574 SkipExpression(); // read jth expression. 4575 SkipExpression(); // read jth expression.
4575 } 4576 }
4576 ReadBool(); // read is_default. 4577 ReadBool(); // read is_default.
4577 SkipStatement(); // read body. 4578 SkipStatement(); // read body.
4578 } 4579 }
4579 return; 4580 return;
4580 } 4581 }
4581 case kContinueSwitchStatement: 4582 case kContinueSwitchStatement:
4582 ReadUInt(); // read target_index. 4583 ReadPosition(); // read position.
4584 ReadUInt(); // read target_index.
4583 return; 4585 return;
4584 case kIfStatement: 4586 case kIfStatement:
4585 SkipExpression(); // read condition. 4587 SkipExpression(); // read condition.
4586 SkipStatement(); // read then. 4588 SkipStatement(); // read then.
4587 SkipStatement(); // read otherwise. 4589 SkipStatement(); // read otherwise.
4588 return; 4590 return;
4589 case kReturnStatement: { 4591 case kReturnStatement: {
4590 ReadPosition(); // read position 4592 ReadPosition(); // read position
4591 Tag tag = ReadTag(); // read (first part of) expression. 4593 Tag tag = ReadTag(); // read (first part of) expression.
4592 if (tag == kSomething) { 4594 if (tag == kSomething) {
(...skipping 2358 matching lines...) Expand 10 before | Expand all | Expand 10 after
6951 } 6953 }
6952 6954
6953 delete[] body_fragments; 6955 delete[] body_fragments;
6954 delete[] case_expression_offsets; 6956 delete[] case_expression_offsets;
6955 6957
6956 SetOffset(end_offset); 6958 SetOffset(end_offset);
6957 return Fragment(head_instructions.entry, current_instructions.current); 6959 return Fragment(head_instructions.entry, current_instructions.current);
6958 } 6960 }
6959 6961
6960 Fragment StreamingFlowGraphBuilder::BuildContinueSwitchStatement() { 6962 Fragment StreamingFlowGraphBuilder::BuildContinueSwitchStatement() {
6961 intptr_t target_index = ReadUInt(); // read target index. 6963 TokenPosition position = ReadPosition(); // read position.
6964 intptr_t target_index = ReadUInt(); // read target index.
6962 6965
6963 TryFinallyBlock* outer_finally = NULL; 6966 TryFinallyBlock* outer_finally = NULL;
6964 intptr_t target_context_depth = -1; 6967 intptr_t target_context_depth = -1;
6965 JoinEntryInstr* entry = switch_block()->Destination( 6968 JoinEntryInstr* entry = switch_block()->Destination(
6966 target_index, &outer_finally, &target_context_depth); 6969 target_index, &outer_finally, &target_context_depth);
6967 6970
6968 Fragment instructions; 6971 Fragment instructions;
6969 instructions += 6972 instructions +=
6970 TranslateFinallyFinalizers(outer_finally, target_context_depth); 6973 TranslateFinallyFinalizers(outer_finally, target_context_depth);
6971 if (instructions.is_open()) { 6974 if (instructions.is_open()) {
6975 if (NeedsDebugStepCheck(parsed_function()->function(), position)) {
6976 instructions += DebugStepCheck(position);
6977 }
6972 instructions += Goto(entry); 6978 instructions += Goto(entry);
6973 } 6979 }
6974 return instructions; 6980 return instructions;
6975 } 6981 }
6976 6982
6977 Fragment StreamingFlowGraphBuilder::BuildIfStatement() { 6983 Fragment StreamingFlowGraphBuilder::BuildIfStatement() {
6978 bool negate; 6984 bool negate;
6979 Fragment instructions = TranslateCondition(&negate); // read condition. 6985 Fragment instructions = TranslateCondition(&negate); // read condition.
6980 TargetEntryInstr* then_entry; 6986 TargetEntryInstr* then_entry;
6981 TargetEntryInstr* otherwise_entry; 6987 TargetEntryInstr* otherwise_entry;
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
7815 } 7821 }
7816 } 7822 }
7817 7823
7818 return Array::Handle(Array::null()); 7824 return Array::Handle(Array::null());
7819 } 7825 }
7820 7826
7821 } // namespace kernel 7827 } // namespace kernel
7822 } // namespace dart 7828 } // namespace dart
7823 7829
7824 #endif // !defined(DART_PRECOMPILED_RUNTIME) 7830 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW
« no previous file with comments | « runtime/observatory/tests/service/step_through_switch_with_continue_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698