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

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

Issue 1149713002: With --noopt run unoptimized code through optimizer, more optimizations can be done later. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: m Created 5 years, 6 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
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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/report.h" 5 #include "vm/report.h"
6 6
7 #include "vm/code_patcher.h" 7 #include "vm/code_patcher.h"
8 #include "vm/exceptions.h" 8 #include "vm/exceptions.h"
9 #include "vm/flags.h" 9 #include "vm/flags.h"
10 #include "vm/longjump.h" 10 #include "vm/longjump.h"
11 #include "vm/object.h" 11 #include "vm/object.h"
12 #include "vm/stack_frame.h" 12 #include "vm/stack_frame.h"
13 #include "vm/symbols.h" 13 #include "vm/symbols.h"
14 14
15 namespace dart { 15 namespace dart {
16 16
17 DEFINE_FLAG(int, stacktrace_depth_on_warning, 5, 17 DEFINE_FLAG(int, stacktrace_depth_on_warning, 5,
18 "Maximal number of stack frames to print after a runtime warning."); 18 "Maximal number of stack frames to print after a runtime warning.");
19 DEFINE_FLAG(bool, silent_warnings, false, "Silence warnings."); 19 DEFINE_FLAG(bool, silent_warnings, false, "Silence warnings.");
20 DEFINE_FLAG(bool, warn_on_javascript_compatibility, false, 20 DEFINE_FLAG(bool, warn_on_javascript_compatibility, false,
21 "Warn on incompatibilities between vm and dart2js."); 21 "Warn on incompatibilities between vm and dart2js.");
22 DEFINE_FLAG(bool, warning_as_error, false, "Treat warnings as errors."); 22 DEFINE_FLAG(bool, warning_as_error, false, "Treat warnings as errors.");
23 23
24 DECLARE_FLAG(bool, always_megamorphic_calls);
24 25
25 RawString* Report::PrependSnippet(Kind kind, 26 RawString* Report::PrependSnippet(Kind kind,
26 const Script& script, 27 const Script& script,
27 intptr_t token_pos, 28 intptr_t token_pos,
28 const String& message) { 29 const String& message) {
29 const char* message_header; 30 const char* message_header;
30 switch (kind) { 31 switch (kind) {
31 case kWarning: message_header = "warning"; break; 32 case kWarning: message_header = "warning"; break;
32 case kJSWarning: message_header = "javascript compatibility warning"; break; 33 case kJSWarning: message_header = "javascript compatibility warning"; break;
33 case kError: message_header = "error"; break; 34 case kError: message_header = "error"; break;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 StackFrame* caller_frame = iterator.NextFrame(); 172 StackFrame* caller_frame = iterator.NextFrame();
172 ASSERT(caller_frame != NULL); 173 ASSERT(caller_frame != NULL);
173 const Code& caller_code = Code::Handle(caller_frame->LookupDartCode()); 174 const Code& caller_code = Code::Handle(caller_frame->LookupDartCode());
174 ASSERT(!caller_code.IsNull()); 175 ASSERT(!caller_code.IsNull());
175 const uword caller_pc = caller_frame->pc(); 176 const uword caller_pc = caller_frame->pc();
176 ICData& ic_data = ICData::Handle(); 177 ICData& ic_data = ICData::Handle();
177 if (is_static_native) { 178 if (is_static_native) {
178 // Assume an unoptimized static call. Optimization was prevented. 179 // Assume an unoptimized static call. Optimization was prevented.
179 CodePatcher::GetUnoptimizedStaticCallAt(caller_pc, caller_code, &ic_data); 180 CodePatcher::GetUnoptimizedStaticCallAt(caller_pc, caller_code, &ic_data);
180 } else { 181 } else {
181 // Assume an instance call. 182 if (FLAG_always_megamorphic_calls) {
182 CodePatcher::GetInstanceCallAt(caller_pc, caller_code, &ic_data); 183 Report::JSWarningFromFrame(caller_frame, msg);
184 return;
185 } else {
186 // Assume an instance call.
187 CodePatcher::GetInstanceCallAt(caller_pc, caller_code, &ic_data);
188 }
183 } 189 }
184 ASSERT(!ic_data.IsNull()); 190 ASSERT(!ic_data.IsNull());
185 // Report warning only if not already reported at this location. 191 // Report warning only if not already reported at this location.
186 if (!ic_data.IssuedJSWarning()) { 192 if (!ic_data.IssuedJSWarning()) {
187 ic_data.SetIssuedJSWarning(); 193 ic_data.SetIssuedJSWarning();
188 Report::JSWarningFromFrame(caller_frame, msg); 194 Report::JSWarningFromFrame(caller_frame, msg);
189 } 195 }
190 } 196 }
191 197
192 198
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 trace_warning.AddProperty("type", "JSCompatibilityWarning"); 240 trace_warning.AddProperty("type", "JSCompatibilityWarning");
235 trace_warning.AddProperty("script", script); 241 trace_warning.AddProperty("script", script);
236 trace_warning.AddProperty("tokenPos", token_pos); 242 trace_warning.AddProperty("tokenPos", token_pos);
237 trace_warning.AddProperty("message", message); 243 trace_warning.AddProperty("message", message);
238 } 244 }
239 trace_buffer->Trace(micros, js.ToCString(), true); // Already escaped. 245 trace_buffer->Trace(micros, js.ToCString(), true); // Already escaped.
240 } 246 }
241 247
242 } // namespace dart 248 } // namespace dart
243 249
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698