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

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

Issue 10911153: Intrinsify Float32Array_getIndexed on IA32 and X64. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Float32Array intrinsified getIndexed with tests Created 8 years, 2 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 550
551 551
552 bool Intrinsifier::Int32Array_getIndexed(Assembler* assembler) { 552 bool Intrinsifier::Int32Array_getIndexed(Assembler* assembler) {
553 return false; 553 return false;
554 } 554 }
555 555
556 556
557 bool Intrinsifier::Uint32Array_getIndexed(Assembler* assembler) { 557 bool Intrinsifier::Uint32Array_getIndexed(Assembler* assembler) {
558 return false; 558 return false;
559 } 559 }
560 560
srdjan 2012/09/28 22:42:08 Two empty lines between functions (here and elsewh
561 bool Intrinsifier::Float32Array_getIndexed(Assembler* assembler) {
562 Label fall_through;
563 // __ int3();
srdjan 2012/09/28 22:42:08 Indent should be two spaces. Remove // __ int3();
564 TestByteArrayIndex(assembler, &fall_through);
565 // After TestByteArrayIndex:
566 // * EAX has the base address of the byte array.
567 // * EBX has the index into the array.
568
569 // EBX contains the SMI index which is shifted left by 1.
570 // This shift means we only multiply the index by 2 not 4 (sizeof float).
571 // Load single precision float into XMM7.
572 __ movss(XMM7, FieldAddress(EAX, EBX, TIMES_2,
573 Float32Array::data_offset()));
574 // Convert into a double precision float.
575 __ cvtss2sd(XMM7, XMM7);
576 // Allocate a double instance.
577 const Class& double_class = Class::Handle(
578 Isolate::Current()->object_store()->double_class());
579 AssemblerMacros::TryAllocate(assembler,
580 double_class,
581 &fall_through,
582 Assembler::kNearJump, EAX);
583 // Store XMM6 into double instance.
584 __ movsd(FieldAddress(EAX, Double::value_offset()), XMM7);
585 __ ret();
586 __ Bind(&fall_through);
587 return false;
588 }
589
590 bool Intrinsifier::Float32Array_setIndexed(Assembler* assembler) {
591 return false;
592 }
561 593
562 // Tests if two top most arguments are smis, jumps to label not_smi if not. 594 // Tests if two top most arguments are smis, jumps to label not_smi if not.
563 // Topmost argument is in EAX. 595 // Topmost argument is in EAX.
564 static void TestBothArgumentsSmis(Assembler* assembler, Label* not_smi) { 596 static void TestBothArgumentsSmis(Assembler* assembler, Label* not_smi) {
565 __ movl(EAX, Address(ESP, + 1 * kWordSize)); 597 __ movl(EAX, Address(ESP, + 1 * kWordSize));
566 __ movl(EBX, Address(ESP, + 2 * kWordSize)); 598 __ movl(EBX, Address(ESP, + 2 * kWordSize));
567 __ orl(EBX, EAX); 599 __ orl(EBX, EAX);
568 __ testl(EBX, Immediate(kSmiTagMask)); 600 __ testl(EBX, Immediate(kSmiTagMask));
569 __ j(NOT_ZERO, not_smi, Assembler::kNearJump); 601 __ j(NOT_ZERO, not_smi, Assembler::kNearJump);
570 } 602 }
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 __ Bind(&is_true); 1462 __ Bind(&is_true);
1431 __ LoadObject(EAX, bool_true); 1463 __ LoadObject(EAX, bool_true);
1432 __ ret(); 1464 __ ret();
1433 return true; 1465 return true;
1434 } 1466 }
1435 1467
1436 #undef __ 1468 #undef __
1437 } // namespace dart 1469 } // namespace dart
1438 1470
1439 #endif // defined TARGET_ARCH_IA32 1471 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698