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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
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 2152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2163 } | 2163 } |
2164 | 2164 |
2165 if (expected.Contains(ToBooleanStub::SYMBOL)) { | 2165 if (expected.Contains(ToBooleanStub::SYMBOL)) { |
2166 // Symbol value -> true. | 2166 // Symbol value -> true. |
2167 __ CmpInstanceType(map, SYMBOL_TYPE); | 2167 __ CmpInstanceType(map, SYMBOL_TYPE); |
2168 __ j(equal, instr->TrueLabel(chunk_)); | 2168 __ j(equal, instr->TrueLabel(chunk_)); |
2169 } | 2169 } |
2170 | 2170 |
2171 if (expected.Contains(ToBooleanStub::SIMD_VALUE)) { | 2171 if (expected.Contains(ToBooleanStub::SIMD_VALUE)) { |
2172 // SIMD value -> true. | 2172 // SIMD value -> true. |
2173 Label not_simd; | 2173 __ CmpInstanceType(map, SIMD128_VALUE_TYPE); |
2174 __ CmpInstanceType(map, FIRST_SIMD_VALUE_TYPE); | 2174 __ j(equal, instr->TrueLabel(chunk_)); |
2175 __ j(less, ¬_simd, Label::kNear); | |
2176 __ CmpInstanceType(map, LAST_SIMD_VALUE_TYPE); | |
2177 __ j(less_equal, instr->TrueLabel(chunk_)); | |
2178 __ bind(¬_simd); | |
2179 } | 2175 } |
2180 | 2176 |
2181 if (expected.Contains(ToBooleanStub::HEAP_NUMBER)) { | 2177 if (expected.Contains(ToBooleanStub::HEAP_NUMBER)) { |
2182 // heap number -> false iff +0, -0, or NaN. | 2178 // heap number -> false iff +0, -0, or NaN. |
2183 Label not_heap_number; | 2179 Label not_heap_number; |
2184 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), | 2180 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), |
2185 factory()->heap_number_map()); | 2181 factory()->heap_number_map()); |
2186 __ j(not_equal, ¬_heap_number, Label::kNear); | 2182 __ j(not_equal, ¬_heap_number, Label::kNear); |
2187 XMMRegister xmm_scratch = double_scratch0(); | 2183 XMMRegister xmm_scratch = double_scratch0(); |
2188 __ xorps(xmm_scratch, xmm_scratch); | 2184 __ xorps(xmm_scratch, xmm_scratch); |
(...skipping 3347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5536 __ j(equal, true_label, true_distance); | 5532 __ j(equal, true_label, true_distance); |
5537 __ CmpObjectType(input, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, input); | 5533 __ CmpObjectType(input, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, input); |
5538 __ j(below, false_label, false_distance); | 5534 __ j(below, false_label, false_distance); |
5539 __ CmpInstanceType(input, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); | 5535 __ CmpInstanceType(input, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); |
5540 __ j(above, false_label, false_distance); | 5536 __ j(above, false_label, false_distance); |
5541 // Check for undetectable objects => false. | 5537 // Check for undetectable objects => false. |
5542 __ test_b(FieldOperand(input, Map::kBitFieldOffset), | 5538 __ test_b(FieldOperand(input, Map::kBitFieldOffset), |
5543 1 << Map::kIsUndetectable); | 5539 1 << Map::kIsUndetectable); |
5544 final_branch_condition = zero; | 5540 final_branch_condition = zero; |
5545 | 5541 |
5546 } else if (String::Equals(type_name, factory()->float32x4_string())) { | 5542 // clang-format off |
5547 __ JumpIfSmi(input, false_label, false_distance); | 5543 #define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \ |
5548 __ CmpObjectType(input, FLOAT32X4_TYPE, input); | 5544 } else if (String::Equals(type_name, factory()->type##_string())) { \ |
| 5545 __ JumpIfSmi(input, false_label, false_distance); \ |
| 5546 __ cmp(FieldOperand(input, HeapObject::kMapOffset), \ |
| 5547 factory()->type##_map()); \ |
5549 final_branch_condition = equal; | 5548 final_branch_condition = equal; |
5550 | 5549 SIMD128_TYPES(SIMD128_TYPE) |
5551 } else if (String::Equals(type_name, factory()->int32x4_string())) { | 5550 #undef SIMD128_TYPE |
5552 __ JumpIfSmi(input, false_label, false_distance); | 5551 // clang-format on |
5553 __ CmpObjectType(input, INT32X4_TYPE, input); | |
5554 final_branch_condition = equal; | |
5555 | |
5556 } else if (String::Equals(type_name, factory()->bool32x4_string())) { | |
5557 __ JumpIfSmi(input, false_label, false_distance); | |
5558 __ CmpObjectType(input, BOOL32X4_TYPE, input); | |
5559 final_branch_condition = equal; | |
5560 | |
5561 } else if (String::Equals(type_name, factory()->int16x8_string())) { | |
5562 __ JumpIfSmi(input, false_label, false_distance); | |
5563 __ CmpObjectType(input, INT16X8_TYPE, input); | |
5564 final_branch_condition = equal; | |
5565 | |
5566 } else if (String::Equals(type_name, factory()->bool16x8_string())) { | |
5567 __ JumpIfSmi(input, false_label, false_distance); | |
5568 __ CmpObjectType(input, BOOL16X8_TYPE, input); | |
5569 final_branch_condition = equal; | |
5570 | |
5571 } else if (String::Equals(type_name, factory()->int8x16_string())) { | |
5572 __ JumpIfSmi(input, false_label, false_distance); | |
5573 __ CmpObjectType(input, INT8X16_TYPE, input); | |
5574 final_branch_condition = equal; | |
5575 | |
5576 } else if (String::Equals(type_name, factory()->bool8x16_string())) { | |
5577 __ JumpIfSmi(input, false_label, false_distance); | |
5578 __ CmpObjectType(input, BOOL8X16_TYPE, input); | |
5579 final_branch_condition = equal; | |
5580 | 5552 |
5581 } else { | 5553 } else { |
5582 __ jmp(false_label, false_distance); | 5554 __ jmp(false_label, false_distance); |
5583 } | 5555 } |
5584 return final_branch_condition; | 5556 return final_branch_condition; |
5585 } | 5557 } |
5586 | 5558 |
5587 | 5559 |
5588 void LCodeGen::DoIsConstructCallAndBranch(LIsConstructCallAndBranch* instr) { | 5560 void LCodeGen::DoIsConstructCallAndBranch(LIsConstructCallAndBranch* instr) { |
5589 Register temp = ToRegister(instr->temp()); | 5561 Register temp = ToRegister(instr->temp()); |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5876 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5848 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5877 } | 5849 } |
5878 | 5850 |
5879 | 5851 |
5880 #undef __ | 5852 #undef __ |
5881 | 5853 |
5882 } // namespace internal | 5854 } // namespace internal |
5883 } // namespace v8 | 5855 } // namespace v8 |
5884 | 5856 |
5885 #endif // V8_TARGET_ARCH_IA32 | 5857 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |