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

Unified Diff: src/runtime/runtime-test.cc

Issue 612383002: Split yet more runtime functions into separate files. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 | « src/runtime/runtime-symbol.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-test.cc
diff --git a/src/runtime/runtime-test.cc b/src/runtime/runtime-test.cc
index 9e4e4346039f9f5289e95a52814721ada9641ba7..18ff7eafc01fde9b9dbfc3b7fb7b802ea6ac57be 100644
--- a/src/runtime/runtime-test.cc
+++ b/src/runtime/runtime-test.cc
@@ -303,6 +303,53 @@ RUNTIME_FUNCTION(Runtime_GetV8Version) {
}
+static int StackSize(Isolate* isolate) {
+ int n = 0;
+ for (JavaScriptFrameIterator it(isolate); !it.done(); it.Advance()) n++;
+ return n;
+}
+
+
+static void PrintTransition(Isolate* isolate, Object* result) {
+ // indentation
+ {
+ const int nmax = 80;
+ int n = StackSize(isolate);
+ if (n <= nmax)
+ PrintF("%4d:%*s", n, n, "");
+ else
+ PrintF("%4d:%*s", n, nmax, "...");
+ }
+
+ if (result == NULL) {
+ JavaScriptFrame::PrintTop(isolate, stdout, true, false);
+ PrintF(" {\n");
+ } else {
+ // function result
+ PrintF("} -> ");
+ result->ShortPrint();
+ PrintF("\n");
+ }
+}
+
+
+RUNTIME_FUNCTION(Runtime_TraceEnter) {
+ SealHandleScope shs(isolate);
+ DCHECK(args.length() == 0);
+ PrintTransition(isolate, NULL);
+ return isolate->heap()->undefined_value();
+}
+
+
+RUNTIME_FUNCTION(Runtime_TraceExit) {
+ SealHandleScope shs(isolate);
+ DCHECK(args.length() == 1);
+ CONVERT_ARG_CHECKED(Object, obj, 0);
+ PrintTransition(isolate, obj);
+ return obj; // return TOS
+}
+
+
#ifdef DEBUG
// ListNatives is ONLY used by the fuzz-natives.js in debug mode
// Exclude the code in release mode.
« no previous file with comments | « src/runtime/runtime-symbol.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698