OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 2197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2208 } | 2208 } |
2209 | 2209 |
2210 if (expected.Contains(ToBooleanStub::SYMBOL)) { | 2210 if (expected.Contains(ToBooleanStub::SYMBOL)) { |
2211 // Symbol value -> true. | 2211 // Symbol value -> true. |
2212 __ CmpInstanceType(map, SYMBOL_TYPE); | 2212 __ CmpInstanceType(map, SYMBOL_TYPE); |
2213 __ j(equal, instr->TrueLabel(chunk_)); | 2213 __ j(equal, instr->TrueLabel(chunk_)); |
2214 } | 2214 } |
2215 | 2215 |
2216 if (expected.Contains(ToBooleanStub::SIMD_VALUE)) { | 2216 if (expected.Contains(ToBooleanStub::SIMD_VALUE)) { |
2217 // SIMD value -> true. | 2217 // SIMD value -> true. |
2218 Label not_simd; | 2218 __ CmpInstanceType(map, SIMD128_VALUE_TYPE); |
2219 __ CmpInstanceType(map, FIRST_SIMD_VALUE_TYPE); | 2219 __ j(equal, instr->TrueLabel(chunk_)); |
2220 __ j(less, ¬_simd, Label::kNear); | |
2221 __ CmpInstanceType(map, LAST_SIMD_VALUE_TYPE); | |
2222 __ j(less_equal, instr->TrueLabel(chunk_)); | |
2223 __ bind(¬_simd); | |
2224 } | 2220 } |
2225 | 2221 |
2226 if (expected.Contains(ToBooleanStub::HEAP_NUMBER)) { | 2222 if (expected.Contains(ToBooleanStub::HEAP_NUMBER)) { |
2227 // heap number -> false iff +0, -0, or NaN. | 2223 // heap number -> false iff +0, -0, or NaN. |
2228 Label not_heap_number; | 2224 Label not_heap_number; |
2229 __ CompareRoot(map, Heap::kHeapNumberMapRootIndex); | 2225 __ CompareRoot(map, Heap::kHeapNumberMapRootIndex); |
2230 __ j(not_equal, ¬_heap_number, Label::kNear); | 2226 __ j(not_equal, ¬_heap_number, Label::kNear); |
2231 XMMRegister xmm_scratch = double_scratch0(); | 2227 XMMRegister xmm_scratch = double_scratch0(); |
2232 __ xorps(xmm_scratch, xmm_scratch); | 2228 __ xorps(xmm_scratch, xmm_scratch); |
2233 __ ucomisd(xmm_scratch, FieldOperand(reg, HeapNumber::kValueOffset)); | 2229 __ ucomisd(xmm_scratch, FieldOperand(reg, HeapNumber::kValueOffset)); |
(...skipping 3507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5741 __ j(equal, true_label, true_distance); | 5737 __ j(equal, true_label, true_distance); |
5742 __ CmpObjectType(input, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, input); | 5738 __ CmpObjectType(input, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, input); |
5743 __ j(below, false_label, false_distance); | 5739 __ j(below, false_label, false_distance); |
5744 __ CmpInstanceType(input, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); | 5740 __ CmpInstanceType(input, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); |
5745 __ j(above, false_label, false_distance); | 5741 __ j(above, false_label, false_distance); |
5746 // Check for undetectable objects => false. | 5742 // Check for undetectable objects => false. |
5747 __ testb(FieldOperand(input, Map::kBitFieldOffset), | 5743 __ testb(FieldOperand(input, Map::kBitFieldOffset), |
5748 Immediate(1 << Map::kIsUndetectable)); | 5744 Immediate(1 << Map::kIsUndetectable)); |
5749 final_branch_condition = zero; | 5745 final_branch_condition = zero; |
5750 | 5746 |
5751 } else if (String::Equals(type_name, factory->float32x4_string())) { | 5747 // clang-format off |
5752 __ JumpIfSmi(input, false_label, false_distance); | 5748 #define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \ |
5753 __ CmpObjectType(input, FLOAT32X4_TYPE, input); | 5749 } else if (String::Equals(type_name, factory->type##_string())) { \ |
| 5750 __ JumpIfSmi(input, false_label, false_distance); \ |
| 5751 __ movp(input, FieldOperand(input, HeapObject::kMapOffset)); \ |
| 5752 __ CompareRoot(input, Heap::k##Type##MapRootIndex); \ |
5754 final_branch_condition = equal; | 5753 final_branch_condition = equal; |
5755 | 5754 SIMD128_TYPES(SIMD128_TYPE) |
5756 } else if (String::Equals(type_name, factory->int32x4_string())) { | 5755 #undef SIMD128_TYPE |
5757 __ JumpIfSmi(input, false_label, false_distance); | 5756 // clang-format on |
5758 __ CmpObjectType(input, INT32X4_TYPE, input); | |
5759 final_branch_condition = equal; | |
5760 | |
5761 } else if (String::Equals(type_name, factory->bool32x4_string())) { | |
5762 __ JumpIfSmi(input, false_label, false_distance); | |
5763 __ CmpObjectType(input, BOOL32X4_TYPE, input); | |
5764 final_branch_condition = equal; | |
5765 | |
5766 } else if (String::Equals(type_name, factory->int16x8_string())) { | |
5767 __ JumpIfSmi(input, false_label, false_distance); | |
5768 __ CmpObjectType(input, INT16X8_TYPE, input); | |
5769 final_branch_condition = equal; | |
5770 | |
5771 } else if (String::Equals(type_name, factory->bool16x8_string())) { | |
5772 __ JumpIfSmi(input, false_label, false_distance); | |
5773 __ CmpObjectType(input, BOOL16X8_TYPE, input); | |
5774 final_branch_condition = equal; | |
5775 | |
5776 } else if (String::Equals(type_name, factory->int8x16_string())) { | |
5777 __ JumpIfSmi(input, false_label, false_distance); | |
5778 __ CmpObjectType(input, INT8X16_TYPE, input); | |
5779 final_branch_condition = equal; | |
5780 | |
5781 } else if (String::Equals(type_name, factory->bool8x16_string())) { | |
5782 __ JumpIfSmi(input, false_label, false_distance); | |
5783 __ CmpObjectType(input, BOOL8X16_TYPE, input); | |
5784 final_branch_condition = equal; | |
5785 | 5757 |
5786 } else { | 5758 } else { |
5787 __ jmp(false_label, false_distance); | 5759 __ jmp(false_label, false_distance); |
5788 } | 5760 } |
5789 | 5761 |
5790 return final_branch_condition; | 5762 return final_branch_condition; |
5791 } | 5763 } |
5792 | 5764 |
5793 | 5765 |
5794 void LCodeGen::DoIsConstructCallAndBranch(LIsConstructCallAndBranch* instr) { | 5766 void LCodeGen::DoIsConstructCallAndBranch(LIsConstructCallAndBranch* instr) { |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6080 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6052 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6081 } | 6053 } |
6082 | 6054 |
6083 | 6055 |
6084 #undef __ | 6056 #undef __ |
6085 | 6057 |
6086 } // namespace internal | 6058 } // namespace internal |
6087 } // namespace v8 | 6059 } // namespace v8 |
6088 | 6060 |
6089 #endif // V8_TARGET_ARCH_X64 | 6061 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |