| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/isolate.h" | 5 #include "vm/isolate.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "lib/mirrors.h" | 9 #include "lib/mirrors.h" |
| 10 #include "vm/compiler_stats.h" | 10 #include "vm/compiler_stats.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 const Object& exception = | 162 const Object& exception = |
| 163 Object::Handle(isolate_, | 163 Object::Handle(isolate_, |
| 164 Exceptions::Create(Exceptions::kIsolateUnhandledException, | 164 Exceptions::Create(Exceptions::kIsolateUnhandledException, |
| 165 exception_args)); | 165 exception_args)); |
| 166 if (exception.IsError()) { | 166 if (exception.IsError()) { |
| 167 return false; | 167 return false; |
| 168 } | 168 } |
| 169 ASSERT(exception.IsInstance()); | 169 ASSERT(exception.IsInstance()); |
| 170 | 170 |
| 171 // Invoke script's callback function. | 171 // Invoke script's callback function. |
| 172 GrowableArray<const Object*> callback_args(0); | |
| 173 callback_args.Add(&exception); | |
| 174 const Array& kNoArgumentNames = Array::Handle(isolate_); | |
| 175 Object& function = Object::Handle(isolate_, ResolveCallbackFunction()); | 172 Object& function = Object::Handle(isolate_, ResolveCallbackFunction()); |
| 176 if (function.IsNull() || function.IsError()) { | 173 if (function.IsNull() || function.IsError()) { |
| 177 return false; | 174 return false; |
| 178 } | 175 } |
| 176 const Array& callback_args = Array::Handle(Array::New(1)); |
| 177 callback_args.SetAt(0, exception); |
| 179 const Object& result = | 178 const Object& result = |
| 180 Object::Handle(DartEntry::InvokeStatic(Function::Cast(function), | 179 Object::Handle(DartEntry::InvokeStatic(Function::Cast(function), |
| 181 callback_args, | 180 callback_args)); |
| 182 kNoArgumentNames)); | |
| 183 if (result.IsError()) { | 181 if (result.IsError()) { |
| 184 const Error& err = Error::Cast(result); | 182 const Error& err = Error::Cast(result); |
| 185 OS::PrintErr("failed calling unhandled exception callback: %s\n", | 183 OS::PrintErr("failed calling unhandled exception callback: %s\n", |
| 186 err.ToErrorCString()); | 184 err.ToErrorCString()); |
| 187 return false; | 185 return false; |
| 188 } | 186 } |
| 189 | 187 |
| 190 ASSERT(result.IsBool()); | 188 ASSERT(result.IsBool()); |
| 191 bool continue_from_exception = Bool::Cast(result).value(); | 189 bool continue_from_exception = Bool::Cast(result).value(); |
| 192 if (continue_from_exception) { | 190 if (continue_from_exception) { |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 | 601 |
| 604 | 602 |
| 605 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor, | 603 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor, |
| 606 bool visit_prologue_weak_handles) { | 604 bool visit_prologue_weak_handles) { |
| 607 if (api_state() != NULL) { | 605 if (api_state() != NULL) { |
| 608 api_state()->VisitWeakHandles(visitor, visit_prologue_weak_handles); | 606 api_state()->VisitWeakHandles(visitor, visit_prologue_weak_handles); |
| 609 } | 607 } |
| 610 } | 608 } |
| 611 | 609 |
| 612 } // namespace dart | 610 } // namespace dart |
| OLD | NEW |