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

Side by Side Diff: src/x64/macro-assembler-x64.cc

Issue 222133003: Update Integer32ToSmiField, SmiToInteger32, and SmiComprare to support 31-bit SMI for x32 port (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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 | « src/x64/macro-assembler-x64.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 1101
1102 1102
1103 void MacroAssembler::Integer32ToSmiField(const Operand& dst, Register src) { 1103 void MacroAssembler::Integer32ToSmiField(const Operand& dst, Register src) {
1104 if (emit_debug_code()) { 1104 if (emit_debug_code()) {
1105 testb(dst, Immediate(0x01)); 1105 testb(dst, Immediate(0x01));
1106 Label ok; 1106 Label ok;
1107 j(zero, &ok, Label::kNear); 1107 j(zero, &ok, Label::kNear);
1108 Abort(kInteger32ToSmiFieldWritingToNonSmiLocation); 1108 Abort(kInteger32ToSmiFieldWritingToNonSmiLocation);
1109 bind(&ok); 1109 bind(&ok);
1110 } 1110 }
1111 ASSERT(kSmiShift % kBitsPerByte == 0); 1111
1112 movl(Operand(dst, kSmiShift / kBitsPerByte), src); 1112 if (SmiValuesAre32Bits()) {
Toon Verwaest 2014/04/03 11:47:48 We shouldn't be able to call Integer32ToSmiField o
1113 ASSERT(kSmiShift % kBitsPerByte == 0);
1114 movl(Operand(dst, kSmiShift / kBitsPerByte), src);
1115 } else {
1116 ASSERT(SmiValuesAre31Bits());
1117 Integer32ToSmi(kScratchRegister, src);
1118 movp(dst, kScratchRegister);
1119 }
1113 } 1120 }
1114 1121
1115 1122
1116 void MacroAssembler::Integer64PlusConstantToSmi(Register dst, 1123 void MacroAssembler::Integer64PlusConstantToSmi(Register dst,
1117 Register src, 1124 Register src,
1118 int constant) { 1125 int constant) {
1119 if (dst.is(src)) { 1126 if (dst.is(src)) {
1120 addl(dst, Immediate(constant)); 1127 addl(dst, Immediate(constant));
1121 } else { 1128 } else {
1122 leal(dst, Operand(src, constant)); 1129 leal(dst, Operand(src, constant));
1123 } 1130 }
1124 shlp(dst, Immediate(kSmiShift)); 1131 shlp(dst, Immediate(kSmiShift));
1125 } 1132 }
1126 1133
1127 1134
1128 void MacroAssembler::SmiToInteger32(Register dst, Register src) { 1135 void MacroAssembler::SmiToInteger32(Register dst, Register src) {
1129 STATIC_ASSERT(kSmiTag == 0); 1136 STATIC_ASSERT(kSmiTag == 0);
1130 if (!dst.is(src)) { 1137 if (!dst.is(src)) {
1131 movp(dst, src); 1138 movp(dst, src);
1132 } 1139 }
1133 shrq(dst, Immediate(kSmiShift)); 1140
1141 if (SmiValuesAre32Bits()) {
1142 shrp(dst, Immediate(kSmiShift));
1143 } else {
1144 ASSERT(SmiValuesAre31Bits());
1145 sarl(dst, Immediate(kSmiShift));
1146 }
1134 } 1147 }
1135 1148
1136 1149
1137 void MacroAssembler::SmiToInteger32(Register dst, const Operand& src) { 1150 void MacroAssembler::SmiToInteger32(Register dst, const Operand& src) {
1138 movl(dst, Operand(src, kSmiShift / kBitsPerByte)); 1151 if (SmiValuesAre32Bits()) {
1152 movl(dst, Operand(src, kSmiShift / kBitsPerByte));
1153 } else {
1154 ASSERT(SmiValuesAre31Bits());
1155 movl(dst, src);
1156 sarl(dst, Immediate(kSmiShift));
1157 }
1139 } 1158 }
1140 1159
1141 1160
1142 void MacroAssembler::SmiToInteger64(Register dst, Register src) { 1161 void MacroAssembler::SmiToInteger64(Register dst, Register src) {
1143 STATIC_ASSERT(kSmiTag == 0); 1162 STATIC_ASSERT(kSmiTag == 0);
1144 if (!dst.is(src)) { 1163 if (!dst.is(src)) {
1145 movp(dst, src); 1164 movp(dst, src);
1146 } 1165 }
1147 sarq(dst, Immediate(kSmiShift)); 1166 sarp(dst, Immediate(kSmiShift));
1167 if (kPointerSize == kInt32Size) {
1168 // Sign extend to 64-bit.
1169 movsxlq(dst, dst);
1170 }
1148 } 1171 }
1149 1172
1150 1173
1151 void MacroAssembler::SmiToInteger64(Register dst, const Operand& src) { 1174 void MacroAssembler::SmiToInteger64(Register dst, const Operand& src) {
1152 movsxlq(dst, Operand(src, kSmiShift / kBitsPerByte)); 1175 if (SmiValuesAre32Bits()) {
1176 movsxlq(dst, Operand(src, kSmiShift / kBitsPerByte));
1177 } else {
1178 ASSERT(SmiValuesAre31Bits());
1179 movp(dst, src);
1180 SmiToInteger64(dst, dst);
1181 }
1153 } 1182 }
1154 1183
1155 1184
1156 void MacroAssembler::SmiTest(Register src) { 1185 void MacroAssembler::SmiTest(Register src) {
1157 AssertSmi(src); 1186 AssertSmi(src);
1158 testp(src, src); 1187 testp(src, src);
1159 } 1188 }
1160 1189
1161 1190
1162 void MacroAssembler::SmiCompare(Register smi1, Register smi2) { 1191 void MacroAssembler::SmiCompare(Register smi1, Register smi2) {
(...skipping 29 matching lines...) Expand all
1192 1221
1193 void MacroAssembler::SmiCompare(const Operand& dst, Register src) { 1222 void MacroAssembler::SmiCompare(const Operand& dst, Register src) {
1194 AssertSmi(dst); 1223 AssertSmi(dst);
1195 AssertSmi(src); 1224 AssertSmi(src);
1196 cmpp(dst, src); 1225 cmpp(dst, src);
1197 } 1226 }
1198 1227
1199 1228
1200 void MacroAssembler::SmiCompare(const Operand& dst, Smi* src) { 1229 void MacroAssembler::SmiCompare(const Operand& dst, Smi* src) {
1201 AssertSmi(dst); 1230 AssertSmi(dst);
1202 cmpl(Operand(dst, kSmiShift / kBitsPerByte), Immediate(src->value())); 1231 if (SmiValuesAre32Bits()) {
1232 cmpl(Operand(dst, kSmiShift / kBitsPerByte), Immediate(src->value()));
1233 } else {
1234 ASSERT(SmiValuesAre31Bits());
1235 cmpl(dst, Immediate(src));
1236 }
1203 } 1237 }
1204 1238
1205 1239
1206 void MacroAssembler::Cmp(const Operand& dst, Smi* src) { 1240 void MacroAssembler::Cmp(const Operand& dst, Smi* src) {
1207 // The Operand cannot use the smi register. 1241 // The Operand cannot use the smi register.
1208 Register smi_reg = GetSmiConstant(src); 1242 Register smi_reg = GetSmiConstant(src);
1209 ASSERT(!dst.AddressUsesRegister(smi_reg)); 1243 ASSERT(!dst.AddressUsesRegister(smi_reg));
1210 cmpp(dst, smi_reg); 1244 cmpp(dst, smi_reg);
1211 } 1245 }
1212 1246
1213 1247
1214 void MacroAssembler::SmiCompareInteger32(const Operand& dst, Register src) { 1248 void MacroAssembler::SmiCompareInteger32(const Operand& dst, Register src) {
1215 cmpl(Operand(dst, kSmiShift / kBitsPerByte), src); 1249 if (SmiValuesAre32Bits()) {
1250 cmpl(Operand(dst, kSmiShift / kBitsPerByte), src);
1251 } else {
1252 ASSERT(SmiValuesAre31Bits());
1253 SmiToInteger32(kScratchRegister, dst);
1254 cmpl(kScratchRegister, src);
1255 }
1216 } 1256 }
1217 1257
1218 1258
1219 void MacroAssembler::PositiveSmiTimesPowerOfTwoToInteger64(Register dst, 1259 void MacroAssembler::PositiveSmiTimesPowerOfTwoToInteger64(Register dst,
1220 Register src, 1260 Register src,
1221 int power) { 1261 int power) {
1222 ASSERT(power >= 0); 1262 ASSERT(power >= 0);
1223 ASSERT(power < 64); 1263 ASSERT(power < 64);
1224 if (power == 0) { 1264 if (power == 0) {
1225 SmiToInteger64(dst, src); 1265 SmiToInteger64(dst, src);
(...skipping 3859 matching lines...) Expand 10 before | Expand all | Expand 10 after
5085 if (ms.shift() > 0) sarl(rdx, Immediate(ms.shift())); 5125 if (ms.shift() > 0) sarl(rdx, Immediate(ms.shift()));
5086 movl(rax, dividend); 5126 movl(rax, dividend);
5087 shrl(rax, Immediate(31)); 5127 shrl(rax, Immediate(31));
5088 addl(rdx, rax); 5128 addl(rdx, rax);
5089 } 5129 }
5090 5130
5091 5131
5092 } } // namespace v8::internal 5132 } } // namespace v8::internal
5093 5133
5094 #endif // V8_TARGET_ARCH_X64 5134 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698