| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/code_observers.h" | 10 #include "vm/code_observers.h" |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 // TODO(5411455): Use flag to override default value and Validate the | 381 // TODO(5411455): Use flag to override default value and Validate the |
| 382 // stack size by querying OS. | 382 // stack size by querying OS. |
| 383 uword Isolate::GetSpecifiedStackSize() { | 383 uword Isolate::GetSpecifiedStackSize() { |
| 384 ASSERT(Isolate::kStackSizeBuffer < Thread::GetMaxStackSize()); | 384 ASSERT(Isolate::kStackSizeBuffer < Thread::GetMaxStackSize()); |
| 385 uword stack_size = Thread::GetMaxStackSize() - Isolate::kStackSizeBuffer; | 385 uword stack_size = Thread::GetMaxStackSize() - Isolate::kStackSizeBuffer; |
| 386 return stack_size; | 386 return stack_size; |
| 387 } | 387 } |
| 388 | 388 |
| 389 | 389 |
| 390 void Isolate::SetStackLimitFromCurrentTOS(uword stack_top_value) { | 390 void Isolate::SetStackLimitFromCurrentTOS(uword stack_top_value) { |
| 391 #ifdef USING_SIMULATOR |
| 392 // Ignore passed-in native stack top and use Simulator stack top. |
| 393 Simulator* sim = Simulator::Current(); // May allocate a simulator. |
| 394 ASSERT(simulator() == sim); // This isolate's simulator is the current one. |
| 395 stack_top_value = sim->StackTop(); |
| 396 // The overflow area is accounted for by the simulator. |
| 397 #endif |
| 391 SetStackLimit(stack_top_value - GetSpecifiedStackSize()); | 398 SetStackLimit(stack_top_value - GetSpecifiedStackSize()); |
| 392 } | 399 } |
| 393 | 400 |
| 394 | 401 |
| 395 void Isolate::SetStackLimit(uword limit) { | 402 void Isolate::SetStackLimit(uword limit) { |
| 396 MutexLocker ml(mutex_); | 403 MutexLocker ml(mutex_); |
| 397 if (stack_limit_ == saved_stack_limit_) { | 404 if (stack_limit_ == saved_stack_limit_) { |
| 398 // No interrupt pending, set stack_limit_ too. | 405 // No interrupt pending, set stack_limit_ too. |
| 399 stack_limit_ = limit; | 406 stack_limit_ = limit; |
| 400 } | 407 } |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 | 628 |
| 622 | 629 |
| 623 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor, | 630 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor, |
| 624 bool visit_prologue_weak_handles) { | 631 bool visit_prologue_weak_handles) { |
| 625 if (api_state() != NULL) { | 632 if (api_state() != NULL) { |
| 626 api_state()->VisitWeakHandles(visitor, visit_prologue_weak_handles); | 633 api_state()->VisitWeakHandles(visitor, visit_prologue_weak_handles); |
| 627 } | 634 } |
| 628 } | 635 } |
| 629 | 636 |
| 630 } // namespace dart | 637 } // namespace dart |
| OLD | NEW |