Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Unified Diff: src/runtime.cc

Issue 429453005: Do not include native Javascript in ExecutionState frames. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/es6/debug-promise-events.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index fa304e77deeb71eec34c1e6647333c5d53016ee2..55db916751f3c3e8e18f263f5976752c82562811 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -11048,7 +11048,12 @@ RUNTIME_FUNCTION(Runtime_GetFrameCount) {
}
for (JavaScriptFrameIterator it(isolate, id); !it.done(); it.Advance()) {
- n += it.frame()->GetInlineCount();
+ List<FrameSummary> frames(FLAG_max_inlining_levels + 1);
+ it.frame()->Summarize(&frames);
+ for (int i = frames.length() - 1; i >= 0; i--) {
+ // Omit functions from native scripts.
+ if (!frames[i].function()->IsFromNativeScript()) n++;
+ }
}
return Smi::FromInt(n);
}
@@ -11163,6 +11168,23 @@ RUNTIME_FUNCTION(Runtime_IsOptimized) {
}
+// Advances the iterator to the frame that matches the index and returns the
+// inlined frame index, or -1 if not found. Skips native JS functions.
+static int FindIndexedNonNativeFrame(JavaScriptFrameIterator* it, int index) {
+ int count = -1;
+ for (; !it->done(); it->Advance()) {
+ List<FrameSummary> frames(FLAG_max_inlining_levels + 1);
+ it->frame()->Summarize(&frames);
+ for (int i = frames.length() - 1; i >= 0; i--) {
+ // Omit functions from native scripts.
+ if (frames[i].function()->IsFromNativeScript()) continue;
+ if (++count == index) return i;
+ }
+ }
+ return -1;
+}
+
+
// Return an array with frame details
// args[0]: number: break id
// args[1]: number: frame index
@@ -11196,22 +11218,13 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) {
return heap->undefined_value();
}
- int count = 0;
JavaScriptFrameIterator it(isolate, id);
- for (; !it.done(); it.Advance()) {
- if (index < count + it.frame()->GetInlineCount()) break;
- count += it.frame()->GetInlineCount();
- }
- if (it.done()) return heap->undefined_value();
-
- bool is_optimized = it.frame()->is_optimized();
+ // Inlined frame index in optimized frame, starting from outer function.
+ int inlined_jsframe_index = FindIndexedNonNativeFrame(&it, index);
+ if (inlined_jsframe_index == -1) return heap->undefined_value();
- int inlined_jsframe_index = 0; // Inlined frame index in optimized frame.
- if (is_optimized) {
- inlined_jsframe_index =
- it.frame()->GetInlineCount() - (index - count) - 1;
- }
FrameInspector frame_inspector(it.frame(), inlined_jsframe_index, isolate);
+ bool is_optimized = it.frame()->is_optimized();
// Traverse the saved contexts chain to find the active context for the
// selected frame.
@@ -13585,14 +13598,11 @@ RUNTIME_FUNCTION(Runtime_LiveEditRestartFrame) {
return heap->undefined_value();
}
- int count = 0;
JavaScriptFrameIterator it(isolate, id);
- for (; !it.done(); it.Advance()) {
- if (index < count + it.frame()->GetInlineCount()) break;
- count += it.frame()->GetInlineCount();
- }
- if (it.done()) return heap->undefined_value();
-
+ int inlined_jsframe_index = FindIndexedNonNativeFrame(&it, index);
+ if (inlined_jsframe_index == -1) return heap->undefined_value();
+ // We don't really care what the inlined frame index is, since we are
+ // throwing away the entire frame anyways.
const char* error_message = LiveEdit::RestartFrame(it.frame());
if (error_message) {
return *(isolate->factory()->InternalizeUtf8String(error_message));
« no previous file with comments | « no previous file | test/mjsunit/es6/debug-promise-events.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698