| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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/thread.h" | 5 #include "vm/thread.h" |
| 6 | 6 |
| 7 #include "vm/dart_api_state.h" | 7 #include "vm/dart_api_state.h" |
| 8 #include "vm/growable_array.h" | 8 #include "vm/growable_array.h" |
| 9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
| 10 #include "vm/lockers.h" | 10 #include "vm/lockers.h" |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 | 324 |
| 325 void Thread::ClearStackLimit() { | 325 void Thread::ClearStackLimit() { |
| 326 SetStackLimit(~static_cast<uword>(0)); | 326 SetStackLimit(~static_cast<uword>(0)); |
| 327 } | 327 } |
| 328 | 328 |
| 329 | 329 |
| 330 /* static */ | 330 /* static */ |
| 331 uword Thread::GetCurrentStackPointer() { | 331 uword Thread::GetCurrentStackPointer() { |
| 332 // Since AddressSanitizer's detect_stack_use_after_return instruments the | 332 // Since AddressSanitizer's detect_stack_use_after_return instruments the |
| 333 // C++ code to give out fake stack addresses, we call a stub in that case. | 333 // C++ code to give out fake stack addresses, we call a stub in that case. |
| 334 ASSERT(StubCode::GetStackPointer_entry() != NULL); |
| 334 uword (*func)() = reinterpret_cast<uword (*)()>( | 335 uword (*func)() = reinterpret_cast<uword (*)()>( |
| 335 StubCode::GetStackPointer_entry()->EntryPoint()); | 336 StubCode::GetStackPointer_entry()->EntryPoint()); |
| 336 // But for performance (and to support simulators), we normally use a local. | 337 // But for performance (and to support simulators), we normally use a local. |
| 337 #if defined(__has_feature) | 338 #if defined(__has_feature) |
| 338 #if __has_feature(address_sanitizer) | 339 #if __has_feature(address_sanitizer) |
| 339 uword current_sp = func(); | 340 uword current_sp = func(); |
| 340 return current_sp; | 341 return current_sp; |
| 341 #else | 342 #else |
| 342 uword stack_allocated_local_address = reinterpret_cast<uword>(&func); | 343 uword stack_allocated_local_address = reinterpret_cast<uword>(&func); |
| 343 return stack_allocated_local_address; | 344 return stack_allocated_local_address; |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 | 704 |
| 704 DisableThreadInterruptsScope::~DisableThreadInterruptsScope() { | 705 DisableThreadInterruptsScope::~DisableThreadInterruptsScope() { |
| 705 if (thread() != NULL) { | 706 if (thread() != NULL) { |
| 706 OSThread* os_thread = thread()->os_thread(); | 707 OSThread* os_thread = thread()->os_thread(); |
| 707 ASSERT(os_thread != NULL); | 708 ASSERT(os_thread != NULL); |
| 708 os_thread->EnableThreadInterrupts(); | 709 os_thread->EnableThreadInterrupts(); |
| 709 } | 710 } |
| 710 } | 711 } |
| 711 | 712 |
| 712 } // namespace dart | 713 } // namespace dart |
| OLD | NEW |