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

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

Issue 63983005: Simplify the desugaring of catch clauses. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Incorporated final review comments. Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/ast.h ('k') | runtime/vm/parser.h » ('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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/flow_graph_builder.h" 5 #include "vm/flow_graph_builder.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "vm/ast_printer.h" 8 #include "vm/ast_printer.h"
9 #include "vm/bit_vector.h" 9 #include "vm/bit_vector.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 3581 matching lines...) Expand 10 before | Expand all | Expand 10 after
3592 3592
3593 CatchBlockEntryInstr* catch_entry = 3593 CatchBlockEntryInstr* catch_entry =
3594 new CatchBlockEntryInstr(owner()->AllocateBlockId(), 3594 new CatchBlockEntryInstr(owner()->AllocateBlockId(),
3595 catch_handler_index, 3595 catch_handler_index,
3596 catch_block->handler_types(), 3596 catch_block->handler_types(),
3597 try_handler_index, 3597 try_handler_index,
3598 catch_block->exception_var(), 3598 catch_block->exception_var(),
3599 catch_block->stacktrace_var(), 3599 catch_block->stacktrace_var(),
3600 catch_block->needs_stacktrace()); 3600 catch_block->needs_stacktrace());
3601 owner()->AddCatchEntry(catch_entry); 3601 owner()->AddCatchEntry(catch_entry);
3602 ASSERT(!for_catch.is_open());
3603 AppendFragment(catch_entry, for_catch); 3602 AppendFragment(catch_entry, for_catch);
3604 3603
3605 JoinEntryInstr* join = node->end_catch_label()->join_for_continue(); 3604 if (for_catch.is_open()) {
3606 if (join != NULL) { 3605 JoinEntryInstr* join = new JoinEntryInstr(owner()->AllocateBlockId(),
3606 original_handler_index);
3607 for_catch.Goto(join);
3607 if (is_open()) Goto(join); 3608 if (is_open()) Goto(join);
3608 exit_ = join; 3609 exit_ = join;
3609 } 3610 }
3610 3611
3611 if (finally_block != NULL) { 3612 if (finally_block != NULL) {
3612 // Create a handler for the code in the catch block, containing the 3613 // Create a handler for the code in the catch block, containing the
3613 // code in the finally block. 3614 // code in the finally block.
3614 owner()->set_try_index(original_handler_index); 3615 owner()->set_try_index(original_handler_index);
3615 EffectGraphVisitor for_finally(owner()); 3616 EffectGraphVisitor for_finally(owner());
3616 for_finally.BuildRestoreContext(catch_block->context_var()); 3617 for_finally.BuildRestoreContext(catch_block->context_var());
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
3885 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; 3886 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1;
3886 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 3887 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
3887 OS::SNPrint(chars, len, kFormat, function_name, reason); 3888 OS::SNPrint(chars, len, kFormat, function_name, reason);
3888 const Error& error = Error::Handle( 3889 const Error& error = Error::Handle(
3889 LanguageError::New(String::Handle(String::New(chars)))); 3890 LanguageError::New(String::Handle(String::New(chars))));
3890 Isolate::Current()->long_jump_base()->Jump(1, error); 3891 Isolate::Current()->long_jump_base()->Jump(1, error);
3891 } 3892 }
3892 3893
3893 3894
3894 } // namespace dart 3895 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/ast.h ('k') | runtime/vm/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698