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

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

Issue 392343002: Cleanup of class id loading sequences. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/stub_code_ia32.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 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 __ j(EQUAL, &ok, Assembler::kNearJump); 1264 __ j(EQUAL, &ok, Assembler::kNearJump);
1265 __ Stop("Incorrect stub for IC data"); 1265 __ Stop("Incorrect stub for IC data");
1266 __ Bind(&ok); 1266 __ Bind(&ok);
1267 } 1267 }
1268 #endif // DEBUG 1268 #endif // DEBUG
1269 1269
1270 Label stepping, done_stepping; 1270 Label stepping, done_stepping;
1271 if (FLAG_enable_debugger) { 1271 if (FLAG_enable_debugger) {
1272 // Check single stepping. 1272 // Check single stepping.
1273 __ movq(RAX, FieldAddress(CTX, Context::isolate_offset())); 1273 __ movq(RAX, FieldAddress(CTX, Context::isolate_offset()));
1274 __ movzxb(RAX, Address(RAX, Isolate::single_step_offset())); 1274 __ cmpb(Address(RAX, Isolate::single_step_offset()), Immediate(0));
1275 __ cmpq(RAX, Immediate(0));
1276 __ j(NOT_EQUAL, &stepping); 1275 __ j(NOT_EQUAL, &stepping);
1277 __ Bind(&done_stepping); 1276 __ Bind(&done_stepping);
1278 } 1277 }
1279 1278
1280 // Load arguments descriptor into R10. 1279 // Load arguments descriptor into R10.
1281 __ movq(R10, FieldAddress(RBX, ICData::arguments_descriptor_offset())); 1280 __ movq(R10, FieldAddress(RBX, ICData::arguments_descriptor_offset()));
1282 // Loop that checks if there is an IC data match. 1281 // Loop that checks if there is an IC data match.
1283 Label loop, update, test, found; 1282 Label loop, update, test, found;
1284 // RBX: IC data object (preserved). 1283 // RBX: IC data object (preserved).
1285 __ movq(R12, FieldAddress(RBX, ICData::ic_data_offset())); 1284 __ movq(R12, FieldAddress(RBX, ICData::ic_data_offset()));
1286 // R12: ic_data_array with check entries: classes and target functions. 1285 // R12: ic_data_array with check entries: classes and target functions.
1287 __ leaq(R12, FieldAddress(R12, Array::data_offset())); 1286 __ leaq(R12, FieldAddress(R12, Array::data_offset()));
1288 // R12: points directly to the first ic data array element. 1287 // R12: points directly to the first ic data array element.
1289 1288
1290 // Get the receiver's class ID (first read number of arguments from 1289 // Get the receiver's class ID (first read number of arguments from
1291 // arguments descriptor array and then access the receiver from the stack). 1290 // arguments descriptor array and then access the receiver from the stack).
1292 __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset())); 1291 __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset()));
1293 __ movq(RAX, Address(RSP, RAX, TIMES_4, 0)); // RAX (argument count) is Smi. 1292 __ movq(R13, Address(RSP, RAX, TIMES_4, 0)); // RAX (argument count) is Smi.
1294 __ LoadTaggedClassIdMayBeSmi(RAX, RAX); 1293 __ LoadTaggedClassIdMayBeSmi(RAX, R13);
1295 // RAX: receiver's class ID as smi. 1294 // RAX: receiver's class ID as smi.
1296 __ movq(R13, Address(R12, 0)); // First class ID (Smi) to check. 1295 __ movq(R13, Address(R12, 0)); // First class ID (Smi) to check.
1297 __ jmp(&test); 1296 __ jmp(&test);
1298 1297
1299 __ Bind(&loop); 1298 __ Bind(&loop);
1300 for (int i = 0; i < num_args; i++) { 1299 for (int i = 0; i < num_args; i++) {
1301 if (i > 0) { 1300 if (i > 0) {
1302 // If not the first, load the next argument's class ID. 1301 // If not the first, load the next argument's class ID.
1303 __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset())); 1302 __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset()));
1304 __ movq(RAX, Address(RSP, RAX, TIMES_4, - i * kWordSize)); 1303 __ movq(R13, Address(RSP, RAX, TIMES_4, - i * kWordSize));
1305 __ LoadTaggedClassIdMayBeSmi(RAX, RAX); 1304 __ LoadTaggedClassIdMayBeSmi(RAX, R13);
1306 // RAX: next argument class ID (smi). 1305 // RAX: next argument class ID (smi).
1307 __ movq(R13, Address(R12, i * kWordSize)); 1306 __ movq(R13, Address(R12, i * kWordSize));
1308 // R13: next class ID to check (smi). 1307 // R13: next class ID to check (smi).
1309 } 1308 }
1310 __ cmpq(RAX, R13); // Class id match? 1309 __ cmpq(RAX, R13); // Class id match?
1311 if (i < (num_args - 1)) { 1310 if (i < (num_args - 1)) {
1312 __ j(NOT_EQUAL, &update); // Continue. 1311 __ j(NOT_EQUAL, &update); // Continue.
1313 } else { 1312 } else {
1314 // Last check, all checks before matched. 1313 // Last check, all checks before matched.
1315 __ j(EQUAL, &found); // Break. 1314 __ j(EQUAL, &found); // Break.
1316 } 1315 }
1317 } 1316 }
1318 __ Bind(&update); 1317 __ Bind(&update);
1319 // Reload receiver class ID. It has not been destroyed when num_args == 1. 1318 // Reload receiver class ID. It has not been destroyed when num_args == 1.
1320 if (num_args > 1) { 1319 if (num_args > 1) {
1321 __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset())); 1320 __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset()));
1322 __ movq(RAX, Address(RSP, RAX, TIMES_4, 0)); 1321 __ movq(R13, Address(RSP, RAX, TIMES_4, 0));
1323 __ LoadTaggedClassIdMayBeSmi(RAX, RAX); 1322 __ LoadTaggedClassIdMayBeSmi(RAX, R13);
1324 } 1323 }
1325 1324
1326 const intptr_t entry_size = ICData::TestEntryLengthFor(num_args) * kWordSize; 1325 const intptr_t entry_size = ICData::TestEntryLengthFor(num_args) * kWordSize;
1327 __ addq(R12, Immediate(entry_size)); // Next entry. 1326 __ addq(R12, Immediate(entry_size)); // Next entry.
1328 __ movq(R13, Address(R12, 0)); // Next class ID. 1327 __ movq(R13, Address(R12, 0)); // Next class ID.
1329 1328
1330 __ Bind(&test); 1329 __ Bind(&test);
1331 __ cmpq(R13, Immediate(Smi::RawValue(kIllegalCid))); // Done? 1330 __ cmpq(R13, Immediate(Smi::RawValue(kIllegalCid))); // Done?
1332 __ j(NOT_EQUAL, &loop, Assembler::kNearJump); 1331 __ j(NOT_EQUAL, &loop, Assembler::kNearJump);
1333 1332
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
1911 1910
1912 __ movq(left, Address(RSP, 2 * kWordSize)); 1911 __ movq(left, Address(RSP, 2 * kWordSize));
1913 __ movq(right, Address(RSP, 1 * kWordSize)); 1912 __ movq(right, Address(RSP, 1 * kWordSize));
1914 GenerateIdenticalWithNumberCheckStub(assembler, left, right); 1913 GenerateIdenticalWithNumberCheckStub(assembler, left, right);
1915 __ ret(); 1914 __ ret();
1916 } 1915 }
1917 1916
1918 } // namespace dart 1917 } // namespace dart
1919 1918
1920 #endif // defined TARGET_ARCH_X64 1919 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698