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

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

Issue 11074016: Intrinsify writing to Uint8 and Int8 arrays on IA32. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 EBX, 513 EBX,
514 TIMES_1, 514 TIMES_1,
515 Int8Array::data_offset())); 515 Int8Array::data_offset()));
516 __ SmiTag(EAX); 516 __ SmiTag(EAX);
517 __ ret(); 517 __ ret();
518 __ Bind(&fall_through); 518 __ Bind(&fall_through);
519 return false; 519 return false;
520 } 520 }
521 521
522 522
523 bool Intrinsifier::Int8Array_setIndexed(Assembler* assembler) {
524 Label fall_through;
525 // Verify that the array index is valid.
526 TestByteArraySetIndex(assembler, &fall_through);
srdjan 2012/10/08 21:45:53 Please add comments about register content.
527 __ SmiUntag(EBX);
528 // Move EBX into EDI.
529 __ movl(EDI, EBX);
530 // Move the value into EBX.
531 __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Value.
532 // If EBX is not an Smi, jump to fall through.
533 __ testl(EBX, Immediate(kSmiTagMask));
534 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump);
535 __ SmiUntag(EBX);
536 // If EBX is too large an Int8, jump to fall through.
537 __ cmpl(EBX, Immediate(0xFF));
cshapiro 2012/10/08 21:40:41 We need to add 128 to EBX for this compare to be s
538 __ j(GREATER, &fall_through, Assembler::kNearJump);
539 // Store EBX into array EAX[EDI] = EBX.
540 __ movb(FieldAddress(EAX, EDI, TIMES_1, Int8Array::data_offset()), BL);
541 __ ret();
542 __ Bind(&fall_through);
543 return false;
544 }
545
546
523 bool Intrinsifier::Uint8Array_getIndexed(Assembler* assembler) { 547 bool Intrinsifier::Uint8Array_getIndexed(Assembler* assembler) {
524 Label fall_through; 548 Label fall_through;
525 TestByteArrayIndex(assembler, &fall_through); 549 TestByteArrayIndex(assembler, &fall_through);
526 __ SmiUntag(EBX); 550 __ SmiUntag(EBX);
527 __ movzxb(EAX, FieldAddress(EAX, 551 __ movzxb(EAX, FieldAddress(EAX,
528 EBX, 552 EBX,
529 TIMES_1, 553 TIMES_1,
530 Uint8Array::data_offset())); 554 Uint8Array::data_offset()));
531 __ SmiTag(EAX); 555 __ SmiTag(EAX);
532 __ ret(); 556 __ ret();
533 __ Bind(&fall_through); 557 __ Bind(&fall_through);
534 return false; 558 return false;
535 } 559 }
536 560
537 561
562 bool Intrinsifier::Uint8Array_setIndexed(Assembler* assembler) {
563 Label fall_through;
564 // Verify that the array index is valid.
565 TestByteArraySetIndex(assembler, &fall_through);
srdjan 2012/10/08 21:45:53 ditto
566 __ SmiUntag(EBX);
567 // Move EBX into EDI.
568 __ movl(EDI, EBX);
569 // Move the value into EBX.
570 __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Value.
571 // If EBX is not an Smi, jump to fall through.
572 __ testl(EBX, Immediate(kSmiTagMask));
573 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump);
574 __ SmiUntag(EBX);
575 // If EBX is too large an Uint8, jump to fall through.
576 __ cmpl(EBX, Immediate(0xFF));
577 __ j(GREATER, &fall_through, Assembler::kNearJump);
578 // Store EBX into array EAX[EDI] = EBX.
579 __ movb(FieldAddress(EAX, EDI, TIMES_1, Uint8Array::data_offset()), BL);
580 __ ret();
581 __ Bind(&fall_through);
582 return false;
583 }
584
585
538 bool Intrinsifier::Int16Array_getIndexed(Assembler* assembler) { 586 bool Intrinsifier::Int16Array_getIndexed(Assembler* assembler) {
539 Label fall_through; 587 Label fall_through;
540 TestByteArrayIndex(assembler, &fall_through); 588 TestByteArrayIndex(assembler, &fall_through);
541 __ movsxw(EAX, FieldAddress(EAX, 589 __ movsxw(EAX, FieldAddress(EAX,
542 EBX, 590 EBX,
543 TIMES_1, 591 TIMES_1,
544 Int16Array::data_offset())); 592 Int16Array::data_offset()));
545 __ SmiTag(EAX); 593 __ SmiTag(EAX);
546 __ ret(); 594 __ ret();
547 __ Bind(&fall_through); 595 __ Bind(&fall_through);
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after
1498 __ Bind(&is_true); 1546 __ Bind(&is_true);
1499 __ LoadObject(EAX, bool_true); 1547 __ LoadObject(EAX, bool_true);
1500 __ ret(); 1548 __ ret();
1501 return true; 1549 return true;
1502 } 1550 }
1503 1551
1504 #undef __ 1552 #undef __
1505 } // namespace dart 1553 } // namespace dart
1506 1554
1507 #endif // defined TARGET_ARCH_IA32 1555 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698