Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Side by Side Diff: runtime/vm/isolate.cc

Issue 2985863002: Changes new space allocation from simple bump pointer allocation from (Closed)
Patch Set: Zeroes out TLAB when needed. Changes variable and fn names Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/text_buffer.h" 10 #include "platform/text_buffer.h"
(...skipping 2556 matching lines...) Expand 10 before | Expand all | Expand 10 after
2567 thread->heap_ = heap(); 2567 thread->heap_ = heap();
2568 thread->set_os_thread(os_thread); 2568 thread->set_os_thread(os_thread);
2569 ASSERT(thread->execution_state() == Thread::kThreadInNative); 2569 ASSERT(thread->execution_state() == Thread::kThreadInNative);
2570 thread->set_execution_state(Thread::kThreadInVM); 2570 thread->set_execution_state(Thread::kThreadInVM);
2571 thread->set_safepoint_state(0); 2571 thread->set_safepoint_state(0);
2572 thread->set_vm_tag(VMTag::kVMTagId); 2572 thread->set_vm_tag(VMTag::kVMTagId);
2573 ASSERT(thread->no_safepoint_scope_depth() == 0); 2573 ASSERT(thread->no_safepoint_scope_depth() == 0);
2574 os_thread->set_thread(thread); 2574 os_thread->set_thread(thread);
2575 if (is_mutator) { 2575 if (is_mutator) {
2576 mutator_thread_ = thread; 2576 mutator_thread_ = thread;
2577 if (this != Dart::vm_isolate()) { 2577 if (Dart::vm_isolate() != NULL && heap() != Dart::vm_isolate()->heap()) {
rmacnak 2017/07/26 21:30:30 if ((Dart::vm_isolate() != NULL) && (heap() != Dar
danunez 2017/07/26 22:07:11 Done.
2578 mutator_thread_->set_top(heap()->new_space()->top()); 2578 mutator_thread_->set_top(0);
2579 mutator_thread_->set_end(heap()->new_space()->end()); 2579 mutator_thread_->set_end(0);
2580 } 2580 }
2581 } 2581 }
2582 Thread::SetCurrent(thread); 2582 Thread::SetCurrent(thread);
2583 os_thread->EnableThreadInterrupts(); 2583 os_thread->EnableThreadInterrupts();
2584 } 2584 }
2585 return thread; 2585 return thread;
2586 } 2586 }
2587 2587
2588 void Isolate::UnscheduleThread(Thread* thread, 2588 void Isolate::UnscheduleThread(Thread* thread,
2589 bool is_mutator, 2589 bool is_mutator,
(...skipping 20 matching lines...) Expand all
2610 // Ensure that the thread reports itself as being at a safepoint. 2610 // Ensure that the thread reports itself as being at a safepoint.
2611 thread->EnterSafepoint(); 2611 thread->EnterSafepoint();
2612 } 2612 }
2613 OSThread* os_thread = thread->os_thread(); 2613 OSThread* os_thread = thread->os_thread();
2614 ASSERT(os_thread != NULL); 2614 ASSERT(os_thread != NULL);
2615 os_thread->DisableThreadInterrupts(); 2615 os_thread->DisableThreadInterrupts();
2616 os_thread->set_thread(NULL); 2616 os_thread->set_thread(NULL);
2617 OSThread::SetCurrent(os_thread); 2617 OSThread::SetCurrent(os_thread);
2618 if (is_mutator) { 2618 if (is_mutator) {
2619 if (this != Dart::vm_isolate()) { 2619 if (this != Dart::vm_isolate()) {
2620 heap()->new_space()->set_top(mutator_thread_->top_); 2620 // Ensure the new space is pointing right after the last object allocated.
2621 heap()->new_space()->set_end(mutator_thread_->end_); 2621 if (mutator_thread_->HasActiveTLAB()) {
2622 heap()->new_space()->set_top(mutator_thread_->top());
2623 }
2622 } 2624 }
2623 mutator_thread_->top_ = 0; 2625 mutator_thread_->set_top(0);
2624 mutator_thread_->end_ = 0; 2626 mutator_thread_->set_end(0);
2625 mutator_thread_ = NULL; 2627 mutator_thread_ = NULL;
2626 } 2628 }
2627 thread->isolate_ = NULL; 2629 thread->isolate_ = NULL;
2628 thread->heap_ = NULL; 2630 thread->heap_ = NULL;
2629 thread->set_os_thread(NULL); 2631 thread->set_os_thread(NULL);
2630 thread->set_execution_state(Thread::kThreadInNative); 2632 thread->set_execution_state(Thread::kThreadInNative);
2631 thread->set_safepoint_state(Thread::SetAtSafepoint(true, 0)); 2633 thread->set_safepoint_state(Thread::SetAtSafepoint(true, 0));
2632 thread->clear_pending_functions(); 2634 thread->clear_pending_functions();
2633 ASSERT(thread->no_safepoint_scope_depth() == 0); 2635 ASSERT(thread->no_safepoint_scope_depth() == 0);
2634 // Return thread structure. 2636 // Return thread structure.
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
2853 void IsolateSpawnState::DecrementSpawnCount() { 2855 void IsolateSpawnState::DecrementSpawnCount() {
2854 ASSERT(spawn_count_monitor_ != NULL); 2856 ASSERT(spawn_count_monitor_ != NULL);
2855 ASSERT(spawn_count_ != NULL); 2857 ASSERT(spawn_count_ != NULL);
2856 MonitorLocker ml(spawn_count_monitor_); 2858 MonitorLocker ml(spawn_count_monitor_);
2857 ASSERT(*spawn_count_ > 0); 2859 ASSERT(*spawn_count_ > 0);
2858 *spawn_count_ = *spawn_count_ - 1; 2860 *spawn_count_ = *spawn_count_ - 1;
2859 ml.Notify(); 2861 ml.Notify();
2860 } 2862 }
2861 2863
2862 } // namespace dart 2864 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698