| Index: runtime/vm/exceptions.cc
|
| diff --git a/runtime/vm/exceptions.cc b/runtime/vm/exceptions.cc
|
| index 7b715410609d70e827a3ae232cce210762493460..343373fa127adef6f5465ce76ed174207d028ef2 100644
|
| --- a/runtime/vm/exceptions.cc
|
| +++ b/runtime/vm/exceptions.cc
|
| @@ -23,7 +23,6 @@
|
| #include "vm/symbols.h"
|
| #include "vm/tags.h"
|
|
|
| -
|
| namespace dart {
|
|
|
| DECLARE_FLAG(bool, trace_deoptimization);
|
| @@ -32,7 +31,6 @@ DEFINE_FLAG(bool,
|
| false,
|
| "Prints a stack trace everytime a throw occurs.");
|
|
|
| -
|
| class StackTraceBuilder : public ValueObject {
|
| public:
|
| StackTraceBuilder() {}
|
| @@ -41,7 +39,6 @@ class StackTraceBuilder : public ValueObject {
|
| virtual void AddFrame(const Code& code, const Smi& offset) = 0;
|
| };
|
|
|
| -
|
| class RegularStackTraceBuilder : public StackTraceBuilder {
|
| public:
|
| explicit RegularStackTraceBuilder(Zone* zone)
|
| @@ -66,7 +63,6 @@ class RegularStackTraceBuilder : public StackTraceBuilder {
|
| DISALLOW_COPY_AND_ASSIGN(RegularStackTraceBuilder);
|
| };
|
|
|
| -
|
| class PreallocatedStackTraceBuilder : public StackTraceBuilder {
|
| public:
|
| explicit PreallocatedStackTraceBuilder(const Instance& stacktrace)
|
| @@ -90,7 +86,6 @@ class PreallocatedStackTraceBuilder : public StackTraceBuilder {
|
| DISALLOW_COPY_AND_ASSIGN(PreallocatedStackTraceBuilder);
|
| };
|
|
|
| -
|
| void PreallocatedStackTraceBuilder::AddFrame(const Code& code,
|
| const Smi& offset) {
|
| if (cur_index_ >= StackTrace::kPreallocatedStackdepth) {
|
| @@ -126,7 +121,6 @@ void PreallocatedStackTraceBuilder::AddFrame(const Code& code,
|
| cur_index_ += 1;
|
| }
|
|
|
| -
|
| static void BuildStackTrace(StackTraceBuilder* builder) {
|
| StackFrameIterator frames(StackFrameIterator::kDontValidateFrames,
|
| Thread::Current(),
|
| @@ -146,7 +140,6 @@ static void BuildStackTrace(StackTraceBuilder* builder) {
|
| }
|
| }
|
|
|
| -
|
| static RawObject** VariableAt(uword fp, int stack_slot) {
|
| #if defined(TARGET_ARCH_DBC)
|
| return reinterpret_cast<RawObject**>(fp + stack_slot * kWordSize);
|
| @@ -160,7 +153,6 @@ static RawObject** VariableAt(uword fp, int stack_slot) {
|
| #endif
|
| }
|
|
|
| -
|
| class ExceptionHandlerFinder : public StackResource {
|
| public:
|
| explicit ExceptionHandlerFinder(Thread* thread)
|
| @@ -347,7 +339,6 @@ class ExceptionHandlerFinder : public StackResource {
|
| intptr_t pc_; // Current pc in the handler frame.
|
| };
|
|
|
| -
|
| static void FindErrorHandler(uword* handler_pc,
|
| uword* handler_sp,
|
| uword* handler_fp) {
|
| @@ -366,7 +357,6 @@ static void FindErrorHandler(uword* handler_pc,
|
| *handler_fp = frame->fp();
|
| }
|
|
|
| -
|
| static uword RemapExceptionPCForDeopt(Thread* thread,
|
| uword program_counter,
|
| uword frame_pointer) {
|
| @@ -396,7 +386,6 @@ static uword RemapExceptionPCForDeopt(Thread* thread,
|
| return program_counter;
|
| }
|
|
|
| -
|
| static void ClearLazyDeopts(Thread* thread, uword frame_pointer) {
|
| #if !defined(TARGET_ARCH_DBC)
|
| MallocGrowableArray<PendingLazyDeopt>* pending_deopts =
|
| @@ -440,7 +429,6 @@ static void ClearLazyDeopts(Thread* thread, uword frame_pointer) {
|
| #endif // !DBC
|
| }
|
|
|
| -
|
| static void JumpToExceptionHandler(Thread* thread,
|
| uword program_counter,
|
| uword stack_pointer,
|
| @@ -457,7 +445,6 @@ static void JumpToExceptionHandler(Thread* thread,
|
| frame_pointer, false /* do not clear deopt */);
|
| }
|
|
|
| -
|
| void Exceptions::JumpToFrame(Thread* thread,
|
| uword program_counter,
|
| uword stack_pointer,
|
| @@ -499,7 +486,6 @@ void Exceptions::JumpToFrame(Thread* thread,
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| static RawField* LookupStackTraceField(const Instance& instance) {
|
| if (instance.GetClassId() < kNumPredefinedCids) {
|
| // 'class Error' is not a predefined class.
|
| @@ -532,12 +518,10 @@ static RawField* LookupStackTraceField(const Instance& instance) {
|
| return Field::null();
|
| }
|
|
|
| -
|
| RawStackTrace* Exceptions::CurrentStackTrace() {
|
| return GetStackTraceForException();
|
| }
|
|
|
| -
|
| static void ThrowExceptionHelper(Thread* thread,
|
| const Instance& incoming_exception,
|
| const Instance& existing_stacktrace,
|
| @@ -637,7 +621,6 @@ static void ThrowExceptionHelper(Thread* thread,
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| // Static helpers for allocating, initializing, and throwing an error instance.
|
|
|
| // Return the script of the Dart function that called the native entry or the
|
| @@ -650,7 +633,6 @@ RawScript* Exceptions::GetCallerScript(DartFrameIterator* iterator) {
|
| return caller.script();
|
| }
|
|
|
| -
|
| // Allocate a new instance of the given class name.
|
| // TODO(hausner): Rename this NewCoreInstance to call out the fact that
|
| // the class name is resolved in the core library implicitly?
|
| @@ -667,7 +649,6 @@ RawInstance* Exceptions::NewInstance(const char* class_name) {
|
| return Instance::New(cls);
|
| }
|
|
|
| -
|
| // Allocate, initialize, and throw a TypeError or CastError.
|
| // If error_msg is not null, throw a TypeError, even for a type cast.
|
| void Exceptions::CreateAndThrowTypeError(TokenPosition location,
|
| @@ -778,7 +759,6 @@ void Exceptions::CreateAndThrowTypeError(TokenPosition location,
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| void Exceptions::Throw(Thread* thread, const Instance& exception) {
|
| // Do not notify debugger on stack overflow and out of memory exceptions.
|
| // The VM would crash when the debugger calls back into the VM to
|
| @@ -795,7 +775,6 @@ void Exceptions::Throw(Thread* thread, const Instance& exception) {
|
| false);
|
| }
|
|
|
| -
|
| void Exceptions::ReThrow(Thread* thread,
|
| const Instance& exception,
|
| const Instance& stacktrace) {
|
| @@ -803,7 +782,6 @@ void Exceptions::ReThrow(Thread* thread,
|
| ThrowExceptionHelper(thread, exception, stacktrace, true);
|
| }
|
|
|
| -
|
| void Exceptions::PropagateError(const Error& error) {
|
| Thread* thread = Thread::Current();
|
| Zone* zone = thread->zone();
|
| @@ -829,7 +807,6 @@ void Exceptions::PropagateError(const Error& error) {
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| void Exceptions::ThrowByType(ExceptionType type, const Array& arguments) {
|
| Thread* thread = Thread::Current();
|
| const Object& result =
|
| @@ -844,7 +821,6 @@ void Exceptions::ThrowByType(ExceptionType type, const Array& arguments) {
|
| }
|
| }
|
|
|
| -
|
| void Exceptions::ThrowOOM() {
|
| Thread* thread = Thread::Current();
|
| Isolate* isolate = thread->isolate();
|
| @@ -853,7 +829,6 @@ void Exceptions::ThrowOOM() {
|
| Throw(thread, oom);
|
| }
|
|
|
| -
|
| void Exceptions::ThrowStackOverflow() {
|
| Thread* thread = Thread::Current();
|
| Isolate* isolate = thread->isolate();
|
| @@ -862,14 +837,12 @@ void Exceptions::ThrowStackOverflow() {
|
| Throw(thread, stack_overflow);
|
| }
|
|
|
| -
|
| void Exceptions::ThrowArgumentError(const Instance& arg) {
|
| const Array& args = Array::Handle(Array::New(1));
|
| args.SetAt(0, arg);
|
| Exceptions::ThrowByType(Exceptions::kArgument, args);
|
| }
|
|
|
| -
|
| void Exceptions::ThrowRangeError(const char* argument_name,
|
| const Integer& argument_value,
|
| intptr_t expected_from,
|
| @@ -882,21 +855,18 @@ void Exceptions::ThrowRangeError(const char* argument_name,
|
| Exceptions::ThrowByType(Exceptions::kRange, args);
|
| }
|
|
|
| -
|
| void Exceptions::ThrowRangeErrorMsg(const char* msg) {
|
| const Array& args = Array::Handle(Array::New(1));
|
| args.SetAt(0, String::Handle(String::New(msg)));
|
| Exceptions::ThrowByType(Exceptions::kRangeMsg, args);
|
| }
|
|
|
| -
|
| void Exceptions::ThrowCompileTimeError(const LanguageError& error) {
|
| const Array& args = Array::Handle(Array::New(1));
|
| args.SetAt(0, String::Handle(error.FormatMessage()));
|
| Exceptions::ThrowByType(Exceptions::kCompileTimeError, args);
|
| }
|
|
|
| -
|
| RawObject* Exceptions::Create(ExceptionType type, const Array& arguments) {
|
| Library& library = Library::Handle();
|
| const String* class_name = NULL;
|
| @@ -988,5 +958,4 @@ RawObject* Exceptions::Create(ExceptionType type, const Array& arguments) {
|
| *constructor_name, arguments);
|
| }
|
|
|
| -
|
| } // namespace dart
|
|
|