Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1008)

Side by Side Diff: runtime/vm/stub_code_x64.cc

Issue 1799793002: Precompilation: Have instances calls load the entry point and Code object from the ic data array in… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/stub_code_mips.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 2126 matching lines...) Expand 10 before | Expand all | Expand 10 after
2137 } 2137 }
2138 2138
2139 2139
2140 // Called from switchable IC calls. 2140 // Called from switchable IC calls.
2141 // RDI: receiver 2141 // RDI: receiver
2142 // RBX: ICData (preserved) 2142 // RBX: ICData (preserved)
2143 // Result: 2143 // Result:
2144 // RCX: target entry point 2144 // RCX: target entry point
2145 // CODE_REG: target Code object 2145 // CODE_REG: target Code object
2146 // R10: arguments descriptor 2146 // R10: arguments descriptor
2147 void StubCode::GenerateICLookupStub(Assembler* assembler) { 2147 void StubCode::GenerateICLookupThroughFunctionStub(Assembler* assembler) {
2148 Label loop, found, miss; 2148 Label loop, found, miss;
2149 2149
2150 __ movq(R13, FieldAddress(RBX, ICData::ic_data_offset())); 2150 __ movq(R13, FieldAddress(RBX, ICData::ic_data_offset()));
2151 __ movq(R10, FieldAddress(RBX, ICData::arguments_descriptor_offset())); 2151 __ movq(R10, FieldAddress(RBX, ICData::arguments_descriptor_offset()));
2152 __ leaq(R13, FieldAddress(R13, Array::data_offset())); 2152 __ leaq(R13, FieldAddress(R13, Array::data_offset()));
2153 // R13: first IC entry 2153 // R13: first IC entry
2154 __ LoadTaggedClassIdMayBeSmi(RAX, RDI); 2154 __ LoadTaggedClassIdMayBeSmi(RAX, RDI);
2155 // RAX: receiver cid as Smi 2155 // RAX: receiver cid as Smi
2156 2156
2157 __ Bind(&loop); 2157 __ Bind(&loop);
(...skipping 16 matching lines...) Expand all
2174 __ movq(CODE_REG, FieldAddress(RAX, Function::code_offset())); 2174 __ movq(CODE_REG, FieldAddress(RAX, Function::code_offset()));
2175 __ ret(); 2175 __ ret();
2176 2176
2177 __ Bind(&miss); 2177 __ Bind(&miss);
2178 __ LoadIsolate(RAX); 2178 __ LoadIsolate(RAX);
2179 __ movq(CODE_REG, Address(RAX, Isolate::ic_miss_code_offset())); 2179 __ movq(CODE_REG, Address(RAX, Isolate::ic_miss_code_offset()));
2180 __ movq(RCX, FieldAddress(CODE_REG, Code::entry_point_offset())); 2180 __ movq(RCX, FieldAddress(CODE_REG, Code::entry_point_offset()));
2181 __ ret(); 2181 __ ret();
2182 } 2182 }
2183 2183
2184
2185 void StubCode::GenerateICLookupThroughCodeStub(Assembler* assembler) {
2186 Label loop, found, miss;
2187
2188 __ movq(R13, FieldAddress(RBX, ICData::ic_data_offset()));
2189 __ movq(R10, FieldAddress(RBX, ICData::arguments_descriptor_offset()));
2190 __ leaq(R13, FieldAddress(R13, Array::data_offset()));
2191 // R13: first IC entry
2192 __ LoadTaggedClassIdMayBeSmi(RAX, RDI);
2193 // RAX: receiver cid as Smi
2194
2195 __ Bind(&loop);
2196 __ movq(R9, Address(R13, 0));
2197 __ cmpq(RAX, R9);
2198 __ j(EQUAL, &found, Assembler::kNearJump);
2199
2200 ASSERT(Smi::RawValue(kIllegalCid) == 0);
2201 __ testq(R9, R9);
2202 __ j(ZERO, &miss, Assembler::kNearJump);
2203
2204 const intptr_t entry_length = ICData::TestEntryLengthFor(1) * kWordSize;
2205 __ addq(R13, Immediate(entry_length)); // Next entry.
2206 __ jmp(&loop);
2207
2208 __ Bind(&found);
2209 const intptr_t code_offset = ICData::CodeIndexFor(1) * kWordSize;
2210 const intptr_t entry_offset = ICData::EntryPointIndexFor(1) * kWordSize;
2211 __ movq(RCX, Address(R13, entry_offset));
2212 __ movq(CODE_REG, Address(R13, code_offset));
2213 __ ret();
2214
2215 __ Bind(&miss);
2216 __ LoadIsolate(RAX);
2217 __ movq(CODE_REG, Address(RAX, Isolate::ic_miss_code_offset()));
2218 __ movq(RCX, FieldAddress(CODE_REG, Code::entry_point_offset()));
2219 __ ret();
2220 }
2221
2184 } // namespace dart 2222 } // namespace dart
2185 2223
2186 #endif // defined TARGET_ARCH_X64 2224 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698