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

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

Issue 1670133002: [es6] Further fixing of tail Calls. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Tail call tracing added Created 4 years, 10 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.h ('k') | test/mjsunit/es6/tail-call-simple.js » ('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 3979be5f13b179cc4a4f7879d685f0e45a02bbce..5f27a609a6d934b6977875250ff7369cd30195fa 100644
--- a/src/runtime/runtime-test.cc
+++ b/src/runtime/runtime-test.cc
@@ -408,53 +408,54 @@ RUNTIME_FUNCTION(Runtime_DisassembleFunction) {
return isolate->heap()->undefined_value();
}
+namespace {
-static int StackSize(Isolate* isolate) {
+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");
+void PrintIndentation(Isolate* isolate) {
+ const int nmax = 80;
+ int n = StackSize(isolate);
+ if (n <= nmax) {
+ PrintF("%4d:%*s", n, n, "");
} else {
- // function result
- PrintF("} -> ");
- result->ShortPrint();
- PrintF("\n");
+ PrintF("%4d:%*s", n, nmax, "...");
}
}
+} // namespace
RUNTIME_FUNCTION(Runtime_TraceEnter) {
SealHandleScope shs(isolate);
- DCHECK(args.length() == 0);
- PrintTransition(isolate, NULL);
+ DCHECK_EQ(0, args.length());
+ PrintIndentation(isolate);
+ JavaScriptFrame::PrintTop(isolate, stdout, true, false);
+ PrintF(" {\n");
return isolate->heap()->undefined_value();
}
RUNTIME_FUNCTION(Runtime_TraceExit) {
SealHandleScope shs(isolate);
- DCHECK(args.length() == 1);
+ DCHECK_EQ(1, args.length());
CONVERT_ARG_CHECKED(Object, obj, 0);
- PrintTransition(isolate, obj);
+ PrintIndentation(isolate);
+ PrintF("} -> ");
+ obj->ShortPrint();
+ PrintF("\n");
return obj; // return TOS
}
+RUNTIME_FUNCTION(Runtime_TraceTailCall) {
+ SealHandleScope shs(isolate);
+ DCHECK_EQ(0, args.length());
+ PrintIndentation(isolate);
+ PrintF("} -> tail call ->\n");
+ return isolate->heap()->undefined_value();
+}
RUNTIME_FUNCTION(Runtime_HaveSameMap) {
SealHandleScope shs(isolate);
« no previous file with comments | « src/runtime/runtime.h ('k') | test/mjsunit/es6/tail-call-simple.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698