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

Side by Side Diff: runtime/vm/intrinsifier_x64.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_mips.cc ('k') | tests/standalone/typed_data_test.dart » ('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 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/intrinsifier.h" 8 #include "vm/intrinsifier.h"
9 9
10 #include "vm/assembler.h" 10 #include "vm/assembler.h"
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 390
391 391
392 // Gets the length of a TypedData. 392 // Gets the length of a TypedData.
393 void Intrinsifier::TypedData_getLength(Assembler* assembler) { 393 void Intrinsifier::TypedData_getLength(Assembler* assembler) {
394 __ movq(RAX, Address(RSP, + 1 * kWordSize)); 394 __ movq(RAX, Address(RSP, + 1 * kWordSize));
395 __ movq(RAX, FieldAddress(RAX, TypedData::length_offset())); 395 __ movq(RAX, FieldAddress(RAX, TypedData::length_offset()));
396 __ ret(); 396 __ ret();
397 } 397 }
398 398
399 399
400 void Intrinsifier::Uint8Array_getIndexed(Assembler* assembler) {
401 Label fall_through;
402 __ movq(RCX, Address(RSP, + 1 * kWordSize)); // Index.
403 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Array.
404 __ testq(RCX, Immediate(kSmiTagMask));
405 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index.
406 // Range check.
407 __ cmpq(RCX, FieldAddress(RAX, TypedData::length_offset()));
408 // Runtime throws exception.
409 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump);
410
411 __ SmiUntag(RCX);
412 __ movzxb(RAX, FieldAddress(RAX, RCX, TIMES_1, TypedData::data_offset()));
413 __ SmiTag(RAX);
414 __ ret();
415 __ Bind(&fall_through);
416 }
417
418
419 void Intrinsifier::ExternalUint8Array_getIndexed(Assembler* assembler) {
420 Label fall_through;
421 __ movq(RCX, Address(RSP, + 1 * kWordSize)); // Index.
422 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Array.
423 __ testq(RCX, Immediate(kSmiTagMask));
424 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index.
425 // Range check.
426 __ cmpq(RCX, FieldAddress(RAX, TypedData::length_offset()));
427 // Runtime throws exception.
428 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump);
429
430 __ movq(RAX, FieldAddress(RAX, ExternalTypedData::data_offset()));
431 __ SmiUntag(RCX);
432 __ movzxb(RAX, Address(RAX, RCX, TIMES_1, 0));
433 __ SmiTag(RAX);
434 __ ret();
435 __ Bind(&fall_through);
436 }
437
438
400 static ScaleFactor GetScaleFactor(intptr_t size) { 439 static ScaleFactor GetScaleFactor(intptr_t size) {
401 switch (size) { 440 switch (size) {
402 case 1: return TIMES_1; 441 case 1: return TIMES_1;
403 case 2: return TIMES_2; 442 case 2: return TIMES_2;
404 case 4: return TIMES_4; 443 case 4: return TIMES_4;
405 case 8: return TIMES_8; 444 case 8: return TIMES_8;
406 case 16: return TIMES_16; 445 case 16: return TIMES_16;
407 } 446 }
408 UNREACHABLE(); 447 UNREACHABLE();
409 return static_cast<ScaleFactor>(0); 448 return static_cast<ScaleFactor>(0);
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 // Set return value to Isolate::current_tag_. 1615 // Set return value to Isolate::current_tag_.
1577 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); 1616 __ movq(RAX, Address(RBX, Isolate::current_tag_offset()));
1578 __ ret(); 1617 __ ret();
1579 } 1618 }
1580 1619
1581 #undef __ 1620 #undef __
1582 1621
1583 } // namespace dart 1622 } // namespace dart
1584 1623
1585 #endif // defined TARGET_ARCH_X64 1624 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier_mips.cc ('k') | tests/standalone/typed_data_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698