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

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

Issue 408373002: Adds intrinsics for Float64Array [] and []=. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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_arm64.cc ('k') | runtime/vm/intrinsifier_mips.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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 474
475 __ movl(EAX, FieldAddress(EAX, ExternalTypedData::data_offset())); 475 __ movl(EAX, FieldAddress(EAX, ExternalTypedData::data_offset()));
476 __ SmiUntag(EBX); 476 __ SmiUntag(EBX);
477 __ movzxb(EAX, Address(EAX, EBX, TIMES_1, 0)); 477 __ movzxb(EAX, Address(EAX, EBX, TIMES_1, 0));
478 __ SmiTag(EAX); 478 __ SmiTag(EAX);
479 __ ret(); 479 __ ret();
480 __ Bind(&fall_through); 480 __ Bind(&fall_through);
481 } 481 }
482 482
483 483
484 void Intrinsifier::Float64Array_getIndexed(Assembler* assembler) {
485 Label fall_through;
486 __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Index.
487 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Array.
488 __ testl(EBX, Immediate(kSmiTagMask));
489 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index.
490 // Range check.
491 __ cmpl(EBX, FieldAddress(EAX, TypedData::length_offset()));
492 // Runtime throws exception.
493 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump);
494
495 Address element_address =
496 Assembler::ElementAddressForRegIndex(false, // Not external
497 kTypedDataFloat64ArrayCid, // Cid.
498 8, // Index scale.
499 EAX, // Array.
500 EBX); // Index.
501
502 __ movsd(XMM0, element_address);
503
504 const Class& double_class = Class::Handle(
505 Isolate::Current()->object_store()->double_class());
506 __ TryAllocate(double_class,
507 &fall_through,
508 Assembler::kNearJump,
509 EAX, // Result register.
510 EBX);
511 __ movsd(FieldAddress(EAX, Double::value_offset()), XMM0);
512 __ ret();
513 __ Bind(&fall_through);
514 }
515
516
517 void Intrinsifier::Float64Array_setIndexed(Assembler* assembler) {
518 Label fall_through;
519 __ movl(EBX, Address(ESP, + 2 * kWordSize)); // Index.
520 __ movl(EAX, Address(ESP, + 3 * kWordSize)); // Array.
521 __ testl(EBX, Immediate(kSmiTagMask));
522 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index.
523 // Range check.
524 __ cmpl(EBX, FieldAddress(EAX, TypedData::length_offset()));
525 // Runtime throws exception.
526 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump);
527
528 __ movl(ECX, Address(ESP, + 1 * kWordSize)); // Value.
529 __ testl(ECX, Immediate(kSmiTagMask));
530 __ j(ZERO, &fall_through, Assembler::kNearJump); // Value is Smi.
531 __ LoadClassId(EDI, ECX);
532
533 __ cmpl(EDI, Immediate(kDoubleCid));
534 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump); // Not a Double.
535
536 __ movsd(XMM0, FieldAddress(ECX, Double::value_offset()));
537
538 Address element_address =
539 Assembler::ElementAddressForRegIndex(false, // Not external
540 kTypedDataFloat64ArrayCid, // Cid.
541 8, // Index scale.
542 EAX, // Array.
543 EBX); // Index.
544
545 __ movsd(element_address, XMM0);
546 __ ret();
547 __ Bind(&fall_through);
548 }
549
550
484 static ScaleFactor GetScaleFactor(intptr_t size) { 551 static ScaleFactor GetScaleFactor(intptr_t size) {
485 switch (size) { 552 switch (size) {
486 case 1: return TIMES_1; 553 case 1: return TIMES_1;
487 case 2: return TIMES_2; 554 case 2: return TIMES_2;
488 case 4: return TIMES_4; 555 case 4: return TIMES_4;
489 case 8: return TIMES_8; 556 case 8: return TIMES_8;
490 case 16: return TIMES_16; 557 case 16: return TIMES_16;
491 } 558 }
492 UNREACHABLE(); 559 UNREACHABLE();
493 return static_cast<ScaleFactor>(0); 560 return static_cast<ScaleFactor>(0);
(...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1708 Isolate::current_tag_offset()); 1775 Isolate::current_tag_offset());
1709 // Set return value to Isolate::current_tag_. 1776 // Set return value to Isolate::current_tag_.
1710 __ movl(EAX, current_tag_addr); 1777 __ movl(EAX, current_tag_addr);
1711 __ ret(); 1778 __ ret();
1712 } 1779 }
1713 1780
1714 #undef __ 1781 #undef __
1715 } // namespace dart 1782 } // namespace dart
1716 1783
1717 #endif // defined TARGET_ARCH_IA32 1784 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier_arm64.cc ('k') | runtime/vm/intrinsifier_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698