| 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_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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 | 359 |
| 360 | 360 |
| 361 // Gets the length of a TypedData. | 361 // Gets the length of a TypedData. |
| 362 void Intrinsifier::TypedDataLength(Assembler* assembler) { | 362 void Intrinsifier::TypedDataLength(Assembler* assembler) { |
| 363 __ movq(RAX, Address(RSP, + 1 * kWordSize)); | 363 __ movq(RAX, Address(RSP, + 1 * kWordSize)); |
| 364 __ movq(RAX, FieldAddress(RAX, TypedData::length_offset())); | 364 __ movq(RAX, FieldAddress(RAX, TypedData::length_offset())); |
| 365 __ ret(); | 365 __ ret(); |
| 366 } | 366 } |
| 367 | 367 |
| 368 | 368 |
| 369 void Intrinsifier::Uint8ArrayGetIndexed(Assembler* assembler) { | |
| 370 Label fall_through; | |
| 371 __ movq(RCX, Address(RSP, + 1 * kWordSize)); // Index. | |
| 372 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Array. | |
| 373 __ testq(RCX, Immediate(kSmiTagMask)); | |
| 374 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index. | |
| 375 // Range check. | |
| 376 __ cmpq(RCX, FieldAddress(RAX, TypedData::length_offset())); | |
| 377 // Runtime throws exception. | |
| 378 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump); | |
| 379 | |
| 380 __ SmiUntag(RCX); | |
| 381 __ movzxb(RAX, FieldAddress(RAX, RCX, TIMES_1, TypedData::data_offset())); | |
| 382 __ SmiTag(RAX); | |
| 383 __ ret(); | |
| 384 __ Bind(&fall_through); | |
| 385 } | |
| 386 | |
| 387 | |
| 388 void Intrinsifier::ExternalUint8ArrayGetIndexed(Assembler* assembler) { | |
| 389 Label fall_through; | |
| 390 __ movq(RCX, Address(RSP, + 1 * kWordSize)); // Index. | |
| 391 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Array. | |
| 392 __ testq(RCX, Immediate(kSmiTagMask)); | |
| 393 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index. | |
| 394 // Range check. | |
| 395 __ cmpq(RCX, FieldAddress(RAX, TypedData::length_offset())); | |
| 396 // Runtime throws exception. | |
| 397 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump); | |
| 398 | |
| 399 __ movq(RAX, FieldAddress(RAX, ExternalTypedData::data_offset())); | |
| 400 __ SmiUntag(RCX); | |
| 401 __ movzxb(RAX, Address(RAX, RCX, TIMES_1, 0)); | |
| 402 __ SmiTag(RAX); | |
| 403 __ ret(); | |
| 404 __ Bind(&fall_through); | |
| 405 } | |
| 406 | |
| 407 | |
| 408 void Intrinsifier::Float64ArrayGetIndexed(Assembler* assembler) { | 369 void Intrinsifier::Float64ArrayGetIndexed(Assembler* assembler) { |
| 409 Label fall_through; | 370 Label fall_through; |
| 410 __ movq(RCX, Address(RSP, + 1 * kWordSize)); // Index. | 371 __ movq(RCX, Address(RSP, + 1 * kWordSize)); // Index. |
| 411 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Array. | 372 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Array. |
| 412 __ testq(RCX, Immediate(kSmiTagMask)); | 373 __ testq(RCX, Immediate(kSmiTagMask)); |
| 413 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index. | 374 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index. |
| 414 // Range check. | 375 // Range check. |
| 415 __ cmpq(RCX, FieldAddress(RAX, TypedData::length_offset())); | 376 __ cmpq(RCX, FieldAddress(RAX, TypedData::length_offset())); |
| 416 // Runtime throws exception. | 377 // Runtime throws exception. |
| 417 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump); | 378 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump); |
| (...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1694 // Set return value to Isolate::current_tag_. | 1655 // Set return value to Isolate::current_tag_. |
| 1695 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); | 1656 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); |
| 1696 __ ret(); | 1657 __ ret(); |
| 1697 } | 1658 } |
| 1698 | 1659 |
| 1699 #undef __ | 1660 #undef __ |
| 1700 | 1661 |
| 1701 } // namespace dart | 1662 } // namespace dart |
| 1702 | 1663 |
| 1703 #endif // defined TARGET_ARCH_X64 | 1664 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |