diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2013-07-29 21:21:03 +0200 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2013-07-29 21:21:03 +0200 |
commit | 1bd711c8a09e327946f2eca5030e9710dc0e1e6e (patch) | |
tree | 6233c588fca458165ad6e448c5d3fbaa1648f805 /deps/v8/src/frames.cc | |
parent | 17fbd6cd66453da565d77ab557188eab479dab15 (diff) | |
download | node-new-1bd711c8a09e327946f2eca5030e9710dc0e1e6e.tar.gz |
v8: upgrade to v8 3.20.9
Diffstat (limited to 'deps/v8/src/frames.cc')
-rw-r--r-- | deps/v8/src/frames.cc | 44 |
1 files changed, 38 insertions, 6 deletions
diff --git a/deps/v8/src/frames.cc b/deps/v8/src/frames.cc index 890e77ad63..61792a628c 100644 --- a/deps/v8/src/frames.cc +++ b/deps/v8/src/frames.cc @@ -36,6 +36,7 @@ #include "safepoint-table.h" #include "scopeinfo.h" #include "string-stream.h" +#include "vm-state-inl.h" #include "allocation-inl.h" @@ -221,7 +222,8 @@ SafeStackFrameIterator::SafeStackFrameIterator( : StackFrameIteratorBase(isolate, false), low_bound_(sp), high_bound_(js_entry_sp), - top_frame_type_(StackFrame::NONE) { + top_frame_type_(StackFrame::NONE), + external_callback_scope_(isolate->external_callback_scope()) { StackFrame::State state; StackFrame::Type type; ThreadLocalTop* top = isolate->thread_local_top(); @@ -256,16 +258,28 @@ SafeStackFrameIterator::SafeStackFrameIterator( } if (SingletonFor(type) == NULL) return; frame_ = SingletonFor(type, &state); + if (frame_ == NULL) return; + + Advance(); - if (!done()) Advance(); + if (frame_ != NULL && !frame_->is_exit() && + external_callback_scope_ != NULL && + external_callback_scope_->scope_address() < frame_->fp()) { + // Skip top ExternalCallbackScope if we already advanced to a JS frame + // under it. Sampler will anyways take this top external callback. + external_callback_scope_ = external_callback_scope_->previous(); + } } bool SafeStackFrameIterator::IsValidTop(ThreadLocalTop* top) const { - Address fp = Isolate::c_entry_fp(top); - if (!IsValidExitFrame(fp)) return false; + Address c_entry_fp = Isolate::c_entry_fp(top); + if (!IsValidExitFrame(c_entry_fp)) return false; // There should be at least one JS_ENTRY stack handler. - return Isolate::handler(top) != NULL; + Address handler = Isolate::handler(top); + if (handler == NULL) return false; + // Check that there are no js frames on top of the native frames. + return c_entry_fp < handler; } @@ -340,6 +354,24 @@ void SafeStackFrameIterator::Advance() { AdvanceOneFrame(); if (done()) return; if (frame_->is_java_script()) return; + if (frame_->is_exit() && external_callback_scope_) { + // Some of the EXIT frames may have ExternalCallbackScope allocated on + // top of them. In that case the scope corresponds to the first EXIT + // frame beneath it. There may be other EXIT frames on top of the + // ExternalCallbackScope, just skip them as we cannot collect any useful + // information about them. + if (external_callback_scope_->scope_address() < frame_->fp()) { + Address* callback_address = + external_callback_scope_->callback_address(); + if (*callback_address != NULL) { + frame_->state_.pc_address = callback_address; + } + external_callback_scope_ = external_callback_scope_->previous(); + ASSERT(external_callback_scope_ == NULL || + external_callback_scope_->scope_address() > frame_->fp()); + return; + } + } } } @@ -540,7 +572,7 @@ void ExitFrame::FillState(Address fp, Address sp, State* state) { state->sp = sp; state->fp = fp; state->pc_address = ResolveReturnAddressLocation( - reinterpret_cast<Address*>(sp - 1 * kPointerSize)); + reinterpret_cast<Address*>(sp - 1 * kPCOnStackSize)); } |