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

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_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 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 // __ movzxb(RAX, Address(RAX, Isolate::single_step_offset()));
1275 __ cmpq(RAX, Immediate(0)); 1275 // __ cmpq(RAX, Immediate(0));
srdjan 2014/07/16 21:59:01 Remove dead code.
zra 2014/07/16 22:53:45 Done.
1276 __ cmpb(Address(RAX, Isolate::single_step_offset()), Immediate(0));
1276 __ j(NOT_EQUAL, &stepping); 1277 __ j(NOT_EQUAL, &stepping);
1277 __ Bind(&done_stepping); 1278 __ Bind(&done_stepping);
1278 } 1279 }
1279 1280
1280 // Load arguments descriptor into R10. 1281 // Load arguments descriptor into R10.
1281 __ movq(R10, FieldAddress(RBX, ICData::arguments_descriptor_offset())); 1282 __ movq(R10, FieldAddress(RBX, ICData::arguments_descriptor_offset()));
1282 // Loop that checks if there is an IC data match. 1283 // Loop that checks if there is an IC data match.
1283 Label loop, update, test, found; 1284 Label loop, update, test, found;
1284 // RBX: IC data object (preserved). 1285 // RBX: IC data object (preserved).
1285 __ movq(R12, FieldAddress(RBX, ICData::ic_data_offset())); 1286 __ movq(R12, FieldAddress(RBX, ICData::ic_data_offset()));
1286 // R12: ic_data_array with check entries: classes and target functions. 1287 // R12: ic_data_array with check entries: classes and target functions.
1287 __ leaq(R12, FieldAddress(R12, Array::data_offset())); 1288 __ leaq(R12, FieldAddress(R12, Array::data_offset()));
1288 // R12: points directly to the first ic data array element. 1289 // R12: points directly to the first ic data array element.
1289 1290
1290 // Get the receiver's class ID (first read number of arguments from 1291 // Get the receiver's class ID (first read number of arguments from
1291 // arguments descriptor array and then access the receiver from the stack). 1292 // arguments descriptor array and then access the receiver from the stack).
1292 __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset())); 1293 __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset()));
1293 __ movq(RAX, Address(RSP, RAX, TIMES_4, 0)); // RAX (argument count) is Smi. 1294 __ movq(R13, Address(RSP, RAX, TIMES_4, 0)); // RAX (argument count) is Smi.
1294 __ LoadTaggedClassIdMayBeSmi(RAX, RAX); 1295 __ LoadTaggedClassIdMayBeSmi(RAX, R13);
1295 // RAX: receiver's class ID as smi. 1296 // RAX: receiver's class ID as smi.
1296 __ movq(R13, Address(R12, 0)); // First class ID (Smi) to check. 1297 __ movq(R13, Address(R12, 0)); // First class ID (Smi) to check.
1297 __ jmp(&test); 1298 __ jmp(&test);
1298 1299
1299 __ Bind(&loop); 1300 __ Bind(&loop);
1300 for (int i = 0; i < num_args; i++) { 1301 for (int i = 0; i < num_args; i++) {
1301 if (i > 0) { 1302 if (i > 0) {
1302 // If not the first, load the next argument's class ID. 1303 // If not the first, load the next argument's class ID.
1303 __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset())); 1304 __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset()));
1304 __ movq(RAX, Address(RSP, RAX, TIMES_4, - i * kWordSize)); 1305 __ movq(R13, Address(RSP, RAX, TIMES_4, - i * kWordSize));
1305 __ LoadTaggedClassIdMayBeSmi(RAX, RAX); 1306 __ LoadTaggedClassIdMayBeSmi(RAX, R13);
1306 // RAX: next argument class ID (smi). 1307 // RAX: next argument class ID (smi).
1307 __ movq(R13, Address(R12, i * kWordSize)); 1308 __ movq(R13, Address(R12, i * kWordSize));
1308 // R13: next class ID to check (smi). 1309 // R13: next class ID to check (smi).
1309 } 1310 }
1310 __ cmpq(RAX, R13); // Class id match? 1311 __ cmpq(RAX, R13); // Class id match?
1311 if (i < (num_args - 1)) { 1312 if (i < (num_args - 1)) {
1312 __ j(NOT_EQUAL, &update); // Continue. 1313 __ j(NOT_EQUAL, &update); // Continue.
1313 } else { 1314 } else {
1314 // Last check, all checks before matched. 1315 // Last check, all checks before matched.
1315 __ j(EQUAL, &found); // Break. 1316 __ j(EQUAL, &found); // Break.
1316 } 1317 }
1317 } 1318 }
1318 __ Bind(&update); 1319 __ Bind(&update);
1319 // Reload receiver class ID. It has not been destroyed when num_args == 1. 1320 // Reload receiver class ID. It has not been destroyed when num_args == 1.
1320 if (num_args > 1) { 1321 if (num_args > 1) {
1321 __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset())); 1322 __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset()));
1322 __ movq(RAX, Address(RSP, RAX, TIMES_4, 0)); 1323 __ movq(R13, Address(RSP, RAX, TIMES_4, 0));
1323 __ LoadTaggedClassIdMayBeSmi(RAX, RAX); 1324 __ LoadTaggedClassIdMayBeSmi(RAX, R13);
1324 } 1325 }
1325 1326
1326 const intptr_t entry_size = ICData::TestEntryLengthFor(num_args) * kWordSize; 1327 const intptr_t entry_size = ICData::TestEntryLengthFor(num_args) * kWordSize;
1327 __ addq(R12, Immediate(entry_size)); // Next entry. 1328 __ addq(R12, Immediate(entry_size)); // Next entry.
1328 __ movq(R13, Address(R12, 0)); // Next class ID. 1329 __ movq(R13, Address(R12, 0)); // Next class ID.
1329 1330
1330 __ Bind(&test); 1331 __ Bind(&test);
1331 __ cmpq(R13, Immediate(Smi::RawValue(kIllegalCid))); // Done? 1332 __ cmpq(R13, Immediate(Smi::RawValue(kIllegalCid))); // Done?
1332 __ j(NOT_EQUAL, &loop, Assembler::kNearJump); 1333 __ j(NOT_EQUAL, &loop, Assembler::kNearJump);
1333 1334
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1901 1902
1902 __ movq(left, Address(RSP, 2 * kWordSize)); 1903 __ movq(left, Address(RSP, 2 * kWordSize));
1903 __ movq(right, Address(RSP, 1 * kWordSize)); 1904 __ movq(right, Address(RSP, 1 * kWordSize));
1904 GenerateIdenticalWithNumberCheckStub(assembler, left, right); 1905 GenerateIdenticalWithNumberCheckStub(assembler, left, right);
1905 __ ret(); 1906 __ ret();
1906 } 1907 }
1907 1908
1908 } // namespace dart 1909 } // namespace dart
1909 1910
1910 #endif // defined TARGET_ARCH_X64 1911 #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