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

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

Issue 1531693002: [Interpreter] Implement ForIn in bytecode graph builder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@oth-0009-phi
Patch Set: Minor clean-up/simplication in Runtime_InterpreterForInPrepare. Created 5 years 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/interpreter/interpreter.cc ('k') | test/cctest/compiler/test-run-bytecode-graph-builder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-interpreter.cc
diff --git a/src/runtime/runtime-interpreter.cc b/src/runtime/runtime-interpreter.cc
index c22e6808c3e19c763b35ab61d559b236638c5116..d061a4916dcd8f5230488030833a66b85c309e5a 100644
--- a/src/runtime/runtime-interpreter.cc
+++ b/src/runtime/runtime-interpreter.cc
@@ -150,18 +150,24 @@ RUNTIME_FUNCTION(Runtime_InterpreterNewClosure) {
RUNTIME_FUNCTION(Runtime_InterpreterForInPrepare) {
HandleScope scope(isolate);
- DCHECK_EQ(2, args.length());
+ DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0);
- CONVERT_ARG_HANDLE_CHECKED(HeapObject, property_names, 1);
- Handle<Object> cache_type = property_names;
- Handle<Map> cache_type_map = handle(property_names->map(), isolate);
- Handle<Map> receiver_map = handle(receiver->map(), isolate);
+ Object* property_names = Runtime_GetPropertyNamesFast(
+ 1, Handle<Object>::cast(receiver).location(), isolate);
+ if (isolate->has_pending_exception()) {
+ return property_names;
+ }
+ Handle<Object> cache_type(property_names, isolate);
Handle<FixedArray> cache_array;
int cache_length;
- if (cache_type_map.is_identical_to(isolate->factory()->meta_map())) {
+ Handle<Map> receiver_map = handle(receiver->map(), isolate);
+ if (cache_type->IsMap()) {
+ Handle<Map> cache_type_map =
+ handle(Handle<Map>::cast(cache_type)->map(), isolate);
+ DCHECK(cache_type_map.is_identical_to(isolate->factory()->meta_map()));
int enum_length = cache_type_map->EnumLength();
DescriptorArray* descriptors = receiver_map->instance_descriptors();
if (enum_length > 0 && descriptors->HasEnumCache()) {
@@ -185,14 +191,12 @@ RUNTIME_FUNCTION(Runtime_InterpreterForInPrepare) {
}
}
- Handle<FixedArray> result = isolate->factory()->NewFixedArray(4);
- result->set(0, *receiver);
+ Handle<FixedArray> result = isolate->factory()->NewFixedArray(3);
+ result->set(0, *cache_type);
result->set(1, *cache_array);
- result->set(2, *cache_type);
- result->set(3, Smi::FromInt(cache_length));
+ result->set(2, Smi::FromInt(cache_length));
return *result;
}
-
} // namespace internal
} // namespace v8
« no previous file with comments | « src/interpreter/interpreter.cc ('k') | test/cctest/compiler/test-run-bytecode-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698