| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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" // Needed here to get TARGET_ARCH_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 7 | 7 |
| 8 #include "vm/intrinsifier.h" | 8 #include "vm/intrinsifier.h" |
| 9 | 9 |
| 10 #include "vm/assembler.h" | 10 #include "vm/assembler.h" |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 return false; | 338 return false; |
| 339 } | 339 } |
| 340 | 340 |
| 341 | 341 |
| 342 // Set length of growable object array. | 342 // Set length of growable object array. |
| 343 // On stack: growable array (+2), length (+1), return-address (+0). | 343 // On stack: growable array (+2), length (+1), return-address (+0). |
| 344 bool Intrinsifier::GrowableArray_setLength(Assembler* assembler) { | 344 bool Intrinsifier::GrowableArray_setLength(Assembler* assembler) { |
| 345 Label fall_through; | 345 Label fall_through; |
| 346 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Growable array. | 346 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Growable array. |
| 347 __ movq(RCX, Address(RSP, + 1 * kWordSize)); // Length value. | 347 __ movq(RCX, Address(RSP, + 1 * kWordSize)); // Length value. |
| 348 __ testq(RCX, Immediate(kSmiTagMask)); |
| 349 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi length. |
| 348 __ movq(RDX, FieldAddress(RAX, GrowableObjectArray::data_offset())); | 350 __ movq(RDX, FieldAddress(RAX, GrowableObjectArray::data_offset())); |
| 349 __ cmpq(RCX, FieldAddress(RDX, Array::length_offset())); | 351 __ cmpq(RCX, FieldAddress(RDX, Array::length_offset())); |
| 350 __ j(ABOVE, &fall_through, Assembler::kNearJump); | 352 __ j(ABOVE, &fall_through, Assembler::kNearJump); |
| 351 __ movq(FieldAddress(RAX, GrowableObjectArray::length_offset()), RCX); | 353 __ movq(FieldAddress(RAX, GrowableObjectArray::length_offset()), RCX); |
| 352 __ ret(); | 354 __ ret(); |
| 353 __ Bind(&fall_through); | 355 __ Bind(&fall_through); |
| 354 return false; | 356 return false; |
| 355 } | 357 } |
| 356 | 358 |
| 357 | 359 |
| 358 // Set data of growable object array. | 360 // Set data of growable object array. |
| 359 // On stack: growable array (+2), data (+1), return-address (+0). | 361 // On stack: growable array (+2), data (+1), return-address (+0). |
| 360 bool Intrinsifier::GrowableArray_setData(Assembler* assembler) { | 362 bool Intrinsifier::GrowableArray_setData(Assembler* assembler) { |
| 361 if (FLAG_enable_type_checks) { | 363 if (FLAG_enable_type_checks) { |
| 362 return false; | 364 return false; |
| 363 } | 365 } |
| 364 __ movq(RAX, Address(RSP, + 2 * kWordSize)); | 366 Label fall_through; |
| 365 __ movq(RBX, Address(RSP, + 1 * kWordSize)); | 367 __ movq(RBX, Address(RSP, + 1 * kWordSize)); /// Data. |
| 368 __ testq(RBX, Immediate(kSmiTagMask)); |
| 369 __ j(ZERO, &fall_through, Assembler::kNearJump); // Data is Smi. |
| 370 __ CompareClassId(RBX, kArrayCid); |
| 371 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump); |
| 372 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Growable array. |
| 366 __ StoreIntoObject(RAX, | 373 __ StoreIntoObject(RAX, |
| 367 FieldAddress(RAX, GrowableObjectArray::data_offset()), | 374 FieldAddress(RAX, GrowableObjectArray::data_offset()), |
| 368 RBX); | 375 RBX); |
| 369 __ ret(); | 376 __ ret(); |
| 370 return true; | 377 __ Bind(&fall_through); |
| 378 return false; |
| 371 } | 379 } |
| 372 | 380 |
| 373 | 381 |
| 374 // Add an element to growable array if it doesn't need to grow, otherwise | 382 // Add an element to growable array if it doesn't need to grow, otherwise |
| 375 // call into regular code. | 383 // call into regular code. |
| 376 // On stack: growable array (+2), value (+1), return-address (+0). | 384 // On stack: growable array (+2), value (+1), return-address (+0). |
| 377 bool Intrinsifier::GrowableArray_add(Assembler* assembler) { | 385 bool Intrinsifier::GrowableArray_add(Assembler* assembler) { |
| 378 // In checked mode we need to check the incoming argument. | 386 // In checked mode we need to check the incoming argument. |
| 379 if (FLAG_enable_type_checks) return false; | 387 if (FLAG_enable_type_checks) return false; |
| 380 Label fall_through; | 388 Label fall_through; |
| (...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1504 __ LoadObject(RAX, bool_true); | 1512 __ LoadObject(RAX, bool_true); |
| 1505 __ ret(); | 1513 __ ret(); |
| 1506 return true; | 1514 return true; |
| 1507 } | 1515 } |
| 1508 | 1516 |
| 1509 #undef __ | 1517 #undef __ |
| 1510 | 1518 |
| 1511 } // namespace dart | 1519 } // namespace dart |
| 1512 | 1520 |
| 1513 #endif // defined TARGET_ARCH_X64 | 1521 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |