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

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

Issue 12982010: Review changes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merged 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 } \
457 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \ 464 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \
458 __ leaq(RDI, Address(RDI, scale_factor, fixed_size)); \ 465 __ leaq(RDI, Address(RDI, scale_factor, fixed_size)); \
459 __ andq(RDI, Immediate(-kObjectAlignment)); \ 466 __ andq(RDI, Immediate(-kObjectAlignment)); \
460 Heap* heap = Isolate::Current()->heap(); \ 467 Heap* heap = Isolate::Current()->heap(); \
461 \ 468 \
462 __ movq(RAX, Immediate(heap->TopAddress())); \ 469 __ movq(RAX, Immediate(heap->TopAddress())); \
463 __ movq(RAX, Address(RAX, 0)); \ 470 __ movq(RAX, Address(RAX, 0)); \
464 __ movq(RCX, RAX); \ 471 __ movq(RCX, RAX); \
465 \ 472 \
466 /* RDI: allocation size. */ \ 473 /* RDI: allocation size. */ \
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 __ addq(RDI, Immediate(kWordSize)); \ 532 __ addq(RDI, Immediate(kWordSize)); \
526 __ jmp(&init_loop, Assembler::kNearJump); \ 533 __ jmp(&init_loop, Assembler::kNearJump); \
527 __ Bind(&done); \ 534 __ Bind(&done); \
528 \ 535 \
529 __ ret(); \ 536 __ ret(); \
530 __ Bind(&fall_through); \ 537 __ Bind(&fall_through); \
531 538
532 539
533 #define SCALARLIST_ALLOCATOR(clazz, scale) \ 540 #define SCALARLIST_ALLOCATOR(clazz, scale) \
534 bool Intrinsifier::clazz##_new(Assembler* assembler) { \ 541 bool Intrinsifier::clazz##_new(Assembler* assembler) { \
535 TYPED_ARRAY_ALLOCATION(clazz, k##clazz##Cid, clazz::kMaxElements, scale); \ 542 ScaleFactor scale_fac = scale; \
543 TYPED_ARRAY_ALLOCATION(clazz, k##clazz##Cid, clazz::kMaxElements, scale_fac);\
536 return false; \ 544 return false; \
537 } \ 545 } \
538 bool Intrinsifier::clazz##_factory(Assembler* assembler) { \ 546 bool Intrinsifier::clazz##_factory(Assembler* assembler) { \
539 TYPED_ARRAY_ALLOCATION(clazz, k##clazz##Cid, clazz::kMaxElements, scale); \ 547 ScaleFactor scale_fac = scale; \
548 TYPED_ARRAY_ALLOCATION(clazz, k##clazz##Cid, clazz::kMaxElements, scale_fac);\
540 return false; \ 549 return false; \
541 } 550 }
542 551
543 552
544 SCALARLIST_ALLOCATOR(Int8Array, TIMES_1) 553 SCALARLIST_ALLOCATOR(Int8Array, TIMES_1)
545 SCALARLIST_ALLOCATOR(Uint8Array, TIMES_1) 554 SCALARLIST_ALLOCATOR(Uint8Array, TIMES_1)
546 SCALARLIST_ALLOCATOR(Uint8ClampedArray, TIMES_1) 555 SCALARLIST_ALLOCATOR(Uint8ClampedArray, TIMES_1)
547 SCALARLIST_ALLOCATOR(Int16Array, TIMES_2) 556 SCALARLIST_ALLOCATOR(Int16Array, TIMES_2)
548 SCALARLIST_ALLOCATOR(Uint16Array, TIMES_2) 557 SCALARLIST_ALLOCATOR(Uint16Array, TIMES_2)
549 SCALARLIST_ALLOCATOR(Int32Array, TIMES_4) 558 SCALARLIST_ALLOCATOR(Int32Array, TIMES_4)
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 return true; 619 return true;
611 } 620 }
612 621
613 622
614 static ScaleFactor GetScaleFactor(intptr_t size) { 623 static ScaleFactor GetScaleFactor(intptr_t size) {
615 switch (size) { 624 switch (size) {
616 case 1: return TIMES_1; 625 case 1: return TIMES_1;
617 case 2: return TIMES_2; 626 case 2: return TIMES_2;
618 case 4: return TIMES_4; 627 case 4: return TIMES_4;
619 case 8: return TIMES_8; 628 case 8: return TIMES_8;
629 case 16: return TIMES_16;
620 } 630 }
621 UNREACHABLE(); 631 UNREACHABLE();
622 return static_cast<ScaleFactor>(0); 632 return static_cast<ScaleFactor>(0);
623 }; 633 };
624 634
625 635
626 #define TYPEDDATA_ALLOCATOR(clazz) \ 636 #define TYPEDDATA_ALLOCATOR(clazz) \
627 bool Intrinsifier::TypedData_##clazz##_new(Assembler* assembler) { \ 637 bool Intrinsifier::TypedData_##clazz##_new(Assembler* assembler) { \
628 intptr_t size = TypedData::ElementSizeInBytes(kTypedData##clazz##Cid); \ 638 intptr_t size = TypedData::ElementSizeInBytes(kTypedData##clazz##Cid); \
629 intptr_t max_len = TypedData::MaxElements(kTypedData##clazz##Cid); \ 639 intptr_t max_len = TypedData::MaxElements(kTypedData##clazz##Cid); \
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
1458 __ ret(); 1468 __ ret();
1459 return true; 1469 return true;
1460 } 1470 }
1461 1471
1462 1472
1463 #undef __ 1473 #undef __
1464 1474
1465 } // namespace dart 1475 } // namespace dart
1466 1476
1467 #endif // defined TARGET_ARCH_X64 1477 #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