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

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

Issue 14682020: Optimize functions containing try-catch. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: rebased Created 7 years, 7 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/intermediate_language.h ('k') | tests/language/try_catch2_test.dart » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/intermediate_language.h" 5 #include "vm/intermediate_language.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/dart_entry.h" 8 #include "vm/dart_entry.h"
9 #include "vm/flow_graph_allocator.h" 9 #include "vm/flow_graph_allocator.h"
10 #include "vm/flow_graph_builder.h" 10 #include "vm/flow_graph_builder.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 } 221 }
222 222
223 223
224 GraphEntryInstr::GraphEntryInstr(const ParsedFunction& parsed_function, 224 GraphEntryInstr::GraphEntryInstr(const ParsedFunction& parsed_function,
225 TargetEntryInstr* normal_entry) 225 TargetEntryInstr* normal_entry)
226 : BlockEntryInstr(0, CatchClauseNode::kInvalidTryIndex), 226 : BlockEntryInstr(0, CatchClauseNode::kInvalidTryIndex),
227 parsed_function_(parsed_function), 227 parsed_function_(parsed_function),
228 normal_entry_(normal_entry), 228 normal_entry_(normal_entry),
229 catch_entries_(), 229 catch_entries_(),
230 initial_definitions_(), 230 initial_definitions_(),
231 spill_slot_count_(0) { 231 spill_slot_count_(0),
232 fixed_slot_count_(0) {
232 } 233 }
233 234
234 235
235 ConstantInstr* GraphEntryInstr::constant_null() { 236 ConstantInstr* GraphEntryInstr::constant_null() {
236 ASSERT(initial_definitions_.length() > 0); 237 ASSERT(initial_definitions_.length() > 0);
237 for (intptr_t i = 0; i < initial_definitions_.length(); ++i) { 238 for (intptr_t i = 0; i < initial_definitions_.length(); ++i) {
238 ConstantInstr* defn = initial_definitions_[i]->AsConstant(); 239 ConstantInstr* defn = initial_definitions_[i]->AsConstant();
239 if (defn != NULL && defn->value().IsNull()) return defn; 240 if (defn != NULL && defn->value().IsNull()) return defn;
240 } 241 }
241 UNREACHABLE(); 242 UNREACHABLE();
242 return NULL; 243 return NULL;
243 } 244 }
244 245
245 246
247 CatchBlockEntryInstr* GraphEntryInstr::GetCatchEntry(intptr_t index) {
248 // TODO(fschneider): Sort the catch entries by catch_try_index to avoid
249 // searching.
250 for (intptr_t i = 0; i < catch_entries_.length(); ++i) {
251 if (catch_entries_[i]->catch_try_index() == index) return catch_entries_[i];
252 }
253 return NULL;
254 }
255
256
246 static bool StartsWith(const String& name, const char* prefix, intptr_t n) { 257 static bool StartsWith(const String& name, const char* prefix, intptr_t n) {
247 ASSERT(name.IsOneByteString()); 258 ASSERT(name.IsOneByteString());
248 259
249 if (name.Length() < n) { 260 if (name.Length() < n) {
250 return false; 261 return false;
251 } 262 }
252 263
253 for (intptr_t i = 0; i < n; i++) { 264 for (intptr_t i = 0; i < n; i++) {
254 if (name.CharAt(i) != prefix[i]) { 265 if (name.CharAt(i) != prefix[i]) {
255 return false; 266 return false;
(...skipping 2178 matching lines...) Expand 10 before | Expand all | Expand 10 after
2434 default: 2445 default:
2435 UNREACHABLE(); 2446 UNREACHABLE();
2436 } 2447 }
2437 return kPowRuntimeEntry; 2448 return kPowRuntimeEntry;
2438 } 2449 }
2439 2450
2440 2451
2441 #undef __ 2452 #undef __
2442 2453
2443 } // namespace dart 2454 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | tests/language/try_catch2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698