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

Unified Diff: src/runtime/runtime-forin.cc

Issue 2151773002: Avoid jumping to the runtime for ForInFilter (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: remove double label Created 4 years, 5 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/runtime/runtime.h ('k') | src/runtime/runtime-object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-forin.cc
diff --git a/src/runtime/runtime-forin.cc b/src/runtime/runtime-forin.cc
index 916ff17a9ebfd2c13083f82e25701549d209f0bd..48ddebb672089b2337eceeea0156d8c314815b28 100644
--- a/src/runtime/runtime-forin.cc
+++ b/src/runtime/runtime-forin.cc
@@ -101,11 +101,6 @@ MaybeHandle<Object> HasEnumerableProperty(Isolate* isolate,
return isolate->factory()->undefined_value();
}
-MaybeHandle<Object> Filter(Handle<JSReceiver> receiver, Handle<Object> key) {
- Isolate* const isolate = receiver->GetIsolate();
- return HasEnumerableProperty(isolate, receiver, key);
-}
-
} // namespace
@@ -157,13 +152,24 @@ RUNTIME_FUNCTION(Runtime_ForInDone) {
return isolate->heap()->ToBoolean(index == length);
}
+RUNTIME_FUNCTION(Runtime_ForInHasProperty) {
+ HandleScope scope(isolate);
+ DCHECK_EQ(2, args.length());
+ CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0);
+ CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
+ Handle<Object> result;
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
+ isolate, result, HasEnumerableProperty(isolate, receiver, key));
+ return isolate->heap()->ToBoolean(!result->IsUndefined(isolate));
+}
RUNTIME_FUNCTION(Runtime_ForInFilter) {
HandleScope scope(isolate);
DCHECK_EQ(2, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
- RETURN_RESULT_OR_FAILURE(isolate, Filter(receiver, key));
+ RETURN_RESULT_OR_FAILURE(isolate,
+ HasEnumerableProperty(isolate, receiver, key));
}
@@ -179,7 +185,8 @@ RUNTIME_FUNCTION(Runtime_ForInNext) {
if (receiver->map() == *cache_type) {
return *key;
}
- RETURN_RESULT_OR_FAILURE(isolate, Filter(receiver, key));
+ RETURN_RESULT_OR_FAILURE(isolate,
+ HasEnumerableProperty(isolate, receiver, key));
}
« no previous file with comments | « src/runtime/runtime.h ('k') | src/runtime/runtime-object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698