OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #if V8_TARGET_ARCH_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/base/division-by-constant.h" | 8 #include "src/base/division-by-constant.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 2553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2564 | 2564 |
2565 // The code below is made a lot easier because the calling code already sets | 2565 // The code below is made a lot easier because the calling code already sets |
2566 // up actual and expected registers according to the contract if values are | 2566 // up actual and expected registers according to the contract if values are |
2567 // passed in registers. | 2567 // passed in registers. |
2568 DCHECK(actual.is_immediate() || actual.reg().is(x0)); | 2568 DCHECK(actual.is_immediate() || actual.reg().is(x0)); |
2569 DCHECK(expected.is_immediate() || expected.reg().is(x2)); | 2569 DCHECK(expected.is_immediate() || expected.reg().is(x2)); |
2570 DCHECK((!code_constant.is_null() && code_reg.is(no_reg)) || code_reg.is(x3)); | 2570 DCHECK((!code_constant.is_null() && code_reg.is(no_reg)) || code_reg.is(x3)); |
2571 | 2571 |
2572 if (expected.is_immediate()) { | 2572 if (expected.is_immediate()) { |
2573 DCHECK(actual.is_immediate()); | 2573 DCHECK(actual.is_immediate()); |
| 2574 Mov(x0, actual.immediate()); |
2574 if (expected.immediate() == actual.immediate()) { | 2575 if (expected.immediate() == actual.immediate()) { |
2575 definitely_matches = true; | 2576 definitely_matches = true; |
2576 | 2577 |
2577 } else { | 2578 } else { |
2578 Mov(x0, actual.immediate()); | |
2579 if (expected.immediate() == | 2579 if (expected.immediate() == |
2580 SharedFunctionInfo::kDontAdaptArgumentsSentinel) { | 2580 SharedFunctionInfo::kDontAdaptArgumentsSentinel) { |
2581 // Don't worry about adapting arguments for builtins that | 2581 // Don't worry about adapting arguments for builtins that |
2582 // don't want that done. Skip adaption code by making it look | 2582 // don't want that done. Skip adaption code by making it look |
2583 // like we have a match between expected and actual number of | 2583 // like we have a match between expected and actual number of |
2584 // arguments. | 2584 // arguments. |
2585 definitely_matches = true; | 2585 definitely_matches = true; |
2586 } else { | 2586 } else { |
2587 *definitely_mismatches = true; | 2587 *definitely_mismatches = true; |
2588 // Set up x2 for the argument adaptor. | 2588 // Set up x2 for the argument adaptor. |
2589 Mov(x2, expected.immediate()); | 2589 Mov(x2, expected.immediate()); |
2590 } | 2590 } |
2591 } | 2591 } |
2592 | 2592 |
2593 } else { // expected is a register. | 2593 } else { // expected is a register. |
2594 Operand actual_op = actual.is_immediate() ? Operand(actual.immediate()) | 2594 Operand actual_op = actual.is_immediate() ? Operand(actual.immediate()) |
2595 : Operand(actual.reg()); | 2595 : Operand(actual.reg()); |
| 2596 Mov(x0, actual_op); |
2596 // If actual == expected perform a regular invocation. | 2597 // If actual == expected perform a regular invocation. |
2597 Cmp(expected.reg(), actual_op); | 2598 Cmp(expected.reg(), actual_op); |
2598 B(eq, ®ular_invoke); | 2599 B(eq, ®ular_invoke); |
2599 // Otherwise set up x0 for the argument adaptor. | |
2600 Mov(x0, actual_op); | |
2601 } | 2600 } |
2602 | 2601 |
2603 // If the argument counts may mismatch, generate a call to the argument | 2602 // If the argument counts may mismatch, generate a call to the argument |
2604 // adaptor. | 2603 // adaptor. |
2605 if (!definitely_matches) { | 2604 if (!definitely_matches) { |
2606 if (!code_constant.is_null()) { | 2605 if (!code_constant.is_null()) { |
2607 Mov(x3, Operand(code_constant)); | 2606 Mov(x3, Operand(code_constant)); |
2608 Add(x3, x3, Code::kHeaderSize - kHeapObjectTag); | 2607 Add(x3, x3, Code::kHeaderSize - kHeapObjectTag); |
2609 } | 2608 } |
2610 | 2609 |
(...skipping 2510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5121 } | 5120 } |
5122 | 5121 |
5123 | 5122 |
5124 #undef __ | 5123 #undef __ |
5125 | 5124 |
5126 | 5125 |
5127 } // namespace internal | 5126 } // namespace internal |
5128 } // namespace v8 | 5127 } // namespace v8 |
5129 | 5128 |
5130 #endif // V8_TARGET_ARCH_ARM64 | 5129 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |