OLD | NEW |
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 2522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2533 // Check that both are flat one-byte strings. | 2533 // Check that both are flat one-byte strings. |
2534 DCHECK(kNotStringTag != 0); | 2534 DCHECK(kNotStringTag != 0); |
2535 const int kFlatOneByteStringMask = | 2535 const int kFlatOneByteStringMask = |
2536 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask; | 2536 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask; |
2537 const int kFlatOneByteStringTag = | 2537 const int kFlatOneByteStringTag = |
2538 kStringTag | kOneByteStringTag | kSeqStringTag; | 2538 kStringTag | kOneByteStringTag | kSeqStringTag; |
2539 | 2539 |
2540 andl(scratch1, Immediate(kFlatOneByteStringMask)); | 2540 andl(scratch1, Immediate(kFlatOneByteStringMask)); |
2541 andl(scratch2, Immediate(kFlatOneByteStringMask)); | 2541 andl(scratch2, Immediate(kFlatOneByteStringMask)); |
2542 // Interleave the bits to check both scratch1 and scratch2 in one test. | 2542 // Interleave the bits to check both scratch1 and scratch2 in one test. |
2543 const int kShift = 8; | 2543 DCHECK_EQ(0, kFlatOneByteStringMask & (kFlatOneByteStringMask << 3)); |
2544 DCHECK_EQ(0, kFlatOneByteStringMask & (kFlatOneByteStringMask << kShift)); | 2544 leap(scratch1, Operand(scratch1, scratch2, times_8, 0)); |
2545 shlp(scratch2, Immediate(kShift)); | |
2546 orp(scratch1, scratch2); | |
2547 cmpl(scratch1, | 2545 cmpl(scratch1, |
2548 Immediate(kFlatOneByteStringTag + (kFlatOneByteStringTag << kShift))); | 2546 Immediate(kFlatOneByteStringTag + (kFlatOneByteStringTag << 3))); |
2549 j(not_equal, on_fail, near_jump); | 2547 j(not_equal, on_fail, near_jump); |
2550 } | 2548 } |
2551 | 2549 |
2552 void MacroAssembler::JumpIfBothInstanceTypesAreNotSequentialOneByte( | 2550 void MacroAssembler::JumpIfBothInstanceTypesAreNotSequentialOneByte( |
2553 Register first_object_instance_type, Register second_object_instance_type, | 2551 Register first_object_instance_type, Register second_object_instance_type, |
2554 Register scratch1, Register scratch2, Label* on_fail, | 2552 Register scratch1, Register scratch2, Label* on_fail, |
2555 Label::Distance near_jump) { | 2553 Label::Distance near_jump) { |
2556 // Load instance type for both strings. | 2554 // Load instance type for both strings. |
2557 movp(scratch1, first_object_instance_type); | 2555 movp(scratch1, first_object_instance_type); |
2558 movp(scratch2, second_object_instance_type); | 2556 movp(scratch2, second_object_instance_type); |
(...skipping 2740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5299 movl(rax, dividend); | 5297 movl(rax, dividend); |
5300 shrl(rax, Immediate(31)); | 5298 shrl(rax, Immediate(31)); |
5301 addl(rdx, rax); | 5299 addl(rdx, rax); |
5302 } | 5300 } |
5303 | 5301 |
5304 | 5302 |
5305 } // namespace internal | 5303 } // namespace internal |
5306 } // namespace v8 | 5304 } // namespace v8 |
5307 | 5305 |
5308 #endif // V8_TARGET_ARCH_X64 | 5306 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |