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

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: fixed checked mode tests failure 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
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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 } 218 }
219 219
220 220
221 GraphEntryInstr::GraphEntryInstr(const ParsedFunction& parsed_function, 221 GraphEntryInstr::GraphEntryInstr(const ParsedFunction& parsed_function,
222 TargetEntryInstr* normal_entry) 222 TargetEntryInstr* normal_entry)
223 : BlockEntryInstr(0, CatchClauseNode::kInvalidTryIndex), 223 : BlockEntryInstr(0, CatchClauseNode::kInvalidTryIndex),
224 parsed_function_(parsed_function), 224 parsed_function_(parsed_function),
225 normal_entry_(normal_entry), 225 normal_entry_(normal_entry),
226 catch_entries_(), 226 catch_entries_(),
227 initial_definitions_(), 227 initial_definitions_(),
228 spill_slot_count_(0) { 228 spill_slot_count_(0),
229 fixed_slot_count_(0) {
229 } 230 }
230 231
231 232
232 ConstantInstr* GraphEntryInstr::constant_null() { 233 ConstantInstr* GraphEntryInstr::constant_null() {
233 ASSERT(initial_definitions_.length() > 0); 234 ASSERT(initial_definitions_.length() > 0);
234 for (intptr_t i = 0; i < initial_definitions_.length(); ++i) { 235 for (intptr_t i = 0; i < initial_definitions_.length(); ++i) {
235 ConstantInstr* defn = initial_definitions_[i]->AsConstant(); 236 ConstantInstr* defn = initial_definitions_[i]->AsConstant();
236 if (defn != NULL && defn->value().IsNull()) return defn; 237 if (defn != NULL && defn->value().IsNull()) return defn;
237 } 238 }
238 UNREACHABLE(); 239 UNREACHABLE();
239 return NULL; 240 return NULL;
240 } 241 }
241 242
242 243
244 CatchBlockEntryInstr* GraphEntryInstr::GetCatchEntry(intptr_t index) {
245 for (intptr_t i = 0; i < catch_entries_.length(); ++i) {
246 if (catch_entries_[i]->catch_try_index() == index) return catch_entries_[i];
247 }
248 return NULL;
249 }
250
251
243 static bool StartsWith(const String& name, const char* prefix, intptr_t n) { 252 static bool StartsWith(const String& name, const char* prefix, intptr_t n) {
244 ASSERT(name.IsOneByteString()); 253 ASSERT(name.IsOneByteString());
245 254
246 if (name.Length() < n) { 255 if (name.Length() < n) {
247 return false; 256 return false;
248 } 257 }
249 258
250 for (intptr_t i = 0; i < n; i++) { 259 for (intptr_t i = 0; i < n; i++) {
251 if (name.CharAt(i) != prefix[i]) { 260 if (name.CharAt(i) != prefix[i]) {
252 return false; 261 return false;
(...skipping 2178 matching lines...) Expand 10 before | Expand all | Expand 10 after
2431 default: 2440 default:
2432 UNREACHABLE(); 2441 UNREACHABLE();
2433 } 2442 }
2434 return kPowRuntimeEntry; 2443 return kPowRuntimeEntry;
2435 } 2444 }
2436 2445
2437 2446
2438 #undef __ 2447 #undef __
2439 2448
2440 } // namespace dart 2449 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698