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

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

Issue 2685213004: [x64] Use smaller code sequence when pushing SMIs (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | 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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/base/division-by-constant.h" 8 #include "src/base/division-by-constant.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 2447 matching lines...) Expand 10 before | Expand all | Expand 10 after
2458 SmiToInteger32(kScratchRegister, src); 2458 SmiToInteger32(kScratchRegister, src);
2459 addl(dst, kScratchRegister); 2459 addl(dst, kScratchRegister);
2460 } 2460 }
2461 } 2461 }
2462 2462
2463 2463
2464 void MacroAssembler::Push(Smi* source) { 2464 void MacroAssembler::Push(Smi* source) {
2465 intptr_t smi = reinterpret_cast<intptr_t>(source); 2465 intptr_t smi = reinterpret_cast<intptr_t>(source);
2466 if (is_int32(smi)) { 2466 if (is_int32(smi)) {
2467 Push(Immediate(static_cast<int32_t>(smi))); 2467 Push(Immediate(static_cast<int32_t>(smi)));
2468 } else { 2468 return;
2469 Register constant = GetSmiConstant(source);
2470 Push(constant);
2471 } 2469 }
2470 int first_byte_set = base::bits::CountTrailingZeros64(smi) / 8;
2471 int last_byte_set = (63 - base::bits::CountLeadingZeros64(smi)) / 8;
2472 if (first_byte_set == last_byte_set && kPointerSize == kInt64Size) {
2473 // This sequence has only 7 bytes, compared to the 12 bytes below.
2474 Push(Immediate(0));
2475 movb(Operand(rsp, first_byte_set),
2476 Immediate(static_cast<int8_t>(smi >> (8 * first_byte_set))));
2477 return;
2478 }
2479 Register constant = GetSmiConstant(source);
2480 Push(constant);
2472 } 2481 }
2473 2482
2474 2483
2475 void MacroAssembler::PushRegisterAsTwoSmis(Register src, Register scratch) { 2484 void MacroAssembler::PushRegisterAsTwoSmis(Register src, Register scratch) {
2476 DCHECK(!src.is(scratch)); 2485 DCHECK(!src.is(scratch));
2477 movp(scratch, src); 2486 movp(scratch, src);
2478 // High bits. 2487 // High bits.
2479 shrp(src, Immediate(kPointerSize * kBitsPerByte - kSmiShift)); 2488 shrp(src, Immediate(kPointerSize * kBitsPerByte - kSmiShift));
2480 shlp(src, Immediate(kSmiShift)); 2489 shlp(src, Immediate(kSmiShift));
2481 Push(src); 2490 Push(src);
(...skipping 2799 matching lines...) Expand 10 before | Expand all | Expand 10 after
5281 movl(rax, dividend); 5290 movl(rax, dividend);
5282 shrl(rax, Immediate(31)); 5291 shrl(rax, Immediate(31));
5283 addl(rdx, rax); 5292 addl(rdx, rax);
5284 } 5293 }
5285 5294
5286 5295
5287 } // namespace internal 5296 } // namespace internal
5288 } // namespace v8 5297 } // namespace v8
5289 5298
5290 #endif // V8_TARGET_ARCH_X64 5299 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698