From 681ae19bd4af302925860cffaa26cdde4bec0ce0 Mon Sep 17 00:00:00 2001 From: "kmillikin@chromium.org" Date: Fri, 24 Oct 2008 10:13:22 +0000 Subject: [PATCH] Change a few runtime functions that took and returned a dummy argument to instead take no arguments and return the undefined value. git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@584 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/codegen-arm.cc | 14 ++++---------- src/codegen-ia32.cc | 12 ++++++------ src/runtime.cc | 25 ++++++++++++++++--------- src/runtime.h | 6 +++--- 4 files changed, 29 insertions(+), 28 deletions(-) diff --git a/src/codegen-arm.cc b/src/codegen-arm.cc index 74f1ea74b..9ca78f745 100644 --- a/src/codegen-arm.cc +++ b/src/codegen-arm.cc @@ -226,9 +226,7 @@ void CodeGenerator::GenCode(FunctionLiteral* fun) { if (FLAG_trace) { // Push a valid value as the parameter. The runtime call only uses // it as the return value to indicate non-failure. - __ mov(r0, Operand(Smi::FromInt(0))); - __ push(r0); - __ CallRuntime(Runtime::kTraceEnter, 1); + __ CallRuntime(Runtime::kTraceEnter, 0); } CheckStack(); @@ -242,11 +240,7 @@ void CodeGenerator::GenCode(FunctionLiteral* fun) { bool should_trace = is_builtin ? FLAG_trace_builtin_calls : FLAG_trace_calls; if (should_trace) { - // Push a valid value as the parameter. The runtime call only uses - // it as the return value to indicate non-failure. - __ mov(r0, Operand(Smi::FromInt(0))); - __ push(r0); - __ CallRuntime(Runtime::kDebugTrace, 1); + __ CallRuntime(Runtime::kDebugTrace, 0); } #endif VisitStatements(body); @@ -1846,8 +1840,8 @@ void CodeGenerator::VisitTryFinally(TryFinally* node) { void CodeGenerator::VisitDebuggerStatement(DebuggerStatement* node) { Comment cmnt(masm_, "[ DebuggerStatament"); if (FLAG_debug_info) RecordStatementPosition(node); - __ CallRuntime(Runtime::kDebugBreak, 1); - __ push(r0); + __ CallRuntime(Runtime::kDebugBreak, 0); + // Ignore the return value. } diff --git a/src/codegen-ia32.cc b/src/codegen-ia32.cc index a339a9691..041e41b04 100644 --- a/src/codegen-ia32.cc +++ b/src/codegen-ia32.cc @@ -356,8 +356,8 @@ void CodeGenerator::GenCode(FunctionLiteral* fun) { } if (FLAG_trace) { - __ CallRuntime(Runtime::kTraceEnter, 1); - frame_->Push(eax); + __ CallRuntime(Runtime::kTraceEnter, 0); + // Ignore the return value. } CheckStack(); @@ -371,8 +371,8 @@ void CodeGenerator::GenCode(FunctionLiteral* fun) { bool should_trace = is_builtin ? FLAG_trace_builtin_calls : FLAG_trace_calls; if (should_trace) { - __ CallRuntime(Runtime::kDebugTrace, 1); - frame_->Push(eax); + __ CallRuntime(Runtime::kDebugTrace, 0); + // Ignore the return value. } #endif VisitStatements(body); @@ -2218,8 +2218,8 @@ void CodeGenerator::VisitTryFinally(TryFinally* node) { void CodeGenerator::VisitDebuggerStatement(DebuggerStatement* node) { Comment cmnt(masm_, "[ DebuggerStatement"); RecordStatementPosition(node); - __ CallRuntime(Runtime::kDebugBreak, 1); - frame_->Push(eax); + __ CallRuntime(Runtime::kDebugBreak, 0); + // Ignore the return value. } diff --git a/src/runtime.cc b/src/runtime.cc index 9c91d5293..c19e3ee1a 100644 --- a/src/runtime.cc +++ b/src/runtime.cc @@ -3581,10 +3581,10 @@ static Object* RuntimePreempt(Arguments args) { } -static Object* Runtime_DebugBreak(Arguments args) { +static Object* DebugBreakHelper() { // Just continue if breaks are disabled. if (Debug::disable_break()) { - return args[0]; + return Heap::undefined_value(); } // Don't break in system functions. If the current function is @@ -3596,7 +3596,7 @@ static Object* Runtime_DebugBreak(Arguments args) { if (fun->IsJSFunction()) { GlobalObject* global = JSFunction::cast(fun)->context()->global(); if (global->IsJSBuiltinsObject() || Debug::IsDebugGlobal(global)) { - return args[0]; + return Heap::undefined_value(); } } @@ -3607,14 +3607,20 @@ static Object* Runtime_DebugBreak(Arguments args) { // Enter the debugger. Just continue if we fail to enter the debugger. EnterDebugger debugger; if (debugger.FailedToEnter()) { - return args[0]; + return Heap::undefined_value(); } // Notify the debug event listeners. Debugger::OnDebugBreak(Factory::undefined_value()); // Return to continue execution. - return args[0]; + return Heap::undefined_value(); +} + + +static Object* Runtime_DebugBreak(Arguments args) { + ASSERT(args.length() == 0); + return DebugBreakHelper(); } @@ -3626,7 +3632,7 @@ static Object* Runtime_StackGuard(Arguments args) { // If not real stack overflow the stack guard was used to interrupt // execution for another purpose. - if (StackGuard::IsDebugBreak()) Runtime_DebugBreak(args); + if (StackGuard::IsDebugBreak()) DebugBreakHelper(); if (StackGuard::IsPreempted()) RuntimePreempt(args); if (StackGuard::IsInterrupted()) { // interrupt @@ -3724,9 +3730,10 @@ static void PrintTransition(Object* result) { static Object* Runtime_TraceEnter(Arguments args) { + ASSERT(args.length() == 0); NoHandleAllocation ha; PrintTransition(NULL); - return args[0]; // return TOS + return Heap::undefined_value(); } @@ -3765,10 +3772,10 @@ static Object* Runtime_DebugPrint(Arguments args) { static Object* Runtime_DebugTrace(Arguments args) { - ASSERT(args.length() == 1); + ASSERT(args.length() == 0); NoHandleAllocation ha; Top::PrintStack(); - return args[0]; // return TOS + return Heap::undefined_value(); } diff --git a/src/runtime.h b/src/runtime.h index 63bdc8703..463698c09 100644 --- a/src/runtime.h +++ b/src/runtime.h @@ -277,10 +277,10 @@ namespace v8 { namespace internal { \ /* Debugging */ \ F(DebugPrint, 1) \ - F(DebugTrace, 1) \ - F(TraceEnter, 1) \ + F(DebugTrace, 0) \ + F(TraceEnter, 0) \ F(TraceExit, 1) \ - F(DebugBreak, 1) \ + F(DebugBreak, 0) \ F(FunctionGetAssemblerCode, 1) \ F(Abort, 2) \ \ -- 2.34.1