Commit 719b032a authored by whesse@chromium.org's avatar whesse@chromium.org

Add --trace flag to fast compiler.

Review URL: http://codereview.chromium.org/306026

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3111 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent fbc0eaa1
......@@ -90,6 +90,10 @@ void FastCodeGenerator::Generate(FunctionLiteral* fun) {
VisitDeclarations(fun->scope()->declarations());
}
if (FLAG_trace) {
__ CallRuntime(Runtime::kTraceEnter, 0);
}
{ Comment cmnt(masm_, "[ Body");
VisitStatements(fun->body());
}
......@@ -99,6 +103,13 @@ void FastCodeGenerator::Generate(FunctionLiteral* fun) {
// body.
__ LoadRoot(r0, Heap::kUndefinedValueRootIndex);
SetReturnPosition(fun);
if (FLAG_trace) {
// Push the return value on the stack as the parameter.
// Runtime::TraceExit returns its parameter in r0.
__ push(r0);
__ CallRuntime(Runtime::kTraceExit, 1);
}
__ RecordJSReturn();
__ mov(sp, fp);
__ ldm(ia_w, sp, fp.bit() | lr.bit());
......@@ -150,6 +161,14 @@ void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) {
ASSERT(expr->AsLiteral() != NULL);
__ mov(r0, Operand(expr->AsLiteral()->handle()));
}
if (FLAG_trace) {
// Push the return value on the stack as the parameter.
// Runtime::TraceExit returns its parameter in r0.
__ push(r0);
__ CallRuntime(Runtime::kTraceExit, 1);
}
__ RecordJSReturn();
__ mov(sp, fp);
__ ldm(ia_w, sp, fp.bit() | lr.bit());
......
......@@ -80,6 +80,10 @@ void FastCodeGenerator::Generate(FunctionLiteral* fun) {
VisitDeclarations(fun->scope()->declarations());
}
if (FLAG_trace) {
__ CallRuntime(Runtime::kTraceEnter, 0);
}
{ Comment cmnt(masm_, "[ Body");
VisitStatements(fun->body());
}
......@@ -89,6 +93,11 @@ void FastCodeGenerator::Generate(FunctionLiteral* fun) {
// body.
__ mov(eax, Factory::undefined_value());
SetReturnPosition(fun);
if (FLAG_trace) {
__ push(eax);
__ CallRuntime(Runtime::kTraceExit, 1);
}
__ RecordJSReturn();
// Do not use the leave instruction here because it is too short to
// patch with the code required by the debugger.
......@@ -139,7 +148,12 @@ void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) {
ASSERT(expr->AsLiteral() != NULL);
__ mov(eax, expr->AsLiteral()->handle());
}
if (FLAG_trace) {
__ push(eax);
__ CallRuntime(Runtime::kTraceExit, 1);
}
__ RecordJSReturn();
// Do not use the leave instruction here because it is too short to
// patch with the code required by the debugger.
__ mov(esp, ebp);
......
......@@ -79,6 +79,10 @@ void FastCodeGenerator::Generate(FunctionLiteral* fun) {
VisitDeclarations(fun->scope()->declarations());
}
if (FLAG_trace) {
__ CallRuntime(Runtime::kTraceEnter, 0);
}
{ Comment cmnt(masm_, "[ Body");
VisitStatements(fun->body());
}
......@@ -88,7 +92,12 @@ void FastCodeGenerator::Generate(FunctionLiteral* fun) {
// body.
__ LoadRoot(rax, Heap::kUndefinedValueRootIndex);
SetReturnPosition(fun);
if (FLAG_trace) {
__ push(rax);
__ CallRuntime(Runtime::kTraceExit, 1);
}
__ RecordJSReturn();
// Do not use the leave instruction here because it is too short to
// patch with the code required by the debugger.
__ movq(rsp, rbp);
......@@ -147,6 +156,11 @@ void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) {
ASSERT(expr->AsLiteral() != NULL);
__ Move(rax, expr->AsLiteral()->handle());
}
if (FLAG_trace) {
__ push(rax);
__ CallRuntime(Runtime::kTraceExit, 1);
}
__ RecordJSReturn();
// Do not use the leave instruction here because it is too short to
// patch with the code required by the debugger.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment