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 2353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2364 DCHECK(!src1.is(kScratchRegister)); | 2364 DCHECK(!src1.is(kScratchRegister)); |
2365 DCHECK(!src2.is(kScratchRegister)); | 2365 DCHECK(!src2.is(kScratchRegister)); |
2366 DCHECK(!dst.is(src1)); | 2366 DCHECK(!dst.is(src1)); |
2367 DCHECK(!dst.is(src2)); | 2367 DCHECK(!dst.is(src2)); |
2368 // Both operands must not be smis. | 2368 // Both operands must not be smis. |
2369 #ifdef DEBUG | 2369 #ifdef DEBUG |
2370 Condition not_both_smis = NegateCondition(CheckBothSmi(src1, src2)); | 2370 Condition not_both_smis = NegateCondition(CheckBothSmi(src1, src2)); |
2371 Check(not_both_smis, kBothRegistersWereSmisInSelectNonSmi); | 2371 Check(not_both_smis, kBothRegistersWereSmisInSelectNonSmi); |
2372 #endif | 2372 #endif |
2373 STATIC_ASSERT(kSmiTag == 0); | 2373 STATIC_ASSERT(kSmiTag == 0); |
2374 DCHECK_EQ(static_cast<Smi*>(0), Smi::kZero); | 2374 DCHECK_EQ(static_cast<Smi*>(0), Smi::FromInt(0)); |
2375 movl(kScratchRegister, Immediate(kSmiTagMask)); | 2375 movl(kScratchRegister, Immediate(kSmiTagMask)); |
2376 andp(kScratchRegister, src1); | 2376 andp(kScratchRegister, src1); |
2377 testl(kScratchRegister, src2); | 2377 testl(kScratchRegister, src2); |
2378 // If non-zero then both are smis. | 2378 // If non-zero then both are smis. |
2379 j(not_zero, on_not_smis, near_jump); | 2379 j(not_zero, on_not_smis, near_jump); |
2380 | 2380 |
2381 // Exactly one operand is a smi. | 2381 // Exactly one operand is a smi. |
2382 DCHECK_EQ(1, static_cast<int>(kSmiTagMask)); | 2382 DCHECK_EQ(1, static_cast<int>(kSmiTagMask)); |
2383 // kScratchRegister still holds src1 & kSmiTag, which is either zero or one. | 2383 // kScratchRegister still holds src1 & kSmiTag, which is either zero or one. |
2384 subp(kScratchRegister, Immediate(1)); | 2384 subp(kScratchRegister, Immediate(1)); |
(...skipping 3111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5496 Pop(value); | 5496 Pop(value); |
5497 Check(equal, kUnexpectedStringType); | 5497 Check(equal, kUnexpectedStringType); |
5498 | 5498 |
5499 // The index is assumed to be untagged coming in, tag it to compare with the | 5499 // The index is assumed to be untagged coming in, tag it to compare with the |
5500 // string length without using a temp register, it is restored at the end of | 5500 // string length without using a temp register, it is restored at the end of |
5501 // this function. | 5501 // this function. |
5502 Integer32ToSmi(index, index); | 5502 Integer32ToSmi(index, index); |
5503 SmiCompare(index, FieldOperand(string, String::kLengthOffset)); | 5503 SmiCompare(index, FieldOperand(string, String::kLengthOffset)); |
5504 Check(less, kIndexIsTooLarge); | 5504 Check(less, kIndexIsTooLarge); |
5505 | 5505 |
5506 SmiCompare(index, Smi::kZero); | 5506 SmiCompare(index, Smi::FromInt(0)); |
5507 Check(greater_equal, kIndexIsNegative); | 5507 Check(greater_equal, kIndexIsNegative); |
5508 | 5508 |
5509 // Restore the index | 5509 // Restore the index |
5510 SmiToInteger32(index, index); | 5510 SmiToInteger32(index, index); |
5511 } | 5511 } |
5512 | 5512 |
5513 | 5513 |
5514 void MacroAssembler::PrepareCallCFunction(int num_arguments) { | 5514 void MacroAssembler::PrepareCallCFunction(int num_arguments) { |
5515 int frame_alignment = base::OS::ActivationFrameAlignment(); | 5515 int frame_alignment = base::OS::ActivationFrameAlignment(); |
5516 DCHECK(frame_alignment != 0); | 5516 DCHECK(frame_alignment != 0); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5701 j(equal, call_runtime); | 5701 j(equal, call_runtime); |
5702 | 5702 |
5703 jmp(&start); | 5703 jmp(&start); |
5704 | 5704 |
5705 bind(&next); | 5705 bind(&next); |
5706 | 5706 |
5707 movp(rbx, FieldOperand(rcx, HeapObject::kMapOffset)); | 5707 movp(rbx, FieldOperand(rcx, HeapObject::kMapOffset)); |
5708 | 5708 |
5709 // For all objects but the receiver, check that the cache is empty. | 5709 // For all objects but the receiver, check that the cache is empty. |
5710 EnumLength(rdx, rbx); | 5710 EnumLength(rdx, rbx); |
5711 Cmp(rdx, Smi::kZero); | 5711 Cmp(rdx, Smi::FromInt(0)); |
5712 j(not_equal, call_runtime); | 5712 j(not_equal, call_runtime); |
5713 | 5713 |
5714 bind(&start); | 5714 bind(&start); |
5715 | 5715 |
5716 // Check that there are no elements. Register rcx contains the current JS | 5716 // Check that there are no elements. Register rcx contains the current JS |
5717 // object we've reached through the prototype chain. | 5717 // object we've reached through the prototype chain. |
5718 Label no_elements; | 5718 Label no_elements; |
5719 cmpp(empty_fixed_array_value, | 5719 cmpp(empty_fixed_array_value, |
5720 FieldOperand(rcx, JSObject::kElementsOffset)); | 5720 FieldOperand(rcx, JSObject::kElementsOffset)); |
5721 j(equal, &no_elements); | 5721 j(equal, &no_elements); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5822 movl(rax, dividend); | 5822 movl(rax, dividend); |
5823 shrl(rax, Immediate(31)); | 5823 shrl(rax, Immediate(31)); |
5824 addl(rdx, rax); | 5824 addl(rdx, rax); |
5825 } | 5825 } |
5826 | 5826 |
5827 | 5827 |
5828 } // namespace internal | 5828 } // namespace internal |
5829 } // namespace v8 | 5829 } // namespace v8 |
5830 | 5830 |
5831 #endif // V8_TARGET_ARCH_X64 | 5831 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |