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

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

Issue 308513005: Intrinsify [] for ExternalUint8 and Uint8 typed data. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 435
436 436
437 // Gets the length of a TypedData. 437 // Gets the length of a TypedData.
438 void Intrinsifier::TypedData_getLength(Assembler* assembler) { 438 void Intrinsifier::TypedData_getLength(Assembler* assembler) {
439 __ movl(EAX, Address(ESP, + 1 * kWordSize)); 439 __ movl(EAX, Address(ESP, + 1 * kWordSize));
440 __ movl(EAX, FieldAddress(EAX, TypedData::length_offset())); 440 __ movl(EAX, FieldAddress(EAX, TypedData::length_offset()));
441 __ ret(); 441 __ ret();
442 } 442 }
443 443
444 444
445 void Intrinsifier::Uint8Array_getIndexed(Assembler* assembler) {
446 Label fall_through;
447 __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Index.
448 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Array.
449 __ testl(EBX, Immediate(kSmiTagMask));
450 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index.
451 // Range check.
452 __ cmpl(EBX, FieldAddress(EAX, TypedData::length_offset()));
453 // Runtime throws exception.
454 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump);
455
456 __ SmiUntag(EBX);
457 __ movzxb(EAX, FieldAddress(EAX, EBX, TIMES_1, TypedData::data_offset()));
458 __ SmiTag(EAX);
459 __ ret();
460 __ Bind(&fall_through);
461 }
462
463
464 void Intrinsifier::ExternalUint8Array_getIndexed(Assembler* assembler) {
465 Label fall_through;
466 __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Index.
467 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Array.
468 __ testl(EBX, Immediate(kSmiTagMask));
469 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index.
470 // Range check.
471 __ cmpl(EBX, FieldAddress(EAX, TypedData::length_offset()));
472 // Runtime throws exception.
473 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump);
474
475 __ movl(EAX, FieldAddress(EAX, ExternalTypedData::data_offset()));
476 __ SmiUntag(EBX);
477 __ movzxb(EAX, Address(EAX, EBX, TIMES_1, 0));
478 __ SmiTag(EAX);
479 __ ret();
480 __ Bind(&fall_through);
481 }
482
483
445 static ScaleFactor GetScaleFactor(intptr_t size) { 484 static ScaleFactor GetScaleFactor(intptr_t size) {
446 switch (size) { 485 switch (size) {
447 case 1: return TIMES_1; 486 case 1: return TIMES_1;
448 case 2: return TIMES_2; 487 case 2: return TIMES_2;
449 case 4: return TIMES_4; 488 case 4: return TIMES_4;
450 case 8: return TIMES_8; 489 case 8: return TIMES_8;
451 case 16: return TIMES_16; 490 case 16: return TIMES_16;
452 } 491 }
453 UNREACHABLE(); 492 UNREACHABLE();
454 return static_cast<ScaleFactor>(0); 493 return static_cast<ScaleFactor>(0);
(...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1669 Isolate::current_tag_offset()); 1708 Isolate::current_tag_offset());
1670 // Set return value to Isolate::current_tag_. 1709 // Set return value to Isolate::current_tag_.
1671 __ movl(EAX, current_tag_addr); 1710 __ movl(EAX, current_tag_addr);
1672 __ ret(); 1711 __ ret();
1673 } 1712 }
1674 1713
1675 #undef __ 1714 #undef __
1676 } // namespace dart 1715 } // namespace dart
1677 1716
1678 #endif // defined TARGET_ARCH_IA32 1717 #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