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

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

Issue 13093005: Revert 12534006 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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/intrinsifier_ia32.cc ('k') | runtime/vm/object.h » ('j') | 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" // 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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 /* RDI: requested array length argument. */ \ 447 /* RDI: requested array length argument. */ \
448 __ testq(RDI, Immediate(kSmiTagSize)); \ 448 __ testq(RDI, Immediate(kSmiTagSize)); \
449 __ j(NOT_ZERO, &fall_through); \ 449 __ j(NOT_ZERO, &fall_through); \
450 __ cmpq(RDI, Immediate(0)); \ 450 __ cmpq(RDI, Immediate(0)); \
451 __ j(LESS, &fall_through); \ 451 __ j(LESS, &fall_through); \
452 __ SmiUntag(RDI); \ 452 __ SmiUntag(RDI); \
453 /* Check for maximum allowed length. */ \ 453 /* Check for maximum allowed length. */ \
454 /* RDI: untagged array length. */ \ 454 /* RDI: untagged array length. */ \
455 __ cmpq(RDI, Immediate(max_len)); \ 455 __ cmpq(RDI, Immediate(max_len)); \
456 __ j(GREATER, &fall_through); \ 456 __ j(GREATER, &fall_through); \
457 /* Special case for scaling by 16. */ \
458 if (scale_factor == TIMES_16) { \
459 /* double length of array. */ \
460 __ addq(RDI, RDI); \
461 /* only scale by 8. */ \
462 scale_factor = TIMES_8; \
463 } \
464 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \ 457 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \
465 __ leaq(RDI, Address(RDI, scale_factor, fixed_size)); \ 458 __ leaq(RDI, Address(RDI, scale_factor, fixed_size)); \
466 __ andq(RDI, Immediate(-kObjectAlignment)); \ 459 __ andq(RDI, Immediate(-kObjectAlignment)); \
467 Heap* heap = Isolate::Current()->heap(); \ 460 Heap* heap = Isolate::Current()->heap(); \
468 \ 461 \
469 __ movq(RAX, Immediate(heap->TopAddress())); \ 462 __ movq(RAX, Immediate(heap->TopAddress())); \
470 __ movq(RAX, Address(RAX, 0)); \ 463 __ movq(RAX, Address(RAX, 0)); \
471 __ movq(RCX, RAX); \ 464 __ movq(RCX, RAX); \
472 \ 465 \
473 /* RDI: allocation size. */ \ 466 /* RDI: allocation size. */ \
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 __ j(ABOVE_EQUAL, &done, Assembler::kNearJump); \ 523 __ j(ABOVE_EQUAL, &done, Assembler::kNearJump); \
531 __ movq(Address(RDI, 0), RBX); \ 524 __ movq(Address(RDI, 0), RBX); \
532 __ addq(RDI, Immediate(kWordSize)); \ 525 __ addq(RDI, Immediate(kWordSize)); \
533 __ jmp(&init_loop, Assembler::kNearJump); \ 526 __ jmp(&init_loop, Assembler::kNearJump); \
534 __ Bind(&done); \ 527 __ Bind(&done); \
535 \ 528 \
536 __ ret(); \ 529 __ ret(); \
537 __ Bind(&fall_through); \ 530 __ Bind(&fall_through); \
538 531
539 532
540 #define SCALARLIST_ALLOCATOR(clazz, scale_) \ 533 #define SCALARLIST_ALLOCATOR(clazz, scale) \
541 bool Intrinsifier::clazz##_new(Assembler* assembler) { \ 534 bool Intrinsifier::clazz##_new(Assembler* assembler) { \
542 ScaleFactor scale = scale_; \
543 TYPED_ARRAY_ALLOCATION(clazz, k##clazz##Cid, clazz::kMaxElements, scale); \ 535 TYPED_ARRAY_ALLOCATION(clazz, k##clazz##Cid, clazz::kMaxElements, scale); \
544 return false; \ 536 return false; \
545 } \ 537 } \
546 bool Intrinsifier::clazz##_factory(Assembler* assembler) { \ 538 bool Intrinsifier::clazz##_factory(Assembler* assembler) { \
547 ScaleFactor scale = scale_; \
548 TYPED_ARRAY_ALLOCATION(clazz, k##clazz##Cid, clazz::kMaxElements, scale); \ 539 TYPED_ARRAY_ALLOCATION(clazz, k##clazz##Cid, clazz::kMaxElements, scale); \
549 return false; \ 540 return false; \
550 } 541 }
551 542
552 543
553 SCALARLIST_ALLOCATOR(Int8Array, TIMES_1) 544 SCALARLIST_ALLOCATOR(Int8Array, TIMES_1)
554 SCALARLIST_ALLOCATOR(Uint8Array, TIMES_1) 545 SCALARLIST_ALLOCATOR(Uint8Array, TIMES_1)
555 SCALARLIST_ALLOCATOR(Uint8ClampedArray, TIMES_1) 546 SCALARLIST_ALLOCATOR(Uint8ClampedArray, TIMES_1)
556 SCALARLIST_ALLOCATOR(Int16Array, TIMES_2) 547 SCALARLIST_ALLOCATOR(Int16Array, TIMES_2)
557 SCALARLIST_ALLOCATOR(Uint16Array, TIMES_2) 548 SCALARLIST_ALLOCATOR(Uint16Array, TIMES_2)
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 return true; 610 return true;
620 } 611 }
621 612
622 613
623 static ScaleFactor GetScaleFactor(intptr_t size) { 614 static ScaleFactor GetScaleFactor(intptr_t size) {
624 switch (size) { 615 switch (size) {
625 case 1: return TIMES_1; 616 case 1: return TIMES_1;
626 case 2: return TIMES_2; 617 case 2: return TIMES_2;
627 case 4: return TIMES_4; 618 case 4: return TIMES_4;
628 case 8: return TIMES_8; 619 case 8: return TIMES_8;
629 case 16: return TIMES_16;
630 } 620 }
631 UNREACHABLE(); 621 UNREACHABLE();
632 return static_cast<ScaleFactor>(0); 622 return static_cast<ScaleFactor>(0);
633 }; 623 };
634 624
635 625
636 #define TYPEDDATA_ALLOCATOR(clazz) \ 626 #define TYPEDDATA_ALLOCATOR(clazz) \
637 bool Intrinsifier::TypedData_##clazz##_new(Assembler* assembler) { \ 627 bool Intrinsifier::TypedData_##clazz##_new(Assembler* assembler) { \
638 intptr_t size = TypedData::ElementSizeInBytes(kTypedData##clazz##Cid); \ 628 intptr_t size = TypedData::ElementSizeInBytes(kTypedData##clazz##Cid); \
639 intptr_t max_len = TypedData::MaxElements(kTypedData##clazz##Cid); \ 629 intptr_t max_len = TypedData::MaxElements(kTypedData##clazz##Cid); \
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
1468 __ ret(); 1458 __ ret();
1469 return true; 1459 return true;
1470 } 1460 }
1471 1461
1472 1462
1473 #undef __ 1463 #undef __
1474 1464
1475 } // namespace dart 1465 } // namespace dart
1476 1466
1477 #endif // defined TARGET_ARCH_X64 1467 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier_ia32.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698