OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 2226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2237 Jump(stub->GetCode(isolate()), RelocInfo::CODE_TARGET, cond); | 2237 Jump(stub->GetCode(isolate()), RelocInfo::CODE_TARGET, cond); |
2238 } | 2238 } |
2239 | 2239 |
2240 | 2240 |
2241 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { | 2241 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { |
2242 return ref0.address() - ref1.address(); | 2242 return ref0.address() - ref1.address(); |
2243 } | 2243 } |
2244 | 2244 |
2245 | 2245 |
2246 void MacroAssembler::CallApiFunctionAndReturn(ExternalReference function, | 2246 void MacroAssembler::CallApiFunctionAndReturn(ExternalReference function, |
| 2247 Address function_address, |
| 2248 ExternalReference thunk_ref, |
| 2249 Register thunk_last_arg, |
2247 int stack_space, | 2250 int stack_space, |
2248 bool returns_handle, | 2251 bool returns_handle, |
2249 int return_value_offset) { | 2252 int return_value_offset) { |
2250 ExternalReference next_address = | 2253 ExternalReference next_address = |
2251 ExternalReference::handle_scope_next_address(isolate()); | 2254 ExternalReference::handle_scope_next_address(isolate()); |
2252 const int kNextOffset = 0; | 2255 const int kNextOffset = 0; |
2253 const int kLimitOffset = AddressOffset( | 2256 const int kLimitOffset = AddressOffset( |
2254 ExternalReference::handle_scope_limit_address(isolate()), | 2257 ExternalReference::handle_scope_limit_address(isolate()), |
2255 next_address); | 2258 next_address); |
2256 const int kLevelOffset = AddressOffset( | 2259 const int kLevelOffset = AddressOffset( |
(...skipping 10 matching lines...) Expand all Loading... |
2267 | 2270 |
2268 if (FLAG_log_timer_events) { | 2271 if (FLAG_log_timer_events) { |
2269 FrameScope frame(this, StackFrame::MANUAL); | 2272 FrameScope frame(this, StackFrame::MANUAL); |
2270 PushSafepointRegisters(); | 2273 PushSafepointRegisters(); |
2271 PrepareCallCFunction(1, r0); | 2274 PrepareCallCFunction(1, r0); |
2272 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); | 2275 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); |
2273 CallCFunction(ExternalReference::log_enter_external_function(isolate()), 1); | 2276 CallCFunction(ExternalReference::log_enter_external_function(isolate()), 1); |
2274 PopSafepointRegisters(); | 2277 PopSafepointRegisters(); |
2275 } | 2278 } |
2276 | 2279 |
| 2280 ASSERT(!thunk_last_arg.is(r3)); |
| 2281 Label profiler_disabled; |
| 2282 Label end_profiler_check; |
| 2283 bool* is_profiling_flag = |
| 2284 isolate()->cpu_profiler()->is_profiling_address(); |
| 2285 STATIC_ASSERT(sizeof(*is_profiling_flag) == 1); |
| 2286 mov(r3, Operand(reinterpret_cast<int32_t>(is_profiling_flag))); |
| 2287 ldrb(r3, MemOperand(r3, 0)); |
| 2288 cmp(r3, Operand(0)); |
| 2289 b(eq, &profiler_disabled); |
| 2290 |
| 2291 // Additional parameter is the address of the actual callback. |
| 2292 mov(thunk_last_arg, Operand(reinterpret_cast<int32_t>(function_address))); |
| 2293 mov(r3, Operand(thunk_ref)); |
| 2294 jmp(&end_profiler_check); |
| 2295 |
| 2296 bind(&profiler_disabled); |
| 2297 mov(r3, Operand(function)); |
| 2298 bind(&end_profiler_check); |
| 2299 |
2277 // Native call returns to the DirectCEntry stub which redirects to the | 2300 // Native call returns to the DirectCEntry stub which redirects to the |
2278 // return address pushed on stack (could have moved after GC). | 2301 // return address pushed on stack (could have moved after GC). |
2279 // DirectCEntry stub itself is generated early and never moves. | 2302 // DirectCEntry stub itself is generated early and never moves. |
2280 DirectCEntryStub stub; | 2303 DirectCEntryStub stub; |
2281 stub.GenerateCall(this, function); | 2304 stub.GenerateCall(this, r3); |
2282 | 2305 |
2283 if (FLAG_log_timer_events) { | 2306 if (FLAG_log_timer_events) { |
2284 FrameScope frame(this, StackFrame::MANUAL); | 2307 FrameScope frame(this, StackFrame::MANUAL); |
2285 PushSafepointRegisters(); | 2308 PushSafepointRegisters(); |
2286 PrepareCallCFunction(1, r0); | 2309 PrepareCallCFunction(1, r0); |
2287 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); | 2310 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); |
2288 CallCFunction(ExternalReference::log_leave_external_function(isolate()), 1); | 2311 CallCFunction(ExternalReference::log_leave_external_function(isolate()), 1); |
2289 PopSafepointRegisters(); | 2312 PopSafepointRegisters(); |
2290 } | 2313 } |
2291 | 2314 |
(...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3793 void CodePatcher::EmitCondition(Condition cond) { | 3816 void CodePatcher::EmitCondition(Condition cond) { |
3794 Instr instr = Assembler::instr_at(masm_.pc_); | 3817 Instr instr = Assembler::instr_at(masm_.pc_); |
3795 instr = (instr & ~kCondMask) | cond; | 3818 instr = (instr & ~kCondMask) | cond; |
3796 masm_.emit(instr); | 3819 masm_.emit(instr); |
3797 } | 3820 } |
3798 | 3821 |
3799 | 3822 |
3800 } } // namespace v8::internal | 3823 } } // namespace v8::internal |
3801 | 3824 |
3802 #endif // V8_TARGET_ARCH_ARM | 3825 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |