Index: src/top.h |
=================================================================== |
--- src/top.h (revision 744) |
+++ src/top.h (working copy) |
@@ -312,6 +312,10 @@ |
#endif |
prev_(Top::save_context()) { |
Top::set_save_context(this); |
+ |
+ // If there is no JS frame under the current C frame, use the value 0. |
+ JavaScriptFrameIterator it; |
+ js_sp_ = it.done() ? 0 : it.frame()->sp(); |
} |
~SaveContext() { |
@@ -322,12 +326,18 @@ |
Handle<Context> context() { return context_; } |
SaveContext* prev() { return prev_; } |
+ // Returns true if this save context is below a given JavaScript frame. |
+ bool below(JavaScriptFrame* frame) { |
+ return (js_sp_ == 0) || (frame->sp() < js_sp_); |
+ } |
+ |
private: |
Handle<Context> context_; |
#if __GNUC_VERSION__ >= 40100 && __GNUC_VERSION__ < 40300 |
Handle<Context> dummy_; |
#endif |
SaveContext* prev_; |
+ Address js_sp_; // The top JS frame's sp when saving context. |
}; |