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, | |
2250 int stack_space, | 2247 int stack_space, |
2251 bool returns_handle, | 2248 bool returns_handle, |
2252 int return_value_offset) { | 2249 int return_value_offset) { |
2253 ExternalReference next_address = | 2250 ExternalReference next_address = |
2254 ExternalReference::handle_scope_next_address(isolate()); | 2251 ExternalReference::handle_scope_next_address(isolate()); |
2255 const int kNextOffset = 0; | 2252 const int kNextOffset = 0; |
2256 const int kLimitOffset = AddressOffset( | 2253 const int kLimitOffset = AddressOffset( |
2257 ExternalReference::handle_scope_limit_address(isolate()), | 2254 ExternalReference::handle_scope_limit_address(isolate()), |
2258 next_address); | 2255 next_address); |
2259 const int kLevelOffset = AddressOffset( | 2256 const int kLevelOffset = AddressOffset( |
(...skipping 10 matching lines...) Expand all Loading... |
2270 | 2267 |
2271 if (FLAG_log_timer_events) { | 2268 if (FLAG_log_timer_events) { |
2272 FrameScope frame(this, StackFrame::MANUAL); | 2269 FrameScope frame(this, StackFrame::MANUAL); |
2273 PushSafepointRegisters(); | 2270 PushSafepointRegisters(); |
2274 PrepareCallCFunction(1, r0); | 2271 PrepareCallCFunction(1, r0); |
2275 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); | 2272 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); |
2276 CallCFunction(ExternalReference::log_enter_external_function(isolate()), 1); | 2273 CallCFunction(ExternalReference::log_enter_external_function(isolate()), 1); |
2277 PopSafepointRegisters(); | 2274 PopSafepointRegisters(); |
2278 } | 2275 } |
2279 | 2276 |
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 | |
2300 // Native call returns to the DirectCEntry stub which redirects to the | 2277 // Native call returns to the DirectCEntry stub which redirects to the |
2301 // return address pushed on stack (could have moved after GC). | 2278 // return address pushed on stack (could have moved after GC). |
2302 // DirectCEntry stub itself is generated early and never moves. | 2279 // DirectCEntry stub itself is generated early and never moves. |
2303 DirectCEntryStub stub; | 2280 DirectCEntryStub stub; |
2304 stub.GenerateCall(this, r3); | 2281 stub.GenerateCall(this, function); |
2305 | 2282 |
2306 if (FLAG_log_timer_events) { | 2283 if (FLAG_log_timer_events) { |
2307 FrameScope frame(this, StackFrame::MANUAL); | 2284 FrameScope frame(this, StackFrame::MANUAL); |
2308 PushSafepointRegisters(); | 2285 PushSafepointRegisters(); |
2309 PrepareCallCFunction(1, r0); | 2286 PrepareCallCFunction(1, r0); |
2310 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); | 2287 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); |
2311 CallCFunction(ExternalReference::log_leave_external_function(isolate()), 1); | 2288 CallCFunction(ExternalReference::log_leave_external_function(isolate()), 1); |
2312 PopSafepointRegisters(); | 2289 PopSafepointRegisters(); |
2313 } | 2290 } |
2314 | 2291 |
(...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3816 void CodePatcher::EmitCondition(Condition cond) { | 3793 void CodePatcher::EmitCondition(Condition cond) { |
3817 Instr instr = Assembler::instr_at(masm_.pc_); | 3794 Instr instr = Assembler::instr_at(masm_.pc_); |
3818 instr = (instr & ~kCondMask) | cond; | 3795 instr = (instr & ~kCondMask) | cond; |
3819 masm_.emit(instr); | 3796 masm_.emit(instr); |
3820 } | 3797 } |
3821 | 3798 |
3822 | 3799 |
3823 } } // namespace v8::internal | 3800 } } // namespace v8::internal |
3824 | 3801 |
3825 #endif // V8_TARGET_ARCH_ARM | 3802 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |