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 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/cpu-profiler.h" | 9 #include "src/cpu-profiler.h" |
10 #include "src/hydrogen-osr.h" | 10 #include "src/hydrogen-osr.h" |
(...skipping 2266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2277 | 2277 |
2278 if (expected.Contains(ToBooleanStub::SYMBOL)) { | 2278 if (expected.Contains(ToBooleanStub::SYMBOL)) { |
2279 // Symbol value -> true. | 2279 // Symbol value -> true. |
2280 const Register scratch = scratch1(); | 2280 const Register scratch = scratch1(); |
2281 __ lbu(scratch, FieldMemOperand(map, Map::kInstanceTypeOffset)); | 2281 __ lbu(scratch, FieldMemOperand(map, Map::kInstanceTypeOffset)); |
2282 __ Branch(instr->TrueLabel(chunk_), eq, scratch, Operand(SYMBOL_TYPE)); | 2282 __ Branch(instr->TrueLabel(chunk_), eq, scratch, Operand(SYMBOL_TYPE)); |
2283 } | 2283 } |
2284 | 2284 |
2285 if (expected.Contains(ToBooleanStub::SIMD_VALUE)) { | 2285 if (expected.Contains(ToBooleanStub::SIMD_VALUE)) { |
2286 // SIMD value -> true. | 2286 // SIMD value -> true. |
2287 Label not_simd; | |
2288 const Register scratch = scratch1(); | 2287 const Register scratch = scratch1(); |
2289 __ lbu(scratch, FieldMemOperand(map, Map::kInstanceTypeOffset)); | 2288 __ lbu(scratch, FieldMemOperand(map, Map::kInstanceTypeOffset)); |
2290 __ Branch(¬_simd, lt, scratch, Operand(FIRST_SIMD_VALUE_TYPE)); | 2289 __ Branch(instr->TrueLabel(chunk_), eq, scratch, |
2291 __ Branch(instr->TrueLabel(chunk_), le, scratch, | 2290 Operand(SIMD128_VALUE_TYPE)); |
2292 Operand(LAST_SIMD_VALUE_TYPE)); | |
2293 __ bind(¬_simd); | |
2294 } | 2291 } |
2295 | 2292 |
2296 if (expected.Contains(ToBooleanStub::HEAP_NUMBER)) { | 2293 if (expected.Contains(ToBooleanStub::HEAP_NUMBER)) { |
2297 // heap number -> false iff +0, -0, or NaN. | 2294 // heap number -> false iff +0, -0, or NaN. |
2298 DoubleRegister dbl_scratch = double_scratch0(); | 2295 DoubleRegister dbl_scratch = double_scratch0(); |
2299 Label not_heap_number; | 2296 Label not_heap_number; |
2300 __ LoadRoot(at, Heap::kHeapNumberMapRootIndex); | 2297 __ LoadRoot(at, Heap::kHeapNumberMapRootIndex); |
2301 __ Branch(¬_heap_number, ne, map, Operand(at)); | 2298 __ Branch(¬_heap_number, ne, map, Operand(at)); |
2302 __ ldc1(dbl_scratch, FieldMemOperand(reg, HeapNumber::kValueOffset)); | 2299 __ ldc1(dbl_scratch, FieldMemOperand(reg, HeapNumber::kValueOffset)); |
2303 __ BranchF(instr->TrueLabel(chunk_), instr->FalseLabel(chunk_), | 2300 __ BranchF(instr->TrueLabel(chunk_), instr->FalseLabel(chunk_), |
(...skipping 3567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5871 *cmp2 = Operand(zero_reg); | 5868 *cmp2 = Operand(zero_reg); |
5872 final_branch_condition = eq; | 5869 final_branch_condition = eq; |
5873 | 5870 |
5874 } else if (String::Equals(type_name, factory->symbol_string())) { | 5871 } else if (String::Equals(type_name, factory->symbol_string())) { |
5875 __ JumpIfSmi(input, false_label); | 5872 __ JumpIfSmi(input, false_label); |
5876 __ GetObjectType(input, input, scratch); | 5873 __ GetObjectType(input, input, scratch); |
5877 *cmp1 = scratch; | 5874 *cmp1 = scratch; |
5878 *cmp2 = Operand(SYMBOL_TYPE); | 5875 *cmp2 = Operand(SYMBOL_TYPE); |
5879 final_branch_condition = eq; | 5876 final_branch_condition = eq; |
5880 | 5877 |
5881 } else if (String::Equals(type_name, factory->float32x4_string())) { | |
5882 __ JumpIfSmi(input, false_label); | |
5883 __ GetObjectType(input, input, scratch); | |
5884 *cmp1 = scratch; | |
5885 *cmp2 = Operand(FLOAT32X4_TYPE); | |
5886 final_branch_condition = eq; | |
5887 | |
5888 } else if (String::Equals(type_name, factory->int32x4_string())) { | |
5889 __ JumpIfSmi(input, false_label); | |
5890 __ GetObjectType(input, input, scratch); | |
5891 *cmp1 = scratch; | |
5892 *cmp2 = Operand(INT32X4_TYPE); | |
5893 final_branch_condition = eq; | |
5894 | |
5895 } else if (String::Equals(type_name, factory->bool32x4_string())) { | |
5896 __ JumpIfSmi(input, false_label); | |
5897 __ GetObjectType(input, input, scratch); | |
5898 *cmp1 = scratch; | |
5899 *cmp2 = Operand(BOOL32X4_TYPE); | |
5900 final_branch_condition = eq; | |
5901 | |
5902 } else if (String::Equals(type_name, factory->int16x8_string())) { | |
5903 __ JumpIfSmi(input, false_label); | |
5904 __ GetObjectType(input, input, scratch); | |
5905 *cmp1 = scratch; | |
5906 *cmp2 = Operand(INT16X8_TYPE); | |
5907 final_branch_condition = eq; | |
5908 | |
5909 } else if (String::Equals(type_name, factory->bool16x8_string())) { | |
5910 __ JumpIfSmi(input, false_label); | |
5911 __ GetObjectType(input, input, scratch); | |
5912 *cmp1 = scratch; | |
5913 *cmp2 = Operand(BOOL16X8_TYPE); | |
5914 final_branch_condition = eq; | |
5915 | |
5916 } else if (String::Equals(type_name, factory->int8x16_string())) { | |
5917 __ JumpIfSmi(input, false_label); | |
5918 __ GetObjectType(input, input, scratch); | |
5919 *cmp1 = scratch; | |
5920 *cmp2 = Operand(INT8X16_TYPE); | |
5921 final_branch_condition = eq; | |
5922 | |
5923 } else if (String::Equals(type_name, factory->bool8x16_string())) { | |
5924 __ JumpIfSmi(input, false_label); | |
5925 __ GetObjectType(input, input, scratch); | |
5926 *cmp1 = scratch; | |
5927 *cmp2 = Operand(BOOL8X16_TYPE); | |
5928 final_branch_condition = eq; | |
5929 | |
5930 } else if (String::Equals(type_name, factory->boolean_string())) { | 5878 } else if (String::Equals(type_name, factory->boolean_string())) { |
5931 __ LoadRoot(at, Heap::kTrueValueRootIndex); | 5879 __ LoadRoot(at, Heap::kTrueValueRootIndex); |
5932 __ Branch(USE_DELAY_SLOT, true_label, eq, at, Operand(input)); | 5880 __ Branch(USE_DELAY_SLOT, true_label, eq, at, Operand(input)); |
5933 __ LoadRoot(at, Heap::kFalseValueRootIndex); | 5881 __ LoadRoot(at, Heap::kFalseValueRootIndex); |
5934 *cmp1 = at; | 5882 *cmp1 = at; |
5935 *cmp2 = Operand(input); | 5883 *cmp2 = Operand(input); |
5936 final_branch_condition = eq; | 5884 final_branch_condition = eq; |
5937 | 5885 |
5938 } else if (String::Equals(type_name, factory->undefined_string())) { | 5886 } else if (String::Equals(type_name, factory->undefined_string())) { |
5939 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | 5887 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
(...skipping 29 matching lines...) Expand all Loading... |
5969 __ Branch(USE_DELAY_SLOT, false_label, | 5917 __ Branch(USE_DELAY_SLOT, false_label, |
5970 gt, scratch, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 5918 gt, scratch, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
5971 // map is still valid, so the BitField can be loaded in delay slot. | 5919 // map is still valid, so the BitField can be loaded in delay slot. |
5972 // Check for undetectable objects => false. | 5920 // Check for undetectable objects => false. |
5973 __ lbu(at, FieldMemOperand(map, Map::kBitFieldOffset)); | 5921 __ lbu(at, FieldMemOperand(map, Map::kBitFieldOffset)); |
5974 __ And(at, at, 1 << Map::kIsUndetectable); | 5922 __ And(at, at, 1 << Map::kIsUndetectable); |
5975 *cmp1 = at; | 5923 *cmp1 = at; |
5976 *cmp2 = Operand(zero_reg); | 5924 *cmp2 = Operand(zero_reg); |
5977 final_branch_condition = eq; | 5925 final_branch_condition = eq; |
5978 | 5926 |
| 5927 // clang-format off |
| 5928 #define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \ |
| 5929 } else if (String::Equals(type_name, factory->type##_string())) { \ |
| 5930 __ JumpIfSmi(input, false_label); \ |
| 5931 __ ld(input, FieldMemOperand(input, HeapObject::kMapOffset)); \ |
| 5932 __ LoadRoot(at, Heap::k##Type##MapRootIndex); \ |
| 5933 *cmp1 = input; \ |
| 5934 *cmp2 = Operand(at); \ |
| 5935 final_branch_condition = eq; |
| 5936 SIMD128_TYPES(SIMD128_TYPE) |
| 5937 #undef SIMD128_TYPE |
| 5938 // clang-format on |
| 5939 |
| 5940 |
5979 } else { | 5941 } else { |
5980 *cmp1 = at; | 5942 *cmp1 = at; |
5981 *cmp2 = Operand(zero_reg); // Set to valid regs, to avoid caller assertion. | 5943 *cmp2 = Operand(zero_reg); // Set to valid regs, to avoid caller assertion. |
5982 __ Branch(false_label); | 5944 __ Branch(false_label); |
5983 } | 5945 } |
5984 | 5946 |
5985 return final_branch_condition; | 5947 return final_branch_condition; |
5986 } | 5948 } |
5987 | 5949 |
5988 | 5950 |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6286 __ Push(at, ToRegister(instr->function())); | 6248 __ Push(at, ToRegister(instr->function())); |
6287 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6249 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6288 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6250 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6289 } | 6251 } |
6290 | 6252 |
6291 | 6253 |
6292 #undef __ | 6254 #undef __ |
6293 | 6255 |
6294 } // namespace internal | 6256 } // namespace internal |
6295 } // namespace v8 | 6257 } // namespace v8 |
OLD | NEW |