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

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

Issue 12600012: Add a new, separate block entry instruction for catch-blocks. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: fixed IL printer Created 7 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_builder.h ('k') | runtime/vm/flow_graph_optimizer.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 (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/code_descriptors.h" 9 #include "vm/code_descriptors.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 : 0), 50 : 0),
51 num_stack_locals_(parsed_function.num_stack_locals()), 51 num_stack_locals_(parsed_function.num_stack_locals()),
52 inlining_context_(inlining_context), 52 inlining_context_(inlining_context),
53 last_used_block_id_(0), // 0 is used for the graph entry. 53 last_used_block_id_(0), // 0 is used for the graph entry.
54 context_level_(0), 54 context_level_(0),
55 last_used_try_index_(CatchClauseNode::kInvalidTryIndex), 55 last_used_try_index_(CatchClauseNode::kInvalidTryIndex),
56 try_index_(CatchClauseNode::kInvalidTryIndex), 56 try_index_(CatchClauseNode::kInvalidTryIndex),
57 graph_entry_(NULL) { } 57 graph_entry_(NULL) { }
58 58
59 59
60 void FlowGraphBuilder::AddCatchEntry(TargetEntryInstr* entry) { 60 void FlowGraphBuilder::AddCatchEntry(CatchBlockEntryInstr* entry) {
61 graph_entry_->AddCatchEntry(entry); 61 graph_entry_->AddCatchEntry(entry);
62 } 62 }
63 63
64 64
65 InliningContext* InliningContext::Create(Definition* call) { 65 InliningContext* InliningContext::Create(Definition* call) {
66 return new ValueInliningContext(); 66 return new ValueInliningContext();
67 } 67 }
68 68
69 69
70 void InliningContext::PrepareGraphs(FlowGraph* caller_graph, 70 void InliningContext::PrepareGraphs(FlowGraph* caller_graph,
(...skipping 2962 matching lines...) Expand 10 before | Expand all | Expand 10 after
3033 owner()->set_try_index(old_try_index); 3033 owner()->set_try_index(old_try_index);
3034 3034
3035 CatchClauseNode* catch_block = node->catch_block(); 3035 CatchClauseNode* catch_block = node->catch_block();
3036 if (catch_block != NULL) { 3036 if (catch_block != NULL) {
3037 // Set the corresponding try index for this catch block so 3037 // Set the corresponding try index for this catch block so
3038 // that we can set the appropriate handler pc when we generate 3038 // that we can set the appropriate handler pc when we generate
3039 // code for this catch block. 3039 // code for this catch block.
3040 catch_block->set_try_index(try_index); 3040 catch_block->set_try_index(try_index);
3041 EffectGraphVisitor for_catch_block(owner(), temp_index()); 3041 EffectGraphVisitor for_catch_block(owner(), temp_index());
3042 catch_block->Visit(&for_catch_block); 3042 catch_block->Visit(&for_catch_block);
3043 TargetEntryInstr* catch_entry = 3043 CatchBlockEntryInstr* catch_entry =
3044 new TargetEntryInstr(owner()->AllocateBlockId(), old_try_index); 3044 new CatchBlockEntryInstr(owner()->AllocateBlockId(),
3045 catch_entry->set_catch_try_index(try_index); 3045 old_try_index,
3046 catch_entry->set_catch_handler_types(catch_block->handler_types()); 3046 catch_block->handler_types(),
3047 try_index);
3047 owner()->AddCatchEntry(catch_entry); 3048 owner()->AddCatchEntry(catch_entry);
3048 ASSERT(!for_catch_block.is_open()); 3049 ASSERT(!for_catch_block.is_open());
3049 AppendFragment(catch_entry, for_catch_block); 3050 AppendFragment(catch_entry, for_catch_block);
3050 if (node->end_catch_label() != NULL) { 3051 if (node->end_catch_label() != NULL) {
3051 JoinEntryInstr* join = node->end_catch_label()->join_for_continue(); 3052 JoinEntryInstr* join = node->end_catch_label()->join_for_continue();
3052 if (join != NULL) { 3053 if (join != NULL) {
3053 if (is_open()) Goto(join); 3054 if (is_open()) Goto(join);
3054 exit_ = join; 3055 exit_ = join;
3055 } 3056 }
3056 } 3057 }
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
3298 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; 3299 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1;
3299 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 3300 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
3300 OS::SNPrint(chars, len, kFormat, function_name, reason); 3301 OS::SNPrint(chars, len, kFormat, function_name, reason);
3301 const Error& error = Error::Handle( 3302 const Error& error = Error::Handle(
3302 LanguageError::New(String::Handle(String::New(chars)))); 3303 LanguageError::New(String::Handle(String::New(chars))));
3303 Isolate::Current()->long_jump_base()->Jump(1, error); 3304 Isolate::Current()->long_jump_base()->Jump(1, error);
3304 } 3305 }
3305 3306
3306 3307
3307 } // namespace dart 3308 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_builder.h ('k') | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698