Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #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/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1031 locs->set_out(Location::RequiresRegister()); | 1031 locs->set_out(Location::RequiresRegister()); |
| 1032 } | 1032 } |
| 1033 return locs; | 1033 return locs; |
| 1034 } | 1034 } |
| 1035 | 1035 |
| 1036 | 1036 |
| 1037 void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1037 void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1038 Register array = locs()->in(0).reg(); | 1038 Register array = locs()->in(0).reg(); |
| 1039 Location index = locs()->in(1); | 1039 Location index = locs()->in(1); |
| 1040 | 1040 |
| 1041 if (class_id() == kExternalUint8ArrayCid) { | |
| 1042 Register result = locs()->out().reg(); | |
| 1043 Address element_address = index.IsRegister() | |
| 1044 ? Address(result, index.reg(), TIMES_1, 0) | |
| 1045 : Address(result, Smi::Cast(index.constant()).Value()); | |
| 1046 if (index.IsRegister()) { | |
| 1047 __ SmiUntag(index.reg()); | |
| 1048 } | |
| 1049 __ movq(result, | |
| 1050 FieldAddress(array, ExternalUint8Array::external_data_offset())); | |
| 1051 __ movq(result, | |
| 1052 Address(result, ExternalByteArrayData<uint8_t>::data_offset())); | |
| 1053 __ movzxb(result, element_address); | |
| 1054 __ SmiTag(result); | |
| 1055 if (index.IsRegister()) { | |
| 1056 __ SmiTag(index.reg()); // Re-tag. | |
| 1057 } | |
| 1058 return; | |
| 1059 } | |
| 1060 | |
| 1041 FieldAddress element_address = index.IsRegister() ? | 1061 FieldAddress element_address = index.IsRegister() ? |
| 1042 FlowGraphCompiler::ElementAddressForRegIndex( | 1062 FlowGraphCompiler::ElementAddressForRegIndex( |
| 1043 class_id(), array, index.reg()) : | 1063 class_id(), array, index.reg()) : |
| 1044 FlowGraphCompiler::ElementAddressForIntIndex( | 1064 FlowGraphCompiler::ElementAddressForIntIndex( |
| 1045 class_id(), array, Smi::Cast(index.constant()).Value()); | 1065 class_id(), array, Smi::Cast(index.constant()).Value()); |
| 1046 | 1066 |
| 1047 if (representation() == kUnboxedDouble) { | 1067 if (representation() == kUnboxedDouble) { |
| 1068 XmmRegister result = locs()->out().xmm_reg(); | |
| 1048 if (class_id() == kFloat32ArrayCid) { | 1069 if (class_id() == kFloat32ArrayCid) { |
| 1049 // Load single precision float. | 1070 // Load single precision float. |
| 1050 __ movss(locs()->out().xmm_reg(), element_address); | 1071 __ movss(result, element_address); |
| 1051 // Promote to double. | 1072 // Promote to double. |
| 1052 __ cvtss2sd(locs()->out().xmm_reg(), locs()->out().xmm_reg()); | 1073 __ cvtss2sd(result, locs()->out().xmm_reg()); |
| 1053 } else { | 1074 } else { |
| 1054 ASSERT(class_id() == kFloat64ArrayCid); | 1075 ASSERT(class_id() == kFloat64ArrayCid); |
| 1055 __ movsd(locs()->out().xmm_reg(), element_address); | 1076 __ movsd(result, element_address); |
| 1077 } | |
| 1078 return; | |
| 1079 } | |
| 1080 | |
| 1081 Register result = locs()->out().reg(); | |
| 1082 if (class_id() == kUint8ArrayCid) { | |
| 1083 if (index.IsRegister()) { | |
| 1084 __ SmiUntag(index.reg()); | |
| 1085 } | |
| 1086 __ movzxb(result, element_address); | |
| 1087 __ SmiTag(result); | |
| 1088 if (index.IsRegister()) { | |
| 1089 __ SmiTag(index.reg()); // Re-tag. | |
| 1056 } | 1090 } |
|
srdjan
2012/11/22 18:18:19
ditto
Florian Schneider
2012/11/23 14:49:39
Done.
| |
| 1057 } else { | 1091 } else { |
| 1058 __ movq(locs()->out().reg(), element_address); | 1092 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid)); |
| 1093 __ movq(result, element_address); | |
| 1059 } | 1094 } |
| 1060 } | 1095 } |
| 1061 | 1096 |
| 1062 | 1097 |
| 1063 LocationSummary* StoreIndexedInstr::MakeLocationSummary() const { | 1098 LocationSummary* StoreIndexedInstr::MakeLocationSummary() const { |
| 1064 const intptr_t kNumInputs = 3; | 1099 const intptr_t kNumInputs = 3; |
| 1065 const intptr_t kNumTemps = class_id() == kFloat32ArrayCid ? 1 : 0; | 1100 const intptr_t kNumTemps = class_id() == kFloat32ArrayCid ? 1 : 0; |
| 1066 LocationSummary* locs = | 1101 LocationSummary* locs = |
| 1067 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 1102 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 1068 if (class_id() == kFloat32ArrayCid) { | 1103 if (class_id() == kFloat32ArrayCid) { |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 1099 // Store. | 1134 // Store. |
| 1100 __ movss(element_address, locs()->temp(0).xmm_reg()); | 1135 __ movss(element_address, locs()->temp(0).xmm_reg()); |
| 1101 return; | 1136 return; |
| 1102 } | 1137 } |
| 1103 | 1138 |
| 1104 if (class_id() == kFloat64ArrayCid) { | 1139 if (class_id() == kFloat64ArrayCid) { |
| 1105 __ movsd(element_address, locs()->in(2).xmm_reg()); | 1140 __ movsd(element_address, locs()->in(2).xmm_reg()); |
| 1106 return; | 1141 return; |
| 1107 } | 1142 } |
| 1108 | 1143 |
| 1144 ASSERT(class_id() == kArrayCid); | |
| 1109 if (ShouldEmitStoreBarrier()) { | 1145 if (ShouldEmitStoreBarrier()) { |
| 1110 Register value = locs()->in(2).reg(); | 1146 Register value = locs()->in(2).reg(); |
| 1111 __ StoreIntoObject(array, element_address, value); | 1147 __ StoreIntoObject(array, element_address, value); |
| 1112 return; | 1148 return; |
| 1113 } | 1149 } |
| 1114 | 1150 |
| 1115 if (locs()->in(2).IsConstant()) { | 1151 if (locs()->in(2).IsConstant()) { |
| 1116 const Object& constant = locs()->in(2).constant(); | 1152 const Object& constant = locs()->in(2).constant(); |
| 1117 __ StoreObject(element_address, constant); | 1153 __ StoreObject(element_address, constant); |
| 1118 } else { | 1154 } else { |
| (...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2397 | 2433 |
| 2398 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2434 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2399 UNIMPLEMENTED(); | 2435 UNIMPLEMENTED(); |
| 2400 } | 2436 } |
| 2401 | 2437 |
| 2402 } // namespace dart | 2438 } // namespace dart |
| 2403 | 2439 |
| 2404 #undef __ | 2440 #undef __ |
| 2405 | 2441 |
| 2406 #endif // defined TARGET_ARCH_X64 | 2442 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |