OLD | NEW |
---|---|
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 #include "src/code-stub-assembler.h" | 4 #include "src/code-stub-assembler.h" |
5 #include "src/code-factory.h" | 5 #include "src/code-factory.h" |
6 #include "src/frames-inl.h" | 6 #include "src/frames-inl.h" |
7 #include "src/frames.h" | 7 #include "src/frames.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 2445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2456 // Convert the Smi {value}. | 2456 // Convert the Smi {value}. |
2457 var_result.Bind(SmiToWord32(value)); | 2457 var_result.Bind(SmiToWord32(value)); |
2458 Goto(&done_loop); | 2458 Goto(&done_loop); |
2459 } | 2459 } |
2460 | 2460 |
2461 Bind(&if_valueisnotsmi); | 2461 Bind(&if_valueisnotsmi); |
2462 { | 2462 { |
2463 // Check if {value} is a HeapNumber. | 2463 // Check if {value} is a HeapNumber. |
2464 Label if_valueisheapnumber(this), | 2464 Label if_valueisheapnumber(this), |
2465 if_valueisnotheapnumber(this, Label::kDeferred); | 2465 if_valueisnotheapnumber(this, Label::kDeferred); |
2466 Branch(WordEqual(LoadMap(value), HeapNumberMapConstant()), | 2466 Branch(IsHeapNumberMap(LoadMap(value)), &if_valueisheapnumber, |
2467 &if_valueisheapnumber, &if_valueisnotheapnumber); | 2467 &if_valueisnotheapnumber); |
2468 | 2468 |
2469 Bind(&if_valueisheapnumber); | 2469 Bind(&if_valueisheapnumber); |
2470 { | 2470 { |
2471 // Truncate the floating point value. | 2471 // Truncate the floating point value. |
2472 var_result.Bind(TruncateHeapNumberValueToWord32(value)); | 2472 var_result.Bind(TruncateHeapNumberValueToWord32(value)); |
2473 Goto(&done_loop); | 2473 Goto(&done_loop); |
2474 } | 2474 } |
2475 | 2475 |
2476 Bind(&if_valueisnotheapnumber); | 2476 Bind(&if_valueisnotheapnumber); |
2477 { | 2477 { |
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3661 // Make the hash mask from the length of the number string cache. It | 3661 // Make the hash mask from the length of the number string cache. It |
3662 // contains two elements (number and string) for each cache entry. | 3662 // contains two elements (number and string) for each cache entry. |
3663 Node* mask = LoadFixedArrayBaseLength(number_string_cache); | 3663 Node* mask = LoadFixedArrayBaseLength(number_string_cache); |
3664 Node* one = IntPtrConstant(1); | 3664 Node* one = IntPtrConstant(1); |
3665 mask = IntPtrSub(mask, one); | 3665 mask = IntPtrSub(mask, one); |
3666 | 3666 |
3667 GotoIf(TaggedIsSmi(argument), &smi); | 3667 GotoIf(TaggedIsSmi(argument), &smi); |
3668 | 3668 |
3669 // Argument isn't smi, check to see if it's a heap-number. | 3669 // Argument isn't smi, check to see if it's a heap-number. |
3670 Node* map = LoadMap(argument); | 3670 Node* map = LoadMap(argument); |
3671 GotoUnless(WordEqual(map, HeapNumberMapConstant()), &runtime); | 3671 GotoUnless(IsHeapNumberMap(map), &runtime); |
3672 | 3672 |
3673 // Make a hash from the two 32-bit values of the double. | 3673 // Make a hash from the two 32-bit values of the double. |
3674 Node* low = | 3674 Node* low = |
3675 LoadObjectField(argument, HeapNumber::kValueOffset, MachineType::Int32()); | 3675 LoadObjectField(argument, HeapNumber::kValueOffset, MachineType::Int32()); |
3676 Node* high = LoadObjectField(argument, HeapNumber::kValueOffset + kIntSize, | 3676 Node* high = LoadObjectField(argument, HeapNumber::kValueOffset + kIntSize, |
3677 MachineType::Int32()); | 3677 MachineType::Int32()); |
3678 Node* hash = Word32Xor(low, high); | 3678 Node* hash = Word32Xor(low, high); |
3679 if (Is64()) hash = ChangeInt32ToInt64(hash); | 3679 if (Is64()) hash = ChangeInt32ToInt64(hash); |
3680 hash = WordShl(hash, one); | 3680 hash = WordShl(hash, one); |
3681 Node* index = WordAnd(hash, SmiToWord(mask)); | 3681 Node* index = WordAnd(hash, SmiToWord(mask)); |
3682 | 3682 |
3683 // Cache entry's key must be a heap number | 3683 // Cache entry's key must be a heap number |
3684 Node* number_key = | 3684 Node* number_key = |
3685 LoadFixedArrayElement(number_string_cache, index, 0, INTPTR_PARAMETERS); | 3685 LoadFixedArrayElement(number_string_cache, index, 0, INTPTR_PARAMETERS); |
3686 GotoIf(TaggedIsSmi(number_key), &runtime); | 3686 GotoIf(TaggedIsSmi(number_key), &runtime); |
3687 map = LoadMap(number_key); | 3687 map = LoadMap(number_key); |
3688 GotoUnless(WordEqual(map, HeapNumberMapConstant()), &runtime); | 3688 GotoUnless(IsHeapNumberMap(map), &runtime); |
3689 | 3689 |
3690 // Cache entry's key must match the heap number value we're looking for. | 3690 // Cache entry's key must match the heap number value we're looking for. |
3691 Node* low_compare = LoadObjectField(number_key, HeapNumber::kValueOffset, | 3691 Node* low_compare = LoadObjectField(number_key, HeapNumber::kValueOffset, |
3692 MachineType::Int32()); | 3692 MachineType::Int32()); |
3693 Node* high_compare = LoadObjectField( | 3693 Node* high_compare = LoadObjectField( |
3694 number_key, HeapNumber::kValueOffset + kIntSize, MachineType::Int32()); | 3694 number_key, HeapNumber::kValueOffset + kIntSize, MachineType::Int32()); |
3695 GotoUnless(WordEqual(low, low_compare), &runtime); | 3695 GotoUnless(WordEqual(low, low_compare), &runtime); |
3696 GotoUnless(WordEqual(high, high_compare), &runtime); | 3696 GotoUnless(WordEqual(high, high_compare), &runtime); |
3697 | 3697 |
3698 // Heap number match, return value fro cache entry. | 3698 // Heap number match, return value fro cache entry. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3769 } | 3769 } |
3770 } | 3770 } |
3771 | 3771 |
3772 Bind(&end); | 3772 Bind(&end); |
3773 return var_result.value(); | 3773 return var_result.value(); |
3774 } | 3774 } |
3775 | 3775 |
3776 Node* CodeStubAssembler::NonNumberToNumber(Node* context, Node* input) { | 3776 Node* CodeStubAssembler::NonNumberToNumber(Node* context, Node* input) { |
3777 // Assert input is a HeapObject (not smi or heap number) | 3777 // Assert input is a HeapObject (not smi or heap number) |
3778 CSA_ASSERT(this, Word32BinaryNot(TaggedIsSmi(input))); | 3778 CSA_ASSERT(this, Word32BinaryNot(TaggedIsSmi(input))); |
3779 CSA_ASSERT(this, Word32NotEqual(LoadMap(input), HeapNumberMapConstant())); | 3779 CSA_ASSERT(this, Word32BinaryNot(IsHeapNumberMap(LoadMap(input)))); |
Igor Sheludko
2016/12/01 09:48:33
Oops!
| |
3780 | 3780 |
3781 // We might need to loop once here due to ToPrimitive conversions. | 3781 // We might need to loop once here due to ToPrimitive conversions. |
3782 Variable var_input(this, MachineRepresentation::kTagged); | 3782 Variable var_input(this, MachineRepresentation::kTagged); |
3783 Variable var_result(this, MachineRepresentation::kTagged); | 3783 Variable var_result(this, MachineRepresentation::kTagged); |
3784 Label loop(this, &var_input); | 3784 Label loop(this, &var_input); |
3785 Label end(this); | 3785 Label end(this); |
3786 var_input.Bind(input); | 3786 var_input.Bind(input); |
3787 Goto(&loop); | 3787 Goto(&loop); |
3788 Bind(&loop); | 3788 Bind(&loop); |
3789 { | 3789 { |
(...skipping 30 matching lines...) Expand all Loading... | |
3820 // The {input} is a JSReceiver, we need to convert it to a Primitive first | 3820 // The {input} is a JSReceiver, we need to convert it to a Primitive first |
3821 // using the ToPrimitive type conversion, preferably yielding a Number. | 3821 // using the ToPrimitive type conversion, preferably yielding a Number. |
3822 Callable callable = CodeFactory::NonPrimitiveToPrimitive( | 3822 Callable callable = CodeFactory::NonPrimitiveToPrimitive( |
3823 isolate(), ToPrimitiveHint::kNumber); | 3823 isolate(), ToPrimitiveHint::kNumber); |
3824 Node* result = CallStub(callable, context, input); | 3824 Node* result = CallStub(callable, context, input); |
3825 | 3825 |
3826 // Check if the {result} is already a Number. | 3826 // Check if the {result} is already a Number. |
3827 Label if_resultisnumber(this), if_resultisnotnumber(this); | 3827 Label if_resultisnumber(this), if_resultisnotnumber(this); |
3828 GotoIf(TaggedIsSmi(result), &if_resultisnumber); | 3828 GotoIf(TaggedIsSmi(result), &if_resultisnumber); |
3829 Node* result_map = LoadMap(result); | 3829 Node* result_map = LoadMap(result); |
3830 Branch(WordEqual(result_map, HeapNumberMapConstant()), &if_resultisnumber, | 3830 Branch(IsHeapNumberMap(result_map), &if_resultisnumber, |
3831 &if_resultisnotnumber); | 3831 &if_resultisnotnumber); |
3832 | 3832 |
3833 Bind(&if_resultisnumber); | 3833 Bind(&if_resultisnumber); |
3834 { | 3834 { |
3835 // The ToPrimitive conversion already gave us a Number, so we're done. | 3835 // The ToPrimitive conversion already gave us a Number, so we're done. |
3836 var_result.Bind(result); | 3836 var_result.Bind(result); |
3837 Goto(&end); | 3837 Goto(&end); |
3838 } | 3838 } |
3839 | 3839 |
3840 Bind(&if_resultisnotnumber); | 3840 Bind(&if_resultisnotnumber); |
(...skipping 27 matching lines...) Expand all Loading... | |
3868 | 3868 |
3869 Label not_smi(this, Label::kDeferred); | 3869 Label not_smi(this, Label::kDeferred); |
3870 GotoUnless(TaggedIsSmi(input), ¬_smi); | 3870 GotoUnless(TaggedIsSmi(input), ¬_smi); |
3871 var_result.Bind(input); | 3871 var_result.Bind(input); |
3872 Goto(&end); | 3872 Goto(&end); |
3873 | 3873 |
3874 Bind(¬_smi); | 3874 Bind(¬_smi); |
3875 { | 3875 { |
3876 Label not_heap_number(this, Label::kDeferred); | 3876 Label not_heap_number(this, Label::kDeferred); |
3877 Node* input_map = LoadMap(input); | 3877 Node* input_map = LoadMap(input); |
3878 GotoIf(Word32NotEqual(input_map, HeapNumberMapConstant()), | 3878 GotoUnless(IsHeapNumberMap(input_map), ¬_heap_number); |
Igor Sheludko
2016/12/01 09:48:33
Oops!
| |
3879 ¬_heap_number); | |
3880 | 3879 |
3881 var_result.Bind(input); | 3880 var_result.Bind(input); |
3882 Goto(&end); | 3881 Goto(&end); |
3883 | 3882 |
3884 Bind(¬_heap_number); | 3883 Bind(¬_heap_number); |
3885 { | 3884 { |
3886 var_result.Bind(NonNumberToNumber(context, input)); | 3885 var_result.Bind(NonNumberToNumber(context, input)); |
3887 Goto(&end); | 3886 Goto(&end); |
3888 } | 3887 } |
3889 } | 3888 } |
(...skipping 10 matching lines...) Expand all Loading... | |
3900 | 3899 |
3901 GotoIf(TaggedIsSmi(input), &is_number); | 3900 GotoIf(TaggedIsSmi(input), &is_number); |
3902 | 3901 |
3903 Node* input_map = LoadMap(input); | 3902 Node* input_map = LoadMap(input); |
3904 Node* input_instance_type = LoadMapInstanceType(input_map); | 3903 Node* input_instance_type = LoadMapInstanceType(input_map); |
3905 | 3904 |
3906 result.Bind(input); | 3905 result.Bind(input); |
3907 GotoIf(IsStringInstanceType(input_instance_type), &done); | 3906 GotoIf(IsStringInstanceType(input_instance_type), &done); |
3908 | 3907 |
3909 Label not_heap_number(this); | 3908 Label not_heap_number(this); |
3910 Branch(WordNotEqual(input_map, HeapNumberMapConstant()), ¬_heap_number, | 3909 Branch(IsHeapNumberMap(input_map), &is_number, ¬_heap_number); |
3911 &is_number); | |
3912 | 3910 |
3913 Bind(&is_number); | 3911 Bind(&is_number); |
3914 result.Bind(NumberToString(context, input)); | 3912 result.Bind(NumberToString(context, input)); |
3915 Goto(&done); | 3913 Goto(&done); |
3916 | 3914 |
3917 Bind(¬_heap_number); | 3915 Bind(¬_heap_number); |
3918 { | 3916 { |
3919 GotoIf(Word32NotEqual(input_instance_type, Int32Constant(ODDBALL_TYPE)), | 3917 GotoIf(Word32NotEqual(input_instance_type, Int32Constant(ODDBALL_TYPE)), |
3920 &runtime); | 3918 &runtime); |
3921 result.Bind(LoadObjectField(input, Oddball::kToStringOffset)); | 3919 result.Bind(LoadObjectField(input, Oddball::kToStringOffset)); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4010 | 4008 |
4011 // Load the current {arg} value. | 4009 // Load the current {arg} value. |
4012 Node* arg = var_arg.value(); | 4010 Node* arg = var_arg.value(); |
4013 | 4011 |
4014 // Check if {arg} is a Smi. | 4012 // Check if {arg} is a Smi. |
4015 GotoIf(TaggedIsSmi(arg), &out); | 4013 GotoIf(TaggedIsSmi(arg), &out); |
4016 | 4014 |
4017 // Check if {arg} is a HeapNumber. | 4015 // Check if {arg} is a HeapNumber. |
4018 Label if_argisheapnumber(this), | 4016 Label if_argisheapnumber(this), |
4019 if_argisnotheapnumber(this, Label::kDeferred); | 4017 if_argisnotheapnumber(this, Label::kDeferred); |
4020 Branch(WordEqual(LoadMap(arg), HeapNumberMapConstant()), | 4018 Branch(IsHeapNumberMap(LoadMap(arg)), &if_argisheapnumber, |
4021 &if_argisheapnumber, &if_argisnotheapnumber); | 4019 &if_argisnotheapnumber); |
4022 | 4020 |
4023 Bind(&if_argisheapnumber); | 4021 Bind(&if_argisheapnumber); |
4024 { | 4022 { |
4025 // Load the floating-point value of {arg}. | 4023 // Load the floating-point value of {arg}. |
4026 Node* arg_value = LoadHeapNumberValue(arg); | 4024 Node* arg_value = LoadHeapNumberValue(arg); |
4027 | 4025 |
4028 // Check if {arg} is NaN. | 4026 // Check if {arg} is NaN. |
4029 GotoUnless(Float64Equal(arg_value, arg_value), &return_zero); | 4027 GotoUnless(Float64Equal(arg_value, arg_value), &return_zero); |
4030 | 4028 |
4031 // Truncate {arg} towards zero. | 4029 // Truncate {arg} towards zero. |
(...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5302 } | 5300 } |
5303 Bind(&if_result); | 5301 Bind(&if_result); |
5304 return var_receiver_map.value(); | 5302 return var_receiver_map.value(); |
5305 } | 5303 } |
5306 | 5304 |
5307 Node* CodeStubAssembler::TryToIntptr(Node* key, Label* miss) { | 5305 Node* CodeStubAssembler::TryToIntptr(Node* key, Label* miss) { |
5308 Variable var_intptr_key(this, MachineType::PointerRepresentation()); | 5306 Variable var_intptr_key(this, MachineType::PointerRepresentation()); |
5309 Label done(this, &var_intptr_key), key_is_smi(this); | 5307 Label done(this, &var_intptr_key), key_is_smi(this); |
5310 GotoIf(TaggedIsSmi(key), &key_is_smi); | 5308 GotoIf(TaggedIsSmi(key), &key_is_smi); |
5311 // Try to convert a heap number to a Smi. | 5309 // Try to convert a heap number to a Smi. |
5312 GotoUnless(WordEqual(LoadMap(key), HeapNumberMapConstant()), miss); | 5310 GotoUnless(IsHeapNumberMap(LoadMap(key)), miss); |
5313 { | 5311 { |
5314 Node* value = LoadHeapNumberValue(key); | 5312 Node* value = LoadHeapNumberValue(key); |
5315 Node* int_value = RoundFloat64ToInt32(value); | 5313 Node* int_value = RoundFloat64ToInt32(value); |
5316 GotoUnless(Float64Equal(value, ChangeInt32ToFloat64(int_value)), miss); | 5314 GotoUnless(Float64Equal(value, ChangeInt32ToFloat64(int_value)), miss); |
5317 var_intptr_key.Bind(ChangeInt32ToIntPtr(int_value)); | 5315 var_intptr_key.Bind(ChangeInt32ToIntPtr(int_value)); |
5318 Goto(&done); | 5316 Goto(&done); |
5319 } | 5317 } |
5320 | 5318 |
5321 Bind(&key_is_smi); | 5319 Bind(&key_is_smi); |
5322 { | 5320 { |
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6216 BranchIfSmiLessThan(rhs, lhs, if_true, if_false); | 6214 BranchIfSmiLessThan(rhs, lhs, if_true, if_false); |
6217 break; | 6215 break; |
6218 case kGreaterThanOrEqual: | 6216 case kGreaterThanOrEqual: |
6219 BranchIfSmiLessThanOrEqual(rhs, lhs, if_true, if_false); | 6217 BranchIfSmiLessThanOrEqual(rhs, lhs, if_true, if_false); |
6220 break; | 6218 break; |
6221 } | 6219 } |
6222 } | 6220 } |
6223 | 6221 |
6224 Bind(&if_rhsisnotsmi); | 6222 Bind(&if_rhsisnotsmi); |
6225 { | 6223 { |
6226 CSA_ASSERT(this, WordEqual(LoadMap(rhs), HeapNumberMapConstant())); | 6224 CSA_ASSERT(this, IsHeapNumberMap(LoadMap(rhs))); |
6227 // Convert the {lhs} and {rhs} to floating point values, and | 6225 // Convert the {lhs} and {rhs} to floating point values, and |
6228 // perform a floating point comparison. | 6226 // perform a floating point comparison. |
6229 var_fcmp_lhs.Bind(SmiToFloat64(lhs)); | 6227 var_fcmp_lhs.Bind(SmiToFloat64(lhs)); |
6230 var_fcmp_rhs.Bind(LoadHeapNumberValue(rhs)); | 6228 var_fcmp_rhs.Bind(LoadHeapNumberValue(rhs)); |
6231 Goto(&do_fcmp); | 6229 Goto(&do_fcmp); |
6232 } | 6230 } |
6233 } | 6231 } |
6234 | 6232 |
6235 Bind(&if_lhsisnotsmi); | 6233 Bind(&if_lhsisnotsmi); |
6236 { | 6234 { |
6237 CSA_ASSERT(this, WordEqual(LoadMap(lhs), HeapNumberMapConstant())); | 6235 CSA_ASSERT(this, IsHeapNumberMap(LoadMap(lhs))); |
6238 | 6236 |
6239 // Check if {rhs} is a Smi or a HeapObject. | 6237 // Check if {rhs} is a Smi or a HeapObject. |
6240 Label if_rhsissmi(this), if_rhsisnotsmi(this); | 6238 Label if_rhsissmi(this), if_rhsisnotsmi(this); |
6241 Branch(TaggedIsSmi(rhs), &if_rhsissmi, &if_rhsisnotsmi); | 6239 Branch(TaggedIsSmi(rhs), &if_rhsissmi, &if_rhsisnotsmi); |
6242 | 6240 |
6243 Bind(&if_rhsissmi); | 6241 Bind(&if_rhsissmi); |
6244 { | 6242 { |
6245 // Convert the {lhs} and {rhs} to floating point values, and | 6243 // Convert the {lhs} and {rhs} to floating point values, and |
6246 // perform a floating point comparison. | 6244 // perform a floating point comparison. |
6247 var_fcmp_lhs.Bind(LoadHeapNumberValue(lhs)); | 6245 var_fcmp_lhs.Bind(LoadHeapNumberValue(lhs)); |
6248 var_fcmp_rhs.Bind(SmiToFloat64(rhs)); | 6246 var_fcmp_rhs.Bind(SmiToFloat64(rhs)); |
6249 Goto(&do_fcmp); | 6247 Goto(&do_fcmp); |
6250 } | 6248 } |
6251 | 6249 |
6252 Bind(&if_rhsisnotsmi); | 6250 Bind(&if_rhsisnotsmi); |
6253 { | 6251 { |
6254 CSA_ASSERT(this, WordEqual(LoadMap(rhs), HeapNumberMapConstant())); | 6252 CSA_ASSERT(this, IsHeapNumberMap(LoadMap(rhs))); |
6255 | 6253 |
6256 // Convert the {lhs} and {rhs} to floating point values, and | 6254 // Convert the {lhs} and {rhs} to floating point values, and |
6257 // perform a floating point comparison. | 6255 // perform a floating point comparison. |
6258 var_fcmp_lhs.Bind(LoadHeapNumberValue(lhs)); | 6256 var_fcmp_lhs.Bind(LoadHeapNumberValue(lhs)); |
6259 var_fcmp_rhs.Bind(LoadHeapNumberValue(rhs)); | 6257 var_fcmp_rhs.Bind(LoadHeapNumberValue(rhs)); |
6260 Goto(&do_fcmp); | 6258 Goto(&do_fcmp); |
6261 } | 6259 } |
6262 } | 6260 } |
6263 | 6261 |
6264 Bind(&do_fcmp); | 6262 Bind(&do_fcmp); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6373 // a Number hint. | 6371 // a Number hint. |
6374 Callable callable = CodeFactory::NonNumberToNumber(isolate()); | 6372 Callable callable = CodeFactory::NonNumberToNumber(isolate()); |
6375 var_rhs.Bind(CallStub(callable, context, rhs)); | 6373 var_rhs.Bind(CallStub(callable, context, rhs)); |
6376 Goto(&loop); | 6374 Goto(&loop); |
6377 } | 6375 } |
6378 } | 6376 } |
6379 } | 6377 } |
6380 | 6378 |
6381 Bind(&if_lhsisnotsmi); | 6379 Bind(&if_lhsisnotsmi); |
6382 { | 6380 { |
6383 // Load the HeapNumber map for later comparisons. | |
6384 Node* number_map = HeapNumberMapConstant(); | |
6385 | |
6386 // Load the map of {lhs}. | 6381 // Load the map of {lhs}. |
6387 Node* lhs_map = LoadMap(lhs); | 6382 Node* lhs_map = LoadMap(lhs); |
6388 | 6383 |
6389 // Check if {rhs} is a Smi or a HeapObject. | 6384 // Check if {rhs} is a Smi or a HeapObject. |
6390 Label if_rhsissmi(this), if_rhsisnotsmi(this); | 6385 Label if_rhsissmi(this), if_rhsisnotsmi(this); |
6391 Branch(TaggedIsSmi(rhs), &if_rhsissmi, &if_rhsisnotsmi); | 6386 Branch(TaggedIsSmi(rhs), &if_rhsissmi, &if_rhsisnotsmi); |
6392 | 6387 |
6393 Bind(&if_rhsissmi); | 6388 Bind(&if_rhsissmi); |
6394 { | 6389 { |
6395 // Check if the {lhs} is a HeapNumber. | 6390 // Check if the {lhs} is a HeapNumber. |
6396 Label if_lhsisnumber(this), if_lhsisnotnumber(this, Label::kDeferred); | 6391 Label if_lhsisnumber(this), if_lhsisnotnumber(this, Label::kDeferred); |
6397 Branch(WordEqual(lhs_map, number_map), &if_lhsisnumber, | 6392 Branch(IsHeapNumberMap(lhs_map), &if_lhsisnumber, &if_lhsisnotnumber); |
6398 &if_lhsisnotnumber); | |
6399 | 6393 |
6400 Bind(&if_lhsisnumber); | 6394 Bind(&if_lhsisnumber); |
6401 { | 6395 { |
6402 // Convert the {lhs} and {rhs} to floating point values, and | 6396 // Convert the {lhs} and {rhs} to floating point values, and |
6403 // perform a floating point comparison. | 6397 // perform a floating point comparison. |
6404 var_fcmp_lhs.Bind(LoadHeapNumberValue(lhs)); | 6398 var_fcmp_lhs.Bind(LoadHeapNumberValue(lhs)); |
6405 var_fcmp_rhs.Bind(SmiToFloat64(rhs)); | 6399 var_fcmp_rhs.Bind(SmiToFloat64(rhs)); |
6406 Goto(&do_fcmp); | 6400 Goto(&do_fcmp); |
6407 } | 6401 } |
6408 | 6402 |
6409 Bind(&if_lhsisnotnumber); | 6403 Bind(&if_lhsisnotnumber); |
6410 { | 6404 { |
6411 // Convert the {lhs} to a Number; we don't need to perform the | 6405 // Convert the {lhs} to a Number; we don't need to perform the |
6412 // dedicated ToPrimitive(lhs, hint Number) operation, as the | 6406 // dedicated ToPrimitive(lhs, hint Number) operation, as the |
6413 // ToNumber(lhs) will by itself already invoke ToPrimitive with | 6407 // ToNumber(lhs) will by itself already invoke ToPrimitive with |
6414 // a Number hint. | 6408 // a Number hint. |
6415 Callable callable = CodeFactory::NonNumberToNumber(isolate()); | 6409 Callable callable = CodeFactory::NonNumberToNumber(isolate()); |
6416 var_lhs.Bind(CallStub(callable, context, lhs)); | 6410 var_lhs.Bind(CallStub(callable, context, lhs)); |
6417 Goto(&loop); | 6411 Goto(&loop); |
6418 } | 6412 } |
6419 } | 6413 } |
6420 | 6414 |
6421 Bind(&if_rhsisnotsmi); | 6415 Bind(&if_rhsisnotsmi); |
6422 { | 6416 { |
6423 // Load the map of {rhs}. | 6417 // Load the map of {rhs}. |
6424 Node* rhs_map = LoadMap(rhs); | 6418 Node* rhs_map = LoadMap(rhs); |
6425 | 6419 |
6426 // Check if {lhs} is a HeapNumber. | 6420 // Check if {lhs} is a HeapNumber. |
6427 Label if_lhsisnumber(this), if_lhsisnotnumber(this); | 6421 Label if_lhsisnumber(this), if_lhsisnotnumber(this); |
6428 Branch(WordEqual(lhs_map, number_map), &if_lhsisnumber, | 6422 Branch(IsHeapNumberMap(lhs_map), &if_lhsisnumber, &if_lhsisnotnumber); |
6429 &if_lhsisnotnumber); | |
6430 | 6423 |
6431 Bind(&if_lhsisnumber); | 6424 Bind(&if_lhsisnumber); |
6432 { | 6425 { |
6433 // Check if {rhs} is also a HeapNumber. | 6426 // Check if {rhs} is also a HeapNumber. |
6434 Label if_rhsisnumber(this), if_rhsisnotnumber(this, Label::kDeferred); | 6427 Label if_rhsisnumber(this), if_rhsisnotnumber(this, Label::kDeferred); |
6435 Branch(WordEqual(lhs_map, rhs_map), &if_rhsisnumber, | 6428 Branch(WordEqual(lhs_map, rhs_map), &if_rhsisnumber, |
6436 &if_rhsisnotnumber); | 6429 &if_rhsisnotnumber); |
6437 | 6430 |
6438 Bind(&if_rhsisnumber); | 6431 Bind(&if_rhsisnumber); |
6439 { | 6432 { |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6727 // We have already checked for {lhs} and {rhs} being the same value, so | 6720 // We have already checked for {lhs} and {rhs} being the same value, so |
6728 // if both are Smis when we get here they must not be equal. | 6721 // if both are Smis when we get here they must not be equal. |
6729 Goto(&if_notequal); | 6722 Goto(&if_notequal); |
6730 | 6723 |
6731 Bind(&if_rhsisnotsmi); | 6724 Bind(&if_rhsisnotsmi); |
6732 { | 6725 { |
6733 // Load the map of {rhs}. | 6726 // Load the map of {rhs}. |
6734 Node* rhs_map = LoadMap(rhs); | 6727 Node* rhs_map = LoadMap(rhs); |
6735 | 6728 |
6736 // Check if {rhs} is a HeapNumber. | 6729 // Check if {rhs} is a HeapNumber. |
6737 Node* number_map = HeapNumberMapConstant(); | |
6738 Label if_rhsisnumber(this), if_rhsisnotnumber(this); | 6730 Label if_rhsisnumber(this), if_rhsisnotnumber(this); |
6739 Branch(WordEqual(rhs_map, number_map), &if_rhsisnumber, | 6731 Branch(IsHeapNumberMap(rhs_map), &if_rhsisnumber, &if_rhsisnotnumber); |
6740 &if_rhsisnotnumber); | |
6741 | 6732 |
6742 Bind(&if_rhsisnumber); | 6733 Bind(&if_rhsisnumber); |
6743 { | 6734 { |
6744 // Convert {lhs} and {rhs} to floating point values, and | 6735 // Convert {lhs} and {rhs} to floating point values, and |
6745 // perform a floating point comparison. | 6736 // perform a floating point comparison. |
6746 var_fcmp_lhs.Bind(SmiToFloat64(lhs)); | 6737 var_fcmp_lhs.Bind(SmiToFloat64(lhs)); |
6747 var_fcmp_rhs.Bind(LoadHeapNumberValue(rhs)); | 6738 var_fcmp_rhs.Bind(LoadHeapNumberValue(rhs)); |
6748 Goto(&do_fcmp); | 6739 Goto(&do_fcmp); |
6749 } | 6740 } |
6750 | 6741 |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7229 { | 7220 { |
7230 // The {lhs} and {rhs} reference the exact same value, yet we need special | 7221 // The {lhs} and {rhs} reference the exact same value, yet we need special |
7231 // treatment for HeapNumber, as NaN is not equal to NaN. | 7222 // treatment for HeapNumber, as NaN is not equal to NaN. |
7232 GenerateEqual_Same(this, lhs, &if_equal, &if_notequal); | 7223 GenerateEqual_Same(this, lhs, &if_equal, &if_notequal); |
7233 } | 7224 } |
7234 | 7225 |
7235 Bind(&if_notsame); | 7226 Bind(&if_notsame); |
7236 { | 7227 { |
7237 // The {lhs} and {rhs} reference different objects, yet for Smi, HeapNumber, | 7228 // The {lhs} and {rhs} reference different objects, yet for Smi, HeapNumber, |
7238 // String and Simd128Value they can still be considered equal. | 7229 // String and Simd128Value they can still be considered equal. |
7239 Node* number_map = HeapNumberMapConstant(); | |
7240 | 7230 |
7241 // Check if {lhs} is a Smi or a HeapObject. | 7231 // Check if {lhs} is a Smi or a HeapObject. |
7242 Label if_lhsissmi(this), if_lhsisnotsmi(this); | 7232 Label if_lhsissmi(this), if_lhsisnotsmi(this); |
7243 Branch(TaggedIsSmi(lhs), &if_lhsissmi, &if_lhsisnotsmi); | 7233 Branch(TaggedIsSmi(lhs), &if_lhsissmi, &if_lhsisnotsmi); |
7244 | 7234 |
7245 Bind(&if_lhsisnotsmi); | 7235 Bind(&if_lhsisnotsmi); |
7246 { | 7236 { |
7247 // Load the map of {lhs}. | 7237 // Load the map of {lhs}. |
7248 Node* lhs_map = LoadMap(lhs); | 7238 Node* lhs_map = LoadMap(lhs); |
7249 | 7239 |
7250 // Check if {lhs} is a HeapNumber. | 7240 // Check if {lhs} is a HeapNumber. |
7251 Label if_lhsisnumber(this), if_lhsisnotnumber(this); | 7241 Label if_lhsisnumber(this), if_lhsisnotnumber(this); |
7252 Branch(WordEqual(lhs_map, number_map), &if_lhsisnumber, | 7242 Branch(IsHeapNumberMap(lhs_map), &if_lhsisnumber, &if_lhsisnotnumber); |
7253 &if_lhsisnotnumber); | |
7254 | 7243 |
7255 Bind(&if_lhsisnumber); | 7244 Bind(&if_lhsisnumber); |
7256 { | 7245 { |
7257 // Check if {rhs} is a Smi or a HeapObject. | 7246 // Check if {rhs} is a Smi or a HeapObject. |
7258 Label if_rhsissmi(this), if_rhsisnotsmi(this); | 7247 Label if_rhsissmi(this), if_rhsisnotsmi(this); |
7259 Branch(TaggedIsSmi(rhs), &if_rhsissmi, &if_rhsisnotsmi); | 7248 Branch(TaggedIsSmi(rhs), &if_rhsissmi, &if_rhsisnotsmi); |
7260 | 7249 |
7261 Bind(&if_rhsissmi); | 7250 Bind(&if_rhsissmi); |
7262 { | 7251 { |
7263 // Convert {lhs} and {rhs} to floating point values. | 7252 // Convert {lhs} and {rhs} to floating point values. |
7264 Node* lhs_value = LoadHeapNumberValue(lhs); | 7253 Node* lhs_value = LoadHeapNumberValue(lhs); |
7265 Node* rhs_value = SmiToFloat64(rhs); | 7254 Node* rhs_value = SmiToFloat64(rhs); |
7266 | 7255 |
7267 // Perform a floating point comparison of {lhs} and {rhs}. | 7256 // Perform a floating point comparison of {lhs} and {rhs}. |
7268 Branch(Float64Equal(lhs_value, rhs_value), &if_equal, &if_notequal); | 7257 Branch(Float64Equal(lhs_value, rhs_value), &if_equal, &if_notequal); |
7269 } | 7258 } |
7270 | 7259 |
7271 Bind(&if_rhsisnotsmi); | 7260 Bind(&if_rhsisnotsmi); |
7272 { | 7261 { |
7273 // Load the map of {rhs}. | 7262 // Load the map of {rhs}. |
7274 Node* rhs_map = LoadMap(rhs); | 7263 Node* rhs_map = LoadMap(rhs); |
7275 | 7264 |
7276 // Check if {rhs} is also a HeapNumber. | 7265 // Check if {rhs} is also a HeapNumber. |
7277 Label if_rhsisnumber(this), if_rhsisnotnumber(this); | 7266 Label if_rhsisnumber(this), if_rhsisnotnumber(this); |
7278 Branch(WordEqual(rhs_map, number_map), &if_rhsisnumber, | 7267 Branch(IsHeapNumberMap(rhs_map), &if_rhsisnumber, &if_rhsisnotnumber); |
7279 &if_rhsisnotnumber); | |
7280 | 7268 |
7281 Bind(&if_rhsisnumber); | 7269 Bind(&if_rhsisnumber); |
7282 { | 7270 { |
7283 // Convert {lhs} and {rhs} to floating point values. | 7271 // Convert {lhs} and {rhs} to floating point values. |
7284 Node* lhs_value = LoadHeapNumberValue(lhs); | 7272 Node* lhs_value = LoadHeapNumberValue(lhs); |
7285 Node* rhs_value = LoadHeapNumberValue(rhs); | 7273 Node* rhs_value = LoadHeapNumberValue(rhs); |
7286 | 7274 |
7287 // Perform a floating point comparison of {lhs} and {rhs}. | 7275 // Perform a floating point comparison of {lhs} and {rhs}. |
7288 Branch(Float64Equal(lhs_value, rhs_value), &if_equal, &if_notequal); | 7276 Branch(Float64Equal(lhs_value, rhs_value), &if_equal, &if_notequal); |
7289 } | 7277 } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7374 Bind(&if_rhsissmi); | 7362 Bind(&if_rhsissmi); |
7375 Goto(&if_notequal); | 7363 Goto(&if_notequal); |
7376 | 7364 |
7377 Bind(&if_rhsisnotsmi); | 7365 Bind(&if_rhsisnotsmi); |
7378 { | 7366 { |
7379 // Load the map of the {rhs}. | 7367 // Load the map of the {rhs}. |
7380 Node* rhs_map = LoadMap(rhs); | 7368 Node* rhs_map = LoadMap(rhs); |
7381 | 7369 |
7382 // The {rhs} could be a HeapNumber with the same value as {lhs}. | 7370 // The {rhs} could be a HeapNumber with the same value as {lhs}. |
7383 Label if_rhsisnumber(this), if_rhsisnotnumber(this); | 7371 Label if_rhsisnumber(this), if_rhsisnotnumber(this); |
7384 Branch(WordEqual(rhs_map, number_map), &if_rhsisnumber, | 7372 Branch(IsHeapNumberMap(rhs_map), &if_rhsisnumber, &if_rhsisnotnumber); |
7385 &if_rhsisnotnumber); | |
7386 | 7373 |
7387 Bind(&if_rhsisnumber); | 7374 Bind(&if_rhsisnumber); |
7388 { | 7375 { |
7389 // Convert {lhs} and {rhs} to floating point values. | 7376 // Convert {lhs} and {rhs} to floating point values. |
7390 Node* lhs_value = SmiToFloat64(lhs); | 7377 Node* lhs_value = SmiToFloat64(lhs); |
7391 Node* rhs_value = LoadHeapNumberValue(rhs); | 7378 Node* rhs_value = LoadHeapNumberValue(rhs); |
7392 | 7379 |
7393 // Perform a floating point comparison of {lhs} and {rhs}. | 7380 // Perform a floating point comparison of {lhs} and {rhs}. |
7394 Branch(Float64Equal(lhs_value, rhs_value), &if_equal, &if_notequal); | 7381 Branch(Float64Equal(lhs_value, rhs_value), &if_equal, &if_notequal); |
7395 } | 7382 } |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8078 | 8065 |
8079 Node* CodeStubAssembler::IsDebugActive() { | 8066 Node* CodeStubAssembler::IsDebugActive() { |
8080 Node* is_debug_active = Load( | 8067 Node* is_debug_active = Load( |
8081 MachineType::Uint8(), | 8068 MachineType::Uint8(), |
8082 ExternalConstant(ExternalReference::debug_is_active_address(isolate()))); | 8069 ExternalConstant(ExternalReference::debug_is_active_address(isolate()))); |
8083 return WordNotEqual(is_debug_active, Int32Constant(0)); | 8070 return WordNotEqual(is_debug_active, Int32Constant(0)); |
8084 } | 8071 } |
8085 | 8072 |
8086 } // namespace internal | 8073 } // namespace internal |
8087 } // namespace v8 | 8074 } // namespace v8 |
OLD | NEW |