| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
| 9 #include "src/debug.h" | 9 #include "src/debug.h" |
| 10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 while (save != NULL && !save->IsBelowFrame(frame)) { | 378 while (save != NULL && !save->IsBelowFrame(frame)) { |
| 379 save = save->prev(); | 379 save = save->prev(); |
| 380 } | 380 } |
| 381 DCHECK(save != NULL); | 381 DCHECK(save != NULL); |
| 382 return save; | 382 return save; |
| 383 } | 383 } |
| 384 | 384 |
| 385 | 385 |
| 386 // Advances the iterator to the frame that matches the index and returns the | 386 // Advances the iterator to the frame that matches the index and returns the |
| 387 // inlined frame index, or -1 if not found. Skips native JS functions. | 387 // inlined frame index, or -1 if not found. Skips native JS functions. |
| 388 int FindIndexedNonNativeFrame(JavaScriptFrameIterator* it, int index) { | 388 int Runtime::FindIndexedNonNativeFrame(JavaScriptFrameIterator* it, int index) { |
| 389 int count = -1; | 389 int count = -1; |
| 390 for (; !it->done(); it->Advance()) { | 390 for (; !it->done(); it->Advance()) { |
| 391 List<FrameSummary> frames(FLAG_max_inlining_levels + 1); | 391 List<FrameSummary> frames(FLAG_max_inlining_levels + 1); |
| 392 it->frame()->Summarize(&frames); | 392 it->frame()->Summarize(&frames); |
| 393 for (int i = frames.length() - 1; i >= 0; i--) { | 393 for (int i = frames.length() - 1; i >= 0; i--) { |
| 394 // Omit functions from native scripts. | 394 // Omit functions from native scripts. |
| 395 if (frames[i].function()->IsFromNativeScript()) continue; | 395 if (frames[i].function()->IsFromNativeScript()) continue; |
| 396 if (++count == index) return i; | 396 if (++count == index) return i; |
| 397 } | 397 } |
| 398 } | 398 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 428 | 428 |
| 429 // Find the relevant frame with the requested index. | 429 // Find the relevant frame with the requested index. |
| 430 StackFrame::Id id = isolate->debug()->break_frame_id(); | 430 StackFrame::Id id = isolate->debug()->break_frame_id(); |
| 431 if (id == StackFrame::NO_ID) { | 431 if (id == StackFrame::NO_ID) { |
| 432 // If there are no JavaScript stack frames return undefined. | 432 // If there are no JavaScript stack frames return undefined. |
| 433 return heap->undefined_value(); | 433 return heap->undefined_value(); |
| 434 } | 434 } |
| 435 | 435 |
| 436 JavaScriptFrameIterator it(isolate, id); | 436 JavaScriptFrameIterator it(isolate, id); |
| 437 // Inlined frame index in optimized frame, starting from outer function. | 437 // Inlined frame index in optimized frame, starting from outer function. |
| 438 int inlined_jsframe_index = FindIndexedNonNativeFrame(&it, index); | 438 int inlined_jsframe_index = Runtime::FindIndexedNonNativeFrame(&it, index); |
| 439 if (inlined_jsframe_index == -1) return heap->undefined_value(); | 439 if (inlined_jsframe_index == -1) return heap->undefined_value(); |
| 440 | 440 |
| 441 FrameInspector frame_inspector(it.frame(), inlined_jsframe_index, isolate); | 441 FrameInspector frame_inspector(it.frame(), inlined_jsframe_index, isolate); |
| 442 bool is_optimized = it.frame()->is_optimized(); | 442 bool is_optimized = it.frame()->is_optimized(); |
| 443 | 443 |
| 444 // Traverse the saved contexts chain to find the active context for the | 444 // Traverse the saved contexts chain to find the active context for the |
| 445 // selected frame. | 445 // selected frame. |
| 446 SaveContext* save = FindSavedContextForFrame(isolate, it.frame()); | 446 SaveContext* save = FindSavedContextForFrame(isolate, it.frame()); |
| 447 | 447 |
| 448 // Get the frame id. | 448 // Get the frame id. |
| (...skipping 2287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2736 return Smi::FromInt(isolate->debug()->is_active()); | 2736 return Smi::FromInt(isolate->debug()->is_active()); |
| 2737 } | 2737 } |
| 2738 | 2738 |
| 2739 | 2739 |
| 2740 RUNTIME_FUNCTION(RuntimeReference_DebugBreakInOptimizedCode) { | 2740 RUNTIME_FUNCTION(RuntimeReference_DebugBreakInOptimizedCode) { |
| 2741 UNIMPLEMENTED(); | 2741 UNIMPLEMENTED(); |
| 2742 return NULL; | 2742 return NULL; |
| 2743 } | 2743 } |
| 2744 } | 2744 } |
| 2745 } // namespace v8::internal | 2745 } // namespace v8::internal |
| OLD | NEW |