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

Side by Side Diff: runtime/vm/flow_graph.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
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.h" 5 #include "vm/flow_graph.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/flow_graph_builder.h" 8 #include "vm/flow_graph_builder.h"
9 #include "vm/intermediate_language.h" 9 #include "vm/intermediate_language.h"
10 #include "vm/longjump.h" 10 #include "vm/longjump.h"
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 } 1061 }
1062 } 1062 }
1063 } 1063 }
1064 1064
1065 return loop_headers; 1065 return loop_headers;
1066 } 1066 }
1067 1067
1068 1068
1069 void FlowGraph::Bailout(const char* reason) const { 1069 void FlowGraph::Bailout(const char* reason) const {
1070 const char* kFormat = "FlowGraph Bailout: %s %s"; 1070 const char* kFormat = "FlowGraph Bailout: %s %s";
1071 const char* function_name = parsed_function_.function().ToCString(); 1071 const Function& function = parsed_function_.function();
1072 const char* function_name = function.ToCString();
1072 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; 1073 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1;
1073 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 1074 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
1074 OS::SNPrint(chars, len, kFormat, function_name, reason); 1075 OS::SNPrint(chars, len, kFormat, function_name, reason);
1075 const Error& error = Error::Handle( 1076 const Error& error = Error::Handle(
1076 LanguageError::New(String::Handle(String::New(chars)))); 1077 LanguageError::New(Error::Handle(), // No previous error.
1078 Script::Handle(function.script()),
Ivan Posva 2013/11/15 04:42:13 Now that we report script and position, do we real
regis 2013/11/15 18:27:38 Done.
1079 function.token_pos(),
1080 LanguageError::kError,
1081 String::Handle(String::New(chars))));
1077 Isolate::Current()->long_jump_base()->Jump(1, error); 1082 Isolate::Current()->long_jump_base()->Jump(1, error);
1078 } 1083 }
1079 1084
1080 1085
1081 intptr_t FlowGraph::InstructionCount() const { 1086 intptr_t FlowGraph::InstructionCount() const {
1082 intptr_t size = 0; 1087 intptr_t size = 0;
1083 // Iterate each block, skipping the graph entry. 1088 // Iterate each block, skipping the graph entry.
1084 for (intptr_t i = 1; i < preorder_.length(); ++i) { 1089 for (intptr_t i = 1; i < preorder_.length(); ++i) {
1085 for (ForwardInstructionIterator it(preorder_[i]); 1090 for (ForwardInstructionIterator it(preorder_[i]);
1086 !it.Done(); 1091 !it.Done();
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 } 1200 }
1196 1201
1197 1202
1198 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from, 1203 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from,
1199 BlockEntryInstr* to) const { 1204 BlockEntryInstr* to) const {
1200 return available_at_[to->postorder_number()]->Contains( 1205 return available_at_[to->postorder_number()]->Contains(
1201 from->postorder_number()); 1206 from->postorder_number());
1202 } 1207 }
1203 1208
1204 } // namespace dart 1209 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698