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 2250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2261 Jump(stub->GetCode(isolate()), RelocInfo::CODE_TARGET, cond); | 2261 Jump(stub->GetCode(isolate()), RelocInfo::CODE_TARGET, cond); |
2262 } | 2262 } |
2263 | 2263 |
2264 | 2264 |
2265 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { | 2265 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { |
2266 return ref0.address() - ref1.address(); | 2266 return ref0.address() - ref1.address(); |
2267 } | 2267 } |
2268 | 2268 |
2269 | 2269 |
2270 void MacroAssembler::CallApiFunctionAndReturn(ExternalReference function, | 2270 void MacroAssembler::CallApiFunctionAndReturn(ExternalReference function, |
2271 int stack_space) { | 2271 int stack_space, |
| 2272 bool returns_handle, |
| 2273 int return_value_offset) { |
2272 ExternalReference next_address = | 2274 ExternalReference next_address = |
2273 ExternalReference::handle_scope_next_address(isolate()); | 2275 ExternalReference::handle_scope_next_address(isolate()); |
2274 const int kNextOffset = 0; | 2276 const int kNextOffset = 0; |
2275 const int kLimitOffset = AddressOffset( | 2277 const int kLimitOffset = AddressOffset( |
2276 ExternalReference::handle_scope_limit_address(isolate()), | 2278 ExternalReference::handle_scope_limit_address(isolate()), |
2277 next_address); | 2279 next_address); |
2278 const int kLevelOffset = AddressOffset( | 2280 const int kLevelOffset = AddressOffset( |
2279 ExternalReference::handle_scope_level_address(isolate()), | 2281 ExternalReference::handle_scope_level_address(isolate()), |
2280 next_address); | 2282 next_address); |
2281 | 2283 |
(...skipping 25 matching lines...) Expand all Loading... |
2307 PushSafepointRegisters(); | 2309 PushSafepointRegisters(); |
2308 PrepareCallCFunction(1, r0); | 2310 PrepareCallCFunction(1, r0); |
2309 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); | 2311 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); |
2310 CallCFunction(ExternalReference::log_leave_external_function(isolate()), 1); | 2312 CallCFunction(ExternalReference::log_leave_external_function(isolate()), 1); |
2311 PopSafepointRegisters(); | 2313 PopSafepointRegisters(); |
2312 } | 2314 } |
2313 | 2315 |
2314 Label promote_scheduled_exception; | 2316 Label promote_scheduled_exception; |
2315 Label delete_allocated_handles; | 2317 Label delete_allocated_handles; |
2316 Label leave_exit_frame; | 2318 Label leave_exit_frame; |
| 2319 Label return_value_loaded; |
2317 | 2320 |
2318 // If result is non-zero, dereference to get the result value | 2321 if (returns_handle) { |
2319 // otherwise set it to undefined. | 2322 Label load_return_value; |
2320 cmp(r0, Operand::Zero()); | 2323 cmp(r0, Operand::Zero()); |
2321 LoadRoot(r0, Heap::kUndefinedValueRootIndex, eq); | 2324 b(eq, &load_return_value); |
2322 ldr(r0, MemOperand(r0), ne); | 2325 // derefernce returned value |
2323 | 2326 ldr(r0, MemOperand(r0)); |
| 2327 b(&return_value_loaded); |
| 2328 bind(&load_return_value); |
| 2329 } |
| 2330 // load value from ReturnValue |
| 2331 ldr(r0, MemOperand(fp, return_value_offset*kPointerSize)); |
| 2332 bind(&return_value_loaded); |
2324 // No more valid handles (the result handle was the last one). Restore | 2333 // No more valid handles (the result handle was the last one). Restore |
2325 // previous handle scope. | 2334 // previous handle scope. |
2326 str(r4, MemOperand(r7, kNextOffset)); | 2335 str(r4, MemOperand(r7, kNextOffset)); |
2327 if (emit_debug_code()) { | 2336 if (emit_debug_code()) { |
2328 ldr(r1, MemOperand(r7, kLevelOffset)); | 2337 ldr(r1, MemOperand(r7, kLevelOffset)); |
2329 cmp(r1, r6); | 2338 cmp(r1, r6); |
2330 Check(eq, "Unexpected level after return from api call"); | 2339 Check(eq, "Unexpected level after return from api call"); |
2331 } | 2340 } |
2332 sub(r6, r6, Operand(1)); | 2341 sub(r6, r6, Operand(1)); |
2333 str(r6, MemOperand(r7, kLevelOffset)); | 2342 str(r6, MemOperand(r7, kLevelOffset)); |
(...skipping 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3858 void CodePatcher::EmitCondition(Condition cond) { | 3867 void CodePatcher::EmitCondition(Condition cond) { |
3859 Instr instr = Assembler::instr_at(masm_.pc_); | 3868 Instr instr = Assembler::instr_at(masm_.pc_); |
3860 instr = (instr & ~kCondMask) | cond; | 3869 instr = (instr & ~kCondMask) | cond; |
3861 masm_.emit(instr); | 3870 masm_.emit(instr); |
3862 } | 3871 } |
3863 | 3872 |
3864 | 3873 |
3865 } } // namespace v8::internal | 3874 } } // namespace v8::internal |
3866 | 3875 |
3867 #endif // V8_TARGET_ARCH_ARM | 3876 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |