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_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 3114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3125 VisitForAccumulatorValue(args->at(0)); | 3125 VisitForAccumulatorValue(args->at(0)); |
3126 | 3126 |
3127 Label materialize_true, materialize_false; | 3127 Label materialize_true, materialize_false; |
3128 Label* if_true = NULL; | 3128 Label* if_true = NULL; |
3129 Label* if_false = NULL; | 3129 Label* if_false = NULL; |
3130 Label* fall_through = NULL; | 3130 Label* fall_through = NULL; |
3131 context()->PrepareTest(&materialize_true, &materialize_false, &if_true, | 3131 context()->PrepareTest(&materialize_true, &materialize_false, &if_true, |
3132 &if_false, &fall_through); | 3132 &if_false, &fall_through); |
3133 | 3133 |
3134 __ JumpIfSmi(x0, if_false); | 3134 __ JumpIfSmi(x0, if_false); |
3135 Register map = x10; | 3135 __ CompareObjectType(x0, x10, x11, SIMD128_VALUE_TYPE); |
3136 Register type_reg = x11; | |
3137 __ Ldr(map, FieldMemOperand(x0, HeapObject::kMapOffset)); | |
3138 __ Ldrb(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset)); | |
3139 __ Sub(type_reg, type_reg, Operand(FIRST_SIMD_VALUE_TYPE)); | |
3140 __ Cmp(type_reg, Operand(LAST_SIMD_VALUE_TYPE - FIRST_SIMD_VALUE_TYPE)); | |
3141 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 3136 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
3142 Split(ls, if_true, if_false, fall_through); | 3137 Split(eq, if_true, if_false, fall_through); |
3143 | 3138 |
3144 context()->Plug(if_true, if_false); | 3139 context()->Plug(if_true, if_false); |
3145 } | 3140 } |
3146 | 3141 |
3147 | 3142 |
3148 void FullCodeGenerator::EmitIsUndetectableObject(CallRuntime* expr) { | 3143 void FullCodeGenerator::EmitIsUndetectableObject(CallRuntime* expr) { |
3149 ASM_LOCATION("FullCodeGenerator::EmitIsUndetectableObject"); | 3144 ASM_LOCATION("FullCodeGenerator::EmitIsUndetectableObject"); |
3150 ZoneList<Expression*>* args = expr->arguments(); | 3145 ZoneList<Expression*>* args = expr->arguments(); |
3151 DCHECK(args->length() == 1); | 3146 DCHECK(args->length() == 1); |
3152 | 3147 |
(...skipping 1583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4736 // Check for undetectable objects => false. | 4731 // Check for undetectable objects => false. |
4737 __ JumpIfObjectType(x0, x0, x1, FIRST_NONSTRING_TYPE, if_false, ge); | 4732 __ JumpIfObjectType(x0, x0, x1, FIRST_NONSTRING_TYPE, if_false, ge); |
4738 __ Ldrb(x1, FieldMemOperand(x0, Map::kBitFieldOffset)); | 4733 __ Ldrb(x1, FieldMemOperand(x0, Map::kBitFieldOffset)); |
4739 __ TestAndSplit(x1, 1 << Map::kIsUndetectable, if_true, if_false, | 4734 __ TestAndSplit(x1, 1 << Map::kIsUndetectable, if_true, if_false, |
4740 fall_through); | 4735 fall_through); |
4741 } else if (String::Equals(check, factory->symbol_string())) { | 4736 } else if (String::Equals(check, factory->symbol_string())) { |
4742 ASM_LOCATION("FullCodeGenerator::EmitLiteralCompareTypeof symbol_string"); | 4737 ASM_LOCATION("FullCodeGenerator::EmitLiteralCompareTypeof symbol_string"); |
4743 __ JumpIfSmi(x0, if_false); | 4738 __ JumpIfSmi(x0, if_false); |
4744 __ CompareObjectType(x0, x0, x1, SYMBOL_TYPE); | 4739 __ CompareObjectType(x0, x0, x1, SYMBOL_TYPE); |
4745 Split(eq, if_true, if_false, fall_through); | 4740 Split(eq, if_true, if_false, fall_through); |
4746 } else if (String::Equals(check, factory->float32x4_string())) { | |
4747 ASM_LOCATION( | |
4748 "FullCodeGenerator::EmitLiteralCompareTypeof float32x4_string"); | |
4749 __ JumpIfSmi(x0, if_false); | |
4750 __ CompareObjectType(x0, x0, x1, FLOAT32X4_TYPE); | |
4751 Split(eq, if_true, if_false, fall_through); | |
4752 } else if (String::Equals(check, factory->int32x4_string())) { | |
4753 ASM_LOCATION("FullCodeGenerator::EmitLiteralCompareTypeof int32x4_string"); | |
4754 __ JumpIfSmi(x0, if_false); | |
4755 __ CompareObjectType(x0, x0, x1, INT32X4_TYPE); | |
4756 Split(eq, if_true, if_false, fall_through); | |
4757 } else if (String::Equals(check, factory->bool32x4_string())) { | |
4758 ASM_LOCATION("FullCodeGenerator::EmitLiteralCompareTypeof bool32x4_string"); | |
4759 __ JumpIfSmi(x0, if_false); | |
4760 __ CompareObjectType(x0, x0, x1, BOOL32X4_TYPE); | |
4761 Split(eq, if_true, if_false, fall_through); | |
4762 } else if (String::Equals(check, factory->int16x8_string())) { | |
4763 ASM_LOCATION("FullCodeGenerator::EmitLiteralCompareTypeof int16x8_string"); | |
4764 __ JumpIfSmi(x0, if_false); | |
4765 __ CompareObjectType(x0, x0, x1, INT16X8_TYPE); | |
4766 Split(eq, if_true, if_false, fall_through); | |
4767 } else if (String::Equals(check, factory->bool16x8_string())) { | |
4768 ASM_LOCATION("FullCodeGenerator::EmitLiteralCompareTypeof bool16x8_string"); | |
4769 __ JumpIfSmi(x0, if_false); | |
4770 __ CompareObjectType(x0, x0, x1, BOOL16X8_TYPE); | |
4771 Split(eq, if_true, if_false, fall_through); | |
4772 } else if (String::Equals(check, factory->int8x16_string())) { | |
4773 ASM_LOCATION("FullCodeGenerator::EmitLiteralCompareTypeof int8x16_string"); | |
4774 __ JumpIfSmi(x0, if_false); | |
4775 __ CompareObjectType(x0, x0, x1, INT8X16_TYPE); | |
4776 Split(eq, if_true, if_false, fall_through); | |
4777 } else if (String::Equals(check, factory->bool8x16_string())) { | |
4778 ASM_LOCATION("FullCodeGenerator::EmitLiteralCompareTypeof bool8x16_string"); | |
4779 __ JumpIfSmi(x0, if_false); | |
4780 __ CompareObjectType(x0, x0, x1, BOOL8X16_TYPE); | |
4781 Split(eq, if_true, if_false, fall_through); | |
4782 } else if (String::Equals(check, factory->boolean_string())) { | 4741 } else if (String::Equals(check, factory->boolean_string())) { |
4783 ASM_LOCATION("FullCodeGenerator::EmitLiteralCompareTypeof boolean_string"); | 4742 ASM_LOCATION("FullCodeGenerator::EmitLiteralCompareTypeof boolean_string"); |
4784 __ JumpIfRoot(x0, Heap::kTrueValueRootIndex, if_true); | 4743 __ JumpIfRoot(x0, Heap::kTrueValueRootIndex, if_true); |
4785 __ CompareRoot(x0, Heap::kFalseValueRootIndex); | 4744 __ CompareRoot(x0, Heap::kFalseValueRootIndex); |
4786 Split(eq, if_true, if_false, fall_through); | 4745 Split(eq, if_true, if_false, fall_through); |
4787 } else if (String::Equals(check, factory->undefined_string())) { | 4746 } else if (String::Equals(check, factory->undefined_string())) { |
4788 ASM_LOCATION( | 4747 ASM_LOCATION( |
4789 "FullCodeGenerator::EmitLiteralCompareTypeof undefined_string"); | 4748 "FullCodeGenerator::EmitLiteralCompareTypeof undefined_string"); |
4790 __ JumpIfRoot(x0, Heap::kUndefinedValueRootIndex, if_true); | 4749 __ JumpIfRoot(x0, Heap::kUndefinedValueRootIndex, if_true); |
4791 __ JumpIfSmi(x0, if_false); | 4750 __ JumpIfSmi(x0, if_false); |
4792 // Check for undetectable objects => true. | 4751 // Check for undetectable objects => true. |
4793 __ Ldr(x0, FieldMemOperand(x0, HeapObject::kMapOffset)); | 4752 __ Ldr(x0, FieldMemOperand(x0, HeapObject::kMapOffset)); |
4794 __ Ldrb(x1, FieldMemOperand(x0, Map::kBitFieldOffset)); | 4753 __ Ldrb(x1, FieldMemOperand(x0, Map::kBitFieldOffset)); |
4795 __ TestAndSplit(x1, 1 << Map::kIsUndetectable, if_false, if_true, | 4754 __ TestAndSplit(x1, 1 << Map::kIsUndetectable, if_false, if_true, |
4796 fall_through); | 4755 fall_through); |
4797 } else if (String::Equals(check, factory->function_string())) { | 4756 } else if (String::Equals(check, factory->function_string())) { |
4798 ASM_LOCATION("FullCodeGenerator::EmitLiteralCompareTypeof function_string"); | 4757 ASM_LOCATION("FullCodeGenerator::EmitLiteralCompareTypeof function_string"); |
4799 __ JumpIfSmi(x0, if_false); | 4758 __ JumpIfSmi(x0, if_false); |
4800 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | 4759 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); |
4801 __ JumpIfObjectType(x0, x10, x11, JS_FUNCTION_TYPE, if_true); | 4760 __ JumpIfObjectType(x0, x10, x11, JS_FUNCTION_TYPE, if_true); |
4802 __ CompareAndSplit(x11, JS_FUNCTION_PROXY_TYPE, eq, if_true, if_false, | 4761 __ CompareAndSplit(x11, JS_FUNCTION_PROXY_TYPE, eq, if_true, if_false, |
4803 fall_through); | 4762 fall_through); |
4804 | |
4805 } else if (String::Equals(check, factory->object_string())) { | 4763 } else if (String::Equals(check, factory->object_string())) { |
4806 ASM_LOCATION("FullCodeGenerator::EmitLiteralCompareTypeof object_string"); | 4764 ASM_LOCATION("FullCodeGenerator::EmitLiteralCompareTypeof object_string"); |
4807 __ JumpIfSmi(x0, if_false); | 4765 __ JumpIfSmi(x0, if_false); |
4808 __ JumpIfRoot(x0, Heap::kNullValueRootIndex, if_true); | 4766 __ JumpIfRoot(x0, Heap::kNullValueRootIndex, if_true); |
4809 // Check for JS objects => true. | 4767 // Check for JS objects => true. |
4810 Register map = x10; | 4768 Register map = x10; |
4811 __ JumpIfObjectType(x0, map, x11, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, | 4769 __ JumpIfObjectType(x0, map, x11, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, |
4812 if_false, lt); | 4770 if_false, lt); |
4813 __ CompareInstanceType(map, x11, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); | 4771 __ CompareInstanceType(map, x11, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); |
4814 __ B(gt, if_false); | 4772 __ B(gt, if_false); |
4815 // Check for undetectable objects => false. | 4773 // Check for undetectable objects => false. |
4816 __ Ldrb(x10, FieldMemOperand(map, Map::kBitFieldOffset)); | 4774 __ Ldrb(x10, FieldMemOperand(map, Map::kBitFieldOffset)); |
4817 | 4775 |
4818 __ TestAndSplit(x10, 1 << Map::kIsUndetectable, if_true, if_false, | 4776 __ TestAndSplit(x10, 1 << Map::kIsUndetectable, if_true, if_false, |
4819 fall_through); | 4777 fall_through); |
4820 | 4778 // clang-format off |
| 4779 #define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \ |
| 4780 } else if (String::Equals(check, factory->type##_string())) { \ |
| 4781 ASM_LOCATION("FullCodeGenerator::EmitLiteralCompareTypeof " \ |
| 4782 #type "_string"); \ |
| 4783 __ JumpIfSmi(x0, if_true); \ |
| 4784 __ Ldr(x0, FieldMemOperand(x0, HeapObject::kMapOffset)); \ |
| 4785 __ CompareRoot(x0, Heap::k##Type##MapRootIndex); \ |
| 4786 Split(eq, if_true, if_false, fall_through); |
| 4787 SIMD128_TYPES(SIMD128_TYPE) |
| 4788 #undef SIMD128_TYPE |
| 4789 // clang-format on |
4821 } else { | 4790 } else { |
4822 ASM_LOCATION("FullCodeGenerator::EmitLiteralCompareTypeof other"); | 4791 ASM_LOCATION("FullCodeGenerator::EmitLiteralCompareTypeof other"); |
4823 if (if_false != fall_through) __ B(if_false); | 4792 if (if_false != fall_through) __ B(if_false); |
4824 } | 4793 } |
4825 context()->Plug(if_true, if_false); | 4794 context()->Plug(if_true, if_false); |
4826 } | 4795 } |
4827 | 4796 |
4828 | 4797 |
4829 void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) { | 4798 void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) { |
4830 Comment cmnt(masm_, "[ CompareOperation"); | 4799 Comment cmnt(masm_, "[ CompareOperation"); |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5460 } | 5429 } |
5461 | 5430 |
5462 return INTERRUPT; | 5431 return INTERRUPT; |
5463 } | 5432 } |
5464 | 5433 |
5465 | 5434 |
5466 } // namespace internal | 5435 } // namespace internal |
5467 } // namespace v8 | 5436 } // namespace v8 |
5468 | 5437 |
5469 #endif // V8_TARGET_ARCH_ARM64 | 5438 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |