Revert r7483 "Move SafeStackFrameIterator::active_count_ into an isolate."
It broke the Mac build. Sampler::SampleStack() can't use Isolate::Current() when called from the sampler thread (from SampleContext). We have to pass the isolate pointer. TBR=mikhail.naganov@gmail.com Review URL: http://codereview.chromium.org/6791014 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7485 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
6952f68ee3
commit
24596cae32
@ -39,6 +39,9 @@
|
||||
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 {
|
||||
@ -218,24 +221,10 @@ 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_(isolate),
|
||||
maintainer_(),
|
||||
stack_validator_(low_bound, high_bound),
|
||||
is_valid_top_(IsValidTop(isolate, low_bound, high_bound)),
|
||||
is_valid_fp_(IsWithinBounds(low_bound, high_bound, fp)),
|
||||
@ -244,10 +233,6 @@ 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) {
|
||||
@ -403,14 +388,13 @@ StackFrame::Type StackFrame::ComputeType(State* state) {
|
||||
const int offset = StandardFrameConstants::kMarkerOffset;
|
||||
Object* marker = Memory::Object_at(state->fp + offset);
|
||||
if (!marker->IsSmi()) {
|
||||
Isolate* isolate = Isolate::Current();
|
||||
// If we're using a "safe" stack iterator, we treat optimized
|
||||
// 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(isolate))
|
||||
return JAVA_SCRIPT;
|
||||
Code::Kind kind = GetContainingCode(isolate, *(state->pc_address))->kind();
|
||||
if (SafeStackFrameIterator::is_active()) return JAVA_SCRIPT;
|
||||
Code::Kind kind = GetContainingCode(Isolate::Current(),
|
||||
*(state->pc_address))->kind();
|
||||
ASSERT(kind == Code::FUNCTION || kind == Code::OPTIMIZED_FUNCTION);
|
||||
return (kind == Code::OPTIMIZED_FUNCTION) ? OPTIMIZED : JAVA_SCRIPT;
|
||||
}
|
||||
@ -555,7 +539,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(Isolate::Current()));
|
||||
ASSERT(!SafeStackFrameIterator::is_active());
|
||||
|
||||
// Compute the safepoint information.
|
||||
unsigned stack_slots = 0;
|
||||
@ -656,9 +640,8 @@ Code* JavaScriptFrame::unchecked_code() const {
|
||||
|
||||
Address JavaScriptFrame::GetCallerStackPointer() const {
|
||||
int arguments;
|
||||
Isolate* isolate = Isolate::Current();
|
||||
if (SafeStackFrameIterator::is_active(isolate) ||
|
||||
isolate->heap()->gc_state() != Heap::NOT_IN_GC) {
|
||||
if (SafeStackFrameIterator::is_active() ||
|
||||
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
|
||||
// expression stack elements of the calling frame. The reason for
|
||||
|
10
src/frames.h
10
src/frames.h
@ -739,7 +739,7 @@ class SafeStackFrameIterator BASE_EMBEDDED {
|
||||
void Advance();
|
||||
void Reset();
|
||||
|
||||
static bool is_active(Isolate* isolate);
|
||||
static bool is_active() { return active_count_ > 0; }
|
||||
|
||||
static bool IsWithinBounds(
|
||||
Address low_bound, Address high_bound, Address addr) {
|
||||
@ -786,13 +786,13 @@ class SafeStackFrameIterator BASE_EMBEDDED {
|
||||
// heap objects.
|
||||
class ActiveCountMaintainer BASE_EMBEDDED {
|
||||
public:
|
||||
explicit ActiveCountMaintainer(Isolate* isolate);
|
||||
~ActiveCountMaintainer();
|
||||
private:
|
||||
Isolate* isolate_;
|
||||
ActiveCountMaintainer() { active_count_++; }
|
||||
~ActiveCountMaintainer() { active_count_--; }
|
||||
};
|
||||
|
||||
ActiveCountMaintainer maintainer_;
|
||||
// TODO(isolates): this is dangerous.
|
||||
static int active_count_;
|
||||
StackAddressValidator stack_validator_;
|
||||
const bool is_valid_top_;
|
||||
const bool is_valid_fp_;
|
||||
|
@ -316,8 +316,6 @@ typedef List<HeapObject*, PreallocatedStorage> DebugObjectCache;
|
||||
/* AstNode state. */ \
|
||||
V(unsigned, ast_node_id, 0) \
|
||||
V(unsigned, ast_node_count, 0) \
|
||||
/* SafeStackFrameIterator activations count. */ \
|
||||
V(int, safe_stack_iterator_counter, 0) \
|
||||
ISOLATE_PLATFORM_INIT_LIST(V) \
|
||||
ISOLATE_LOGGING_INIT_LIST(V) \
|
||||
ISOLATE_DEBUGGER_INIT_LIST(V)
|
||||
|
Loading…
Reference in New Issue
Block a user