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

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

Issue 68113028: Lazily format LanguageError messages (fix issue 15069). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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/flow_graph_builder.cc ('k') | runtime/vm/object.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) 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/globals.h" // Needed here to get TARGET_ARCH_XXX. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX.
6 6
7 #include "vm/flow_graph_compiler.h" 7 #include "vm/flow_graph_compiler.h"
8 8
9 #include "vm/cha.h" 9 #include "vm/cha.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 pending_deoptimization_env_ = NULL; 275 pending_deoptimization_env_ = NULL;
276 EmitInstructionEpilogue(instr); 276 EmitInstructionEpilogue(instr);
277 } 277 }
278 } 278 }
279 } 279 }
280 set_current_block(NULL); 280 set_current_block(NULL);
281 } 281 }
282 282
283 283
284 void FlowGraphCompiler::Bailout(const char* reason) { 284 void FlowGraphCompiler::Bailout(const char* reason) {
285 const char* kFormat = "FlowGraphCompiler Bailout: %s %s."; 285 const Function& function = parsed_function_.function();
286 const char* function_name = parsed_function().function().ToCString();
287 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1;
288 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
289 OS::SNPrint(chars, len, kFormat, function_name, reason);
290 const Error& error = Error::Handle( 286 const Error& error = Error::Handle(
291 LanguageError::New(String::Handle(String::New(chars)))); 287 LanguageError::NewFormatted(Error::Handle(), // No previous error.
288 Script::Handle(function.script()),
289 function.token_pos(),
290 LanguageError::kError,
291 Heap::kNew,
292 "FlowGraphCompiler Bailout: %s %s",
293 String::Handle(function.name()).ToCString(),
294 reason));
292 Isolate::Current()->long_jump_base()->Jump(1, error); 295 Isolate::Current()->long_jump_base()->Jump(1, error);
293 } 296 }
294 297
295 298
296 intptr_t FlowGraphCompiler::StackSize() const { 299 intptr_t FlowGraphCompiler::StackSize() const {
297 if (is_optimizing_) { 300 if (is_optimizing_) {
298 return flow_graph_.graph_entry()->spill_slot_count(); 301 return flow_graph_.graph_entry()->spill_slot_count();
299 } else { 302 } else {
300 return parsed_function_.num_stack_locals() + 303 return parsed_function_.num_stack_locals() +
301 parsed_function_.num_copied_params(); 304 parsed_function_.num_copied_params();
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 1217
1215 for (int i = 0; i < len; i++) { 1218 for (int i = 0; i < len; i++) {
1216 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), 1219 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i),
1217 &Function::ZoneHandle(ic_data.GetTargetAt(i)), 1220 &Function::ZoneHandle(ic_data.GetTargetAt(i)),
1218 ic_data.GetCountAt(i))); 1221 ic_data.GetCountAt(i)));
1219 } 1222 }
1220 sorted->Sort(HighestCountFirst); 1223 sorted->Sort(HighestCountFirst);
1221 } 1224 }
1222 1225
1223 } // namespace dart 1226 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698