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

Unified Diff: runtime/vm/intermediate_language_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/intermediate_language_mips.cc ('k') | runtime/vm/intrinsifier.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_x64.cc
===================================================================
--- runtime/vm/intermediate_language_x64.cc (revision 38478)
+++ runtime/vm/intermediate_language_x64.cc (working copy)
@@ -990,66 +990,17 @@
}
-static Address ElementAddressForIntIndex(bool is_external,
- intptr_t cid,
- intptr_t index_scale,
- Register array,
- intptr_t index) {
- if (is_external) {
- return Address(array, index * index_scale);
- } else {
- const int64_t disp = static_cast<int64_t>(index) * index_scale +
- Instance::DataOffsetFor(cid);
- ASSERT(Utils::IsInt(32, disp));
- return FieldAddress(array, static_cast<int32_t>(disp));
- }
-}
-
-
-static ScaleFactor ToScaleFactor(intptr_t index_scale) {
- // Note that index is expected smi-tagged, (i.e, times 2) for all arrays with
- // index scale factor > 1. E.g., for Uint8Array and OneByteString the index is
- // expected to be untagged before accessing.
- ASSERT(kSmiTagShift == 1);
- switch (index_scale) {
- case 1: return TIMES_1;
- case 2: return TIMES_1;
- case 4: return TIMES_2;
- case 8: return TIMES_4;
- case 16: return TIMES_8;
- default:
- UNREACHABLE();
- return TIMES_1;
- }
-}
-
-
-static Address ElementAddressForRegIndex(bool is_external,
- intptr_t cid,
- intptr_t index_scale,
- Register array,
- Register index) {
- if (is_external) {
- return Address(array, index, ToScaleFactor(index_scale), 0);
- } else {
- return FieldAddress(array,
- index,
- ToScaleFactor(index_scale),
- Instance::DataOffsetFor(cid));
- }
-}
-
-
void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
// The array register points to the backing store for external arrays.
const Register array = locs()->in(0).reg();
const Location index = locs()->in(1);
Address element_address = index.IsRegister()
- ? ElementAddressForRegIndex(IsExternal(), class_id(), index_scale(),
- array, index.reg())
- : ElementAddressForIntIndex(IsExternal(), class_id(), index_scale(),
- array, Smi::Cast(index.constant()).Value());
+ ? Assembler::ElementAddressForRegIndex(
+ IsExternal(), class_id(), index_scale(), array, index.reg())
+ : Assembler::ElementAddressForIntIndex(
+ IsExternal(), class_id(), index_scale(),
+ array, Smi::Cast(index.constant()).Value());
if ((representation() == kUnboxedDouble) ||
(representation() == kUnboxedFloat32x4) ||
@@ -1217,10 +1168,11 @@
const Location index = locs()->in(1);
Address element_address = index.IsRegister()
- ? ElementAddressForRegIndex(IsExternal(), class_id(), index_scale(),
- array, index.reg())
- : ElementAddressForIntIndex(IsExternal(), class_id(), index_scale(),
- array, Smi::Cast(index.constant()).Value());
+ ? Assembler::ElementAddressForRegIndex(
+ IsExternal(), class_id(), index_scale(), array, index.reg())
+ : Assembler::ElementAddressForIntIndex(
+ IsExternal(), class_id(), index_scale(),
+ array, Smi::Cast(index.constant()).Value());
if ((index_scale() == 1) && index.IsRegister()) {
__ SmiUntag(index.reg());
« no previous file with comments | « runtime/vm/intermediate_language_mips.cc ('k') | runtime/vm/intrinsifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698