Commit 8633086f authored by dcarney@chromium.org's avatar dcarney@chromium.org

fix arm simulator after 14725

BUG=

R=svenpanne@chromium.org

Review URL: https://codereview.chromium.org/15484006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14731 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 4a7ed948
...@@ -1628,10 +1628,13 @@ typedef double (*SimulatorRuntimeFPIntCall)(double darg0, int32_t arg0); ...@@ -1628,10 +1628,13 @@ 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).
typedef v8::Handle<v8::Value> (*SimulatorRuntimeDirectApiCall)(int32_t arg0); typedef v8::Handle<v8::Value> (*SimulatorRuntimeDirectApiCall)(int32_t arg0);
typedef void (*SimulatorRuntimeDirectApiCallNew)(int32_t arg0);
// This signature supports direct call to accessor getter callback. // This signature supports direct call to accessor getter callback.
typedef v8::Handle<v8::Value> (*SimulatorRuntimeDirectGetterCall)(int32_t arg0, typedef v8::Handle<v8::Value> (*SimulatorRuntimeDirectGetterCall)(int32_t arg0,
int32_t arg1); int32_t arg1);
typedef void (*SimulatorRuntimeDirectGetterCallNew)(int32_t arg0,
int32_t arg1);
// Software interrupt instructions are used by the simulator to call into the // Software interrupt instructions are used by the simulator to call into the
// C-based V8 runtime. // C-based V8 runtime.
...@@ -1770,40 +1773,56 @@ void Simulator::SoftwareInterrupt(Instruction* instr) { ...@@ -1770,40 +1773,56 @@ void Simulator::SoftwareInterrupt(Instruction* instr) {
break; break;
} }
} }
} else if (redirection->type() == ExternalReference::DIRECT_API_CALL) { } else if (
SimulatorRuntimeDirectApiCall target = redirection->type() == ExternalReference::DIRECT_API_CALL ||
reinterpret_cast<SimulatorRuntimeDirectApiCall>(external); redirection->type() == ExternalReference::DIRECT_API_CALL_NEW) {
if (::v8::internal::FLAG_trace_sim || !stack_aligned) { if (::v8::internal::FLAG_trace_sim || !stack_aligned) {
PrintF("Call to host function at %p args %08x", PrintF("Call to host function at %p args %08x",
FUNCTION_ADDR(target), arg0); reinterpret_cast<void*>(external), arg0);
if (!stack_aligned) { if (!stack_aligned) {
PrintF(" with unaligned stack %08x\n", get_register(sp)); PrintF(" with unaligned stack %08x\n", get_register(sp));
} }
PrintF("\n"); PrintF("\n");
} }
CHECK(stack_aligned); CHECK(stack_aligned);
v8::Handle<v8::Value> result = target(arg0); if (redirection->type() == ExternalReference::DIRECT_API_CALL) {
if (::v8::internal::FLAG_trace_sim) { SimulatorRuntimeDirectApiCall target =
PrintF("Returned %p\n", reinterpret_cast<void *>(*result)); reinterpret_cast<SimulatorRuntimeDirectApiCall>(external);
v8::Handle<v8::Value> result = target(arg0);
if (::v8::internal::FLAG_trace_sim) {
PrintF("Returned %p\n", reinterpret_cast<void *>(*result));
}
set_register(r0, reinterpret_cast<int32_t>(*result));
} else {
SimulatorRuntimeDirectApiCallNew target =
reinterpret_cast<SimulatorRuntimeDirectApiCallNew>(external);
target(arg0);
} }
set_register(r0, reinterpret_cast<int32_t>(*result)); } else if (
} else if (redirection->type() == ExternalReference::DIRECT_GETTER_CALL) { redirection->type() == ExternalReference::DIRECT_GETTER_CALL ||
SimulatorRuntimeDirectGetterCall target = redirection->type() == ExternalReference::DIRECT_GETTER_CALL_NEW) {
reinterpret_cast<SimulatorRuntimeDirectGetterCall>(external);
if (::v8::internal::FLAG_trace_sim || !stack_aligned) { if (::v8::internal::FLAG_trace_sim || !stack_aligned) {
PrintF("Call to host function at %p args %08x %08x", PrintF("Call to host function at %p args %08x %08x",
FUNCTION_ADDR(target), arg0, arg1); reinterpret_cast<void*>(external), arg0, arg1);
if (!stack_aligned) { if (!stack_aligned) {
PrintF(" with unaligned stack %08x\n", get_register(sp)); PrintF(" with unaligned stack %08x\n", get_register(sp));
} }
PrintF("\n"); PrintF("\n");
} }
CHECK(stack_aligned); CHECK(stack_aligned);
v8::Handle<v8::Value> result = target(arg0, arg1); if (redirection->type() == ExternalReference::DIRECT_GETTER_CALL) {
if (::v8::internal::FLAG_trace_sim) { SimulatorRuntimeDirectGetterCall target =
PrintF("Returned %p\n", reinterpret_cast<void *>(*result)); reinterpret_cast<SimulatorRuntimeDirectGetterCall>(external);
v8::Handle<v8::Value> result = target(arg0, arg1);
if (::v8::internal::FLAG_trace_sim) {
PrintF("Returned %p\n", reinterpret_cast<void *>(*result));
}
set_register(r0, reinterpret_cast<int32_t>(*result));
} else {
SimulatorRuntimeDirectGetterCallNew target =
reinterpret_cast<SimulatorRuntimeDirectGetterCallNew>(external);
target(arg0, arg1);
} }
set_register(r0, reinterpret_cast<int32_t>(*result));
} else { } else {
// builtin call. // builtin call.
ASSERT(redirection->type() == ExternalReference::BUILTIN_CALL); ASSERT(redirection->type() == ExternalReference::BUILTIN_CALL);
......
...@@ -937,8 +937,12 @@ static void GenerateFastApiDirectCall(MacroAssembler* masm, ...@@ -937,8 +937,12 @@ static void GenerateFastApiDirectCall(MacroAssembler* masm,
bool returns_handle = bool returns_handle =
!CallbackTable::ReturnsVoid(masm->isolate(), function_address); !CallbackTable::ReturnsVoid(masm->isolate(), function_address);
ApiFunction fun(function_address); ApiFunction fun(function_address);
ExternalReference::Type type =
returns_handle ?
ExternalReference::DIRECT_API_CALL :
ExternalReference::DIRECT_API_CALL_NEW;
ExternalReference ref = ExternalReference(&fun, ExternalReference ref = ExternalReference(&fun,
ExternalReference::DIRECT_API_CALL, type,
masm->isolate()); masm->isolate());
AllowExternalCallThatCantCauseGC scope(masm); AllowExternalCallThatCantCauseGC scope(masm);
__ CallApiFunctionAndReturn(ref, __ CallApiFunctionAndReturn(ref,
...@@ -1438,8 +1442,12 @@ void BaseLoadStubCompiler::GenerateLoadCallback( ...@@ -1438,8 +1442,12 @@ void BaseLoadStubCompiler::GenerateLoadCallback(
bool returns_handle = bool returns_handle =
!CallbackTable::ReturnsVoid(isolate(), getter_address); !CallbackTable::ReturnsVoid(isolate(), getter_address);
ApiFunction fun(getter_address); ApiFunction fun(getter_address);
ExternalReference ref = ExternalReference( ExternalReference::Type type =
&fun, ExternalReference::DIRECT_GETTER_CALL, isolate()); returns_handle ?
ExternalReference::DIRECT_GETTER_CALL :
ExternalReference::DIRECT_GETTER_CALL_NEW;
ExternalReference ref = ExternalReference(&fun, type, isolate());
__ CallApiFunctionAndReturn(ref, __ CallApiFunctionAndReturn(ref,
kStackUnwindSpace, kStackUnwindSpace,
returns_handle, returns_handle,
......
...@@ -647,9 +647,17 @@ class ExternalReference BASE_EMBEDDED { ...@@ -647,9 +647,17 @@ class ExternalReference BASE_EMBEDDED {
// Handle<Value> f(v8::Arguments&) // Handle<Value> f(v8::Arguments&)
DIRECT_API_CALL, DIRECT_API_CALL,
// Direct call to API function callback.
// void f(v8::Arguments&)
DIRECT_API_CALL_NEW,
// Direct call to accessor getter callback. // Direct call to accessor getter callback.
// Handle<value> f(Local<String> property, AccessorInfo& info) // Handle<value> f(Local<String> property, AccessorInfo& info)
DIRECT_GETTER_CALL DIRECT_GETTER_CALL,
// Direct call to accessor getter callback.
// void f(Local<String> property, AccessorInfo& info)
DIRECT_GETTER_CALL_NEW
}; };
static void SetUp(); static void SetUp();
......
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