OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1316 | 1316 |
1317 | 1317 |
1318 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { | 1318 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { |
1319 return ref0.address() - ref1.address(); | 1319 return ref0.address() - ref1.address(); |
1320 } | 1320 } |
1321 | 1321 |
1322 | 1322 |
1323 void MacroAssembler::CallApiFunctionAndReturn( | 1323 void MacroAssembler::CallApiFunctionAndReturn( |
1324 Register function_address, | 1324 Register function_address, |
1325 ExternalReference thunk_ref, | 1325 ExternalReference thunk_ref, |
1326 Register thunk_last_arg, | |
1327 int stack_space, | 1326 int stack_space, |
1328 int spill_offset, | 1327 int spill_offset, |
1329 MemOperand return_value_operand, | 1328 MemOperand return_value_operand, |
1330 MemOperand* context_restore_operand) { | 1329 MemOperand* context_restore_operand) { |
1331 ASM_LOCATION("CallApiFunctionAndReturn"); | 1330 ASM_LOCATION("CallApiFunctionAndReturn"); |
1332 ExternalReference next_address = | 1331 ExternalReference next_address = |
1333 ExternalReference::handle_scope_next_address(isolate()); | 1332 ExternalReference::handle_scope_next_address(isolate()); |
1334 const int kNextOffset = 0; | 1333 const int kNextOffset = 0; |
1335 const int kLimitOffset = AddressOffset( | 1334 const int kLimitOffset = AddressOffset( |
1336 ExternalReference::handle_scope_limit_address(isolate()), | 1335 ExternalReference::handle_scope_limit_address(isolate()), |
1337 next_address); | 1336 next_address); |
1338 const int kLevelOffset = AddressOffset( | 1337 const int kLevelOffset = AddressOffset( |
1339 ExternalReference::handle_scope_level_address(isolate()), | 1338 ExternalReference::handle_scope_level_address(isolate()), |
1340 next_address); | 1339 next_address); |
1341 | 1340 |
1342 ASSERT(function_address.Is(x3)); | 1341 ASSERT(!AreAliased(function_address, x1, x2)); |
1343 ASSERT(!AreAliased(function_address, thunk_last_arg, x1, x2)); | |
1344 // TODO(all): Why do we care about aliasing x2? (This function uses x1 as a | 1342 // TODO(all): Why do we care about aliasing x2? (This function uses x1 as a |
1345 // scratch regiser.) | 1343 // scratch regiser.) |
1346 | 1344 |
1347 // TODO(all): Why isn't thunk_last_arg used? | |
1348 USE(thunk_last_arg); | |
1349 | |
1350 Label profiler_disabled; | 1345 Label profiler_disabled; |
1351 Label end_profiler_check; | 1346 Label end_profiler_check; |
1352 bool* is_profiling_flag = isolate()->cpu_profiler()->is_profiling_address(); | 1347 bool* is_profiling_flag = isolate()->cpu_profiler()->is_profiling_address(); |
1353 STATIC_ASSERT(sizeof(*is_profiling_flag) == 1); | 1348 STATIC_ASSERT(sizeof(*is_profiling_flag) == 1); |
1354 Mov(x10, reinterpret_cast<uintptr_t>(is_profiling_flag)); | 1349 Mov(x10, reinterpret_cast<uintptr_t>(is_profiling_flag)); |
1355 Ldrb(w10, MemOperand(x10)); | 1350 Ldrb(w10, MemOperand(x10)); |
1356 Cbz(w10, &profiler_disabled); | 1351 Cbz(w10, &profiler_disabled); |
1357 | 1352 |
1358 // Additional parameter is the address of the actual callback. | 1353 // Additional parameter is the address of the actual callback. |
1359 Mov(function_address, Operand(thunk_ref)); | 1354 Mov(function_address, Operand(thunk_ref)); |
1360 // TODO(jbramley): Remove this once the no-op move at profiler_disabled is | 1355 if (!function_address.Is(x3)) { |
1361 // investigated. | 1356 B(&end_profiler_check); |
1362 B(&end_profiler_check); | 1357 Bind(&profiler_disabled); |
1363 | 1358 Mov(x3, function_address); |
1364 Bind(&profiler_disabled); | 1359 Bind(&end_profiler_check); |
1365 // TODO(jbramley): ARM does a no-op move here. Why? | 1360 } else { |
1366 Bind(&end_profiler_check); | 1361 Bind(&profiler_disabled); |
| 1362 Bind(&end_profiler_check); |
| 1363 } |
1367 | 1364 |
1368 // Save the callee-save registers we are going to use. | 1365 // Save the callee-save registers we are going to use. |
1369 // TODO(all): Is this necessary? ARM doesn't do it. | 1366 // TODO(all): Is this necessary? ARM doesn't do it. |
1370 STATIC_ASSERT(kCallApiFunctionSpillSpace == 4); | 1367 STATIC_ASSERT(kCallApiFunctionSpillSpace == 4); |
1371 Poke(x19, (spill_offset + 0) * kXRegSizeInBytes); | 1368 Poke(x19, (spill_offset + 0) * kXRegSizeInBytes); |
1372 Poke(x20, (spill_offset + 1) * kXRegSizeInBytes); | 1369 Poke(x20, (spill_offset + 1) * kXRegSizeInBytes); |
1373 Poke(x21, (spill_offset + 2) * kXRegSizeInBytes); | 1370 Poke(x21, (spill_offset + 2) * kXRegSizeInBytes); |
1374 Poke(x22, (spill_offset + 3) * kXRegSizeInBytes); | 1371 Poke(x22, (spill_offset + 3) * kXRegSizeInBytes); |
1375 | 1372 |
1376 // Allocate HandleScope in callee-save registers. | 1373 // Allocate HandleScope in callee-save registers. |
(...skipping 3428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4805 } | 4802 } |
4806 } | 4803 } |
4807 | 4804 |
4808 | 4805 |
4809 #undef __ | 4806 #undef __ |
4810 | 4807 |
4811 | 4808 |
4812 } } // namespace v8::internal | 4809 } } // namespace v8::internal |
4813 | 4810 |
4814 #endif // V8_TARGET_ARCH_A64 | 4811 #endif // V8_TARGET_ARCH_A64 |
OLD | NEW |