OLD | NEW |
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" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 const TokenPosition token_pos = caller_code.GetTokenIndexOfPC(caller_pc); | 242 const TokenPosition token_pos = caller_code.GetTokenIndexOfPC(caller_pc); |
243 const Function& caller = Function::Handle(zone, caller_code.function()); | 243 const Function& caller = Function::Handle(zone, caller_code.function()); |
244 const Script& script = Script::Handle(zone, caller.script()); | 244 const Script& script = Script::Handle(zone, caller.script()); |
245 MessageF(kJSWarning, script, token_pos, Report::AtLocation, "%s", msg); | 245 MessageF(kJSWarning, script, token_pos, Report::AtLocation, "%s", msg); |
246 } | 246 } |
247 | 247 |
248 | 248 |
249 void Report::TraceJSWarning(const Script& script, | 249 void Report::TraceJSWarning(const Script& script, |
250 TokenPosition token_pos, | 250 TokenPosition token_pos, |
251 const String& message) { | 251 const String& message) { |
| 252 if (!FLAG_support_service) { |
| 253 return; |
| 254 } |
252 const int64_t micros = OS::GetCurrentTimeMicros(); | 255 const int64_t micros = OS::GetCurrentTimeMicros(); |
253 Isolate* isolate = Isolate::Current(); | 256 Isolate* isolate = Isolate::Current(); |
254 TraceBuffer* trace_buffer = isolate->trace_buffer(); | 257 TraceBuffer* trace_buffer = isolate->trace_buffer(); |
255 if (trace_buffer == NULL) { | 258 if (trace_buffer == NULL) { |
256 TraceBuffer::Init(isolate); | 259 TraceBuffer::Init(isolate); |
257 trace_buffer = isolate->trace_buffer(); | 260 trace_buffer = isolate->trace_buffer(); |
258 } | 261 } |
259 JSONStream js; | 262 JSONStream js; |
260 { | 263 { |
261 JSONObject trace_warning(&js); | 264 JSONObject trace_warning(&js); |
262 trace_warning.AddProperty("type", "JSCompatibilityWarning"); | 265 trace_warning.AddProperty("type", "JSCompatibilityWarning"); |
263 trace_warning.AddProperty("script", script); | 266 trace_warning.AddProperty("script", script); |
264 trace_warning.AddProperty("tokenPos", token_pos); | 267 trace_warning.AddProperty("tokenPos", token_pos); |
265 trace_warning.AddProperty("message", message); | 268 trace_warning.AddProperty("message", message); |
266 } | 269 } |
267 trace_buffer->Trace(micros, js.ToCString(), true); // Already escaped. | 270 trace_buffer->Trace(micros, js.ToCString(), true); // Already escaped. |
268 } | 271 } |
269 | 272 |
270 } // namespace dart | 273 } // namespace dart |
271 | 274 |
OLD | NEW |