Chromium Code Reviews| OLD | NEW |
|---|---|
| 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" // Needed here to get TARGET_ARCH_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
| 6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 __ str(R3, Address(R2, 0), CC); | 120 __ str(R3, Address(R2, 0), CC); |
| 121 __ AddImmediate(R2, kWordSize, CC); | 121 __ AddImmediate(R2, kWordSize, CC); |
| 122 __ b(&init_loop, CC); | 122 __ b(&init_loop, CC); |
| 123 | 123 |
| 124 __ Ret(); // Returns the newly allocated object in R0. | 124 __ Ret(); // Returns the newly allocated object in R0. |
| 125 __ Bind(&fall_through); | 125 __ Bind(&fall_through); |
| 126 return false; | 126 return false; |
| 127 } | 127 } |
| 128 | 128 |
| 129 | 129 |
| 130 bool Intrinsifier::Array_getLength(Assembler* assembler) { | |
| 131 __ ldr(R0, Address(SP, 0 * kWordSize)); | |
| 132 __ ldr(R0, FieldAddress(R0, Array::length_offset())); | |
| 133 __ Ret(); | |
| 134 return true; | |
|
srdjan
2013/08/12 21:49:47
I would not remove the intrinsics. They make start
Florian Schneider
2013/08/14 12:30:24
The problem is that we prohibit inlining of intrin
| |
| 135 } | |
| 136 | |
| 137 | |
| 138 bool Intrinsifier::ImmutableArray_getLength(Assembler* assembler) { | |
| 139 return Array_getLength(assembler); | |
| 140 } | |
| 141 | |
| 142 | |
| 143 bool Intrinsifier::Array_getIndexed(Assembler* assembler) { | 130 bool Intrinsifier::Array_getIndexed(Assembler* assembler) { |
| 144 Label fall_through; | 131 Label fall_through; |
| 145 | 132 |
| 146 __ ldr(R0, Address(SP, + 0 * kWordSize)); // Index | 133 __ ldr(R0, Address(SP, + 0 * kWordSize)); // Index |
| 147 __ ldr(R1, Address(SP, + 1 * kWordSize)); // Array | 134 __ ldr(R1, Address(SP, + 1 * kWordSize)); // Array |
| 148 | 135 |
| 149 __ tst(R0, ShifterOperand(kSmiTagMask)); | 136 __ tst(R0, ShifterOperand(kSmiTagMask)); |
| 150 __ b(&fall_through, NE); // Index is not an smi, fall through | 137 __ b(&fall_through, NE); // Index is not an smi, fall through |
| 151 | 138 |
| 152 // range check | 139 // range check |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 311 // Set the length field in the growable array object to 0. | 298 // Set the length field in the growable array object to 0. |
| 312 __ LoadImmediate(R1, 0); | 299 __ LoadImmediate(R1, 0); |
| 313 __ str(R1, FieldAddress(R0, GrowableObjectArray::length_offset())); | 300 __ str(R1, FieldAddress(R0, GrowableObjectArray::length_offset())); |
| 314 __ Ret(); // Returns the newly allocated object in R0. | 301 __ Ret(); // Returns the newly allocated object in R0. |
| 315 | 302 |
| 316 __ Bind(&fall_through); | 303 __ Bind(&fall_through); |
| 317 return false; | 304 return false; |
| 318 } | 305 } |
| 319 | 306 |
| 320 | 307 |
| 321 bool Intrinsifier::GrowableArray_getLength(Assembler* assembler) { | |
| 322 __ ldr(R0, Address(SP, 0 * kWordSize)); | |
| 323 __ ldr(R0, FieldAddress(R0, GrowableObjectArray::length_offset())); | |
| 324 __ Ret(); | |
| 325 return true; | |
| 326 } | |
| 327 | |
| 328 | |
| 329 bool Intrinsifier::GrowableArray_getCapacity(Assembler* assembler) { | 308 bool Intrinsifier::GrowableArray_getCapacity(Assembler* assembler) { |
| 330 __ ldr(R0, Address(SP, 0 * kWordSize)); | 309 __ ldr(R0, Address(SP, 0 * kWordSize)); |
| 331 __ ldr(R0, FieldAddress(R0, GrowableObjectArray::data_offset())); | 310 __ ldr(R0, FieldAddress(R0, GrowableObjectArray::data_offset())); |
| 332 __ ldr(R0, FieldAddress(R0, Array::length_offset())); | 311 __ ldr(R0, FieldAddress(R0, Array::length_offset())); |
| 333 __ Ret(); | 312 __ Ret(); |
| 334 return true; | 313 return true; |
| 335 } | 314 } |
| 336 | 315 |
| 337 | 316 |
| 338 bool Intrinsifier::GrowableArray_getIndexed(Assembler* assembler) { | 317 bool Intrinsifier::GrowableArray_getIndexed(Assembler* assembler) { |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 539 __ Bind(&init_loop); \ | 518 __ Bind(&init_loop); \ |
| 540 __ cmp(R2, ShifterOperand(R1)); \ | 519 __ cmp(R2, ShifterOperand(R1)); \ |
| 541 __ str(R3, Address(R2, 0), CC); \ | 520 __ str(R3, Address(R2, 0), CC); \ |
| 542 __ add(R2, R2, ShifterOperand(kWordSize), CC); \ | 521 __ add(R2, R2, ShifterOperand(kWordSize), CC); \ |
| 543 __ b(&init_loop, CC); \ | 522 __ b(&init_loop, CC); \ |
| 544 \ | 523 \ |
| 545 __ Ret(); \ | 524 __ Ret(); \ |
| 546 __ Bind(&fall_through); \ | 525 __ Bind(&fall_through); \ |
| 547 | 526 |
| 548 | 527 |
| 549 // Gets the length of a TypedData. | |
| 550 bool Intrinsifier::TypedData_getLength(Assembler* assembler) { | |
| 551 __ ldr(R0, Address(SP, 0 * kWordSize)); | |
| 552 __ ldr(R0, FieldAddress(R0, TypedData::length_offset())); | |
| 553 __ Ret(); | |
| 554 return true; | |
| 555 } | |
| 556 | |
| 557 | |
| 558 static int GetScaleFactor(intptr_t size) { | 528 static int GetScaleFactor(intptr_t size) { |
| 559 switch (size) { | 529 switch (size) { |
| 560 case 1: return 0; | 530 case 1: return 0; |
| 561 case 2: return 1; | 531 case 2: return 1; |
| 562 case 4: return 2; | 532 case 4: return 2; |
| 563 case 8: return 3; | 533 case 8: return 3; |
| 564 case 16: return 4; | 534 case 16: return 4; |
| 565 } | 535 } |
| 566 UNREACHABLE(); | 536 UNREACHABLE(); |
| 567 return -1; | 537 return -1; |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1421 | 1391 |
| 1422 bool Intrinsifier::String_getHashCode(Assembler* assembler) { | 1392 bool Intrinsifier::String_getHashCode(Assembler* assembler) { |
| 1423 __ ldr(R0, Address(SP, 0 * kWordSize)); | 1393 __ ldr(R0, Address(SP, 0 * kWordSize)); |
| 1424 __ ldr(R0, FieldAddress(R0, String::hash_offset())); | 1394 __ ldr(R0, FieldAddress(R0, String::hash_offset())); |
| 1425 __ cmp(R0, ShifterOperand(0)); | 1395 __ cmp(R0, ShifterOperand(0)); |
| 1426 __ bx(LR, NE); // Hash not yet computed. | 1396 __ bx(LR, NE); // Hash not yet computed. |
| 1427 return false; | 1397 return false; |
| 1428 } | 1398 } |
| 1429 | 1399 |
| 1430 | 1400 |
| 1431 bool Intrinsifier::String_getLength(Assembler* assembler) { | |
| 1432 __ ldr(R0, Address(SP, 0 * kWordSize)); | |
| 1433 __ ldr(R0, FieldAddress(R0, String::length_offset())); | |
| 1434 __ Ret(); | |
| 1435 return true; | |
| 1436 } | |
| 1437 | |
| 1438 | |
| 1439 bool Intrinsifier::String_codeUnitAt(Assembler* assembler) { | 1401 bool Intrinsifier::String_codeUnitAt(Assembler* assembler) { |
| 1440 Label fall_through, try_two_byte_string; | 1402 Label fall_through, try_two_byte_string; |
| 1441 | 1403 |
| 1442 __ ldr(R1, Address(SP, 0 * kWordSize)); // Index. | 1404 __ ldr(R1, Address(SP, 0 * kWordSize)); // Index. |
| 1443 __ ldr(R0, Address(SP, 1 * kWordSize)); // String. | 1405 __ ldr(R0, Address(SP, 1 * kWordSize)); // String. |
| 1444 __ tst(R1, ShifterOperand(kSmiTagMask)); | 1406 __ tst(R1, ShifterOperand(kSmiTagMask)); |
| 1445 __ b(&fall_through, NE); // Index is not a Smi. | 1407 __ b(&fall_through, NE); // Index is not a Smi. |
| 1446 // Range check. | 1408 // Range check. |
| 1447 __ ldr(R2, FieldAddress(R0, String::length_offset())); | 1409 __ ldr(R2, FieldAddress(R0, String::length_offset())); |
| 1448 __ cmp(R1, ShifterOperand(R2)); | 1410 __ cmp(R1, ShifterOperand(R2)); |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1693 __ Bind(&ok); | 1655 __ Bind(&ok); |
| 1694 __ Ret(); | 1656 __ Ret(); |
| 1695 | 1657 |
| 1696 __ Bind(&fall_through); | 1658 __ Bind(&fall_through); |
| 1697 return false; | 1659 return false; |
| 1698 } | 1660 } |
| 1699 | 1661 |
| 1700 } // namespace dart | 1662 } // namespace dart |
| 1701 | 1663 |
| 1702 #endif // defined TARGET_ARCH_ARM | 1664 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |