diff --git a/src/api.cc b/src/api.cc index 9b1d01cd8f..a7e0b2878f 100644 --- a/src/api.cc +++ b/src/api.cc @@ -8005,55 +8005,4 @@ void DeferredHandles::Iterate(ObjectVisitor* v) { } -v8::Handle InvokeAccessorGetter( - v8::Local property, - const v8::AccessorInfo& info, - v8::AccessorGetter getter) { - Isolate* isolate = reinterpret_cast(info.GetIsolate()); - Address getter_address = reinterpret_cast
(reinterpret_cast( - getter)); - // Leaving JavaScript. - VMState state(isolate); - ExternalCallbackScope call_scope(isolate, getter_address); - return getter(property, info); -} - - -void InvokeAccessorGetterCallback( - v8::Local property, - const v8::PropertyCallbackInfo& info, - v8::AccessorGetterCallback getter) { - // Leaving JavaScript. - Isolate* isolate = reinterpret_cast(info.GetIsolate()); - Address getter_address = reinterpret_cast
(reinterpret_cast( - getter)); - VMState state(isolate); - ExternalCallbackScope call_scope(isolate, getter_address); - return getter(property, info); -} - - -v8::Handle InvokeInvocationCallback( - const v8::Arguments& args, - v8::InvocationCallback callback) { - Isolate* isolate = reinterpret_cast(args.GetIsolate()); - Address callback_address = - reinterpret_cast
(reinterpret_cast(callback)); - VMState state(isolate); - ExternalCallbackScope call_scope(isolate, callback_address); - return callback(args); -} - - -void InvokeFunctionCallback(const v8::FunctionCallbackInfo& info, - v8::FunctionCallback callback) { - Isolate* isolate = reinterpret_cast(info.GetIsolate()); - Address callback_address = - reinterpret_cast
(reinterpret_cast(callback)); - VMState state(isolate); - ExternalCallbackScope call_scope(isolate, callback_address); - return callback(info); -} - - } } // namespace v8::internal diff --git a/src/api.h b/src/api.h index 50d4b388cc..3d1c69cb18 100644 --- a/src/api.h +++ b/src/api.h @@ -680,24 +680,6 @@ void HandleScopeImplementer::DeleteExtensions(internal::Object** prev_limit) { } -// Interceptor functions called from generated inline caches to notify -// CPU profiler that external callbacks are invoked. -v8::Handle InvokeAccessorGetter( - v8::Local property, - const v8::AccessorInfo& info, - v8::AccessorGetter getter); - - -void InvokeAccessorGetterCallback( - v8::Local property, - const v8::PropertyCallbackInfo& info, - v8::AccessorGetterCallback getter); - -v8::Handle InvokeInvocationCallback(const v8::Arguments& args, - v8::InvocationCallback callback); -void InvokeFunctionCallback(const v8::FunctionCallbackInfo& info, - v8::FunctionCallback callback); - class Testing { public: static v8::Testing::StressType stress_type() { return stress_type_; } diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc index 52efd5fb52..ee6eb97714 100644 --- a/src/arm/code-stubs-arm.cc +++ b/src/arm/code-stubs-arm.cc @@ -6481,6 +6481,13 @@ void DirectCEntryStub::Generate(MacroAssembler* masm) { } +void DirectCEntryStub::GenerateCall(MacroAssembler* masm, + ExternalReference function) { + __ mov(r2, Operand(function)); + GenerateCall(masm, r2); +} + + void DirectCEntryStub::GenerateCall(MacroAssembler* masm, Register target) { intptr_t code = diff --git a/src/arm/code-stubs-arm.h b/src/arm/code-stubs-arm.h index 1f663f52e9..863848cc37 100644 --- a/src/arm/code-stubs-arm.h +++ b/src/arm/code-stubs-arm.h @@ -585,6 +585,7 @@ class DirectCEntryStub: public PlatformCodeStub { public: DirectCEntryStub() {} void Generate(MacroAssembler* masm); + void GenerateCall(MacroAssembler* masm, ExternalReference function); void GenerateCall(MacroAssembler* masm, Register target); private: diff --git a/src/arm/macro-assembler-arm.cc b/src/arm/macro-assembler-arm.cc index 81a2d37643..4b6eac2974 100644 --- a/src/arm/macro-assembler-arm.cc +++ b/src/arm/macro-assembler-arm.cc @@ -2244,9 +2244,6 @@ static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { void MacroAssembler::CallApiFunctionAndReturn(ExternalReference function, - Address function_address, - ExternalReference thunk_ref, - Register thunk_last_arg, int stack_space, bool returns_handle, int return_value_offset) { @@ -2277,31 +2274,11 @@ void MacroAssembler::CallApiFunctionAndReturn(ExternalReference function, PopSafepointRegisters(); } - ASSERT(!thunk_last_arg.is(r3)); - Label profiler_disabled; - Label end_profiler_check; - bool* is_profiling_flag = - isolate()->cpu_profiler()->is_profiling_address(); - STATIC_ASSERT(sizeof(*is_profiling_flag) == 1); - mov(r3, Operand(reinterpret_cast(is_profiling_flag))); - ldrb(r3, MemOperand(r3, 0)); - cmp(r3, Operand(0)); - b(eq, &profiler_disabled); - - // Additional parameter is the address of the actual callback. - mov(thunk_last_arg, Operand(reinterpret_cast(function_address))); - mov(r3, Operand(thunk_ref)); - jmp(&end_profiler_check); - - bind(&profiler_disabled); - mov(r3, Operand(function)); - bind(&end_profiler_check); - // Native call returns to the DirectCEntry stub which redirects to the // return address pushed on stack (could have moved after GC). // DirectCEntry stub itself is generated early and never moves. DirectCEntryStub stub; - stub.GenerateCall(this, r3); + stub.GenerateCall(this, function); if (FLAG_log_timer_events) { FrameScope frame(this, StackFrame::MANUAL); diff --git a/src/arm/macro-assembler-arm.h b/src/arm/macro-assembler-arm.h index 8d3626dcaa..11d3066b91 100644 --- a/src/arm/macro-assembler-arm.h +++ b/src/arm/macro-assembler-arm.h @@ -1085,9 +1085,6 @@ class MacroAssembler: public Assembler { // - space to be unwound on exit (includes the call JS arguments space and // the additional space allocated for the fast call). void CallApiFunctionAndReturn(ExternalReference function, - Address function_address, - ExternalReference thunk_ref, - Register thunk_last_arg, int stack_space, bool returns_handle, int return_value_offset_from_fp); diff --git a/src/arm/simulator-arm.cc b/src/arm/simulator-arm.cc index a29d461ebf..c9db167b0e 100644 --- a/src/arm/simulator-arm.cc +++ b/src/arm/simulator-arm.cc @@ -830,10 +830,7 @@ class Redirection { Isolate* isolate = Isolate::Current(); Redirection* current = isolate->simulator_redirection(); for (; current != NULL; current = current->next_) { - if (current->external_function_ == external_function) { - ASSERT_EQ(current->type(), type); - return current; - } + if (current->external_function_ == external_function) return current; } return new Redirection(external_function, type); } @@ -1632,19 +1629,12 @@ typedef double (*SimulatorRuntimeFPIntCall)(double darg0, int32_t arg0); // (refer to InvocationCallback in v8.h). typedef v8::Handle (*SimulatorRuntimeDirectApiCall)(int32_t arg0); typedef void (*SimulatorRuntimeDirectApiCallNew)(int32_t arg0); -typedef v8::Handle (*SimulatorRuntimeProfilingApiCall)( - int32_t arg0, int32_t arg1); -typedef void (*SimulatorRuntimeProfilingApiCallNew)(int32_t arg0, int32_t arg1); // This signature supports direct call to accessor getter callback. typedef v8::Handle (*SimulatorRuntimeDirectGetterCall)(int32_t arg0, int32_t arg1); typedef void (*SimulatorRuntimeDirectGetterCallNew)(int32_t arg0, int32_t arg1); -typedef v8::Handle (*SimulatorRuntimeProfilingGetterCall)( - int32_t arg0, int32_t arg1, int32_t arg2); -typedef void (*SimulatorRuntimeProfilingGetterCallNew)( - int32_t arg0, int32_t arg1, int32_t arg2); // Software interrupt instructions are used by the simulator to call into the // C-based V8 runtime. @@ -1808,31 +1798,6 @@ void Simulator::SoftwareInterrupt(Instruction* instr) { reinterpret_cast(external); target(arg0); } - } else if ( - redirection->type() == ExternalReference::PROFILING_API_CALL || - redirection->type() == ExternalReference::PROFILING_API_CALL_NEW) { - if (::v8::internal::FLAG_trace_sim || !stack_aligned) { - PrintF("Call to host function at %p args %08x %08x", - reinterpret_cast(external), arg0, arg1); - if (!stack_aligned) { - PrintF(" with unaligned stack %08x\n", get_register(sp)); - } - PrintF("\n"); - } - CHECK(stack_aligned); - if (redirection->type() == ExternalReference::PROFILING_API_CALL) { - SimulatorRuntimeProfilingApiCall target = - reinterpret_cast(external); - v8::Handle result = target(arg0, arg1); - if (::v8::internal::FLAG_trace_sim) { - PrintF("Returned %p\n", reinterpret_cast(*result)); - } - set_register(r0, reinterpret_cast(*result)); - } else { - SimulatorRuntimeProfilingApiCallNew target = - reinterpret_cast(external); - target(arg0, arg1); - } } else if ( redirection->type() == ExternalReference::DIRECT_GETTER_CALL || redirection->type() == ExternalReference::DIRECT_GETTER_CALL_NEW) { @@ -1858,32 +1823,6 @@ void Simulator::SoftwareInterrupt(Instruction* instr) { reinterpret_cast(external); target(arg0, arg1); } - } else if ( - redirection->type() == ExternalReference::PROFILING_GETTER_CALL || - redirection->type() == ExternalReference::PROFILING_GETTER_CALL_NEW) { - if (::v8::internal::FLAG_trace_sim || !stack_aligned) { - PrintF("Call to host function at %p args %08x %08x %08x", - reinterpret_cast(external), arg0, arg1, arg2); - if (!stack_aligned) { - PrintF(" with unaligned stack %08x\n", get_register(sp)); - } - PrintF("\n"); - } - CHECK(stack_aligned); - if (redirection->type() == ExternalReference::PROFILING_GETTER_CALL) { - SimulatorRuntimeProfilingGetterCall target = - reinterpret_cast(external); - v8::Handle result = target(arg0, arg1, arg2); - if (::v8::internal::FLAG_trace_sim) { - PrintF("Returned %p\n", reinterpret_cast(*result)); - } - set_register(r0, reinterpret_cast(*result)); - } else { - SimulatorRuntimeProfilingGetterCallNew target = - reinterpret_cast( - external); - target(arg0, arg1, arg2); - } } else { // builtin call. ASSERT(redirection->type() == ExternalReference::BUILTIN_CALL); @@ -1891,7 +1830,7 @@ void Simulator::SoftwareInterrupt(Instruction* instr) { reinterpret_cast(external); if (::v8::internal::FLAG_trace_sim || !stack_aligned) { PrintF( - "Call to host function at %p " + "Call to host function at %p" "args %08x, %08x, %08x, %08x, %08x, %08x", FUNCTION_ADDR(target), arg0, diff --git a/src/arm/stub-cache-arm.cc b/src/arm/stub-cache-arm.cc index a0b23179d7..1ccc10680a 100644 --- a/src/arm/stub-cache-arm.cc +++ b/src/arm/stub-cache-arm.cc @@ -956,22 +956,8 @@ static void GenerateFastApiDirectCall(MacroAssembler* masm, ExternalReference ref = ExternalReference(&fun, type, masm->isolate()); - Address thunk_address = returns_handle - ? FUNCTION_ADDR(&InvokeInvocationCallback) - : FUNCTION_ADDR(&InvokeFunctionCallback); - ExternalReference::Type thunk_type = - returns_handle ? - ExternalReference::PROFILING_API_CALL : - ExternalReference::PROFILING_API_CALL_NEW; - ApiFunction thunk_fun(thunk_address); - ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type, - masm->isolate()); - AllowExternalCallThatCantCauseGC scope(masm); __ CallApiFunctionAndReturn(ref, - function_address, - thunk_ref, - r1, kStackUnwindSpace, returns_handle, kFastApiCallArguments + 1); @@ -1468,28 +1454,14 @@ void BaseLoadStubCompiler::GenerateLoadCallback( Address getter_address = v8::ToCData
(callback->getter()); bool returns_handle = !CallbackTable::ReturnsVoid(isolate(), getter_address); - ApiFunction fun(getter_address); ExternalReference::Type type = returns_handle ? ExternalReference::DIRECT_GETTER_CALL : ExternalReference::DIRECT_GETTER_CALL_NEW; - ExternalReference ref = ExternalReference(&fun, type, isolate()); - Address thunk_address = returns_handle - ? FUNCTION_ADDR(&InvokeAccessorGetter) - : FUNCTION_ADDR(&InvokeAccessorGetterCallback); - ExternalReference::Type thunk_type = - returns_handle ? - ExternalReference::PROFILING_GETTER_CALL : - ExternalReference::PROFILING_GETTER_CALL_NEW; - ApiFunction thunk_fun(thunk_address); - ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type, - isolate()); + ExternalReference ref = ExternalReference(&fun, type, isolate()); __ CallApiFunctionAndReturn(ref, - getter_address, - thunk_ref, - r2, kStackUnwindSpace, returns_handle, 5); diff --git a/src/assembler.h b/src/assembler.h index 95853e8e3a..f66f8bfa7e 100644 --- a/src/assembler.h +++ b/src/assembler.h @@ -647,35 +647,17 @@ class ExternalReference BASE_EMBEDDED { // Handle f(v8::Arguments&) DIRECT_API_CALL, - // Call to invocation callback via InvokeInvocationCallback. - // Handle f(v8::Arguments&, v8::InvocationCallback) - PROFILING_API_CALL, - // Direct call to API function callback. // void f(v8::Arguments&) DIRECT_API_CALL_NEW, - // Call to function callback via InvokeFunctionCallback. - // void f(v8::Arguments&, v8::FunctionCallback) - PROFILING_API_CALL_NEW, - // Direct call to accessor getter callback. // Handle f(Local property, AccessorInfo& info) DIRECT_GETTER_CALL, - // Call to accessor getter callback via InvokeAccessorGetter. - // Handle f(Local property, AccessorInfo& info, - // AccessorGetter getter) - PROFILING_GETTER_CALL, - // Direct call to accessor getter callback. // void f(Local property, AccessorInfo& info) - DIRECT_GETTER_CALL_NEW, - - // Call to accessor getter callback via InvokeAccessorGetterCallback. - // void f(Local property, AccessorInfo& info, - // AccessorGetterCallback callback) - PROFILING_GETTER_CALL_NEW + DIRECT_GETTER_CALL_NEW }; static void SetUp(); diff --git a/src/cpu-profiler.h b/src/cpu-profiler.h index 455c893328..2f8479fcca 100644 --- a/src/cpu-profiler.h +++ b/src/cpu-profiler.h @@ -248,9 +248,6 @@ class CpuProfiler { void SharedFunctionInfoMoveEvent(Address from, Address to); INLINE(bool is_profiling() const) { return is_profiling_; } - bool* is_profiling_address() { - return &is_profiling_; - } private: void StartProcessorIfNotStarted(); diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc index 17d4aac8ad..60c5c2675f 100644 --- a/src/ia32/macro-assembler-ia32.cc +++ b/src/ia32/macro-assembler-ia32.cc @@ -1973,8 +1973,6 @@ void MacroAssembler::PrepareCallApiFunction(int argc, bool returns_handle) { void MacroAssembler::CallApiFunctionAndReturn(Address function_address, - Address thunk_address, - Operand thunk_last_arg, int stack_space, bool returns_handle, int return_value_offset) { @@ -2000,26 +1998,8 @@ void MacroAssembler::CallApiFunctionAndReturn(Address function_address, PopSafepointRegisters(); } - - Label profiler_disabled; - Label end_profiler_check; - bool* is_profiling_flag = - isolate()->cpu_profiler()->is_profiling_address(); - STATIC_ASSERT(sizeof(*is_profiling_flag) == 1); - mov(eax, Immediate(reinterpret_cast
(is_profiling_flag))); - cmpb(Operand(eax, 0), 0); - j(zero, &profiler_disabled); - - // Additional parameter is the address of the actual getter function. - mov(thunk_last_arg, Immediate(function_address)); - // Call the api function. - call(thunk_address, RelocInfo::RUNTIME_ENTRY); - jmp(&end_profiler_check); - - bind(&profiler_disabled); // Call the api function. call(function_address, RelocInfo::RUNTIME_ENTRY); - bind(&end_profiler_check); if (FLAG_log_timer_events) { FrameScope frame(this, StackFrame::MANUAL); diff --git a/src/ia32/macro-assembler-ia32.h b/src/ia32/macro-assembler-ia32.h index 7d780f0e11..8380507ec0 100644 --- a/src/ia32/macro-assembler-ia32.h +++ b/src/ia32/macro-assembler-ia32.h @@ -784,8 +784,6 @@ class MacroAssembler: public Assembler { // caller-save registers. Restores context. On return removes // stack_space * kPointerSize (GCed). void CallApiFunctionAndReturn(Address function_address, - Address thunk_address, - Operand thunk_last_arg, int stack_space, bool returns_handle, int return_value_offset_from_ebp); diff --git a/src/ia32/stub-cache-ia32.cc b/src/ia32/stub-cache-ia32.cc index 05995aa801..93923a7034 100644 --- a/src/ia32/stub-cache-ia32.cc +++ b/src/ia32/stub-cache-ia32.cc @@ -503,12 +503,7 @@ static void GenerateFastApiCall(MacroAssembler* masm, STATIC_ASSERT(kFastApiCallArguments == 6); __ lea(eax, Operand(esp, kFastApiCallArguments * kPointerSize)); - - // API function gets reference to the v8::Arguments. If CPU profiler - // is enabled wrapper function will be called and we need to pass - // address of the callback as additional parameter, always allocate - // space for it. - const int kApiArgc = 1 + 1; + const int kApiArgc = 1; // API function gets reference to the v8::Arguments. // Allocate the v8::Arguments structure in the arguments' space since // it's not controlled by GC. @@ -522,26 +517,20 @@ static void GenerateFastApiCall(MacroAssembler* masm, __ PrepareCallApiFunction(kApiArgc + kApiStackSpace, returns_handle); // v8::Arguments::implicit_args_. - __ mov(ApiParameterOperand(2, returns_handle), eax); + __ mov(ApiParameterOperand(1, returns_handle), eax); __ add(eax, Immediate(argc * kPointerSize)); // v8::Arguments::values_. - __ mov(ApiParameterOperand(3, returns_handle), eax); + __ mov(ApiParameterOperand(2, returns_handle), eax); // v8::Arguments::length_. - __ Set(ApiParameterOperand(4, returns_handle), Immediate(argc)); + __ Set(ApiParameterOperand(3, returns_handle), Immediate(argc)); // v8::Arguments::is_construct_call_. - __ Set(ApiParameterOperand(5, returns_handle), Immediate(0)); + __ Set(ApiParameterOperand(4, returns_handle), Immediate(0)); // v8::InvocationCallback's argument. - __ lea(eax, ApiParameterOperand(2, returns_handle)); + __ lea(eax, ApiParameterOperand(1, returns_handle)); __ mov(ApiParameterOperand(0, returns_handle), eax); - Address thunk_address = returns_handle - ? FUNCTION_ADDR(&InvokeInvocationCallback) - : FUNCTION_ADDR(&InvokeFunctionCallback); - __ CallApiFunctionAndReturn(function_address, - thunk_address, - ApiParameterOperand(1, returns_handle), argc + kFastApiCallArguments + 1, returns_handle, kFastApiCallArguments + 1); @@ -1417,9 +1406,7 @@ void BaseLoadStubCompiler::GenerateLoadCallback( // array for v8::Arguments::values_, handler for name and pointer // to the values (it considered as smi in GC). const int kStackSpace = PropertyCallbackArguments::kArgsLength + 2; - // Allocate space for opional callback address parameter in case - // CPU profiler is active. - const int kApiArgc = 2 + 1; + const int kApiArgc = 2; Address getter_address = v8::ToCData
(callback->getter()); bool returns_handle = @@ -1435,13 +1422,7 @@ void BaseLoadStubCompiler::GenerateLoadCallback( // garbage collection but instead return the allocation failure // object. - Address thunk_address = returns_handle - ? FUNCTION_ADDR(&InvokeAccessorGetter) - : FUNCTION_ADDR(&InvokeAccessorGetterCallback); - __ CallApiFunctionAndReturn(getter_address, - thunk_address, - ApiParameterOperand(2, returns_handle), kStackSpace, returns_handle, 6); diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc index 88d2bfe462..5c8d08c5c6 100644 --- a/src/mips/code-stubs-mips.cc +++ b/src/mips/code-stubs-mips.cc @@ -6911,6 +6911,13 @@ void DirectCEntryStub::Generate(MacroAssembler* masm) { } +void DirectCEntryStub::GenerateCall(MacroAssembler* masm, + ExternalReference function) { + __ li(t9, Operand(function)); + this->GenerateCall(masm, t9); +} + + void DirectCEntryStub::GenerateCall(MacroAssembler* masm, Register target) { __ Move(t9, target); diff --git a/src/mips/code-stubs-mips.h b/src/mips/code-stubs-mips.h index bf5db10f63..ec7d147988 100644 --- a/src/mips/code-stubs-mips.h +++ b/src/mips/code-stubs-mips.h @@ -599,6 +599,8 @@ class DirectCEntryStub: public PlatformCodeStub { public: DirectCEntryStub() {} void Generate(MacroAssembler* masm); + void GenerateCall(MacroAssembler* masm, + ExternalReference function); void GenerateCall(MacroAssembler* masm, Register target); private: diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc index d41ddd2ccf..15436e7140 100644 --- a/src/mips/macro-assembler-mips.cc +++ b/src/mips/macro-assembler-mips.cc @@ -3909,9 +3909,6 @@ static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { void MacroAssembler::CallApiFunctionAndReturn(ExternalReference function, - Address function_address, - ExternalReference thunk_ref, - Register thunk_last_arg, int stack_space, bool returns_handle, int return_value_offset_from_fp) { @@ -3950,30 +3947,11 @@ void MacroAssembler::CallApiFunctionAndReturn(ExternalReference function, addiu(a0, fp, ExitFrameConstants::kStackSpaceOffset); } - Label profiler_disabled; - Label end_profiler_check; - bool* is_profiling_flag = - isolate()->cpu_profiler()->is_profiling_address(); - STATIC_ASSERT(sizeof(*is_profiling_flag) == 1); - li(t9, reinterpret_cast(is_profiling_flag)); - lb(t9, MemOperand(t9, 0)); - beq(t9, zero_reg, &profiler_disabled); - - // Third parameter is the address of the actual getter function. - li(thunk_last_arg, reinterpret_cast(function_address)); - li(t9, Operand(thunk_ref)); - jmp(&end_profiler_check); - - bind(&profiler_disabled); - li(t9, Operand(function)); - - bind(&end_profiler_check); - // Native call returns to the DirectCEntry stub which redirects to the // return address pushed on stack (could have moved after GC). // DirectCEntry stub itself is generated early and never moves. DirectCEntryStub stub; - stub.GenerateCall(this, t9); + stub.GenerateCall(this, function); if (FLAG_log_timer_events) { FrameScope frame(this, StackFrame::MANUAL); diff --git a/src/mips/macro-assembler-mips.h b/src/mips/macro-assembler-mips.h index c983b8ba5a..5e6bfbae43 100644 --- a/src/mips/macro-assembler-mips.h +++ b/src/mips/macro-assembler-mips.h @@ -1235,9 +1235,6 @@ class MacroAssembler: public Assembler { // - space to be unwound on exit (includes the call JS arguments space and // the additional space allocated for the fast call). void CallApiFunctionAndReturn(ExternalReference function, - Address function_address, - ExternalReference thunk_ref, - Register thunk_last_arg, int stack_space, bool returns_handle, int return_value_offset_from_fp); diff --git a/src/mips/simulator-mips.cc b/src/mips/simulator-mips.cc index 8771bd29f7..d8a39ab30c 100644 --- a/src/mips/simulator-mips.cc +++ b/src/mips/simulator-mips.cc @@ -1394,9 +1394,6 @@ typedef v8::Handle (*SimulatorRuntimeDirectApiCall)(int32_t arg0); // Here, we pass the first argument in a0, because this function // does not return a struct. typedef void (*SimulatorRuntimeDirectApiCallNew)(int32_t arg0); -typedef v8::Handle (*SimulatorRuntimeProfilingApiCall)( - int32_t arg0, int32_t arg1); -typedef void (*SimulatorRuntimeProfilingApiCallNew)(int32_t arg0, int32_t arg1); // This signature supports direct call to accessor getter callback. // See comment at SimulatorRuntimeDirectApiCall. @@ -1405,10 +1402,6 @@ typedef v8::Handle (*SimulatorRuntimeDirectGetterCall)(int32_t arg0, // See comment at SimulatorRuntimeDirectApiCallNew. typedef void (*SimulatorRuntimeDirectGetterCallNew)(int32_t arg0, int32_t arg1); -typedef v8::Handle (*SimulatorRuntimeProfilingGetterCall)( - int32_t arg0, int32_t arg1, int32_t arg2); -typedef void (*SimulatorRuntimeProfilingGetterCallNew)( - int32_t arg0, int32_t arg1, int32_t arg2); // Software interrupt instructions are used by the simulator to call into the // C-based V8 runtime. They are also used for debugging with simulator. @@ -1577,30 +1570,6 @@ void Simulator::SoftwareInterrupt(Instruction* instr) { reinterpret_cast(external); target(arg0); } - } else if ( - redirection->type() == ExternalReference::PROFILING_API_CALL || - redirection->type() == ExternalReference::PROFILING_API_CALL_NEW) { - if (redirection->type() == ExternalReference::PROFILING_API_CALL) { - // See comment at type definition of SimulatorRuntimeDirectApiCall - // for explanation of register usage. - if (::v8::internal::FLAG_trace_sim) { - PrintF("Call to host function at %p args %08x %08x\n", - reinterpret_cast(external), arg1, arg2); - } - SimulatorRuntimeProfilingApiCall target = - reinterpret_cast(external); - v8::Handle result = target(arg1, arg2); - *(reinterpret_cast(arg0)) = reinterpret_cast(*result); - set_register(v0, arg0); - } else { - if (::v8::internal::FLAG_trace_sim) { - PrintF("Call to host function at %p args %08x %08x\n", - reinterpret_cast(external), arg0, arg1); - } - SimulatorRuntimeProfilingApiCallNew target = - reinterpret_cast(external); - target(arg0, arg1); - } } else if ( redirection->type() == ExternalReference::DIRECT_GETTER_CALL || redirection->type() == ExternalReference::DIRECT_GETTER_CALL_NEW) { @@ -1625,30 +1594,6 @@ void Simulator::SoftwareInterrupt(Instruction* instr) { reinterpret_cast(external); target(arg0, arg1); } - } else if ( - redirection->type() == ExternalReference::PROFILING_GETTER_CALL || - redirection->type() == ExternalReference::PROFILING_GETTER_CALL_NEW) { - if (redirection->type() == ExternalReference::PROFILING_GETTER_CALL) { - // See comment at type definition of SimulatorRuntimeProfilingGetterCall - // for explanation of register usage. - if (::v8::internal::FLAG_trace_sim) { - PrintF("Call to host function at %p args %08x %08x %08x\n", - reinterpret_cast(external), arg1, arg2, arg3); - } - SimulatorRuntimeProfilingGetterCall target = - reinterpret_cast(external); - v8::Handle result = target(arg1, arg2, arg3); - *(reinterpret_cast(arg0)) = reinterpret_cast(*result); - set_register(v0, arg0); - } else { - if (::v8::internal::FLAG_trace_sim) { - PrintF("Call to host function at %p args %08x %08x %08x\n", - reinterpret_cast(external), arg0, arg1, arg2); - } - SimulatorRuntimeProfilingGetterCallNew target = - reinterpret_cast(external); - target(arg0, arg1, arg2); - } } else { SimulatorRuntimeCall target = reinterpret_cast(external); diff --git a/src/mips/stub-cache-mips.cc b/src/mips/stub-cache-mips.cc index 2f9e211bc6..6e422422ea 100644 --- a/src/mips/stub-cache-mips.cc +++ b/src/mips/stub-cache-mips.cc @@ -932,7 +932,6 @@ static void GenerateFastApiDirectCall(MacroAssembler* masm, !CallbackTable::ReturnsVoid(masm->isolate(), function_address); Register first_arg = returns_handle ? a1 : a0; - Register second_arg = returns_handle ? a2 : a1; // first_arg = v8::Arguments& // Arguments is built at sp + 1 (sp is a reserved spot for ra). @@ -959,23 +958,8 @@ static void GenerateFastApiDirectCall(MacroAssembler* masm, ExternalReference(&fun, type, masm->isolate()); - - Address thunk_address = returns_handle - ? FUNCTION_ADDR(&InvokeInvocationCallback) - : FUNCTION_ADDR(&InvokeFunctionCallback); - ExternalReference::Type thunk_type = - returns_handle ? - ExternalReference::PROFILING_API_CALL : - ExternalReference::PROFILING_API_CALL_NEW; - ApiFunction thunk_fun(thunk_address); - ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type, - masm->isolate()); - AllowExternalCallThatCantCauseGC scope(masm); __ CallApiFunctionAndReturn(ref, - function_address, - thunk_ref, - second_arg, kStackUnwindSpace, returns_handle, kFastApiCallArguments + 1); @@ -1468,7 +1452,6 @@ void BaseLoadStubCompiler::GenerateLoadCallback( Register first_arg = returns_handle ? a1 : a0; Register second_arg = returns_handle ? a2 : a1; - Register third_arg = returns_handle ? a3 : a2; __ mov(a2, scratch2()); // Saved in case scratch2 == a1. __ mov(first_arg, sp); // (first argument - see note below) = Handle @@ -1489,28 +1472,14 @@ void BaseLoadStubCompiler::GenerateLoadCallback( __ Addu(second_arg, sp, kPointerSize); const int kStackUnwindSpace = kFastApiCallArguments + 1; - ApiFunction fun(getter_address); ExternalReference::Type type = returns_handle ? ExternalReference::DIRECT_GETTER_CALL : ExternalReference::DIRECT_GETTER_CALL_NEW; - ExternalReference ref = ExternalReference(&fun, type, isolate()); - Address thunk_address = returns_handle - ? FUNCTION_ADDR(&InvokeAccessorGetter) - : FUNCTION_ADDR(&InvokeAccessorGetterCallback); - ExternalReference::Type thunk_type = - returns_handle ? - ExternalReference::PROFILING_GETTER_CALL : - ExternalReference::PROFILING_GETTER_CALL_NEW; - ApiFunction thunk_fun(thunk_address); - ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type, - isolate()); + ExternalReference ref = ExternalReference(&fun, type, isolate()); __ CallApiFunctionAndReturn(ref, - getter_address, - thunk_ref, - third_arg, kStackUnwindSpace, returns_handle, 5); diff --git a/src/sampler.cc b/src/sampler.cc index 96b20f0369..efac288ee7 100644 --- a/src/sampler.cc +++ b/src/sampler.cc @@ -496,7 +496,9 @@ class SamplerThread : public Thread { void SampleContext(Sampler* sampler) { if (!SignalHandler::Installed()) return; pthread_t tid = sampler->platform_data()->vm_tid(); - pthread_kill(tid, SIGPROF); + int result = pthread_kill(tid, SIGPROF); + USE(result); + ASSERT(result == 0); } #elif defined(__MACH__) diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc index b6a1d34d6a..a2568a400f 100644 --- a/src/x64/macro-assembler-x64.cc +++ b/src/x64/macro-assembler-x64.cc @@ -697,8 +697,6 @@ void MacroAssembler::PrepareCallApiFunction(int arg_stack_space, void MacroAssembler::CallApiFunctionAndReturn(Address function_address, - Address thunk_address, - Register thunk_last_arg, int stack_space, bool returns_handle, int return_value_offset) { @@ -739,29 +737,9 @@ void MacroAssembler::CallApiFunctionAndReturn(Address function_address, PopSafepointRegisters(); } - - Label profiler_disabled; - Label end_profiler_check; - bool* is_profiling_flag = - isolate()->cpu_profiler()->is_profiling_address(); - STATIC_ASSERT(sizeof(*is_profiling_flag) == 1); - movq(rax, is_profiling_flag, RelocInfo::EXTERNAL_REFERENCE); - cmpb(Operand(rax, 0), Immediate(0)); - j(zero, &profiler_disabled); - - // Third parameter is the address of the actual getter function. - movq(thunk_last_arg, function_address, RelocInfo::EXTERNAL_REFERENCE); - movq(rax, thunk_address, RelocInfo::EXTERNAL_REFERENCE); - jmp(&end_profiler_check); - - bind(&profiler_disabled); // Call the api function! movq(rax, reinterpret_cast(function_address), RelocInfo::EXTERNAL_REFERENCE); - - bind(&end_profiler_check); - - // Call the api function! call(rax); if (FLAG_log_timer_events) { diff --git a/src/x64/macro-assembler-x64.h b/src/x64/macro-assembler-x64.h index 1b7e586c0a..7b8747cab9 100644 --- a/src/x64/macro-assembler-x64.h +++ b/src/x64/macro-assembler-x64.h @@ -1239,8 +1239,6 @@ class MacroAssembler: public Assembler { // caller-save registers. Restores context. On return removes // stack_space * kPointerSize (GCed). void CallApiFunctionAndReturn(Address function_address, - Address thunk_address, - Register thunk_last_arg, int stack_space, bool returns_handle, int return_value_offset_from_rbp); diff --git a/src/x64/stub-cache-x64.cc b/src/x64/stub-cache-x64.cc index 2b1953e522..c1059050ce 100644 --- a/src/x64/stub-cache-x64.cc +++ b/src/x64/stub-cache-x64.cc @@ -491,14 +491,11 @@ static void GenerateFastApiCall(MacroAssembler* masm, #if defined(__MINGW64__) Register arguments_arg = rcx; - Register callback_arg = rdx; #elif defined(_WIN64) // Win64 uses first register--rcx--for returned value. Register arguments_arg = returns_handle ? rdx : rcx; - Register callback_arg = returns_handle ? r8 : rdx; #else Register arguments_arg = rdi; - Register callback_arg = rsi; #endif // Allocate the v8::Arguments structure in the arguments' space since @@ -517,13 +514,7 @@ static void GenerateFastApiCall(MacroAssembler* masm, // v8::InvocationCallback's argument. __ lea(arguments_arg, StackSpaceOperand(0)); - Address thunk_address = returns_handle - ? FUNCTION_ADDR(&InvokeInvocationCallback) - : FUNCTION_ADDR(&InvokeFunctionCallback); - __ CallApiFunctionAndReturn(function_address, - thunk_address, - callback_arg, argc + kFastApiCallArguments + 1, returns_handle, kFastApiCallArguments + 1); @@ -1327,16 +1318,13 @@ void BaseLoadStubCompiler::GenerateLoadCallback( !CallbackTable::ReturnsVoid(isolate(), getter_address); #if defined(__MINGW64__) - Register getter_arg = r8; Register accessor_info_arg = rdx; Register name_arg = rcx; #elif defined(_WIN64) // Win64 uses first register--rcx--for returned value. - Register getter_arg = returns_handle ? r9 : r8; Register accessor_info_arg = returns_handle ? r8 : rdx; Register name_arg = returns_handle ? rdx : rcx; #else - Register getter_arg = rdx; Register accessor_info_arg = rsi; Register name_arg = rdi; #endif @@ -1362,13 +1350,7 @@ void BaseLoadStubCompiler::GenerateLoadCallback( // could be used to pass arguments. __ lea(accessor_info_arg, StackSpaceOperand(0)); - Address thunk_address = returns_handle - ? FUNCTION_ADDR(&InvokeAccessorGetter) - : FUNCTION_ADDR(&InvokeAccessorGetterCallback); - __ CallApiFunctionAndReturn(getter_address, - thunk_address, - getter_arg, kStackSpace, returns_handle, 5); diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc index 1318147f1b..5d38c21188 100755 --- a/test/cctest/test-api.cc +++ b/test/cctest/test-api.cc @@ -804,7 +804,7 @@ THREADED_TEST(GlobalProperties) { template -static void CheckReturnValue(const T& t, i::Address callback) { +static void CheckReturnValue(const T& t) { v8::ReturnValue rv = t.GetReturnValue(); i::Object** o = *reinterpret_cast(&rv); CHECK_EQ(v8::Isolate::GetCurrent(), t.GetIsolate()); @@ -817,70 +817,45 @@ static void CheckReturnValue(const T& t, i::Address callback) { rv.Set(v8::Handle()); CHECK((*o)->IsTheHole() || (*o)->IsUndefined()); CHECK_EQ(is_runtime, (*o)->IsTheHole()); - - i::Isolate* isolate = reinterpret_cast(t.GetIsolate()); - // If CPU profiler is active check that when API callback is invoked - // VMState is set to EXTERNAL. - if (isolate->cpu_profiler()->is_profiling()) { - CHECK_EQ(i::EXTERNAL, isolate->current_vm_state()); - CHECK(isolate->external_callback()); - CHECK_EQ(callback, isolate->external_callback()); - } } -static v8::Handle handle_call_impl( - const v8::Arguments& args, - i::Address callback) { +static v8::Handle handle_call(const v8::Arguments& args) { ApiTestFuzzer::Fuzz(); - CheckReturnValue(args, callback); + CheckReturnValue(args); args.GetReturnValue().Set(v8_str("bad value")); return v8_num(102); } -static v8::Handle handle_call(const v8::Arguments& args) { - return handle_call_impl(args, FUNCTION_ADDR(handle_call)); -} - static v8::Handle handle_call_2(const v8::Arguments& args) { - return handle_call_impl(args, FUNCTION_ADDR(handle_call_2)); + return handle_call(args); } -static v8::Handle handle_call_indirect_impl(const v8::Arguments& args, - i::Address callback) { +static v8::Handle handle_call_indirect(const v8::Arguments& args) { ApiTestFuzzer::Fuzz(); - CheckReturnValue(args, callback); + CheckReturnValue(args); args.GetReturnValue().Set(v8_str("bad value")); args.GetReturnValue().Set(v8_num(102)); return v8::Handle(); } -static v8::Handle handle_call_indirect(const v8::Arguments& args) { - return handle_call_indirect_impl(args, FUNCTION_ADDR(handle_call_indirect)); -} - static v8::Handle handle_call_indirect_2(const v8::Arguments& args) { - return handle_call_indirect_impl(args, FUNCTION_ADDR(handle_call_indirect_2)); + return handle_call_indirect(args); } -static void handle_callback_impl(const v8::FunctionCallbackInfo& info, - i::Address callback) { +static void handle_callback(const v8::FunctionCallbackInfo& info) { ApiTestFuzzer::Fuzz(); - CheckReturnValue(info, callback); + CheckReturnValue(info); info.GetReturnValue().Set(v8_str("bad value")); info.GetReturnValue().Set(v8_num(102)); } -static void handle_callback(const v8::FunctionCallbackInfo& info) { - return handle_callback_impl(info, FUNCTION_ADDR(handle_callback)); -} - static void handle_callback_2(const v8::FunctionCallbackInfo& info) { - return handle_callback_impl(info, FUNCTION_ADDR(handle_callback_2)); + return handle_callback(info); } static v8::Handle construct_call(const v8::Arguments& args) { ApiTestFuzzer::Fuzz(); - CheckReturnValue(args, FUNCTION_ADDR(construct_call)); + CheckReturnValue(args); args.This()->Set(v8_str("x"), v8_num(1)); args.This()->Set(v8_str("y"), v8_num(2)); args.GetReturnValue().Set(v8_str("bad value")); @@ -889,7 +864,7 @@ static v8::Handle construct_call(const v8::Arguments& args) { static v8::Handle construct_call_indirect(const v8::Arguments& args) { ApiTestFuzzer::Fuzz(); - CheckReturnValue(args, FUNCTION_ADDR(construct_call_indirect)); + CheckReturnValue(args); args.This()->Set(v8_str("x"), v8_num(1)); args.This()->Set(v8_str("y"), v8_num(2)); args.GetReturnValue().Set(v8_str("bad value")); @@ -900,7 +875,7 @@ static v8::Handle construct_call_indirect(const v8::Arguments& args) { static void construct_callback( const v8::FunctionCallbackInfo& info) { ApiTestFuzzer::Fuzz(); - CheckReturnValue(info, FUNCTION_ADDR(construct_callback)); + CheckReturnValue(info); info.This()->Set(v8_str("x"), v8_num(1)); info.This()->Set(v8_str("y"), v8_num(2)); info.GetReturnValue().Set(v8_str("bad value")); @@ -911,7 +886,7 @@ static void construct_callback( static v8::Handle Return239( Local name, const AccessorInfo& info) { ApiTestFuzzer::Fuzz(); - CheckReturnValue(info, FUNCTION_ADDR(Return239)); + CheckReturnValue(info); info.GetReturnValue().Set(v8_str("bad value")); return v8_num(239); } @@ -919,7 +894,7 @@ static v8::Handle Return239( static v8::Handle Return239Indirect( Local name, const AccessorInfo& info) { ApiTestFuzzer::Fuzz(); - CheckReturnValue(info, FUNCTION_ADDR(Return239Indirect)); + CheckReturnValue(info); Handle value = v8_num(239); info.GetReturnValue().Set(v8_str("bad value")); info.GetReturnValue().Set(value); @@ -929,7 +904,7 @@ static v8::Handle Return239Indirect( static void Return239Callback( Local name, const v8::PropertyCallbackInfo& info) { ApiTestFuzzer::Fuzz(); - CheckReturnValue(info, FUNCTION_ADDR(Return239Callback)); + CheckReturnValue(info); info.GetReturnValue().Set(v8_str("bad value")); info.GetReturnValue().Set(v8_num(239)); } @@ -938,56 +913,31 @@ static void Return239Callback( template static void TestFunctionTemplateInitializer(Handler handler, Handler handler_2) { - for (int i = 0; i < 2; i++) { - bool is_profiling = (i > 0); - // Test constructor calls. - { - LocalContext env; - v8::HandleScope scope(env->GetIsolate()); - - v8::Local profile_name = v8::String::New("my_profile1"); - v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); - if (is_profiling) { - cpu_profiler->StartCpuProfiling(profile_name); - } - - Local fun_templ = - v8::FunctionTemplate::New(handler); - Local fun = fun_templ->GetFunction(); - env->Global()->Set(v8_str("obj"), fun); - Local