Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/exceptions.h" | 5 #include "vm/exceptions.h" |
| 6 | 6 |
| 7 #include "platform/address_sanitizer.h" | 7 #include "platform/address_sanitizer.h" |
| 8 | 8 |
| 9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 279 Simulator::Current()->Longjmp(program_counter, stack_pointer, frame_pointer, | 279 Simulator::Current()->Longjmp(program_counter, stack_pointer, frame_pointer, |
| 280 raw_exception, raw_stacktrace, isolate); | 280 raw_exception, raw_stacktrace, isolate); |
| 281 #else | 281 #else |
| 282 // Prepare for unwinding frames by destroying all the stack resources | 282 // Prepare for unwinding frames by destroying all the stack resources |
| 283 // in the previous frames. | 283 // in the previous frames. |
| 284 | 284 |
| 285 while (isolate->top_resource() != NULL && | 285 while (isolate->top_resource() != NULL && |
| 286 (reinterpret_cast<uword>(isolate->top_resource()) < stack_pointer)) { | 286 (reinterpret_cast<uword>(isolate->top_resource()) < stack_pointer)) { |
| 287 isolate->top_resource()->~StackResource(); | 287 isolate->top_resource()->~StackResource(); |
| 288 } | 288 } |
| 289 #if defined(DEBUG) | |
| 290 // All remaining stack resources should be below stack_pointer. | |
| 291 StackResource* current = isolate->top_resource(); | |
| 292 while (current != NULL) { | |
| 293 ASSERT(reinterpret_cast<uword>(current) > stack_pointer); | |
|
zra
2015/02/17 19:00:23
Is this the only place where this assertion is nee
koda
2015/02/17 19:07:54
Yes, we do the same thing in the simulators. We sh
| |
| 294 current = current->previous(); | |
| 295 } | |
| 296 #endif // DEBUG | |
| 289 | 297 |
| 290 // Call a stub to set up the exception object in kExceptionObjectReg, | 298 // Call a stub to set up the exception object in kExceptionObjectReg, |
| 291 // to set up the stacktrace object in kStackTraceObjectReg, and to | 299 // to set up the stacktrace object in kStackTraceObjectReg, and to |
| 292 // continue execution at the given pc in the given frame. | 300 // continue execution at the given pc in the given frame. |
| 293 typedef void (*ExcpHandler)(uword, uword, uword, RawObject*, RawObject*, | 301 typedef void (*ExcpHandler)(uword, uword, uword, RawObject*, RawObject*, |
| 294 Isolate*); | 302 Isolate*); |
| 295 ExcpHandler func = reinterpret_cast<ExcpHandler>( | 303 ExcpHandler func = reinterpret_cast<ExcpHandler>( |
| 296 StubCode::JumpToExceptionHandlerEntryPoint()); | 304 StubCode::JumpToExceptionHandlerEntryPoint()); |
| 297 | 305 |
| 298 // Unpoison the stack before we tear it down in the generated stub code. | 306 // Unpoison the stack before we tear it down in the generated stub code. |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 754 | 762 |
| 755 // Throw JavascriptCompatibilityError exception. | 763 // Throw JavascriptCompatibilityError exception. |
| 756 void Exceptions::ThrowJavascriptCompatibilityError(const char* msg) { | 764 void Exceptions::ThrowJavascriptCompatibilityError(const char* msg) { |
| 757 const Array& exc_args = Array::Handle(Array::New(1)); | 765 const Array& exc_args = Array::Handle(Array::New(1)); |
| 758 const String& msg_str = String::Handle(String::New(msg)); | 766 const String& msg_str = String::Handle(String::New(msg)); |
| 759 exc_args.SetAt(0, msg_str); | 767 exc_args.SetAt(0, msg_str); |
| 760 Exceptions::ThrowByType(Exceptions::kJavascriptCompatibilityError, exc_args); | 768 Exceptions::ThrowByType(Exceptions::kJavascriptCompatibilityError, exc_args); |
| 761 } | 769 } |
| 762 | 770 |
| 763 } // namespace dart | 771 } // namespace dart |
| OLD | NEW |