| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/base/bits.h" | 5 #include "src/base/bits.h" |
| 6 #include "src/code-factory.h" | 6 #include "src/code-factory.h" |
| 7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
| 8 #include "src/cpu-profiler.h" | 8 #include "src/cpu-profiler.h" |
| 9 #include "src/hydrogen-osr.h" | 9 #include "src/hydrogen-osr.h" |
| 10 #include "src/ic/ic.h" | 10 #include "src/ic/ic.h" |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 LOperand* value = environment->values()->at(env_offset + i); | 605 LOperand* value = environment->values()->at(env_offset + i); |
| 606 AddToTranslation(environment, translation, value, | 606 AddToTranslation(environment, translation, value, |
| 607 environment->HasTaggedValueAt(env_offset + i), | 607 environment->HasTaggedValueAt(env_offset + i), |
| 608 environment->HasUint32ValueAt(env_offset + i), | 608 environment->HasUint32ValueAt(env_offset + i), |
| 609 object_index_pointer, dematerialized_index_pointer); | 609 object_index_pointer, dematerialized_index_pointer); |
| 610 } | 610 } |
| 611 return; | 611 return; |
| 612 } | 612 } |
| 613 | 613 |
| 614 if (op->IsStackSlot()) { | 614 if (op->IsStackSlot()) { |
| 615 int index = op->index(); |
| 616 if (index >= 0) { |
| 617 index += StandardFrameConstants::kFixedFrameSize / kPointerSize; |
| 618 } |
| 615 if (is_tagged) { | 619 if (is_tagged) { |
| 616 translation->StoreStackSlot(op->index()); | 620 translation->StoreStackSlot(index); |
| 617 } else if (is_uint32) { | 621 } else if (is_uint32) { |
| 618 translation->StoreUint32StackSlot(op->index()); | 622 translation->StoreUint32StackSlot(index); |
| 619 } else { | 623 } else { |
| 620 translation->StoreInt32StackSlot(op->index()); | 624 translation->StoreInt32StackSlot(index); |
| 621 } | 625 } |
| 622 } else if (op->IsDoubleStackSlot()) { | 626 } else if (op->IsDoubleStackSlot()) { |
| 623 translation->StoreDoubleStackSlot(op->index()); | 627 int index = op->index(); |
| 628 if (index >= 0) { |
| 629 index += StandardFrameConstants::kFixedFrameSize / kPointerSize; |
| 630 } |
| 631 translation->StoreDoubleStackSlot(index); |
| 624 } else if (op->IsRegister()) { | 632 } else if (op->IsRegister()) { |
| 625 Register reg = ToRegister(op); | 633 Register reg = ToRegister(op); |
| 626 if (is_tagged) { | 634 if (is_tagged) { |
| 627 translation->StoreRegister(reg); | 635 translation->StoreRegister(reg); |
| 628 } else if (is_uint32) { | 636 } else if (is_uint32) { |
| 629 translation->StoreUint32Register(reg); | 637 translation->StoreUint32Register(reg); |
| 630 } else { | 638 } else { |
| 631 translation->StoreInt32Register(reg); | 639 translation->StoreInt32Register(reg); |
| 632 } | 640 } |
| 633 } else if (op->IsDoubleRegister()) { | 641 } else if (op->IsDoubleRegister()) { |
| (...skipping 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2299 | 2307 |
| 2300 if (expected.Contains(ToBooleanStub::SYMBOL)) { | 2308 if (expected.Contains(ToBooleanStub::SYMBOL)) { |
| 2301 // Symbol value -> true. | 2309 // Symbol value -> true. |
| 2302 __ CompareInstanceType(map, ip, SYMBOL_TYPE); | 2310 __ CompareInstanceType(map, ip, SYMBOL_TYPE); |
| 2303 __ beq(instr->TrueLabel(chunk_)); | 2311 __ beq(instr->TrueLabel(chunk_)); |
| 2304 } | 2312 } |
| 2305 | 2313 |
| 2306 if (expected.Contains(ToBooleanStub::SIMD_VALUE)) { | 2314 if (expected.Contains(ToBooleanStub::SIMD_VALUE)) { |
| 2307 // SIMD value -> true. | 2315 // SIMD value -> true. |
| 2308 Label not_simd; | 2316 Label not_simd; |
| 2309 __ CompareInstanceType(map, ip, FIRST_SIMD_VALUE_TYPE); | 2317 __ CompareInstanceType(map, ip, SIMD128_VALUE_TYPE); |
| 2310 __ blt(¬_simd); | 2318 __ beq(instr->TrueLabel(chunk_)); |
| 2311 __ CompareInstanceType(map, ip, LAST_SIMD_VALUE_TYPE); | |
| 2312 __ ble(instr->TrueLabel(chunk_)); | |
| 2313 __ bind(¬_simd); | |
| 2314 } | 2319 } |
| 2315 | 2320 |
| 2316 if (expected.Contains(ToBooleanStub::HEAP_NUMBER)) { | 2321 if (expected.Contains(ToBooleanStub::HEAP_NUMBER)) { |
| 2317 // heap number -> false iff +0, -0, or NaN. | 2322 // heap number -> false iff +0, -0, or NaN. |
| 2318 Label not_heap_number; | 2323 Label not_heap_number; |
| 2319 __ CompareRoot(map, Heap::kHeapNumberMapRootIndex); | 2324 __ CompareRoot(map, Heap::kHeapNumberMapRootIndex); |
| 2320 __ bne(¬_heap_number); | 2325 __ bne(¬_heap_number); |
| 2321 __ lfd(dbl_scratch, FieldMemOperand(reg, HeapNumber::kValueOffset)); | 2326 __ lfd(dbl_scratch, FieldMemOperand(reg, HeapNumber::kValueOffset)); |
| 2322 // Test the double value. Zero and NaN are false. | 2327 // Test the double value. Zero and NaN are false. |
| 2323 __ fcmpu(dbl_scratch, kDoubleRegZero, cr7); | 2328 __ fcmpu(dbl_scratch, kDoubleRegZero, cr7); |
| (...skipping 3608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5932 Factory* factory = isolate()->factory(); | 5937 Factory* factory = isolate()->factory(); |
| 5933 if (String::Equals(type_name, factory->number_string())) { | 5938 if (String::Equals(type_name, factory->number_string())) { |
| 5934 __ JumpIfSmi(input, true_label); | 5939 __ JumpIfSmi(input, true_label); |
| 5935 __ LoadP(scratch, FieldMemOperand(input, HeapObject::kMapOffset)); | 5940 __ LoadP(scratch, FieldMemOperand(input, HeapObject::kMapOffset)); |
| 5936 __ CompareRoot(scratch, Heap::kHeapNumberMapRootIndex); | 5941 __ CompareRoot(scratch, Heap::kHeapNumberMapRootIndex); |
| 5937 final_branch_condition = eq; | 5942 final_branch_condition = eq; |
| 5938 | 5943 |
| 5939 } else if (String::Equals(type_name, factory->string_string())) { | 5944 } else if (String::Equals(type_name, factory->string_string())) { |
| 5940 __ JumpIfSmi(input, false_label); | 5945 __ JumpIfSmi(input, false_label); |
| 5941 __ CompareObjectType(input, scratch, no_reg, FIRST_NONSTRING_TYPE); | 5946 __ CompareObjectType(input, scratch, no_reg, FIRST_NONSTRING_TYPE); |
| 5942 __ bge(false_label); | 5947 final_branch_condition = lt; |
| 5943 __ lbz(scratch, FieldMemOperand(scratch, Map::kBitFieldOffset)); | |
| 5944 __ ExtractBit(r0, scratch, Map::kIsUndetectable); | |
| 5945 __ cmpi(r0, Operand::Zero()); | |
| 5946 final_branch_condition = eq; | |
| 5947 | 5948 |
| 5948 } else if (String::Equals(type_name, factory->symbol_string())) { | 5949 } else if (String::Equals(type_name, factory->symbol_string())) { |
| 5949 __ JumpIfSmi(input, false_label); | 5950 __ JumpIfSmi(input, false_label); |
| 5950 __ CompareObjectType(input, scratch, no_reg, SYMBOL_TYPE); | 5951 __ CompareObjectType(input, scratch, no_reg, SYMBOL_TYPE); |
| 5951 final_branch_condition = eq; | 5952 final_branch_condition = eq; |
| 5952 | 5953 |
| 5953 } else if (String::Equals(type_name, factory->boolean_string())) { | 5954 } else if (String::Equals(type_name, factory->boolean_string())) { |
| 5954 __ CompareRoot(input, Heap::kTrueValueRootIndex); | 5955 __ CompareRoot(input, Heap::kTrueValueRootIndex); |
| 5955 __ beq(true_label); | 5956 __ beq(true_label); |
| 5956 __ CompareRoot(input, Heap::kFalseValueRootIndex); | 5957 __ CompareRoot(input, Heap::kFalseValueRootIndex); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 5982 __ CompareRoot(input, Heap::kNullValueRootIndex); | 5983 __ CompareRoot(input, Heap::kNullValueRootIndex); |
| 5983 __ beq(true_label); | 5984 __ beq(true_label); |
| 5984 __ CheckObjectTypeRange(input, map, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, | 5985 __ CheckObjectTypeRange(input, map, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, |
| 5985 LAST_NONCALLABLE_SPEC_OBJECT_TYPE, false_label); | 5986 LAST_NONCALLABLE_SPEC_OBJECT_TYPE, false_label); |
| 5986 // Check for undetectable objects => false. | 5987 // Check for undetectable objects => false. |
| 5987 __ lbz(scratch, FieldMemOperand(map, Map::kBitFieldOffset)); | 5988 __ lbz(scratch, FieldMemOperand(map, Map::kBitFieldOffset)); |
| 5988 __ ExtractBit(r0, scratch, Map::kIsUndetectable); | 5989 __ ExtractBit(r0, scratch, Map::kIsUndetectable); |
| 5989 __ cmpi(r0, Operand::Zero()); | 5990 __ cmpi(r0, Operand::Zero()); |
| 5990 final_branch_condition = eq; | 5991 final_branch_condition = eq; |
| 5991 | 5992 |
| 5992 } else if (String::Equals(type_name, factory->float32x4_string())) { | 5993 // clang-format off |
| 5993 __ JumpIfSmi(input, false_label); | 5994 #define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \ |
| 5994 __ CompareObjectType(input, scratch, no_reg, FLOAT32X4_TYPE); | 5995 } else if (String::Equals(type_name, factory->type##_string())) { \ |
| 5996 __ JumpIfSmi(input, false_label); \ |
| 5997 __ LoadP(scratch, FieldMemOperand(input, HeapObject::kMapOffset)); \ |
| 5998 __ CompareRoot(scratch, Heap::k##Type##MapRootIndex); \ |
| 5995 final_branch_condition = eq; | 5999 final_branch_condition = eq; |
| 5996 | 6000 SIMD128_TYPES(SIMD128_TYPE) |
| 5997 } else if (String::Equals(type_name, factory->int32x4_string())) { | 6001 #undef SIMD128_TYPE |
| 5998 __ JumpIfSmi(input, false_label); | 6002 // clang-format on |
| 5999 __ CompareObjectType(input, scratch, no_reg, INT32X4_TYPE); | |
| 6000 final_branch_condition = eq; | |
| 6001 | |
| 6002 } else if (String::Equals(type_name, factory->bool32x4_string())) { | |
| 6003 __ JumpIfSmi(input, false_label); | |
| 6004 __ CompareObjectType(input, scratch, no_reg, BOOL32X4_TYPE); | |
| 6005 final_branch_condition = eq; | |
| 6006 | |
| 6007 } else if (String::Equals(type_name, factory->int16x8_string())) { | |
| 6008 __ JumpIfSmi(input, false_label); | |
| 6009 __ CompareObjectType(input, scratch, no_reg, INT16X8_TYPE); | |
| 6010 final_branch_condition = eq; | |
| 6011 | |
| 6012 } else if (String::Equals(type_name, factory->bool16x8_string())) { | |
| 6013 __ JumpIfSmi(input, false_label); | |
| 6014 __ CompareObjectType(input, scratch, no_reg, BOOL16X8_TYPE); | |
| 6015 final_branch_condition = eq; | |
| 6016 | |
| 6017 } else if (String::Equals(type_name, factory->int8x16_string())) { | |
| 6018 __ JumpIfSmi(input, false_label); | |
| 6019 __ CompareObjectType(input, scratch, no_reg, INT8X16_TYPE); | |
| 6020 final_branch_condition = eq; | |
| 6021 | |
| 6022 } else if (String::Equals(type_name, factory->bool8x16_string())) { | |
| 6023 __ JumpIfSmi(input, false_label); | |
| 6024 __ CompareObjectType(input, scratch, no_reg, BOOL8X16_TYPE); | |
| 6025 final_branch_condition = eq; | |
| 6026 | 6003 |
| 6027 } else { | 6004 } else { |
| 6028 __ b(false_label); | 6005 __ b(false_label); |
| 6029 } | 6006 } |
| 6030 | 6007 |
| 6031 return final_branch_condition; | 6008 return final_branch_condition; |
| 6032 } | 6009 } |
| 6033 | 6010 |
| 6034 | 6011 |
| 6035 void LCodeGen::DoIsConstructCallAndBranch(LIsConstructCallAndBranch* instr) { | 6012 void LCodeGen::DoIsConstructCallAndBranch(LIsConstructCallAndBranch* instr) { |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6324 __ Push(scope_info); | 6301 __ Push(scope_info); |
| 6325 __ push(ToRegister(instr->function())); | 6302 __ push(ToRegister(instr->function())); |
| 6326 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6303 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 6327 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6304 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 6328 } | 6305 } |
| 6329 | 6306 |
| 6330 | 6307 |
| 6331 #undef __ | 6308 #undef __ |
| 6332 } // namespace internal | 6309 } // namespace internal |
| 6333 } // namespace v8 | 6310 } // namespace v8 |
| OLD | NEW |