Commit c5252a1b authored by dslomov@chromium.org's avatar dslomov@chromium.org

Revert "Accurate function prototypes for native calls from ARM simulator."

This reverts commit r14991. (one file missing)

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14493 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 1da21f18
...@@ -115,18 +115,15 @@ class CustomArguments : public Relocatable { ...@@ -115,18 +115,15 @@ class CustomArguments : public Relocatable {
#define DECLARE_RUNTIME_FUNCTION(Type, Name) \ #define DECLARE_RUNTIME_FUNCTION(Type, Name) \
Type Name(int args_length, Object** args_object, Isolate* isolate) Type Name(Arguments args, Isolate* isolate)
#define RUNTIME_FUNCTION(Type, Name) \
static Type __RT_impl_##Name(Arguments args, Isolate* isolate); \ #define RUNTIME_FUNCTION(Type, Name) \
Type Name(int args_length, Object** args_object, Isolate* isolate) { \ Type Name(Arguments args, Isolate* isolate)
Arguments args(args_length, args_object); \
return __RT_impl_##Name(args, isolate); \
} \ #define RUNTIME_ARGUMENTS(isolate, args) args, isolate
static Type __RT_impl_##Name(Arguments args, Isolate* isolate)
#define RUNTIME_ARGUMENTS(isolate, args) \
args.length(), args.arguments(), isolate
} } // namespace v8::internal } } // namespace v8::internal
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#if defined(V8_TARGET_ARCH_ARM) #if defined(V8_TARGET_ARCH_ARM)
#include "bootstrapper.h" #include "bootstrapper.h"
#include "builtins-decls.h"
#include "code-stubs.h" #include "code-stubs.h"
#include "regexp-macro-assembler.h" #include "regexp-macro-assembler.h"
#include "stub-cache.h" #include "stub-cache.h"
......
...@@ -975,14 +975,12 @@ ReturnType Simulator::GetFromVFPRegister(int reg_index) { ...@@ -975,14 +975,12 @@ ReturnType Simulator::GetFromVFPRegister(int reg_index) {
} }
// Runtime FP routines take up to two double arguments and zero // For use in calls that take two double values, constructed either
// or one integer arguments. All are consructed here.
// from r0-r3 or d0 and d1. // from r0-r3 or d0 and d1.
void Simulator::GetFpArgs(double* x, double* y, int32_t* z) { void Simulator::GetFpArgs(double* x, double* y) {
if (use_eabi_hardfloat()) { if (use_eabi_hardfloat()) {
*x = vfp_registers_[0]; *x = vfp_registers_[0];
*y = vfp_registers_[1]; *y = vfp_registers_[1];
*z = registers_[1];
} else { } else {
// We use a char buffer to get around the strict-aliasing rules which // We use a char buffer to get around the strict-aliasing rules which
// otherwise allow the compiler to optimize away the copy. // otherwise allow the compiler to optimize away the copy.
...@@ -990,12 +988,44 @@ void Simulator::GetFpArgs(double* x, double* y, int32_t* z) { ...@@ -990,12 +988,44 @@ void Simulator::GetFpArgs(double* x, double* y, int32_t* z) {
// Registers 0 and 1 -> x. // Registers 0 and 1 -> x.
OS::MemCopy(buffer, registers_, sizeof(*x)); OS::MemCopy(buffer, registers_, sizeof(*x));
OS::MemCopy(x, buffer, sizeof(*x)); OS::MemCopy(x, buffer, sizeof(*x));
// Register 2 and 3 -> y. // Registers 2 and 3 -> y.
OS::MemCopy(buffer, registers_ + 2, sizeof(*y));
OS::MemCopy(y, buffer, sizeof(*y));
}
}
// For use in calls that take one double value, constructed either
// from r0 and r1 or d0.
void Simulator::GetFpArgs(double* x) {
if (use_eabi_hardfloat()) {
*x = vfp_registers_[0];
} else {
// We use a char buffer to get around the strict-aliasing rules which
// otherwise allow the compiler to optimize away the copy.
char buffer[sizeof(*x)];
// Registers 0 and 1 -> x.
OS::MemCopy(buffer, registers_, sizeof(*x));
OS::MemCopy(x, buffer, sizeof(*x));
}
}
// For use in calls that take one double value constructed either
// from r0 and r1 or d0 and one integer value.
void Simulator::GetFpArgs(double* x, int32_t* y) {
if (use_eabi_hardfloat()) {
*x = vfp_registers_[0];
*y = registers_[1];
} else {
// We use a char buffer to get around the strict-aliasing rules which
// otherwise allow the compiler to optimize away the copy.
char buffer[sizeof(*x)];
// Registers 0 and 1 -> x.
OS::MemCopy(buffer, registers_, sizeof(*x));
OS::MemCopy(x, buffer, sizeof(*x));
// Register 2 -> y.
OS::MemCopy(buffer, registers_ + 2, sizeof(*y)); OS::MemCopy(buffer, registers_ + 2, sizeof(*y));
OS::MemCopy(y, buffer, sizeof(*y)); OS::MemCopy(y, buffer, sizeof(*y));
// Register 2 -> z
memcpy(buffer, registers_ + 2, sizeof(*z));
memcpy(z, buffer, sizeof(*z));
} }
} }
...@@ -1618,12 +1648,10 @@ typedef int64_t (*SimulatorRuntimeCall)(int32_t arg0, ...@@ -1618,12 +1648,10 @@ typedef int64_t (*SimulatorRuntimeCall)(int32_t arg0,
int32_t arg3, int32_t arg3,
int32_t arg4, int32_t arg4,
int32_t arg5); int32_t arg5);
typedef double (*SimulatorRuntimeFPCall)(int32_t arg0,
// These prototypes handle the four types of FP calls. int32_t arg1,
typedef int64_t (*SimulatorRuntimeCompareCall)(double darg0, double darg1); int32_t arg2,
typedef double (*SimulatorRuntimeFPFPCall)(double darg0, double darg1); int32_t arg3);
typedef double (*SimulatorRuntimeFPCall)(double darg0);
typedef double (*SimulatorRuntimeFPIntCall)(double darg0, int32_t arg0);
// This signature supports direct call in to API function native callback // This signature supports direct call in to API function native callback
// (refer to InvocationCallback in v8.h). // (refer to InvocationCallback in v8.h).
...@@ -1689,27 +1717,27 @@ void Simulator::SoftwareInterrupt(Instruction* instr) { ...@@ -1689,27 +1717,27 @@ void Simulator::SoftwareInterrupt(Instruction* instr) {
intptr_t external = intptr_t external =
reinterpret_cast<intptr_t>(redirection->external_function()); reinterpret_cast<intptr_t>(redirection->external_function());
if (fp_call) { if (fp_call) {
double dval0, dval1; // one or two double parameters
int32_t ival; // zero or one integer parameters
int64_t iresult = 0; // integer return value
double dresult = 0; // double return value
GetFpArgs(&dval0, &dval1, &ival);
if (::v8::internal::FLAG_trace_sim || !stack_aligned) { if (::v8::internal::FLAG_trace_sim || !stack_aligned) {
SimulatorRuntimeCall generic_target = SimulatorRuntimeFPCall target =
reinterpret_cast<SimulatorRuntimeCall>(external); reinterpret_cast<SimulatorRuntimeFPCall>(external);
double dval0, dval1;
int32_t ival;
switch (redirection->type()) { switch (redirection->type()) {
case ExternalReference::BUILTIN_FP_FP_CALL: case ExternalReference::BUILTIN_FP_FP_CALL:
case ExternalReference::BUILTIN_COMPARE_CALL: case ExternalReference::BUILTIN_COMPARE_CALL:
GetFpArgs(&dval0, &dval1);
PrintF("Call to host function at %p with args %f, %f", PrintF("Call to host function at %p with args %f, %f",
FUNCTION_ADDR(generic_target), dval0, dval1); FUNCTION_ADDR(target), dval0, dval1);
break; break;
case ExternalReference::BUILTIN_FP_CALL: case ExternalReference::BUILTIN_FP_CALL:
GetFpArgs(&dval0);
PrintF("Call to host function at %p with arg %f", PrintF("Call to host function at %p with arg %f",
FUNCTION_ADDR(generic_target), dval0); FUNCTION_ADDR(target), dval0);
break; break;
case ExternalReference::BUILTIN_FP_INT_CALL: case ExternalReference::BUILTIN_FP_INT_CALL:
GetFpArgs(&dval0, &ival);
PrintF("Call to host function at %p with args %f, %d", PrintF("Call to host function at %p with args %f, %d",
FUNCTION_ADDR(generic_target), dval0, ival); FUNCTION_ADDR(target), dval0, ival);
break; break;
default: default:
UNREACHABLE(); UNREACHABLE();
...@@ -1721,54 +1749,22 @@ void Simulator::SoftwareInterrupt(Instruction* instr) { ...@@ -1721,54 +1749,22 @@ void Simulator::SoftwareInterrupt(Instruction* instr) {
PrintF("\n"); PrintF("\n");
} }
CHECK(stack_aligned); CHECK(stack_aligned);
switch (redirection->type()) { if (redirection->type() != ExternalReference::BUILTIN_COMPARE_CALL) {
case ExternalReference::BUILTIN_COMPARE_CALL: {
SimulatorRuntimeCompareCall target =
reinterpret_cast<SimulatorRuntimeCompareCall>(external);
iresult = target(dval0, dval1);
set_register(r0, static_cast<int32_t>(iresult));
set_register(r1, static_cast<int32_t>(iresult >> 32));
break;
}
case ExternalReference::BUILTIN_FP_FP_CALL: {
SimulatorRuntimeFPFPCall target =
reinterpret_cast<SimulatorRuntimeFPFPCall>(external);
dresult = target(dval0, dval1);
SetFpResult(dresult);
break;
}
case ExternalReference::BUILTIN_FP_CALL: {
SimulatorRuntimeFPCall target = SimulatorRuntimeFPCall target =
reinterpret_cast<SimulatorRuntimeFPCall>(external); reinterpret_cast<SimulatorRuntimeFPCall>(external);
dresult = target(dval0); double result = target(arg0, arg1, arg2, arg3);
SetFpResult(dresult); SetFpResult(result);
break; } else {
} SimulatorRuntimeCall target =
case ExternalReference::BUILTIN_FP_INT_CALL: { reinterpret_cast<SimulatorRuntimeCall>(external);
SimulatorRuntimeFPIntCall target = int64_t result = target(arg0, arg1, arg2, arg3, arg4, arg5);
reinterpret_cast<SimulatorRuntimeFPIntCall>(external); int32_t lo_res = static_cast<int32_t>(result);
dresult = target(dval0, ival); int32_t hi_res = static_cast<int32_t>(result >> 32);
SetFpResult(dresult); if (::v8::internal::FLAG_trace_sim) {
break; PrintF("Returned %08x\n", lo_res);
}
default:
UNREACHABLE();
break;
}
if (::v8::internal::FLAG_trace_sim || !stack_aligned) {
switch (redirection->type()) {
case ExternalReference::BUILTIN_COMPARE_CALL:
PrintF("Returned %08x\n", static_cast<int32_t>(iresult));
break;
case ExternalReference::BUILTIN_FP_FP_CALL:
case ExternalReference::BUILTIN_FP_CALL:
case ExternalReference::BUILTIN_FP_INT_CALL:
PrintF("Returned %f\n", dresult);
break;
default:
UNREACHABLE();
break;
} }
set_register(r0, lo_res);
set_register(r1, hi_res);
} }
} else if (redirection->type() == ExternalReference::DIRECT_API_CALL) { } else if (redirection->type() == ExternalReference::DIRECT_API_CALL) {
SimulatorRuntimeDirectApiCall target = SimulatorRuntimeDirectApiCall target =
......
...@@ -348,8 +348,10 @@ class Simulator { ...@@ -348,8 +348,10 @@ class Simulator {
void* external_function, void* external_function,
v8::internal::ExternalReference::Type type); v8::internal::ExternalReference::Type type);
// Handle arguments and return value for runtime FP functions. // For use in calls that take double value arguments.
void GetFpArgs(double* x, double* y, int32_t* z); void GetFpArgs(double* x, double* y);
void GetFpArgs(double* x);
void GetFpArgs(double* x, int32_t* y);
void SetFpResult(const double& result); void SetFpResult(const double& result);
void TrashCallerSaveRegisters(); void TrashCallerSaveRegisters();
......
...@@ -168,7 +168,7 @@ inline Atomic32 Release_Load(volatile const Atomic32* ptr) { ...@@ -168,7 +168,7 @@ inline Atomic32 Release_Load(volatile const Atomic32* ptr) {
return *ptr; return *ptr;
} }
#if defined(__x86_64__) && defined(V8_HOST_ARCH_64_BIT) #if defined(__x86_64__)
// 64-bit low-level operations on 64-bit platform. // 64-bit low-level operations on 64-bit platform.
......
...@@ -125,31 +125,23 @@ BUILTIN_LIST_C(DEF_ARG_TYPE) ...@@ -125,31 +125,23 @@ BUILTIN_LIST_C(DEF_ARG_TYPE)
#ifdef DEBUG #ifdef DEBUG
#define BUILTIN(name) \ #define BUILTIN(name) \
MUST_USE_RESULT static MaybeObject* Builtin_Impl_##name( \ MUST_USE_RESULT static MaybeObject* Builtin_Impl_##name( \
name##ArgumentsType args, Isolate* isolate); \ name##ArgumentsType args, Isolate* isolate); \
MUST_USE_RESULT static MaybeObject* Builtin_##name( \ MUST_USE_RESULT static MaybeObject* Builtin_##name( \
int args_length, Object** args_object, Isolate* isolate) { \ name##ArgumentsType args, Isolate* isolate) { \
name##ArgumentsType args(args_length, args_object); \ ASSERT(isolate == Isolate::Current()); \
ASSERT(isolate == Isolate::Current()); \ args.Verify(); \
args.Verify(); \ return Builtin_Impl_##name(args, isolate); \
return Builtin_Impl_##name(args, isolate); \ } \
} \ MUST_USE_RESULT static MaybeObject* Builtin_Impl_##name( \
MUST_USE_RESULT static MaybeObject* Builtin_Impl_##name( \
name##ArgumentsType args, Isolate* isolate) name##ArgumentsType args, Isolate* isolate)
#else // For release mode. #else // For release mode.
#define BUILTIN(name) \ #define BUILTIN(name) \
static MaybeObject* Builtin_impl##name( \ static MaybeObject* Builtin_##name(name##ArgumentsType args, Isolate* isolate)
name##ArgumentsType args, Isolate* isolate); \
static MaybeObject* Builtin_##name( \
int args_length, Object** args_object, Isolate* isolate) { \
name##ArgumentsType args(args_length, args_object); \
return Builtin_impl##name(args, isolate); \
} \
static MaybeObject* Builtin_impl##name( \
name##ArgumentsType args, Isolate* isolate)
#endif #endif
......
...@@ -276,6 +276,8 @@ enum BuiltinExtraArguments { ...@@ -276,6 +276,8 @@ enum BuiltinExtraArguments {
V(APPLY_PREPARE, 1) \ V(APPLY_PREPARE, 1) \
V(APPLY_OVERFLOW, 1) V(APPLY_OVERFLOW, 1)
MaybeObject* ArrayConstructor_StubFailure(Arguments args, Isolate* isolate);
class BuiltinFunctionTable; class BuiltinFunctionTable;
class ObjectVisitor; class ObjectVisitor;
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#if defined(V8_TARGET_ARCH_IA32) #if defined(V8_TARGET_ARCH_IA32)
#include "bootstrapper.h" #include "bootstrapper.h"
#include "builtins-decls.h"
#include "code-stubs.h" #include "code-stubs.h"
#include "isolate.h" #include "isolate.h"
#include "jsregexp.h" #include "jsregexp.h"
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#if defined(V8_TARGET_ARCH_MIPS) #if defined(V8_TARGET_ARCH_MIPS)
#include "bootstrapper.h" #include "bootstrapper.h"
#include "builtins-decls.h"
#include "code-stubs.h" #include "code-stubs.h"
#include "codegen.h" #include "codegen.h"
#include "regexp-macro-assembler.h" #include "regexp-macro-assembler.h"
......
...@@ -26,8 +26,7 @@ ...@@ -26,8 +26,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) \ #if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) \
|| defined(__NetBSD__) || defined(__sun) || defined(__ANDROID__) \ || defined(__NetBSD__) || defined(__sun) || defined(__ANDROID__)
|| defined(__native_client__)
#define USE_SIGNALS #define USE_SIGNALS
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#if defined(V8_TARGET_ARCH_X64) #if defined(V8_TARGET_ARCH_X64)
#include "bootstrapper.h" #include "bootstrapper.h"
#include "builtins-decls.h"
#include "code-stubs.h" #include "code-stubs.h"
#include "regexp-macro-assembler.h" #include "regexp-macro-assembler.h"
#include "stub-cache.h" #include "stub-cache.h"
...@@ -4107,23 +4106,22 @@ void CEntryStub::GenerateCore(MacroAssembler* masm, ...@@ -4107,23 +4106,22 @@ void CEntryStub::GenerateCore(MacroAssembler* masm,
// Call C function. // Call C function.
#ifdef _WIN64 #ifdef _WIN64
// Windows 64-bit ABI passes arguments in rcx, rdx, r8, r9. // Windows 64-bit ABI passes arguments in rcx, rdx, r8, r9
// Pass argv and argc as two parameters. The arguments object will // Store Arguments object on stack, below the 4 WIN64 ABI parameter slots.
// be created by stubs declared by DECLARE_RUNTIME_FUNCTION(). __ movq(StackSpaceOperand(0), r14); // argc.
__ movq(StackSpaceOperand(1), r15); // argv.
if (result_size_ < 2) { if (result_size_ < 2) {
// Pass a pointer to the Arguments object as the first argument. // Pass a pointer to the Arguments object as the first argument.
// Return result in single register (rax). // Return result in single register (rax).
__ movq(rcx, r14); // argc. __ lea(rcx, StackSpaceOperand(0));
__ movq(rdx, r15); // argv. __ LoadAddress(rdx, ExternalReference::isolate_address(masm->isolate()));
__ movq(r8, ExternalReference::isolate_address(masm->isolate()));
} else { } else {
ASSERT_EQ(2, result_size_); ASSERT_EQ(2, result_size_);
// Pass a pointer to the result location as the first argument. // Pass a pointer to the result location as the first argument.
__ lea(rcx, StackSpaceOperand(2)); __ lea(rcx, StackSpaceOperand(2));
// Pass a pointer to the Arguments object as the second argument. // Pass a pointer to the Arguments object as the second argument.
__ movq(rdx, r14); // argc. __ lea(rdx, StackSpaceOperand(0));
__ movq(r8, r15); // argv. __ LoadAddress(r8, ExternalReference::isolate_address(masm->isolate()));
__ movq(r9, ExternalReference::isolate_address(masm->isolate()));
} }
#else // _WIN64 #else // _WIN64
......
...@@ -103,6 +103,3 @@ test-log/ProfLazyMode: SKIP ...@@ -103,6 +103,3 @@ test-log/ProfLazyMode: SKIP
test-debug/DebuggerAgent: SKIP test-debug/DebuggerAgent: SKIP
test-debug/DebuggerAgentProtocolOverflowHeader: SKIP test-debug/DebuggerAgentProtocolOverflowHeader: SKIP
test-sockets/Socket: SKIP test-sockets/Socket: SKIP
# Profiling doesn't work on Native Client.
test-cpu-profiler/*
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