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

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

Issue 2750013002: [kernel] Debugging of switch statement (Closed)
Patch Set: Addressed comments Created 3 years, 9 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/vm/kernel_binary.cc ('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 <map> 5 #include <map>
6 #include <set> 6 #include <set>
7 #include <string> 7 #include <string>
8 8
9 #include "vm/kernel_to_il.h" 9 #include "vm/kernel_to_il.h"
10 10
(...skipping 5792 matching lines...) Expand 10 before | Expand all | Expand 10 after
5803 JoinEntryInstr* body_join = NULL; 5803 JoinEntryInstr* body_join = NULL;
5804 if (block.HadJumper(switch_case)) { 5804 if (block.HadJumper(switch_case)) {
5805 body_join = block.Destination(switch_case); 5805 body_join = block.Destination(switch_case);
5806 body_fragments[i] = Fragment(body_join) + body_fragments[i]; 5806 body_fragments[i] = Fragment(body_join) + body_fragments[i];
5807 } 5807 }
5808 5808
5809 for (intptr_t j = 0; j < switch_case->expressions().length(); j++) { 5809 for (intptr_t j = 0; j < switch_case->expressions().length(); j++) {
5810 TargetEntryInstr* then; 5810 TargetEntryInstr* then;
5811 TargetEntryInstr* otherwise; 5811 TargetEntryInstr* otherwise;
5812 5812
5813 current_instructions += Constant(constant_evaluator_.EvaluateExpression( 5813 Expression* expression = switch_case->expressions()[j];
5814 switch_case->expressions()[j])); 5814 current_instructions +=
5815 Constant(constant_evaluator_.EvaluateExpression(expression));
5815 current_instructions += PushArgument(); 5816 current_instructions += PushArgument();
5816 current_instructions += LoadLocal(scopes_->switch_variable); 5817 current_instructions += LoadLocal(scopes_->switch_variable);
5817 current_instructions += PushArgument(); 5818 current_instructions += PushArgument();
5818 current_instructions += InstanceCall( 5819 current_instructions += InstanceCall(
5819 TokenPosition::kNoSource, Symbols::EqualOperator(), Token::kEQ, 5820 expression->position(), Symbols::EqualOperator(), Token::kEQ,
5820 /*argument_count=*/2, 5821 /*argument_count=*/2,
5821 /*num_args_checked=*/2); 5822 /*num_args_checked=*/2);
5822 current_instructions += BranchIfTrue(&then, &otherwise); 5823 current_instructions += BranchIfTrue(&then, &otherwise);
5823 5824
5824 Fragment then_fragment(then); 5825 Fragment then_fragment(then);
5825 5826
5826 if (body_join != NULL) { 5827 if (body_join != NULL) {
5827 // There are several branches to the body, so we will make a goto to 5828 // There are several branches to the body, so we will make a goto to
5828 // the join block (the real body has already been prepended with a 5829 // the join block (the real body has already been prepended with a
5829 // join instruction). 5830 // join instruction).
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
6439 thread->clear_sticky_error(); 6440 thread->clear_sticky_error();
6440 return error.raw(); 6441 return error.raw();
6441 } 6442 }
6442 } 6443 }
6443 6444
6444 6445
6445 } // namespace kernel 6446 } // namespace kernel
6446 } // namespace dart 6447 } // namespace dart
6447 6448
6448 #endif // !defined(DART_PRECOMPILED_RUNTIME) 6449 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW
« no previous file with comments | « runtime/vm/kernel_binary.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698