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

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

Issue 2571563004: [Turbofan] Implement super calls with spread bytecode in assembly code. (Closed)
Patch Set: Update builtins for new push args modes 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
Index: src/runtime/runtime-array.cc
diff --git a/src/runtime/runtime-array.cc b/src/runtime/runtime-array.cc
index ad374d22b29b874adfb6b4c4c852cedce14739ff..41dc016bf6dd5d46f0ca008ece61014b6c376174 100644
--- a/src/runtime/runtime-array.cc
+++ b/src/runtime/runtime-array.cc
@@ -648,5 +648,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

Powered by Google App Engine
This is Rietveld 408576698