| Index: runtime/vm/exceptions.cc
|
| ===================================================================
|
| --- runtime/vm/exceptions.cc (revision 37467)
|
| +++ runtime/vm/exceptions.cc (working copy)
|
| @@ -34,11 +34,6 @@
|
| "Prints a stack trace everytime a throw occurs.");
|
| DEFINE_FLAG(bool, verbose_stacktrace, false,
|
| "Stack traces will include methods marked invisible.");
|
| -DEFINE_FLAG(int, stacktrace_depth_on_warning, 5,
|
| - "Maximal number of stack frames to print after a runtime warning.");
|
| -DECLARE_FLAG(bool, silent_warnings);
|
| -DECLARE_FLAG(bool, warning_as_error);
|
| -DECLARE_FLAG(bool, warn_on_javascript_compatibility);
|
|
|
|
|
| const char* Exceptions::kCastErrorDstName = "type cast";
|
| @@ -747,85 +742,11 @@
|
|
|
|
|
| // Throw JavascriptCompatibilityError exception.
|
| -static void ThrowJavascriptCompatibilityError(const char* msg) {
|
| +void Exceptions::ThrowJavascriptCompatibilityError(const char* msg) {
|
| const Array& exc_args = Array::Handle(Array::New(1));
|
| const String& msg_str = String::Handle(String::New(msg));
|
| exc_args.SetAt(0, msg_str);
|
| Exceptions::ThrowByType(Exceptions::kJavascriptCompatibilityError, exc_args);
|
| }
|
|
|
| -
|
| -void Exceptions::JSWarning(StackFrame* caller_frame, const char* format, ...) {
|
| - ASSERT(caller_frame != NULL);
|
| - ASSERT(FLAG_warn_on_javascript_compatibility);
|
| - if (FLAG_silent_warnings) return;
|
| - Isolate* isolate = Isolate::Current();
|
| - const Code& caller_code = Code::Handle(isolate,
|
| - caller_frame->LookupDartCode());
|
| - ASSERT(!caller_code.IsNull());
|
| - const uword caller_pc = caller_frame->pc();
|
| - const intptr_t token_pos = caller_code.GetTokenIndexOfPC(caller_pc);
|
| - const Function& caller = Function::Handle(isolate, caller_code.function());
|
| - const Script& script = Script::Handle(isolate, caller.script());
|
| - va_list args;
|
| - va_start(args, format);
|
| - const Error& error = Error::Handle(isolate,
|
| - LanguageError::NewFormattedV(Error::Handle(isolate), // No prev error.
|
| - script, token_pos, LanguageError::kWarning,
|
| - Heap::kNew, format, args));
|
| - va_end(args);
|
| - if (FLAG_warning_as_error) {
|
| - ThrowJavascriptCompatibilityError(error.ToErrorCString());
|
| - } else {
|
| - OS::Print("javascript compatibility warning: %s", error.ToErrorCString());
|
| - va_start(args, format);
|
| - TraceJSWarningV(script, token_pos, format, args);
|
| - va_end(args);
|
| - }
|
| - const Stacktrace& stacktrace =
|
| - Stacktrace::Handle(isolate, Exceptions::CurrentStacktrace());
|
| - intptr_t idx = 0;
|
| - OS::Print("%s",
|
| - stacktrace.ToCStringInternal(&idx,
|
| - FLAG_stacktrace_depth_on_warning));
|
| -}
|
| -
|
| -
|
| -void Exceptions::TraceJSWarningF(const Script& script, intptr_t token_pos,
|
| - const char* format, ...) {
|
| - va_list args;
|
| - va_start(args, format);
|
| - TraceJSWarningV(script, token_pos, format, args);
|
| - va_end(args);
|
| -}
|
| -
|
| -
|
| -void Exceptions::TraceJSWarningV(const Script& script, intptr_t token_pos,
|
| - const char* format, va_list args) {
|
| - const int64_t micros = OS::GetCurrentTimeMicros();
|
| - Isolate* isolate = Isolate::Current();
|
| - TraceBuffer* trace_buffer = isolate->trace_buffer();
|
| - if (trace_buffer == NULL) {
|
| - TraceBuffer::Init(isolate);
|
| - trace_buffer = isolate->trace_buffer();
|
| - }
|
| - JSONStream js;
|
| - {
|
| - JSONObject trace_warning(&js);
|
| - trace_warning.AddProperty("type", "JSCompatibilityWarning");
|
| - trace_warning.AddProperty("script", script);
|
| - trace_warning.AddProperty("tokenPos", token_pos);
|
| - va_list args_copy;
|
| - va_copy(args_copy, args);
|
| - const intptr_t len = OS::VSNPrint(NULL, 0, format, args_copy);
|
| - va_end(args_copy);
|
| - char* msg = reinterpret_cast<char*>(malloc(len + 1));
|
| - va_copy(args_copy, args);
|
| - OS::VSNPrint(msg, len + 1, format, args_copy);
|
| - va_end(args_copy);
|
| - trace_warning.AddProperty("message", msg);
|
| - }
|
| - trace_buffer->Trace(micros, js.ToCString(), true); // Already escaped.
|
| -}
|
| -
|
| } // namespace dart
|
|
|