Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: src/builtins/builtins-object.cc

Issue 2684043002: [turbofan] Use fast stub for ForInPrepare and ForInNext (Closed)
Patch Set: add missing SmiUntag and remove ForInNext RT function Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/builtins/builtins.cc ('k') | src/code-factory.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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)), &nothing_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(&nothing_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
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
OLDNEW
« no previous file with comments | « src/builtins/builtins.cc ('k') | src/code-factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698