Chromium Code Reviews| 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 HasInstanceType(object, SYMBOL_TYPE); | |
|
Igor Sheludko
2016/12/13 20:56:28
IsSymbolMap(LoadMap(object)) does not require load
gsathya
2016/12/13 22:01:03
Doh ofc. Changed
| |
| 2920 } | |
| 2921 | |
| 2922 Node* CodeStubAssembler::IsPrivateSymbol(Node* object) { | |
| 2923 Label out(this); | |
| 2924 Variable var_result(this, MachineType::PointerRepresentation()); | |
|
Igor Sheludko
2016/12/13 20:56:28
CSA expects kWord32 nodes as a condition in Branch
gsathya
2016/12/13 22:01:04
Ah, okay. Changed.
| |
| 2925 var_result.Bind(IntPtrConstant(0)); | |
|
Igor Sheludko
2016/12/13 20:56:28
Same here: Int32Constant().
gsathya
2016/12/13 22:01:03
Done.
| |
| 2926 | |
| 2927 GotoUnless(IsSymbolMap(LoadMap(object)), &out); | |
|
Igor Sheludko
2016/12/13 20:56:28
IsSymbol(object)
gsathya
2016/12/13 22:01:04
Done.
| |
| 2928 Node* const flags = | |
| 2929 SmiToWord32(LoadObjectField(object, Symbol::kFlagsOffset)); | |
| 2930 const int kPrivateMask = 1 << Symbol::kPrivateBit; | |
| 2931 var_result.Bind(IsSetWord32(flags, kPrivateMask)); | |
| 2932 Goto(&out); | |
| 2933 | |
| 2934 Bind(&out); | |
| 2935 return var_result.value(); | |
|
Igor Sheludko
2016/12/13 20:56:28
You may want to use Select() for this.
gsathya
2016/12/13 22:01:03
I did initially but didn't look very readable to m
| |
| 2936 } | |
| 2937 | |
| 2918 Node* CodeStubAssembler::IsNativeContext(Node* object) { | 2938 Node* CodeStubAssembler::IsNativeContext(Node* object) { |
| 2919 return WordEqual(LoadMap(object), LoadRoot(Heap::kNativeContextMapRootIndex)); | 2939 return WordEqual(LoadMap(object), LoadRoot(Heap::kNativeContextMapRootIndex)); |
| 2920 } | 2940 } |
| 2921 | 2941 |
| 2922 Node* CodeStubAssembler::IsFixedDoubleArray(Node* object) { | 2942 Node* CodeStubAssembler::IsFixedDoubleArray(Node* object) { |
| 2923 return WordEqual(LoadMap(object), FixedDoubleArrayMapConstant()); | 2943 return WordEqual(LoadMap(object), FixedDoubleArrayMapConstant()); |
| 2924 } | 2944 } |
| 2925 | 2945 |
| 2926 Node* CodeStubAssembler::IsHashTable(Node* object) { | 2946 Node* CodeStubAssembler::IsHashTable(Node* object) { |
| 2927 return WordEqual(LoadMap(object), LoadRoot(Heap::kHashTableMapRootIndex)); | 2947 return WordEqual(LoadMap(object), LoadRoot(Heap::kHashTableMapRootIndex)); |
| (...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4264 Label* if_bailout) { | 4284 Label* if_bailout) { |
| 4265 DCHECK_EQ(MachineType::PointerRepresentation(), var_index->rep()); | 4285 DCHECK_EQ(MachineType::PointerRepresentation(), var_index->rep()); |
| 4266 Comment("TryToName"); | 4286 Comment("TryToName"); |
| 4267 | 4287 |
| 4268 Label if_hascachedindex(this), if_keyisnotindex(this); | 4288 Label if_hascachedindex(this), if_keyisnotindex(this); |
| 4269 // Handle Smi and HeapNumber keys. | 4289 // Handle Smi and HeapNumber keys. |
| 4270 var_index->Bind(TryToIntptr(key, &if_keyisnotindex)); | 4290 var_index->Bind(TryToIntptr(key, &if_keyisnotindex)); |
| 4271 Goto(if_keyisindex); | 4291 Goto(if_keyisindex); |
| 4272 | 4292 |
| 4273 Bind(&if_keyisnotindex); | 4293 Bind(&if_keyisnotindex); |
| 4294 // Symbols are unique. | |
| 4295 GotoIf(IsSymbol(key), if_keyisunique); | |
| 4274 Node* key_instance_type = LoadInstanceType(key); | 4296 Node* key_instance_type = LoadInstanceType(key); |
|
Igor Sheludko
2016/12/13 20:56:28
On this path we are loading map twice. How about:
gsathya
2016/12/13 22:01:04
Done.
| |
| 4275 // Symbols are unique. | |
| 4276 GotoIf(Word32Equal(key_instance_type, Int32Constant(SYMBOL_TYPE)), | |
| 4277 if_keyisunique); | |
| 4278 // Miss if |key| is not a String. | 4297 // Miss if |key| is not a String. |
| 4279 STATIC_ASSERT(FIRST_NAME_TYPE == FIRST_TYPE); | 4298 STATIC_ASSERT(FIRST_NAME_TYPE == FIRST_TYPE); |
| 4280 GotoUnless(IsStringInstanceType(key_instance_type), if_bailout); | 4299 GotoUnless(IsStringInstanceType(key_instance_type), if_bailout); |
| 4281 // |key| is a String. Check if it has a cached array index. | 4300 // |key| is a String. Check if it has a cached array index. |
| 4282 Node* hash = LoadNameHashField(key); | 4301 Node* hash = LoadNameHashField(key); |
| 4283 Node* contains_index = | 4302 Node* contains_index = |
| 4284 Word32And(hash, Int32Constant(Name::kContainsCachedArrayIndexMask)); | 4303 Word32And(hash, Int32Constant(Name::kContainsCachedArrayIndexMask)); |
| 4285 GotoIf(Word32Equal(contains_index, Int32Constant(0)), &if_hascachedindex); | 4304 GotoIf(Word32Equal(contains_index, Int32Constant(0)), &if_hascachedindex); |
| 4286 // No cached array index. If the string knows that it contains an index, | 4305 // 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. | 4306 // 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); | 8281 Heap::kUndefinedValueRootIndex); |
| 8263 StoreObjectFieldRoot(result, PromiseReactionJobInfo::kDebugNameOffset, | 8282 StoreObjectFieldRoot(result, PromiseReactionJobInfo::kDebugNameOffset, |
| 8264 Heap::kUndefinedValueRootIndex); | 8283 Heap::kUndefinedValueRootIndex); |
| 8265 StoreObjectFieldNoWriteBarrier(result, PromiseReactionJobInfo::kContextOffset, | 8284 StoreObjectFieldNoWriteBarrier(result, PromiseReactionJobInfo::kContextOffset, |
| 8266 context); | 8285 context); |
| 8267 return result; | 8286 return result; |
| 8268 } | 8287 } |
| 8269 | 8288 |
| 8270 } // namespace internal | 8289 } // namespace internal |
| 8271 } // namespace v8 | 8290 } // namespace v8 |
| OLD | NEW |