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

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

Issue 2571563004: [Turbofan] Implement super calls with spread bytecode in assembly code. (Closed)
Patch Set: MIPS64 port Created 3 years, 11 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-classes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-array.cc
diff --git a/src/runtime/runtime-array.cc b/src/runtime/runtime-array.cc
index a9cbc208b34e442cc25d4f40dedf46acfba62ded..20cd65974c0fcaa67e38c823b246b36e073bf970 100644
--- a/src/runtime/runtime-array.cc
+++ b/src/runtime/runtime-array.cc
@@ -646,5 +646,33 @@ RUNTIME_FUNCTION(Runtime_SpreadIterablePrepare) {
return *spread;
}
+RUNTIME_FUNCTION(Runtime_SpreadIterableFixed) {
+ HandleScope scope(isolate);
+ DCHECK_EQ(1, args.length());
+ CONVERT_ARG_HANDLE_CHECKED(Object, spread, 0);
+
+ // The caller should check if proper iteration is necessary.
+ Handle<JSFunction> spread_iterable_function = isolate->spread_iterable();
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
+ isolate, spread,
+ Execution::Call(isolate, spread_iterable_function,
+ isolate->factory()->undefined_value(), 1, &spread));
+
+ // Create a new FixedArray and put the result of the spread into it.
+ Handle<JSArray> spread_array = Handle<JSArray>::cast(spread);
+ uint32_t spread_length;
+ CHECK(spread_array->length()->ToArrayIndex(&spread_length));
+
+ Handle<FixedArray> result = isolate->factory()->NewFixedArray(spread_length);
+ ElementsAccessor* accessor = spread_array->GetElementsAccessor();
+ for (uint32_t i = 0; i < spread_length; i++) {
+ DCHECK(accessor->HasElement(spread_array, i));
+ Handle<Object> element = accessor->Get(spread_array, i);
+ result->set(i, *element);
+ }
+
+ return *result;
+}
+
} // namespace internal
} // namespace v8
« no previous file with comments | « src/runtime/runtime.h ('k') | src/runtime/runtime-classes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698