Index: src/runtime.cc |
diff --git a/src/runtime.cc b/src/runtime.cc |
index 9c23c2c9670a448c820266086fd664e8bbf5af20..5c66c09f0e78e58b4170ca097b6a4899a66f65ba 100644 |
--- a/src/runtime.cc |
+++ b/src/runtime.cc |
@@ -10699,6 +10699,18 @@ static const int kFrameDetailsAtReturnIndex = 7; |
static const int kFrameDetailsFlagsIndex = 8; |
static const int kFrameDetailsFirstDynamicIndex = 9; |
+ |
+static SaveContext* FindSavedContextForFrame(Isolate* isolate, |
+ JavaScriptFrame* frame) { |
+ SaveContext* save = isolate->save_context(); |
+ while (save != NULL && !save->IsAboveFrame(frame)) { |
+ save = save->prev(); |
+ } |
+ ASSERT(save != NULL); |
+ return save; |
+} |
+ |
+ |
// Return an array with frame details |
// args[0]: number: break id |
// args[1]: number: frame index |
@@ -10754,11 +10766,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFrameDetails) { |
// Traverse the saved contexts chain to find the active context for the |
// selected frame. |
- SaveContext* save = isolate->save_context(); |
- while (save != NULL && !save->below(it.frame())) { |
- save = save->prev(); |
- } |
- ASSERT(save != NULL); |
+ SaveContext* save = FindSavedContextForFrame(isolate, it.frame()); |
// Get the frame id. |
Handle<Object> frame_id(WrapFrameId(it.frame()->id()), isolate); |
@@ -12036,11 +12044,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) { |
// Traverse the saved contexts chain to find the active context for the |
// selected frame. |
- SaveContext* save = isolate->save_context(); |
- while (save != NULL && !save->below(frame)) { |
- save = save->prev(); |
- } |
- ASSERT(save != NULL); |
+ SaveContext* save = FindSavedContextForFrame(isolate, frame); |
+ |
SaveContext savex(isolate); |
isolate->set_context(*(save->context())); |