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

Unified Diff: src/frames.cc

Issue 6771047: Move SafeStackFrameIterator::active_count_ into an isolate. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Moved variable to Isolate, as Vitaly has suggested Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/frames.h ('k') | src/isolate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/frames.cc
diff --git a/src/frames.cc b/src/frames.cc
index 79aa2507fba0c31230192a6bb6754a3d5599ce95..4924736b832cba4c6b3e5e8e1864424fb12444a1 100644
--- a/src/frames.cc
+++ b/src/frames.cc
@@ -39,9 +39,6 @@
namespace v8 {
namespace internal {
-
-int SafeStackFrameIterator::active_count_ = 0;
-
// Iterator that supports traversing the stack handlers of a
// particular frame. Needs to know the top of the handler chain.
class StackHandlerIterator BASE_EMBEDDED {
@@ -221,10 +218,24 @@ bool SafeStackFrameIterator::ExitFrameValidator::IsValidFP(Address fp) {
}
+SafeStackFrameIterator::ActiveCountMaintainer::ActiveCountMaintainer(
+ Isolate* isolate)
+ : isolate_(isolate) {
+ isolate_->set_safe_stack_iterator_counter(
+ isolate_->safe_stack_iterator_counter() + 1);
+}
+
+
+SafeStackFrameIterator::ActiveCountMaintainer::~ActiveCountMaintainer() {
+ isolate_->set_safe_stack_iterator_counter(
+ isolate_->safe_stack_iterator_counter() - 1);
+}
+
+
SafeStackFrameIterator::SafeStackFrameIterator(
Isolate* isolate,
Address fp, Address sp, Address low_bound, Address high_bound) :
- maintainer_(),
+ maintainer_(isolate),
stack_validator_(low_bound, high_bound),
is_valid_top_(IsValidTop(isolate, low_bound, high_bound)),
is_valid_fp_(IsWithinBounds(low_bound, high_bound, fp)),
@@ -233,6 +244,10 @@ SafeStackFrameIterator::SafeStackFrameIterator(
iterator_(isolate, is_valid_top_, is_valid_fp_ ? fp : NULL, sp) {
}
+bool SafeStackFrameIterator::is_active(Isolate* isolate) {
+ return isolate->safe_stack_iterator_counter() > 0;
+}
+
bool SafeStackFrameIterator::IsValidTop(Isolate* isolate,
Address low_bound, Address high_bound) {
@@ -392,7 +407,8 @@ StackFrame::Type StackFrame::ComputeType(State* state) {
// frames as normal JavaScript frames to avoid having to look
// into the heap to determine the state. This is safe as long
// as nobody tries to GC...
- if (SafeStackFrameIterator::is_active()) return JAVA_SCRIPT;
+ if (SafeStackFrameIterator::is_active(Isolate::Current()))
Vitaly Repeshko 2011/04/01 15:16:37 Save result of Isolate::Current() as it's used mor
mnaganov (inactive) 2011/04/01 15:21:39 Done.
+ return JAVA_SCRIPT;
Code::Kind kind = GetContainingCode(Isolate::Current(),
*(state->pc_address))->kind();
ASSERT(kind == Code::FUNCTION || kind == Code::OPTIMIZED_FUNCTION);
@@ -539,7 +555,7 @@ void OptimizedFrame::Iterate(ObjectVisitor* v) const {
// Make sure that we're not doing "safe" stack frame iteration. We cannot
// possibly find pointers in optimized frames in that state.
- ASSERT(!SafeStackFrameIterator::is_active());
+ ASSERT(!SafeStackFrameIterator::is_active(Isolate::Current()));
// Compute the safepoint information.
unsigned stack_slots = 0;
@@ -640,7 +656,7 @@ Code* JavaScriptFrame::unchecked_code() const {
Address JavaScriptFrame::GetCallerStackPointer() const {
int arguments;
- if (SafeStackFrameIterator::is_active() ||
+ if (SafeStackFrameIterator::is_active(Isolate::Current()) ||
Vitaly Repeshko 2011/04/01 15:16:37 Same here. The second usage is in the HEAP macro.
mnaganov (inactive) 2011/04/01 15:21:39 Done.
HEAP->gc_state() != Heap::NOT_IN_GC) {
// If the we are currently iterating the safe stack the
// arguments for frames are traversed as if they were
« no previous file with comments | « src/frames.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698