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

Unified Diff: src/compiler/interpreter-assembler.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/compiler/interpreter-assembler.h ('k') | src/compiler/raw-machine-assembler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/interpreter-assembler.cc
diff --git a/src/compiler/interpreter-assembler.cc b/src/compiler/interpreter-assembler.cc
index 6d10b150a47622d0130b5b3bec6723365b25282a..8ca460e8a189a575d1492b8429a95cc57dd42eb5 100644
--- a/src/compiler/interpreter-assembler.cc
+++ b/src/compiler/interpreter-assembler.cc
@@ -24,7 +24,6 @@ namespace v8 {
namespace internal {
namespace compiler {
-
InterpreterAssembler::InterpreterAssembler(Isolate* isolate, Zone* zone,
interpreter::Bytecode bytecode)
: bytecode_(bytecode),
@@ -35,12 +34,13 @@ InterpreterAssembler::InterpreterAssembler(Isolate* isolate, Zone* zone,
InstructionSelector::SupportedMachineOperatorFlags())),
accumulator_(
raw_assembler_->Parameter(Linkage::kInterpreterAccumulatorParameter)),
- bytecode_offset_(raw_assembler_->Parameter(
- Linkage::kInterpreterBytecodeOffsetParameter)),
context_(
raw_assembler_->Parameter(Linkage::kInterpreterContextParameter)),
- code_generated_(false) {}
-
+ code_generated_(false) {
+ if (FLAG_trace_ignition) {
+ TraceBytecode(Runtime::kInterpreterTraceBytecodeEntry);
+ }
+}
InterpreterAssembler::~InterpreterAssembler() {}
@@ -85,9 +85,10 @@ void InterpreterAssembler::SetContext(Node* value) {
context_ = value;
}
-
-Node* InterpreterAssembler::BytecodeOffset() { return bytecode_offset_; }
-
+Node* InterpreterAssembler::BytecodeOffset() {
+ return raw_assembler_->Parameter(
+ Linkage::kInterpreterBytecodeOffsetParameter);
+}
Node* InterpreterAssembler::RegisterFileRawPointer() {
return raw_assembler_->Parameter(Linkage::kInterpreterRegisterFileParameter);
@@ -464,18 +465,11 @@ Node* InterpreterAssembler::CallConstruct(Node* new_target, Node* constructor,
void InterpreterAssembler::CallPrologue() {
- StoreRegister(SmiTag(bytecode_offset_),
+ StoreRegister(SmiTag(BytecodeOffset()),
InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer);
}
-void InterpreterAssembler::CallEpilogue() {
- // Restore the bytecode offset from the stack frame.
- bytecode_offset_ = SmiUntag(LoadRegister(
- InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer));
-}
-
-
Node* InterpreterAssembler::CallN(CallDescriptor* descriptor, Node* code_target,
Node** args) {
CallPrologue();
@@ -491,7 +485,6 @@ Node* InterpreterAssembler::CallN(CallDescriptor* descriptor, Node* code_target,
kUnexpectedStackPointer);
}
- CallEpilogue();
return return_val;
}
@@ -594,7 +587,6 @@ Node* InterpreterAssembler::CallRuntime(Runtime::FunctionId function_id,
CallPrologue();
Node* return_val =
raw_assembler_->CallRuntime1(function_id, arg1, GetContext());
- CallEpilogue();
return return_val;
}
@@ -604,10 +596,16 @@ Node* InterpreterAssembler::CallRuntime(Runtime::FunctionId function_id,
CallPrologue();
Node* return_val =
raw_assembler_->CallRuntime2(function_id, arg1, arg2, GetContext());
- CallEpilogue();
return return_val;
}
+Node* InterpreterAssembler::CallRuntime(Runtime::FunctionId function_id,
+ Node* arg1, Node* arg2, Node* arg3) {
+ CallPrologue();
+ Node* return_val =
+ raw_assembler_->CallRuntime3(function_id, arg1, arg2, arg3, GetContext());
+ return return_val;
+}
Node* InterpreterAssembler::CallRuntime(Runtime::FunctionId function_id,
Node* arg1, Node* arg2, Node* arg3,
@@ -615,12 +613,15 @@ Node* InterpreterAssembler::CallRuntime(Runtime::FunctionId function_id,
CallPrologue();
Node* return_val = raw_assembler_->CallRuntime4(function_id, arg1, arg2, arg3,
arg4, GetContext());
- CallEpilogue();
return return_val;
}
void InterpreterAssembler::Return() {
+ if (FLAG_trace_ignition) {
+ TraceBytecode(Runtime::kInterpreterTraceBytecodeExit);
+ }
+
Node* exit_trampoline_code_object =
HeapConstant(isolate()->builtins()->InterpreterExitTrampoline());
// If the order of the parameters you need to change the call signature below.
@@ -650,10 +651,8 @@ Node* InterpreterAssembler::Advance(Node* delta) {
return raw_assembler_->IntPtrAdd(BytecodeOffset(), delta);
}
-
void InterpreterAssembler::Jump(Node* delta) { DispatchTo(Advance(delta)); }
-
void InterpreterAssembler::JumpIfWordEqual(Node* lhs, Node* rhs, Node* delta) {
RawMachineLabel match, no_match;
Node* condition = raw_assembler_->WordEqual(lhs, rhs);
@@ -671,6 +670,9 @@ void InterpreterAssembler::Dispatch() {
void InterpreterAssembler::DispatchTo(Node* new_bytecode_offset) {
+ if (FLAG_trace_ignition) {
+ TraceBytecode(Runtime::kInterpreterTraceBytecodeExit);
+ }
Node* target_bytecode = raw_assembler_->Load(
MachineType::Uint8(), BytecodeArrayTaggedPointer(), new_bytecode_offset);
@@ -716,6 +718,10 @@ void InterpreterAssembler::AbortIfWordNotEqual(Node* lhs, Node* rhs,
raw_assembler_->Bind(&match);
}
+void InterpreterAssembler::TraceBytecode(Runtime::FunctionId function_id) {
+ CallRuntime(function_id, BytecodeArrayTaggedPointer(),
+ SmiTag(BytecodeOffset()), GetAccumulator());
+}
// static
bool InterpreterAssembler::TargetSupportsUnalignedAccess() {
« no previous file with comments | « src/compiler/interpreter-assembler.h ('k') | src/compiler/raw-machine-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698