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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/builtins/builtins.cc ('k') | src/code-factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/builtins-object.cc
diff --git a/src/builtins/builtins-object.cc b/src/builtins/builtins-object.cc
index 5f90ecfb190a2eb54a5a42f75f9f99c3de775475..259db0f08cd928290f4d3c3a0d053e82699a25ee 100644
--- a/src/builtins/builtins-object.cc
+++ b/src/builtins/builtins-object.cc
@@ -910,6 +910,51 @@ TF_BUILTIN(ForInFilter, ObjectBuiltinsAssembler) {
Return(ForInFilter(key, object, context));
}
+TF_BUILTIN(ForInNext, ObjectBuiltinsAssembler) {
+ typedef ForInNextDescriptor Descriptor;
+
+ Label filter(this);
+ Node* object = Parameter(Descriptor::kObject);
+ Node* cache_array = Parameter(Descriptor::kCacheArray);
+ Node* cache_type = Parameter(Descriptor::kCacheType);
+ Node* index = Parameter(Descriptor::kIndex);
+ Node* context = Parameter(Descriptor::kContext);
+
+ Node* key = LoadFixedArrayElement(cache_array, SmiUntag(index));
+ Node* map = LoadMap(object);
+ GotoUnless(WordEqual(map, cache_type), &filter);
+ Return(key);
+ Bind(&filter);
+ Return(ForInFilter(key, object, context));
+}
+
+TF_BUILTIN(ForInPrepare, ObjectBuiltinsAssembler) {
+ typedef ForInPrepareDescriptor Descriptor;
+
+ Label use_cache(this), nothing_to_iterate(this), call_runtime(this);
+ Node* object = Parameter(Descriptor::kObject);
+ Node* context = Parameter(Descriptor::kContext);
+
+ CheckEnumCache(object, &use_cache, &call_runtime);
+ Bind(&use_cache);
+ Node* map = LoadMap(object);
+ Node* enum_length = EnumLength(map);
+ GotoIf(WordEqual(enum_length, SmiConstant(0)), &nothing_to_iterate);
+ Node* descriptors = LoadMapDescriptors(map);
+ Node* cache_offset =
+ LoadObjectField(descriptors, DescriptorArray::kEnumCacheOffset);
+ Node* enum_cache = LoadObjectField(
+ cache_offset, DescriptorArray::kEnumCacheBridgeCacheOffset);
+ Return(map, enum_cache, enum_length);
+
+ Bind(&nothing_to_iterate);
+ Node* zero = SmiConstant(0);
+ Return(zero, zero, zero);
+
+ Bind(&call_runtime);
+ 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
+}
+
TF_BUILTIN(InstanceOf, ObjectBuiltinsAssembler) {
typedef CompareDescriptor Descriptor;
« 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