| 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_X64 | 7 #if V8_TARGET_ARCH_X64 |
| 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 3308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3319 VisitForAccumulatorValue(args->at(0)); | 3319 VisitForAccumulatorValue(args->at(0)); |
| 3320 | 3320 |
| 3321 Label materialize_true, materialize_false; | 3321 Label materialize_true, materialize_false; |
| 3322 Label* if_true = NULL; | 3322 Label* if_true = NULL; |
| 3323 Label* if_false = NULL; | 3323 Label* if_false = NULL; |
| 3324 Label* fall_through = NULL; | 3324 Label* fall_through = NULL; |
| 3325 context()->PrepareTest(&materialize_true, &materialize_false, &if_true, | 3325 context()->PrepareTest(&materialize_true, &materialize_false, &if_true, |
| 3326 &if_false, &fall_through); | 3326 &if_false, &fall_through); |
| 3327 | 3327 |
| 3328 __ JumpIfSmi(rax, if_false); | 3328 __ JumpIfSmi(rax, if_false); |
| 3329 Register map = rbx; | 3329 __ CmpObjectType(rax, SIMD128_VALUE_TYPE, rbx); |
| 3330 __ movp(map, FieldOperand(rax, HeapObject::kMapOffset)); | |
| 3331 __ CmpInstanceType(map, FIRST_SIMD_VALUE_TYPE); | |
| 3332 __ j(less, if_false); | |
| 3333 __ CmpInstanceType(map, LAST_SIMD_VALUE_TYPE); | |
| 3334 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 3330 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
| 3335 Split(less_equal, if_true, if_false, fall_through); | 3331 Split(equal, if_true, if_false, fall_through); |
| 3336 | 3332 |
| 3337 context()->Plug(if_true, if_false); | 3333 context()->Plug(if_true, if_false); |
| 3338 } | 3334 } |
| 3339 | 3335 |
| 3340 | 3336 |
| 3341 void FullCodeGenerator::EmitIsUndetectableObject(CallRuntime* expr) { | 3337 void FullCodeGenerator::EmitIsUndetectableObject(CallRuntime* expr) { |
| 3342 ZoneList<Expression*>* args = expr->arguments(); | 3338 ZoneList<Expression*>* args = expr->arguments(); |
| 3343 DCHECK(args->length() == 1); | 3339 DCHECK(args->length() == 1); |
| 3344 | 3340 |
| 3345 VisitForAccumulatorValue(args->at(0)); | 3341 VisitForAccumulatorValue(args->at(0)); |
| (...skipping 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4988 // Check for undetectable objects => false. | 4984 // Check for undetectable objects => false. |
| 4989 __ CmpObjectType(rax, FIRST_NONSTRING_TYPE, rdx); | 4985 __ CmpObjectType(rax, FIRST_NONSTRING_TYPE, rdx); |
| 4990 __ j(above_equal, if_false); | 4986 __ j(above_equal, if_false); |
| 4991 __ testb(FieldOperand(rdx, Map::kBitFieldOffset), | 4987 __ testb(FieldOperand(rdx, Map::kBitFieldOffset), |
| 4992 Immediate(1 << Map::kIsUndetectable)); | 4988 Immediate(1 << Map::kIsUndetectable)); |
| 4993 Split(zero, if_true, if_false, fall_through); | 4989 Split(zero, if_true, if_false, fall_through); |
| 4994 } else if (String::Equals(check, factory->symbol_string())) { | 4990 } else if (String::Equals(check, factory->symbol_string())) { |
| 4995 __ JumpIfSmi(rax, if_false); | 4991 __ JumpIfSmi(rax, if_false); |
| 4996 __ CmpObjectType(rax, SYMBOL_TYPE, rdx); | 4992 __ CmpObjectType(rax, SYMBOL_TYPE, rdx); |
| 4997 Split(equal, if_true, if_false, fall_through); | 4993 Split(equal, if_true, if_false, fall_through); |
| 4998 } else if (String::Equals(check, factory->float32x4_string())) { | |
| 4999 __ JumpIfSmi(rax, if_false); | |
| 5000 __ CmpObjectType(rax, FLOAT32X4_TYPE, rdx); | |
| 5001 Split(equal, if_true, if_false, fall_through); | |
| 5002 } else if (String::Equals(check, factory->int32x4_string())) { | |
| 5003 __ JumpIfSmi(rax, if_false); | |
| 5004 __ CmpObjectType(rax, INT32X4_TYPE, rdx); | |
| 5005 Split(equal, if_true, if_false, fall_through); | |
| 5006 } else if (String::Equals(check, factory->bool32x4_string())) { | |
| 5007 __ JumpIfSmi(rax, if_false); | |
| 5008 __ CmpObjectType(rax, BOOL32X4_TYPE, rdx); | |
| 5009 Split(equal, if_true, if_false, fall_through); | |
| 5010 } else if (String::Equals(check, factory->int16x8_string())) { | |
| 5011 __ JumpIfSmi(rax, if_false); | |
| 5012 __ CmpObjectType(rax, INT16X8_TYPE, rdx); | |
| 5013 Split(equal, if_true, if_false, fall_through); | |
| 5014 } else if (String::Equals(check, factory->bool16x8_string())) { | |
| 5015 __ JumpIfSmi(rax, if_false); | |
| 5016 __ CmpObjectType(rax, BOOL16X8_TYPE, rdx); | |
| 5017 Split(equal, if_true, if_false, fall_through); | |
| 5018 } else if (String::Equals(check, factory->int8x16_string())) { | |
| 5019 __ JumpIfSmi(rax, if_false); | |
| 5020 __ CmpObjectType(rax, INT8X16_TYPE, rdx); | |
| 5021 Split(equal, if_true, if_false, fall_through); | |
| 5022 } else if (String::Equals(check, factory->bool8x16_string())) { | |
| 5023 __ JumpIfSmi(rax, if_false); | |
| 5024 __ CmpObjectType(rax, BOOL8X16_TYPE, rdx); | |
| 5025 Split(equal, if_true, if_false, fall_through); | |
| 5026 } else if (String::Equals(check, factory->boolean_string())) { | 4994 } else if (String::Equals(check, factory->boolean_string())) { |
| 5027 __ CompareRoot(rax, Heap::kTrueValueRootIndex); | 4995 __ CompareRoot(rax, Heap::kTrueValueRootIndex); |
| 5028 __ j(equal, if_true); | 4996 __ j(equal, if_true); |
| 5029 __ CompareRoot(rax, Heap::kFalseValueRootIndex); | 4997 __ CompareRoot(rax, Heap::kFalseValueRootIndex); |
| 5030 Split(equal, if_true, if_false, fall_through); | 4998 Split(equal, if_true, if_false, fall_through); |
| 5031 } else if (String::Equals(check, factory->undefined_string())) { | 4999 } else if (String::Equals(check, factory->undefined_string())) { |
| 5032 __ CompareRoot(rax, Heap::kUndefinedValueRootIndex); | 5000 __ CompareRoot(rax, Heap::kUndefinedValueRootIndex); |
| 5033 __ j(equal, if_true); | 5001 __ j(equal, if_true); |
| 5034 __ JumpIfSmi(rax, if_false); | 5002 __ JumpIfSmi(rax, if_false); |
| 5035 // Check for undetectable objects => true. | 5003 // Check for undetectable objects => true. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 5049 __ CompareRoot(rax, Heap::kNullValueRootIndex); | 5017 __ CompareRoot(rax, Heap::kNullValueRootIndex); |
| 5050 __ j(equal, if_true); | 5018 __ j(equal, if_true); |
| 5051 __ CmpObjectType(rax, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, rdx); | 5019 __ CmpObjectType(rax, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, rdx); |
| 5052 __ j(below, if_false); | 5020 __ j(below, if_false); |
| 5053 __ CmpInstanceType(rdx, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); | 5021 __ CmpInstanceType(rdx, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); |
| 5054 __ j(above, if_false); | 5022 __ j(above, if_false); |
| 5055 // Check for undetectable objects => false. | 5023 // Check for undetectable objects => false. |
| 5056 __ testb(FieldOperand(rdx, Map::kBitFieldOffset), | 5024 __ testb(FieldOperand(rdx, Map::kBitFieldOffset), |
| 5057 Immediate(1 << Map::kIsUndetectable)); | 5025 Immediate(1 << Map::kIsUndetectable)); |
| 5058 Split(zero, if_true, if_false, fall_through); | 5026 Split(zero, if_true, if_false, fall_through); |
| 5027 // clang-format off |
| 5028 #define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \ |
| 5029 } else if (String::Equals(check, factory->type##_string())) { \ |
| 5030 __ JumpIfSmi(rax, if_false); \ |
| 5031 __ movp(rax, FieldOperand(rax, HeapObject::kMapOffset)); \ |
| 5032 __ CompareRoot(rax, Heap::k##Type##MapRootIndex); \ |
| 5033 Split(equal, if_true, if_false, fall_through); |
| 5034 SIMD128_TYPES(SIMD128_TYPE) |
| 5035 #undef SIMD128_TYPE |
| 5036 // clang-format on |
| 5059 } else { | 5037 } else { |
| 5060 if (if_false != fall_through) __ jmp(if_false); | 5038 if (if_false != fall_through) __ jmp(if_false); |
| 5061 } | 5039 } |
| 5062 context()->Plug(if_true, if_false); | 5040 context()->Plug(if_true, if_false); |
| 5063 } | 5041 } |
| 5064 | 5042 |
| 5065 | 5043 |
| 5066 void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) { | 5044 void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) { |
| 5067 Comment cmnt(masm_, "[ CompareOperation"); | 5045 Comment cmnt(masm_, "[ CompareOperation"); |
| 5068 SetExpressionPosition(expr); | 5046 SetExpressionPosition(expr); |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5352 Assembler::target_address_at(call_target_address, | 5330 Assembler::target_address_at(call_target_address, |
| 5353 unoptimized_code)); | 5331 unoptimized_code)); |
| 5354 return OSR_AFTER_STACK_CHECK; | 5332 return OSR_AFTER_STACK_CHECK; |
| 5355 } | 5333 } |
| 5356 | 5334 |
| 5357 | 5335 |
| 5358 } // namespace internal | 5336 } // namespace internal |
| 5359 } // namespace v8 | 5337 } // namespace v8 |
| 5360 | 5338 |
| 5361 #endif // V8_TARGET_ARCH_X64 | 5339 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |