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 2897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2908 Node* CodeStubAssembler::IsName(Node* object) { | 2908 Node* CodeStubAssembler::IsName(Node* object) { |
2909 return Int32LessThanOrEqual(LoadInstanceType(object), | 2909 return Int32LessThanOrEqual(LoadInstanceType(object), |
2910 Int32Constant(LAST_NAME_TYPE)); | 2910 Int32Constant(LAST_NAME_TYPE)); |
2911 } | 2911 } |
2912 | 2912 |
2913 Node* CodeStubAssembler::IsString(Node* object) { | 2913 Node* CodeStubAssembler::IsString(Node* object) { |
2914 return Int32LessThanOrEqual(LoadInstanceType(object), | 2914 return Int32LessThanOrEqual(LoadInstanceType(object), |
2915 Int32Constant(FIRST_NONSTRING_TYPE)); | 2915 Int32Constant(FIRST_NONSTRING_TYPE)); |
2916 } | 2916 } |
2917 | 2917 |
| 2918 Node* CodeStubAssembler::IsSymbol(Node* object) { |
| 2919 return IsSymbolMap(LoadMap(object)); |
| 2920 } |
| 2921 |
| 2922 Node* CodeStubAssembler::IsPrivateSymbol(Node* object) { |
| 2923 return Select( |
| 2924 IsSymbol(object), |
| 2925 [=] { |
| 2926 Node* const flags = |
| 2927 SmiToWord32(LoadObjectField(object, Symbol::kFlagsOffset)); |
| 2928 const int kPrivateMask = 1 << Symbol::kPrivateBit; |
| 2929 return IsSetWord32(flags, kPrivateMask); |
| 2930 }, |
| 2931 [=] { return Int32Constant(0); }, MachineRepresentation::kWord32); |
| 2932 } |
| 2933 |
2918 Node* CodeStubAssembler::IsNativeContext(Node* object) { | 2934 Node* CodeStubAssembler::IsNativeContext(Node* object) { |
2919 return WordEqual(LoadMap(object), LoadRoot(Heap::kNativeContextMapRootIndex)); | 2935 return WordEqual(LoadMap(object), LoadRoot(Heap::kNativeContextMapRootIndex)); |
2920 } | 2936 } |
2921 | 2937 |
2922 Node* CodeStubAssembler::IsFixedDoubleArray(Node* object) { | 2938 Node* CodeStubAssembler::IsFixedDoubleArray(Node* object) { |
2923 return WordEqual(LoadMap(object), FixedDoubleArrayMapConstant()); | 2939 return WordEqual(LoadMap(object), FixedDoubleArrayMapConstant()); |
2924 } | 2940 } |
2925 | 2941 |
2926 Node* CodeStubAssembler::IsHashTable(Node* object) { | 2942 Node* CodeStubAssembler::IsHashTable(Node* object) { |
2927 return WordEqual(LoadMap(object), LoadRoot(Heap::kHashTableMapRootIndex)); | 2943 return WordEqual(LoadMap(object), LoadRoot(Heap::kHashTableMapRootIndex)); |
(...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4264 Label* if_bailout) { | 4280 Label* if_bailout) { |
4265 DCHECK_EQ(MachineType::PointerRepresentation(), var_index->rep()); | 4281 DCHECK_EQ(MachineType::PointerRepresentation(), var_index->rep()); |
4266 Comment("TryToName"); | 4282 Comment("TryToName"); |
4267 | 4283 |
4268 Label if_hascachedindex(this), if_keyisnotindex(this); | 4284 Label if_hascachedindex(this), if_keyisnotindex(this); |
4269 // Handle Smi and HeapNumber keys. | 4285 // Handle Smi and HeapNumber keys. |
4270 var_index->Bind(TryToIntptr(key, &if_keyisnotindex)); | 4286 var_index->Bind(TryToIntptr(key, &if_keyisnotindex)); |
4271 Goto(if_keyisindex); | 4287 Goto(if_keyisindex); |
4272 | 4288 |
4273 Bind(&if_keyisnotindex); | 4289 Bind(&if_keyisnotindex); |
4274 Node* key_instance_type = LoadInstanceType(key); | 4290 Node* key_map = LoadMap(key); |
4275 // Symbols are unique. | 4291 // Symbols are unique. |
4276 GotoIf(Word32Equal(key_instance_type, Int32Constant(SYMBOL_TYPE)), | 4292 GotoIf(IsSymbolMap(key_map), if_keyisunique); |
4277 if_keyisunique); | 4293 Node* key_instance_type = LoadMapInstanceType(key_map); |
4278 // Miss if |key| is not a String. | 4294 // Miss if |key| is not a String. |
4279 STATIC_ASSERT(FIRST_NAME_TYPE == FIRST_TYPE); | 4295 STATIC_ASSERT(FIRST_NAME_TYPE == FIRST_TYPE); |
4280 GotoUnless(IsStringInstanceType(key_instance_type), if_bailout); | 4296 GotoUnless(IsStringInstanceType(key_instance_type), if_bailout); |
4281 // |key| is a String. Check if it has a cached array index. | 4297 // |key| is a String. Check if it has a cached array index. |
4282 Node* hash = LoadNameHashField(key); | 4298 Node* hash = LoadNameHashField(key); |
4283 Node* contains_index = | 4299 Node* contains_index = |
4284 Word32And(hash, Int32Constant(Name::kContainsCachedArrayIndexMask)); | 4300 Word32And(hash, Int32Constant(Name::kContainsCachedArrayIndexMask)); |
4285 GotoIf(Word32Equal(contains_index, Int32Constant(0)), &if_hascachedindex); | 4301 GotoIf(Word32Equal(contains_index, Int32Constant(0)), &if_hascachedindex); |
4286 // No cached array index. If the string knows that it contains an index, | 4302 // No cached array index. If the string knows that it contains an index, |
4287 // then it must be an uncacheable index. Handle this case in the runtime. | 4303 // then it must be an uncacheable index. Handle this case in the runtime. |
(...skipping 3974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8262 Heap::kUndefinedValueRootIndex); | 8278 Heap::kUndefinedValueRootIndex); |
8263 StoreObjectFieldRoot(result, PromiseReactionJobInfo::kDebugNameOffset, | 8279 StoreObjectFieldRoot(result, PromiseReactionJobInfo::kDebugNameOffset, |
8264 Heap::kUndefinedValueRootIndex); | 8280 Heap::kUndefinedValueRootIndex); |
8265 StoreObjectFieldNoWriteBarrier(result, PromiseReactionJobInfo::kContextOffset, | 8281 StoreObjectFieldNoWriteBarrier(result, PromiseReactionJobInfo::kContextOffset, |
8266 context); | 8282 context); |
8267 return result; | 8283 return result; |
8268 } | 8284 } |
8269 | 8285 |
8270 } // namespace internal | 8286 } // namespace internal |
8271 } // namespace v8 | 8287 } // namespace v8 |
OLD | NEW |