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

Side by Side Diff: runtime/vm/assembler_x64.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/assembler_x64.h ('k') | runtime/vm/intermediate_language_arm.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 #include "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/heap.h" 10 #include "vm/heap.h"
(...skipping 3393 matching lines...) Expand 10 before | Expand all | Expand 10 after
3404 LoadClassId(result, object); 3404 LoadClassId(result, object);
3405 3405
3406 movq(object, Immediate(kSmiCid)); 3406 movq(object, Immediate(kSmiCid));
3407 // If object is a Smi, move the Smi cid into result. o/w leave alone. 3407 // If object is a Smi, move the Smi cid into result. o/w leave alone.
3408 cmoveq(result, object); 3408 cmoveq(result, object);
3409 // Finally, tag the result. 3409 // Finally, tag the result.
3410 SmiTag(result); 3410 SmiTag(result);
3411 } 3411 }
3412 3412
3413 3413
3414 Address Assembler::ElementAddressForIntIndex(bool is_external,
3415 intptr_t cid,
3416 intptr_t index_scale,
3417 Register array,
3418 intptr_t index) {
3419 if (is_external) {
3420 return Address(array, index * index_scale);
3421 } else {
3422 const int64_t disp = static_cast<int64_t>(index) * index_scale +
3423 Instance::DataOffsetFor(cid);
3424 ASSERT(Utils::IsInt(32, disp));
3425 return FieldAddress(array, static_cast<int32_t>(disp));
3426 }
3427 }
3428
3429
3430 static ScaleFactor ToScaleFactor(intptr_t index_scale) {
3431 // Note that index is expected smi-tagged, (i.e, times 2) for all arrays with
3432 // index scale factor > 1. E.g., for Uint8Array and OneByteString the index is
3433 // expected to be untagged before accessing.
3434 ASSERT(kSmiTagShift == 1);
3435 switch (index_scale) {
3436 case 1: return TIMES_1;
3437 case 2: return TIMES_1;
3438 case 4: return TIMES_2;
3439 case 8: return TIMES_4;
3440 case 16: return TIMES_8;
3441 default:
3442 UNREACHABLE();
3443 return TIMES_1;
3444 }
3445 }
3446
3447
3448 Address Assembler::ElementAddressForRegIndex(bool is_external,
3449 intptr_t cid,
3450 intptr_t index_scale,
3451 Register array,
3452 Register index) {
3453 if (is_external) {
3454 return Address(array, index, ToScaleFactor(index_scale), 0);
3455 } else {
3456 return FieldAddress(array,
3457 index,
3458 ToScaleFactor(index_scale),
3459 Instance::DataOffsetFor(cid));
3460 }
3461 }
3462
3463
3414 static const char* cpu_reg_names[kNumberOfCpuRegisters] = { 3464 static const char* cpu_reg_names[kNumberOfCpuRegisters] = {
3415 "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi", 3465 "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi",
3416 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15" 3466 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"
3417 }; 3467 };
3418 3468
3419 3469
3420 const char* Assembler::RegisterName(Register reg) { 3470 const char* Assembler::RegisterName(Register reg) {
3421 ASSERT((0 <= reg) && (reg < kNumberOfCpuRegisters)); 3471 ASSERT((0 <= reg) && (reg < kNumberOfCpuRegisters));
3422 return cpu_reg_names[reg]; 3472 return cpu_reg_names[reg];
3423 } 3473 }
3424 3474
3425 3475
3426 static const char* xmm_reg_names[kNumberOfXmmRegisters] = { 3476 static const char* xmm_reg_names[kNumberOfXmmRegisters] = {
3427 "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7", 3477 "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7",
3428 "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15" 3478 "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15"
3429 }; 3479 };
3430 3480
3431 3481
3432 const char* Assembler::FpuRegisterName(FpuRegister reg) { 3482 const char* Assembler::FpuRegisterName(FpuRegister reg) {
3433 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); 3483 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters));
3434 return xmm_reg_names[reg]; 3484 return xmm_reg_names[reg];
3435 } 3485 }
3436 3486
3437 } // namespace dart 3487 } // namespace dart
3438 3488
3439 #endif // defined TARGET_ARCH_X64 3489 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/assembler_x64.h ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698