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

Side by Side Diff: src/x64/lithium-gap-resolver-x64.cc

Issue 179773002: [x64] Improve key value sign-extension of dehoisted LoadKeyed/StoreKeyed (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: refine comments Created 6 years, 9 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
« no previous file with comments | « src/x64/lithium-codegen-x64.cc ('k') | src/x64/lithium-x64.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 __ movp(dst, kScratchRegister); 191 __ movp(dst, kScratchRegister);
192 } 192 }
193 193
194 } else if (source->IsConstantOperand()) { 194 } else if (source->IsConstantOperand()) {
195 LConstantOperand* constant_source = LConstantOperand::cast(source); 195 LConstantOperand* constant_source = LConstantOperand::cast(source);
196 if (destination->IsRegister()) { 196 if (destination->IsRegister()) {
197 Register dst = cgen_->ToRegister(destination); 197 Register dst = cgen_->ToRegister(destination);
198 if (cgen_->IsSmiConstant(constant_source)) { 198 if (cgen_->IsSmiConstant(constant_source)) {
199 __ Move(dst, cgen_->ToSmi(constant_source)); 199 __ Move(dst, cgen_->ToSmi(constant_source));
200 } else if (cgen_->IsInteger32Constant(constant_source)) { 200 } else if (cgen_->IsInteger32Constant(constant_source)) {
201 __ Set(dst, static_cast<uint32_t>(cgen_->ToInteger32(constant_source))); 201 int32_t constant = cgen_->ToInteger32(constant_source);
202 // Do sign extension only for constant used as de-hoisted array key.
203 // Others only need zero extension, which saves 2 bytes.
204 if (cgen_->IsDehoistedKeyConstant(constant_source)) {
205 __ Set(dst, constant);
206 } else {
207 __ Set(dst, static_cast<uint32_t>(constant));
208 }
202 } else { 209 } else {
203 __ Move(dst, cgen_->ToHandle(constant_source)); 210 __ Move(dst, cgen_->ToHandle(constant_source));
204 } 211 }
205 } else if (destination->IsDoubleRegister()) { 212 } else if (destination->IsDoubleRegister()) {
206 double v = cgen_->ToDouble(constant_source); 213 double v = cgen_->ToDouble(constant_source);
207 uint64_t int_val = BitCast<uint64_t, double>(v); 214 uint64_t int_val = BitCast<uint64_t, double>(v);
208 XMMRegister dst = cgen_->ToDoubleRegister(destination); 215 XMMRegister dst = cgen_->ToDoubleRegister(destination);
209 if (int_val == 0) { 216 if (int_val == 0) {
210 __ xorps(dst, dst); 217 __ xorps(dst, dst);
211 } else { 218 } else {
212 __ Set(kScratchRegister, int_val); 219 __ Set(kScratchRegister, int_val);
213 __ movq(dst, kScratchRegister); 220 __ movq(dst, kScratchRegister);
214 } 221 }
215 } else { 222 } else {
216 ASSERT(destination->IsStackSlot()); 223 ASSERT(destination->IsStackSlot());
217 Operand dst = cgen_->ToOperand(destination); 224 Operand dst = cgen_->ToOperand(destination);
218 if (cgen_->IsSmiConstant(constant_source)) { 225 if (cgen_->IsSmiConstant(constant_source)) {
219 __ Move(dst, cgen_->ToSmi(constant_source)); 226 __ Move(dst, cgen_->ToSmi(constant_source));
220 } else if (cgen_->IsInteger32Constant(constant_source)) { 227 } else if (cgen_->IsInteger32Constant(constant_source)) {
221 // Zero top 32 bits of a 64 bit spill slot that holds a 32 bit untagged 228 // Do sign extension to 64 bits when stored into stack slot.
222 // value.
223 __ movp(dst, Immediate(cgen_->ToInteger32(constant_source))); 229 __ movp(dst, Immediate(cgen_->ToInteger32(constant_source)));
224 } else { 230 } else {
225 __ Move(kScratchRegister, cgen_->ToHandle(constant_source)); 231 __ Move(kScratchRegister, cgen_->ToHandle(constant_source));
226 __ movp(dst, kScratchRegister); 232 __ movp(dst, kScratchRegister);
227 } 233 }
228 } 234 }
229 235
230 } else if (source->IsDoubleRegister()) { 236 } else if (source->IsDoubleRegister()) {
231 XMMRegister src = cgen_->ToDoubleRegister(source); 237 XMMRegister src = cgen_->ToDoubleRegister(source);
232 if (destination->IsDoubleRegister()) { 238 if (destination->IsDoubleRegister()) {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 moves_[i].set_source(source); 333 moves_[i].set_source(source);
328 } 334 }
329 } 335 }
330 } 336 }
331 337
332 #undef __ 338 #undef __
333 339
334 } } // namespace v8::internal 340 } } // namespace v8::internal
335 341
336 #endif // V8_TARGET_ARCH_X64 342 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/lithium-codegen-x64.cc ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698