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

Unified Diff: src/interpreter/interpreter.cc

Issue 1640213002: [Interpreter] Add option to trace bytecode execution. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review comments Created 4 years, 11 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/interpreter/bytecodes.cc ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/interpreter.cc
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc
index 38150c515c7fd441e6cc0049a830ddf5d4a1a056..1d467e300fe3894a9590bac62d03a7ddca173d33 100644
--- a/src/interpreter/interpreter.cc
+++ b/src/interpreter/interpreter.cc
@@ -4,6 +4,7 @@
#include "src/interpreter/interpreter.h"
+#include "src/ast/prettyprinter.h"
#include "src/code-factory.h"
#include "src/compiler.h"
#include "src/compiler/interpreter-assembler.h"
@@ -60,6 +61,31 @@ void Interpreter::Initialize() {
bool Interpreter::MakeBytecode(CompilationInfo* info) {
+ if (FLAG_print_bytecode || FLAG_print_source || FLAG_print_ast) {
+ OFStream os(stdout);
+ base::SmartArrayPointer<char> name = info->GetDebugName();
+ os << "[generating bytecode for function: " << info->GetDebugName().get()
+ << "]" << std::endl
+ << std::flush;
+ }
+
+#ifdef DEBUG
+ if (info->parse_info() && FLAG_print_source) {
+ OFStream os(stdout);
+ os << "--- Source from AST ---" << std::endl
+ << PrettyPrinter(info->isolate()).PrintProgram(info->literal())
+ << std::endl
+ << std::flush;
+ }
+
+ if (info->parse_info() && FLAG_print_ast) {
+ OFStream os(stdout);
+ os << "--- AST ---" << std::endl
+ << AstPrinter(info->isolate()).PrintProgram(info->literal()) << std::endl
+ << std::flush;
+ }
+#endif // DEBUG
+
BytecodeGenerator generator(info->isolate(), info->zone());
info->EnsureFeedbackVector();
Handle<BytecodeArray> bytecodes = generator.MakeBytecode(info);
@@ -78,11 +104,14 @@ bool Interpreter::MakeBytecode(CompilationInfo* info) {
bool Interpreter::IsInterpreterTableInitialized(
Handle<FixedArray> handler_table) {
+ if (FLAG_trace_ignition) {
+ // Regenerate table to add bytecode tracing operations.
+ return false;
+ }
DCHECK(handler_table->length() == static_cast<int>(Bytecode::kLast) + 1);
return handler_table->get(0) != isolate_->heap()->undefined_value();
}
-
// LdaZero
//
// Load literal '0' into the accumulator.
« no previous file with comments | « src/interpreter/bytecodes.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698