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) { ...@@ -90,6 +90,10 @@ void FastCodeGenerator::Generate(FunctionLiteral* fun) {
VisitDeclarations(fun->scope()->declarations()); VisitDeclarations(fun->scope()->declarations());
} }
if (FLAG_trace) {
__ CallRuntime(Runtime::kTraceEnter, 0);
}
{ Comment cmnt(masm_, "[ Body"); { Comment cmnt(masm_, "[ Body");
VisitStatements(fun->body()); VisitStatements(fun->body());
} }
...@@ -99,6 +103,13 @@ void FastCodeGenerator::Generate(FunctionLiteral* fun) { ...@@ -99,6 +103,13 @@ void FastCodeGenerator::Generate(FunctionLiteral* fun) {
// body. // body.
__ LoadRoot(r0, Heap::kUndefinedValueRootIndex); __ LoadRoot(r0, Heap::kUndefinedValueRootIndex);
SetReturnPosition(fun); 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(); __ RecordJSReturn();
__ mov(sp, fp); __ mov(sp, fp);
__ ldm(ia_w, sp, fp.bit() | lr.bit()); __ ldm(ia_w, sp, fp.bit() | lr.bit());
...@@ -150,6 +161,14 @@ void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) { ...@@ -150,6 +161,14 @@ void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) {
ASSERT(expr->AsLiteral() != NULL); ASSERT(expr->AsLiteral() != NULL);
__ mov(r0, Operand(expr->AsLiteral()->handle())); __ 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(); __ RecordJSReturn();
__ mov(sp, fp); __ mov(sp, fp);
__ ldm(ia_w, sp, fp.bit() | lr.bit()); __ ldm(ia_w, sp, fp.bit() | lr.bit());
......
...@@ -80,6 +80,10 @@ void FastCodeGenerator::Generate(FunctionLiteral* fun) { ...@@ -80,6 +80,10 @@ void FastCodeGenerator::Generate(FunctionLiteral* fun) {
VisitDeclarations(fun->scope()->declarations()); VisitDeclarations(fun->scope()->declarations());
} }
if (FLAG_trace) {
__ CallRuntime(Runtime::kTraceEnter, 0);
}
{ Comment cmnt(masm_, "[ Body"); { Comment cmnt(masm_, "[ Body");
VisitStatements(fun->body()); VisitStatements(fun->body());
} }
...@@ -89,6 +93,11 @@ void FastCodeGenerator::Generate(FunctionLiteral* fun) { ...@@ -89,6 +93,11 @@ void FastCodeGenerator::Generate(FunctionLiteral* fun) {
// body. // body.
__ mov(eax, Factory::undefined_value()); __ mov(eax, Factory::undefined_value());
SetReturnPosition(fun); SetReturnPosition(fun);
if (FLAG_trace) {
__ push(eax);
__ CallRuntime(Runtime::kTraceExit, 1);
}
__ RecordJSReturn(); __ RecordJSReturn();
// Do not use the leave instruction here because it is too short to // Do not use the leave instruction here because it is too short to
// patch with the code required by the debugger. // patch with the code required by the debugger.
...@@ -139,7 +148,12 @@ void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) { ...@@ -139,7 +148,12 @@ void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) {
ASSERT(expr->AsLiteral() != NULL); ASSERT(expr->AsLiteral() != NULL);
__ mov(eax, expr->AsLiteral()->handle()); __ mov(eax, expr->AsLiteral()->handle());
} }
if (FLAG_trace) {
__ push(eax);
__ CallRuntime(Runtime::kTraceExit, 1);
}
__ RecordJSReturn(); __ RecordJSReturn();
// Do not use the leave instruction here because it is too short to // Do not use the leave instruction here because it is too short to
// patch with the code required by the debugger. // patch with the code required by the debugger.
__ mov(esp, ebp); __ mov(esp, ebp);
......
...@@ -79,6 +79,10 @@ void FastCodeGenerator::Generate(FunctionLiteral* fun) { ...@@ -79,6 +79,10 @@ void FastCodeGenerator::Generate(FunctionLiteral* fun) {
VisitDeclarations(fun->scope()->declarations()); VisitDeclarations(fun->scope()->declarations());
} }
if (FLAG_trace) {
__ CallRuntime(Runtime::kTraceEnter, 0);
}
{ Comment cmnt(masm_, "[ Body"); { Comment cmnt(masm_, "[ Body");
VisitStatements(fun->body()); VisitStatements(fun->body());
} }
...@@ -88,7 +92,12 @@ void FastCodeGenerator::Generate(FunctionLiteral* fun) { ...@@ -88,7 +92,12 @@ void FastCodeGenerator::Generate(FunctionLiteral* fun) {
// body. // body.
__ LoadRoot(rax, Heap::kUndefinedValueRootIndex); __ LoadRoot(rax, Heap::kUndefinedValueRootIndex);
SetReturnPosition(fun); SetReturnPosition(fun);
if (FLAG_trace) {
__ push(rax);
__ CallRuntime(Runtime::kTraceExit, 1);
}
__ RecordJSReturn(); __ RecordJSReturn();
// Do not use the leave instruction here because it is too short to // Do not use the leave instruction here because it is too short to
// patch with the code required by the debugger. // patch with the code required by the debugger.
__ movq(rsp, rbp); __ movq(rsp, rbp);
...@@ -147,6 +156,11 @@ void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) { ...@@ -147,6 +156,11 @@ void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) {
ASSERT(expr->AsLiteral() != NULL); ASSERT(expr->AsLiteral() != NULL);
__ Move(rax, expr->AsLiteral()->handle()); __ Move(rax, expr->AsLiteral()->handle());
} }
if (FLAG_trace) {
__ push(rax);
__ CallRuntime(Runtime::kTraceExit, 1);
}
__ RecordJSReturn(); __ RecordJSReturn();
// Do not use the leave instruction here because it is too short to // Do not use the leave instruction here because it is too short to
// patch with the code required by the debugger. // 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