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_X87 | 5 #if V8_TARGET_ARCH_X87 |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 2421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2432 } | 2432 } |
2433 | 2433 |
2434 if (expected.Contains(ToBooleanStub::SYMBOL)) { | 2434 if (expected.Contains(ToBooleanStub::SYMBOL)) { |
2435 // Symbol value -> true. | 2435 // Symbol value -> true. |
2436 __ CmpInstanceType(map, SYMBOL_TYPE); | 2436 __ CmpInstanceType(map, SYMBOL_TYPE); |
2437 __ j(equal, instr->TrueLabel(chunk_)); | 2437 __ j(equal, instr->TrueLabel(chunk_)); |
2438 } | 2438 } |
2439 | 2439 |
2440 if (expected.Contains(ToBooleanStub::SIMD_VALUE)) { | 2440 if (expected.Contains(ToBooleanStub::SIMD_VALUE)) { |
2441 // SIMD value -> true. | 2441 // SIMD value -> true. |
2442 Label not_simd; | 2442 __ CmpInstanceType(map, SIMD128_VALUE_TYPE); |
2443 __ CmpInstanceType(map, FIRST_SIMD_VALUE_TYPE); | 2443 __ j(equal, instr->TrueLabel(chunk_)); |
2444 __ j(less, ¬_simd, Label::kNear); | |
2445 __ CmpInstanceType(map, LAST_SIMD_VALUE_TYPE); | |
2446 __ j(less_equal, instr->TrueLabel(chunk_)); | |
2447 __ bind(¬_simd); | |
2448 } | 2444 } |
2449 | 2445 |
2450 if (expected.Contains(ToBooleanStub::HEAP_NUMBER)) { | 2446 if (expected.Contains(ToBooleanStub::HEAP_NUMBER)) { |
2451 // heap number -> false iff +0, -0, or NaN. | 2447 // heap number -> false iff +0, -0, or NaN. |
2452 Label not_heap_number; | 2448 Label not_heap_number; |
2453 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), | 2449 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), |
2454 factory()->heap_number_map()); | 2450 factory()->heap_number_map()); |
2455 __ j(not_equal, ¬_heap_number, Label::kNear); | 2451 __ j(not_equal, ¬_heap_number, Label::kNear); |
2456 __ fldz(); | 2452 __ fldz(); |
2457 __ fld_d(FieldOperand(reg, HeapNumber::kValueOffset)); | 2453 __ fld_d(FieldOperand(reg, HeapNumber::kValueOffset)); |
(...skipping 3685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6143 __ j(equal, true_label, true_distance); | 6139 __ j(equal, true_label, true_distance); |
6144 __ CmpObjectType(input, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, input); | 6140 __ CmpObjectType(input, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, input); |
6145 __ j(below, false_label, false_distance); | 6141 __ j(below, false_label, false_distance); |
6146 __ CmpInstanceType(input, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); | 6142 __ CmpInstanceType(input, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); |
6147 __ j(above, false_label, false_distance); | 6143 __ j(above, false_label, false_distance); |
6148 // Check for undetectable objects => false. | 6144 // Check for undetectable objects => false. |
6149 __ test_b(FieldOperand(input, Map::kBitFieldOffset), | 6145 __ test_b(FieldOperand(input, Map::kBitFieldOffset), |
6150 1 << Map::kIsUndetectable); | 6146 1 << Map::kIsUndetectable); |
6151 final_branch_condition = zero; | 6147 final_branch_condition = zero; |
6152 | 6148 |
6153 } else if (String::Equals(type_name, factory()->float32x4_string())) { | 6149 // clang-format off |
6154 __ JumpIfSmi(input, false_label, false_distance); | 6150 #define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \ |
6155 __ CmpObjectType(input, FLOAT32X4_TYPE, input); | 6151 } else if (String::Equals(type_name, factory()->type##_string())) { \ |
| 6152 __ JumpIfSmi(input, false_label, false_distance); \ |
| 6153 __ cmp(FieldOperand(input, HeapObject::kMapOffset), \ |
| 6154 factory()->type##_map()); \ |
6156 final_branch_condition = equal; | 6155 final_branch_condition = equal; |
6157 | 6156 SIMD128_TYPES(SIMD128_TYPE) |
6158 } else if (String::Equals(type_name, factory()->int32x4_string())) { | 6157 #undef SIMD128_TYPE |
6159 __ JumpIfSmi(input, false_label, false_distance); | 6158 // clang-format on |
6160 __ CmpObjectType(input, INT32X4_TYPE, input); | |
6161 final_branch_condition = equal; | |
6162 | |
6163 } else if (String::Equals(type_name, factory()->bool32x4_string())) { | |
6164 __ JumpIfSmi(input, false_label, false_distance); | |
6165 __ CmpObjectType(input, BOOL32X4_TYPE, input); | |
6166 final_branch_condition = equal; | |
6167 | |
6168 } else if (String::Equals(type_name, factory()->int16x8_string())) { | |
6169 __ JumpIfSmi(input, false_label, false_distance); | |
6170 __ CmpObjectType(input, INT16X8_TYPE, input); | |
6171 final_branch_condition = equal; | |
6172 | |
6173 } else if (String::Equals(type_name, factory()->bool16x8_string())) { | |
6174 __ JumpIfSmi(input, false_label, false_distance); | |
6175 __ CmpObjectType(input, BOOL16X8_TYPE, input); | |
6176 final_branch_condition = equal; | |
6177 | |
6178 } else if (String::Equals(type_name, factory()->int8x16_string())) { | |
6179 __ JumpIfSmi(input, false_label, false_distance); | |
6180 __ CmpObjectType(input, INT8X16_TYPE, input); | |
6181 final_branch_condition = equal; | |
6182 | |
6183 } else if (String::Equals(type_name, factory()->bool8x16_string())) { | |
6184 __ JumpIfSmi(input, false_label, false_distance); | |
6185 __ CmpObjectType(input, BOOL8X16_TYPE, input); | |
6186 final_branch_condition = equal; | |
6187 | 6159 |
6188 } else { | 6160 } else { |
6189 __ jmp(false_label, false_distance); | 6161 __ jmp(false_label, false_distance); |
6190 } | 6162 } |
6191 return final_branch_condition; | 6163 return final_branch_condition; |
6192 } | 6164 } |
6193 | 6165 |
6194 | 6166 |
6195 void LCodeGen::DoIsConstructCallAndBranch(LIsConstructCallAndBranch* instr) { | 6167 void LCodeGen::DoIsConstructCallAndBranch(LIsConstructCallAndBranch* instr) { |
6196 Register temp = ToRegister(instr->temp()); | 6168 Register temp = ToRegister(instr->temp()); |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6486 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6458 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6487 } | 6459 } |
6488 | 6460 |
6489 | 6461 |
6490 #undef __ | 6462 #undef __ |
6491 | 6463 |
6492 } // namespace internal | 6464 } // namespace internal |
6493 } // namespace v8 | 6465 } // namespace v8 |
6494 | 6466 |
6495 #endif // V8_TARGET_ARCH_X87 | 6467 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |