| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 2090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2101 Assembler* assembler) { | 2101 Assembler* assembler) { |
| 2102 const Register temp = R2; | 2102 const Register temp = R2; |
| 2103 const Register left = R1; | 2103 const Register left = R1; |
| 2104 const Register right = R0; | 2104 const Register right = R0; |
| 2105 __ LoadFromOffset(left, SP, 1 * kWordSize, kNoPP); | 2105 __ LoadFromOffset(left, SP, 1 * kWordSize, kNoPP); |
| 2106 __ LoadFromOffset(right, SP, 0 * kWordSize, kNoPP); | 2106 __ LoadFromOffset(right, SP, 0 * kWordSize, kNoPP); |
| 2107 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 2107 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
| 2108 __ ret(); | 2108 __ ret(); |
| 2109 } | 2109 } |
| 2110 | 2110 |
| 2111 |
| 2112 // Called from megamorphic calls. |
| 2113 // R0: receiver. |
| 2114 // R1: lookup cache. |
| 2115 // Result: |
| 2116 // R1: entry point. |
| 2117 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { |
| 2118 __ LoadTaggedClassIdMayBeSmi(R0, R0); |
| 2119 // R0: class ID of the receiver (smi). |
| 2120 __ LoadFieldFromOffset(R2, R1, MegamorphicCache::buckets_offset(), PP); |
| 2121 __ LoadFieldFromOffset(R1, R1, MegamorphicCache::mask_offset(), PP); |
| 2122 // R2: cache buckets array. |
| 2123 // R1: mask. |
| 2124 __ mov(R3, R0); |
| 2125 |
| 2126 Label loop, update, call_target_function; |
| 2127 __ b(&loop); |
| 2128 |
| 2129 __ Bind(&update); |
| 2130 __ add(R3, R3, Operand(Smi::RawValue(1))); |
| 2131 __ Bind(&loop); |
| 2132 __ and_(R3, R3, Operand(R1)); |
| 2133 const intptr_t base = Array::data_offset(); |
| 2134 // R3 is smi tagged, but table entries are 16 bytes, so LSL 3. |
| 2135 __ add(TMP, R2, Operand(R3, LSL, 3)); |
| 2136 __ LoadFieldFromOffset(R4, TMP, base, PP); |
| 2137 |
| 2138 ASSERT(kIllegalCid == 0); |
| 2139 __ tst(R4, Operand(R4)); |
| 2140 __ b(&call_target_function, EQ); |
| 2141 __ CompareRegisters(R4, R0); |
| 2142 __ b(&update, NE); |
| 2143 |
| 2144 __ Bind(&call_target_function); |
| 2145 // Call the target found in the cache. For a class id match, this is a |
| 2146 // proper target for the given name and arguments descriptor. If the |
| 2147 // illegal class id was found, the target is a cache miss handler that can |
| 2148 // be invoked as a normal Dart function. |
| 2149 __ add(TMP, R2, Operand(R3, LSL, 3)); |
| 2150 __ LoadFieldFromOffset(R0, TMP, base + kWordSize, PP); |
| 2151 __ LoadFieldFromOffset(R1, R0, Function::instructions_offset(), PP); |
| 2152 // TODO(srdjan): Evaluate performance impact of moving the instruction below |
| 2153 // to the call site, instead of having it here. |
| 2154 __ AddImmediate(R1, R1, Instructions::HeaderSize() - kHeapObjectTag, PP); |
| 2155 __ ret(); |
| 2156 } |
| 2157 |
| 2111 } // namespace dart | 2158 } // namespace dart |
| 2112 | 2159 |
| 2113 #endif // defined TARGET_ARCH_ARM64 | 2160 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |