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

Side by Side Diff: runtime/vm/intrinsifier_ia32.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.h ('k') | runtime/vm/intrinsifier_x64.cc » ('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 // The intrinsic code below is executed before a method has built its frame. 5 // The intrinsic code below is executed before a method has built its frame.
6 // The return address is on the stack and the arguments below it. 6 // The return address is on the stack and the arguments below it.
7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved. 7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved.
8 // Each intrinsification method returns true if the corresponding 8 // Each intrinsification method returns true if the corresponding
9 // Dart method was intrinsified. 9 // Dart method was intrinsified.
10 10
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 /* EDI: requested array length argument. */ \ 475 /* EDI: requested array length argument. */ \
476 __ testl(EDI, Immediate(kSmiTagSize)); \ 476 __ testl(EDI, Immediate(kSmiTagSize)); \
477 __ j(NOT_ZERO, &fall_through); \ 477 __ j(NOT_ZERO, &fall_through); \
478 __ cmpl(EDI, Immediate(0)); \ 478 __ cmpl(EDI, Immediate(0)); \
479 __ j(LESS, &fall_through); \ 479 __ j(LESS, &fall_through); \
480 __ SmiUntag(EDI); \ 480 __ SmiUntag(EDI); \
481 /* Check for maximum allowed length. */ \ 481 /* Check for maximum allowed length. */ \
482 /* EDI: untagged array length. */ \ 482 /* EDI: untagged array length. */ \
483 __ cmpl(EDI, Immediate(max_len)); \ 483 __ cmpl(EDI, Immediate(max_len)); \
484 __ j(GREATER, &fall_through); \ 484 __ j(GREATER, &fall_through); \
485 /* Special case for scaling by 16. */ \
486 if (scale_factor == TIMES_16) { \
487 /* double length of array. */ \
488 __ addl(EDI, EDI); \
489 /* only scale by 8. */ \
490 scale_factor = TIMES_8; \
491 } \
485 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \ 492 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \
486 __ leal(EDI, Address(EDI, scale_factor, fixed_size)); \ 493 __ leal(EDI, Address(EDI, scale_factor, fixed_size)); \
487 __ andl(EDI, Immediate(-kObjectAlignment)); \ 494 __ andl(EDI, Immediate(-kObjectAlignment)); \
488 Heap* heap = Isolate::Current()->heap(); \ 495 Heap* heap = Isolate::Current()->heap(); \
489 \ 496 \
490 __ movl(EAX, Address::Absolute(heap->TopAddress())); \ 497 __ movl(EAX, Address::Absolute(heap->TopAddress())); \
491 __ movl(EBX, EAX); \ 498 __ movl(EBX, EAX); \
492 \ 499 \
493 /* EDI: allocation size. */ \ 500 /* EDI: allocation size. */ \
494 __ addl(EBX, EDI); \ 501 __ addl(EBX, EDI); \
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 __ addl(EDI, Immediate(kWordSize)); \ 555 __ addl(EDI, Immediate(kWordSize)); \
549 __ jmp(&init_loop, Assembler::kNearJump); \ 556 __ jmp(&init_loop, Assembler::kNearJump); \
550 __ Bind(&done); \ 557 __ Bind(&done); \
551 \ 558 \
552 __ ret(); \ 559 __ ret(); \
553 __ Bind(&fall_through); \ 560 __ Bind(&fall_through); \
554 561
555 562
556 #define SCALARLIST_ALLOCATOR(clazz, scale) \ 563 #define SCALARLIST_ALLOCATOR(clazz, scale) \
557 bool Intrinsifier::clazz##_new(Assembler* assembler) { \ 564 bool Intrinsifier::clazz##_new(Assembler* assembler) { \
558 TYPED_ARRAY_ALLOCATION(clazz, k##clazz##Cid, clazz::kMaxElements, scale); \ 565 ScaleFactor scale_fac = scale; \
566 TYPED_ARRAY_ALLOCATION(clazz, k##clazz##Cid, clazz::kMaxElements, scale_fac);\
559 return false; \ 567 return false; \
560 } \ 568 } \
561 bool Intrinsifier::clazz##_factory(Assembler* assembler) { \ 569 bool Intrinsifier::clazz##_factory(Assembler* assembler) { \
562 TYPED_ARRAY_ALLOCATION(clazz, k##clazz##Cid, clazz::kMaxElements, scale); \ 570 ScaleFactor scale_fac = scale; \
571 TYPED_ARRAY_ALLOCATION(clazz, k##clazz##Cid, clazz::kMaxElements, scale_fac);\
563 return false; \ 572 return false; \
564 } 573 }
565 574
566 575
567 SCALARLIST_ALLOCATOR(Int8Array, TIMES_1) 576 SCALARLIST_ALLOCATOR(Int8Array, TIMES_1)
568 SCALARLIST_ALLOCATOR(Uint8Array, TIMES_1) 577 SCALARLIST_ALLOCATOR(Uint8Array, TIMES_1)
569 SCALARLIST_ALLOCATOR(Uint8ClampedArray, TIMES_1) 578 SCALARLIST_ALLOCATOR(Uint8ClampedArray, TIMES_1)
570 SCALARLIST_ALLOCATOR(Int16Array, TIMES_2) 579 SCALARLIST_ALLOCATOR(Int16Array, TIMES_2)
571 SCALARLIST_ALLOCATOR(Uint16Array, TIMES_2) 580 SCALARLIST_ALLOCATOR(Uint16Array, TIMES_2)
572 SCALARLIST_ALLOCATOR(Int32Array, TIMES_4) 581 SCALARLIST_ALLOCATOR(Int32Array, TIMES_4)
(...skipping 22 matching lines...) Expand all
595 return true; 604 return true;
596 } 605 }
597 606
598 607
599 static ScaleFactor GetScaleFactor(intptr_t size) { 608 static ScaleFactor GetScaleFactor(intptr_t size) {
600 switch (size) { 609 switch (size) {
601 case 1: return TIMES_1; 610 case 1: return TIMES_1;
602 case 2: return TIMES_2; 611 case 2: return TIMES_2;
603 case 4: return TIMES_4; 612 case 4: return TIMES_4;
604 case 8: return TIMES_8; 613 case 8: return TIMES_8;
614 case 16: return TIMES_16;
605 } 615 }
606 UNREACHABLE(); 616 UNREACHABLE();
607 return static_cast<ScaleFactor>(0); 617 return static_cast<ScaleFactor>(0);
608 }; 618 };
609 619
610 620
611 #define TYPEDDATA_ALLOCATOR(clazz) \ 621 #define TYPEDDATA_ALLOCATOR(clazz) \
612 bool Intrinsifier::TypedData_##clazz##_new(Assembler* assembler) { \ 622 bool Intrinsifier::TypedData_##clazz##_new(Assembler* assembler) { \
613 intptr_t size = TypedData::ElementSizeInBytes(kTypedData##clazz##Cid); \ 623 intptr_t size = TypedData::ElementSizeInBytes(kTypedData##clazz##Cid); \
614 intptr_t max_len = TypedData::MaxElements(kTypedData##clazz##Cid); \ 624 intptr_t max_len = TypedData::MaxElements(kTypedData##clazz##Cid); \
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after
1529 __ SmiTag(EAX); 1539 __ SmiTag(EAX);
1530 __ movl(FieldAddress(EBX, String::hash_offset()), EAX); 1540 __ movl(FieldAddress(EBX, String::hash_offset()), EAX);
1531 __ ret(); 1541 __ ret();
1532 return true; 1542 return true;
1533 } 1543 }
1534 1544
1535 #undef __ 1545 #undef __
1536 } // namespace dart 1546 } // namespace dart
1537 1547
1538 #endif // defined TARGET_ARCH_IA32 1548 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier.h ('k') | runtime/vm/intrinsifier_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698