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

Side by Side Diff: src/isolate.cc

Issue 1034163002: Use atomic operation to read the length of a fixed array. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdlib.h> 5 #include <stdlib.h>
6 6
7 #include <fstream> // NOLINT(readability/streams) 7 #include <fstream> // NOLINT(readability/streams)
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "src/v8.h" 10 #include "src/v8.h"
(...skipping 2614 matching lines...) Expand 10 before | Expand all | Expand 10 after
2625 WeakCell* cell = WeakCell::cast(detached_contexts->get(i + 1)); 2625 WeakCell* cell = WeakCell::cast(detached_contexts->get(i + 1));
2626 if (mark_sweeps > 3) { 2626 if (mark_sweeps > 3) {
2627 PrintF("detached context 0x%p\n survived %d GCs (leak?)\n", 2627 PrintF("detached context 0x%p\n survived %d GCs (leak?)\n",
2628 static_cast<void*>(cell->value()), mark_sweeps); 2628 static_cast<void*>(cell->value()), mark_sweeps);
2629 } 2629 }
2630 } 2630 }
2631 } 2631 }
2632 if (new_length == 0) { 2632 if (new_length == 0) {
2633 heap()->set_detached_contexts(heap()->empty_fixed_array()); 2633 heap()->set_detached_contexts(heap()->empty_fixed_array());
2634 } else if (new_length < length) { 2634 } else if (new_length < length) {
2635 heap()->RightTrimFixedArray<Heap::FROM_MUTATOR>(*detached_contexts, 2635 heap()->RightTrimFixedArray<Heap::SWEEPING_STARTED>(*detached_contexts,
2636 length - new_length); 2636 length - new_length);
2637 } 2637 }
2638 } 2638 }
2639 2639
2640 2640
2641 bool StackLimitCheck::JsHasOverflowed() const { 2641 bool StackLimitCheck::JsHasOverflowed() const {
2642 StackGuard* stack_guard = isolate_->stack_guard(); 2642 StackGuard* stack_guard = isolate_->stack_guard();
2643 #ifdef USE_SIMULATOR 2643 #ifdef USE_SIMULATOR
2644 // The simulator uses a separate JS stack. 2644 // The simulator uses a separate JS stack.
2645 Address jssp_address = Simulator::current(isolate_)->get_sp(); 2645 Address jssp_address = Simulator::current(isolate_)->get_sp();
2646 uintptr_t jssp = reinterpret_cast<uintptr_t>(jssp_address); 2646 uintptr_t jssp = reinterpret_cast<uintptr_t>(jssp_address);
2647 if (jssp < stack_guard->real_jslimit()) return true; 2647 if (jssp < stack_guard->real_jslimit()) return true;
2648 #endif // USE_SIMULATOR 2648 #endif // USE_SIMULATOR
2649 return GetCurrentStackPosition() < stack_guard->real_climit(); 2649 return GetCurrentStackPosition() < stack_guard->real_climit();
2650 } 2650 }
2651 2651
2652 2652
2653 bool PostponeInterruptsScope::Intercept(StackGuard::InterruptFlag flag) { 2653 bool PostponeInterruptsScope::Intercept(StackGuard::InterruptFlag flag) {
2654 // First check whether the previous scope intercepts. 2654 // First check whether the previous scope intercepts.
2655 if (prev_ && prev_->Intercept(flag)) return true; 2655 if (prev_ && prev_->Intercept(flag)) return true;
2656 // Then check whether this scope intercepts. 2656 // Then check whether this scope intercepts.
2657 if ((flag & intercept_mask_)) { 2657 if ((flag & intercept_mask_)) {
2658 intercepted_flags_ |= flag; 2658 intercepted_flags_ |= flag;
2659 return true; 2659 return true;
2660 } 2660 }
2661 return false; 2661 return false;
2662 } 2662 }
2663 2663
2664 } } // namespace v8::internal 2664 } } // namespace v8::internal
OLDNEW
« src/heap/heap.h ('K') | « src/heap/mark-compact.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698