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 | 4 |
5 #include "src/builtins/builtins-utils.h" | 5 #include "src/builtins/builtins-utils.h" |
6 #include "src/builtins/builtins.h" | 6 #include "src/builtins/builtins.h" |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stub-assembler.h" | 8 #include "src/code-stub-assembler.h" |
9 #include "src/property-descriptor.h" | 9 #include "src/property-descriptor.h" |
10 | 10 |
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
903 TF_BUILTIN(ForInFilter, ObjectBuiltinsAssembler) { | 903 TF_BUILTIN(ForInFilter, ObjectBuiltinsAssembler) { |
904 typedef ForInFilterDescriptor Descriptor; | 904 typedef ForInFilterDescriptor Descriptor; |
905 | 905 |
906 Node* key = Parameter(Descriptor::kKey); | 906 Node* key = Parameter(Descriptor::kKey); |
907 Node* object = Parameter(Descriptor::kObject); | 907 Node* object = Parameter(Descriptor::kObject); |
908 Node* context = Parameter(Descriptor::kContext); | 908 Node* context = Parameter(Descriptor::kContext); |
909 | 909 |
910 Return(ForInFilter(key, object, context)); | 910 Return(ForInFilter(key, object, context)); |
911 } | 911 } |
912 | 912 |
913 TF_BUILTIN(ForInNext, ObjectBuiltinsAssembler) { | |
914 typedef ForInNextDescriptor Descriptor; | |
915 | |
916 Label filter(this); | |
917 Node* object = Parameter(Descriptor::kObject); | |
918 Node* cache_array = Parameter(Descriptor::kCacheArray); | |
919 Node* cache_type = Parameter(Descriptor::kCacheType); | |
920 Node* index = Parameter(Descriptor::kIndex); | |
921 Node* context = Parameter(Descriptor::kContext); | |
922 | |
923 Node* key = LoadFixedArrayElement(cache_array, SmiUntag(index)); | |
924 Node* map = LoadMap(object); | |
925 GotoUnless(WordEqual(map, cache_type), &filter); | |
926 Return(key); | |
927 Bind(&filter); | |
928 Return(ForInFilter(key, object, context)); | |
929 } | |
930 | |
931 TF_BUILTIN(ForInPrepare, ObjectBuiltinsAssembler) { | |
932 typedef ForInPrepareDescriptor Descriptor; | |
933 | |
934 Label use_cache(this), nothing_to_iterate(this), call_runtime(this); | |
935 Node* object = Parameter(Descriptor::kObject); | |
936 Node* context = Parameter(Descriptor::kContext); | |
937 | |
938 CheckEnumCache(object, &use_cache, &call_runtime); | |
939 Bind(&use_cache); | |
940 Node* map = LoadMap(object); | |
941 Node* enum_length = EnumLength(map); | |
942 GotoIf(WordEqual(enum_length, SmiConstant(0)), ¬hing_to_iterate); | |
943 Node* descriptors = LoadMapDescriptors(map); | |
944 Node* cache_offset = | |
945 LoadObjectField(descriptors, DescriptorArray::kEnumCacheOffset); | |
946 Node* enum_cache = LoadObjectField( | |
947 cache_offset, DescriptorArray::kEnumCacheBridgeCacheOffset); | |
948 Return(map, enum_cache, enum_length); | |
949 | |
950 Bind(¬hing_to_iterate); | |
951 Node* zero = SmiConstant(0); | |
952 Return(zero, zero, zero); | |
953 | |
954 Bind(&call_runtime); | |
955 TailCallRuntime(Runtime::kForInPrepare, context, object); | |
rmcilroy
2017/02/08 23:37:22
Could we use this same code (inlined) in Interpret
Camillo Bruni
2017/02/09 10:25:05
I spent too much time chatting with people yesterd
| |
956 } | |
957 | |
913 TF_BUILTIN(InstanceOf, ObjectBuiltinsAssembler) { | 958 TF_BUILTIN(InstanceOf, ObjectBuiltinsAssembler) { |
914 typedef CompareDescriptor Descriptor; | 959 typedef CompareDescriptor Descriptor; |
915 | 960 |
916 Node* object = Parameter(Descriptor::kLeft); | 961 Node* object = Parameter(Descriptor::kLeft); |
917 Node* callable = Parameter(Descriptor::kRight); | 962 Node* callable = Parameter(Descriptor::kRight); |
918 Node* context = Parameter(Descriptor::kContext); | 963 Node* context = Parameter(Descriptor::kContext); |
919 | 964 |
920 Return(InstanceOf(object, callable, context)); | 965 Return(InstanceOf(object, callable, context)); |
921 } | 966 } |
922 | 967 |
(...skipping 12 matching lines...) Expand all Loading... | |
935 typedef TypeofDescriptor Descriptor; | 980 typedef TypeofDescriptor Descriptor; |
936 | 981 |
937 Node* object = Parameter(Descriptor::kObject); | 982 Node* object = Parameter(Descriptor::kObject); |
938 Node* context = Parameter(Descriptor::kContext); | 983 Node* context = Parameter(Descriptor::kContext); |
939 | 984 |
940 Return(GetSuperConstructor(object, context)); | 985 Return(GetSuperConstructor(object, context)); |
941 } | 986 } |
942 | 987 |
943 } // namespace internal | 988 } // namespace internal |
944 } // namespace v8 | 989 } // namespace v8 |
OLD | NEW |