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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 ic_data.SetIssuedJSWarning(); | 217 ic_data.SetIssuedJSWarning(); |
218 JSWarningFromFrame(caller_frame, msg); | 218 JSWarningFromFrame(caller_frame, msg); |
219 } | 219 } |
220 } | 220 } |
221 | 221 |
222 | 222 |
223 void Report::JSWarningFromFrame(StackFrame* caller_frame, const char* msg) { | 223 void Report::JSWarningFromFrame(StackFrame* caller_frame, const char* msg) { |
224 ASSERT(caller_frame != NULL); | 224 ASSERT(caller_frame != NULL); |
225 ASSERT(FLAG_warn_on_javascript_compatibility); | 225 ASSERT(FLAG_warn_on_javascript_compatibility); |
226 if (FLAG_silent_warnings) return; | 226 if (FLAG_silent_warnings) return; |
227 Isolate* isolate = Isolate::Current(); | 227 Zone* zone = Thread::Current()->zone(); |
228 const Code& caller_code = Code::Handle(isolate, | 228 const Code& caller_code = Code::Handle(zone, |
229 caller_frame->LookupDartCode()); | 229 caller_frame->LookupDartCode()); |
230 ASSERT(!caller_code.IsNull()); | 230 ASSERT(!caller_code.IsNull()); |
231 const uword caller_pc = caller_frame->pc(); | 231 const uword caller_pc = caller_frame->pc(); |
232 const intptr_t token_pos = caller_code.GetTokenIndexOfPC(caller_pc); | 232 const intptr_t token_pos = caller_code.GetTokenIndexOfPC(caller_pc); |
233 const Function& caller = Function::Handle(isolate, caller_code.function()); | 233 const Function& caller = Function::Handle(zone, caller_code.function()); |
234 const Script& script = Script::Handle(isolate, caller.script()); | 234 const Script& script = Script::Handle(zone, caller.script()); |
235 MessageF(kJSWarning, script, token_pos, "%s", msg); | 235 MessageF(kJSWarning, script, token_pos, "%s", msg); |
236 } | 236 } |
237 | 237 |
238 | 238 |
239 void Report::TraceJSWarning(const Script& script, | 239 void Report::TraceJSWarning(const Script& script, |
240 intptr_t token_pos, | 240 intptr_t token_pos, |
241 const String& message) { | 241 const String& message) { |
242 const int64_t micros = OS::GetCurrentTimeMicros(); | 242 const int64_t micros = OS::GetCurrentTimeMicros(); |
243 Isolate* isolate = Isolate::Current(); | 243 Isolate* isolate = Isolate::Current(); |
244 TraceBuffer* trace_buffer = isolate->trace_buffer(); | 244 TraceBuffer* trace_buffer = isolate->trace_buffer(); |
245 if (trace_buffer == NULL) { | 245 if (trace_buffer == NULL) { |
246 TraceBuffer::Init(isolate); | 246 TraceBuffer::Init(isolate); |
247 trace_buffer = isolate->trace_buffer(); | 247 trace_buffer = isolate->trace_buffer(); |
248 } | 248 } |
249 JSONStream js; | 249 JSONStream js; |
250 { | 250 { |
251 JSONObject trace_warning(&js); | 251 JSONObject trace_warning(&js); |
252 trace_warning.AddProperty("type", "JSCompatibilityWarning"); | 252 trace_warning.AddProperty("type", "JSCompatibilityWarning"); |
253 trace_warning.AddProperty("script", script); | 253 trace_warning.AddProperty("script", script); |
254 trace_warning.AddProperty("tokenPos", token_pos); | 254 trace_warning.AddProperty("tokenPos", token_pos); |
255 trace_warning.AddProperty("message", message); | 255 trace_warning.AddProperty("message", message); |
256 } | 256 } |
257 trace_buffer->Trace(micros, js.ToCString(), true); // Already escaped. | 257 trace_buffer->Trace(micros, js.ToCString(), true); // Already escaped. |
258 } | 258 } |
259 | 259 |
260 } // namespace dart | 260 } // namespace dart |
261 | 261 |
OLD | NEW |