OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <limits.h> // For LONG_MIN, LONG_MAX. | 5 #include <limits.h> // For LONG_MIN, LONG_MAX. |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/division-by-constant.h" | 10 #include "src/base/division-by-constant.h" |
(...skipping 2463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2474 void MacroAssembler::CallExternalReference(const ExternalReference& ext, | 2474 void MacroAssembler::CallExternalReference(const ExternalReference& ext, |
2475 int num_arguments) { | 2475 int num_arguments) { |
2476 mov(r0, Operand(num_arguments)); | 2476 mov(r0, Operand(num_arguments)); |
2477 mov(r1, Operand(ext)); | 2477 mov(r1, Operand(ext)); |
2478 | 2478 |
2479 CEntryStub stub(isolate(), 1); | 2479 CEntryStub stub(isolate(), 1); |
2480 CallStub(&stub); | 2480 CallStub(&stub); |
2481 } | 2481 } |
2482 | 2482 |
2483 | 2483 |
2484 void MacroAssembler::TailCallExternalReference(const ExternalReference& ext, | 2484 void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid) { |
2485 int num_arguments) { | 2485 const Runtime::Function* function = Runtime::FunctionForId(fid); |
2486 // TODO(1236192): Most runtime routines don't need the number of | 2486 DCHECK_EQ(1, function->result_size); |
2487 // arguments passed in because it is constant. At some point we | 2487 if (function->nargs >= 0) { |
2488 // should remove this need and make the runtime routine entry code | 2488 // TODO(1236192): Most runtime routines don't need the number of |
2489 // smarter. | 2489 // arguments passed in because it is constant. At some point we |
2490 mov(r0, Operand(num_arguments)); | 2490 // should remove this need and make the runtime routine entry code |
2491 JumpToExternalReference(ext); | 2491 // smarter. |
| 2492 mov(r0, Operand(function->nargs)); |
| 2493 } |
| 2494 JumpToExternalReference(ExternalReference(fid, isolate())); |
2492 } | 2495 } |
2493 | 2496 |
2494 | 2497 |
2495 void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid, | |
2496 int num_arguments) { | |
2497 TailCallExternalReference(ExternalReference(fid, isolate()), num_arguments); | |
2498 } | |
2499 | |
2500 | |
2501 void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin) { | 2498 void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin) { |
2502 #if defined(__thumb__) | 2499 #if defined(__thumb__) |
2503 // Thumb mode builtin. | 2500 // Thumb mode builtin. |
2504 DCHECK((reinterpret_cast<intptr_t>(builtin.address()) & 1) == 1); | 2501 DCHECK((reinterpret_cast<intptr_t>(builtin.address()) & 1) == 1); |
2505 #endif | 2502 #endif |
2506 mov(r1, Operand(builtin)); | 2503 mov(r1, Operand(builtin)); |
2507 CEntryStub stub(isolate(), 1); | 2504 CEntryStub stub(isolate(), 1); |
2508 Jump(stub.GetCode(), RelocInfo::CODE_TARGET); | 2505 Jump(stub.GetCode(), RelocInfo::CODE_TARGET); |
2509 } | 2506 } |
2510 | 2507 |
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3598 } | 3595 } |
3599 } | 3596 } |
3600 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift)); | 3597 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift)); |
3601 add(result, result, Operand(dividend, LSR, 31)); | 3598 add(result, result, Operand(dividend, LSR, 31)); |
3602 } | 3599 } |
3603 | 3600 |
3604 } // namespace internal | 3601 } // namespace internal |
3605 } // namespace v8 | 3602 } // namespace v8 |
3606 | 3603 |
3607 #endif // V8_TARGET_ARCH_ARM | 3604 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |