Commit be8c9e73 authored by Takuto Ikuta's avatar Takuto Ikuta Committed by Commit Bot

Split torque generated files for faster build

By using different namespace, generated code split into different files.

By this CL, build time of torque_generated_initializers is improved from 80 seconds to 40 seconds on Z840 Linux measured by following command:

# Remove generated code to re-compile all generated files.
~/v8/v8$ rm -rf out/x64.release/gen/
# GOMA_STORE_ONLY=true disables goma's backend cache.
~/v8/v8$ time GOMA_STORE_ONLY=true autoninja -C out/x64.release/ torque_generated_initializers

Bug: v8:8732
Change-Id: I64545f9994aea7e4209ac3852aadf4e2e9f4bc93
Reviewed-on: https://chromium-review.googlesource.com/c/1446331Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59215}
parent 4b9eb7f7
......@@ -882,10 +882,22 @@ torque_namespaces = [
"base",
"arguments",
"array",
"array-copywithin",
"array-filter",
"array-foreach",
"array-join",
"array-map",
"array-of",
"array-reverse",
"array-slice",
"array-splice",
"array-unshift",
"array-lastindexof",
"collections",
"iterator",
"object",
"typed-array",
"typed-array-createtypedarray",
"data-view",
"extras-utils",
"test",
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
namespace array {
namespace array_copywithin {
macro ConvertToRelativeIndex(index: Number, length: Number): Number {
return index < 0 ? Max(index + length, 0) : Min(index, length);
}
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
namespace array {
namespace array_filter {
transitioning javascript builtin
ArrayFilterLoopEagerDeoptContinuation(implicit context: Context)(
receiver: Object, callback: Object, thisArg: Object, array: Object,
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
namespace array {
namespace array_foreach {
transitioning javascript builtin
ArrayForEachLoopEagerDeoptContinuation(implicit context: Context)(
receiver: Object, callback: Object, thisArg: Object, initialK: Object,
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
namespace array {
namespace array_join {
type LoadJoinElementFn = builtin(Context, JSReceiver, Number) => Object;
// Fast C call to write a fixed array (see Buffer.fixedArray) to a single
......@@ -16,7 +16,7 @@ namespace array {
return GetProperty(receiver, k);
}
LoadJoinElement<DictionaryElements>(
LoadJoinElement<array::DictionaryElements>(
context: Context, receiver: JSReceiver, k: Number): Object {
const array: JSArray = UnsafeCast<JSArray>(receiver);
const dict: NumberDictionary = UnsafeCast<NumberDictionary>(array.elements);
......@@ -32,7 +32,7 @@ namespace array {
}
}
LoadJoinElement<FastSmiOrObjectElements>(
LoadJoinElement<array::FastSmiOrObjectElements>(
context: Context, receiver: JSReceiver, k: Number): Object {
const array: JSArray = UnsafeCast<JSArray>(receiver);
const fixedArray: FixedArray = UnsafeCast<FixedArray>(array.elements);
......@@ -40,7 +40,7 @@ namespace array {
return element == Hole ? kEmptyString : element;
}
LoadJoinElement<FastDoubleElements>(
LoadJoinElement<array::FastDoubleElements>(
context: Context, receiver: JSReceiver, k: Number): Object {
const array: JSArray = UnsafeCast<JSArray>(receiver);
const fixedDoubleArray: FixedDoubleArray =
......@@ -98,7 +98,7 @@ namespace array {
loadFn: LoadJoinElementFn, receiver: JSReceiver, originalMap: Map,
originalLen: Number): never
labels Cannot, Can {
if (loadFn == LoadJoinElement<GenericElementsAccessor>) goto Can;
if (loadFn == LoadJoinElement<array::GenericElementsAccessor>) goto Can;
const array: JSArray = UnsafeCast<JSArray>(receiver);
if (originalMap != array.map) goto Cannot;
......@@ -280,7 +280,7 @@ namespace array {
if (CannotUseSameArrayAccessor<T>(
loadFn, receiver, initialMap, lengthNumber))
deferred {
loadFn = LoadJoinElement<GenericElementsAccessor>;
loadFn = LoadJoinElement<array::GenericElementsAccessor>;
}
if (k > 0) {
......@@ -343,9 +343,9 @@ namespace array {
if (IsNoElementsProtectorCellInvalid()) goto IfSlowPath;
if (IsElementsKindLessThanOrEqual(kind, HOLEY_ELEMENTS)) {
loadFn = LoadJoinElement<FastSmiOrObjectElements>;
loadFn = LoadJoinElement<array::FastSmiOrObjectElements>;
} else if (IsElementsKindLessThanOrEqual(kind, HOLEY_DOUBLE_ELEMENTS)) {
loadFn = LoadJoinElement<FastDoubleElements>;
loadFn = LoadJoinElement<array::FastDoubleElements>;
} else if (kind == DICTIONARY_ELEMENTS)
deferred {
const dict: NumberDictionary =
......@@ -362,7 +362,7 @@ namespace array {
ThrowInvalidStringLength(context);
}
} else {
loadFn = LoadJoinElement<DictionaryElements>;
loadFn = LoadJoinElement<array::DictionaryElements>;
}
}
else {
......@@ -370,7 +370,7 @@ namespace array {
}
}
label IfSlowPath {
loadFn = LoadJoinElement<GenericElementsAccessor>;
loadFn = LoadJoinElement<array::GenericElementsAccessor>;
}
return ArrayJoinImpl<JSArray>(
receiver, sep, lenNumber, useToLocaleString, locales, options, loadFn);
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
namespace array {
namespace array_lastindexof {
macro LoadWithHoleCheck<Elements: type>(
elements: FixedArrayBase, index: Smi): Object
labels IfHole;
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
namespace array {
namespace array_map {
transitioning javascript builtin
ArrayMapLoopEagerDeoptContinuation(implicit context: Context)(
receiver: Object, callback: Object, thisArg: Object, array: Object,
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
namespace array {
namespace array_of {
// https://tc39.github.io/ecma262/#sec-array.of
transitioning javascript builtin
ArrayOf(implicit context: Context)(receiver: Object, ...arguments): Object {
......@@ -46,7 +46,7 @@ namespace array {
}
// 8. Perform ? Set(A, "length", len, true).
SetPropertyLength(a, len);
array::SetPropertyLength(a, len);
// 9. Return A.
return a;
......
......@@ -2,24 +2,25 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
namespace array {
namespace array_reverse {
macro LoadElement<ElementsAccessor: type, T: type>(
elements: FixedArrayBase, index: Smi): T;
LoadElement<FastPackedSmiElements, Smi>(implicit context: Context)(
LoadElement<array::FastPackedSmiElements, Smi>(implicit context: Context)(
elements: FixedArrayBase, index: Smi): Smi {
const elems: FixedArray = UnsafeCast<FixedArray>(elements);
return UnsafeCast<Smi>(elems[index]);
}
LoadElement<FastPackedObjectElements, Object>(implicit context: Context)(
elements: FixedArrayBase, index: Smi): Object {
LoadElement<array::FastPackedObjectElements, Object>(
implicit context: Context)(elements: FixedArrayBase, index: Smi): Object {
const elems: FixedArray = UnsafeCast<FixedArray>(elements);
return elems[index];
}
LoadElement<FastPackedDoubleElements, float64>(implicit context: Context)(
elements: FixedArrayBase, index: Smi): float64 {
LoadElement<array::FastPackedDoubleElements, float64>(
implicit context: Context)(elements: FixedArrayBase, index: Smi):
float64 {
try {
const elems: FixedDoubleArray = UnsafeCast<FixedDoubleArray>(elements);
return LoadDoubleWithHoleCheck(elems, index) otherwise Hole;
......@@ -35,20 +36,22 @@ namespace array {
implicit context:
Context)(elements: FixedArrayBase, index: Smi, value: T);
StoreElement<FastPackedSmiElements, Smi>(implicit context: Context)(
StoreElement<array::FastPackedSmiElements, Smi>(implicit context: Context)(
elements: FixedArrayBase, index: Smi, value: Smi) {
const elems: FixedArray = UnsafeCast<FixedArray>(elements);
StoreFixedArrayElementSmi(elems, index, value, SKIP_WRITE_BARRIER);
}
StoreElement<FastPackedObjectElements, Object>(implicit context: Context)(
elements: FixedArrayBase, index: Smi, value: Object) {
StoreElement<array::FastPackedObjectElements, Object>(
implicit context:
Context)(elements: FixedArrayBase, index: Smi, value: Object) {
const elems: FixedArray = UnsafeCast<FixedArray>(elements);
elems[index] = value;
}
StoreElement<FastPackedDoubleElements, float64>(implicit context: Context)(
elements: FixedArrayBase, index: Smi, value: float64) {
StoreElement<array::FastPackedDoubleElements, float64>(
implicit context:
Context)(elements: FixedArrayBase, index: Smi, value: float64) {
const elems: FixedDoubleArray = UnsafeCast<FixedDoubleArray>(elements);
StoreFixedDoubleArrayElementWithSmiIndex(elems, index, value);
}
......@@ -149,15 +152,15 @@ namespace array {
const kind: ElementsKind = array.map.elements_kind;
if (kind == PACKED_SMI_ELEMENTS) {
EnsureWriteableFastElements(array);
FastPackedArrayReverse<FastPackedSmiElements, Smi>(
array::EnsureWriteableFastElements(array);
FastPackedArrayReverse<array::FastPackedSmiElements, Smi>(
array.elements, array.length);
} else if (kind == PACKED_ELEMENTS) {
EnsureWriteableFastElements(array);
FastPackedArrayReverse<FastPackedObjectElements, Object>(
array::EnsureWriteableFastElements(array);
FastPackedArrayReverse<array::FastPackedObjectElements, Object>(
array.elements, array.length);
} else if (kind == PACKED_DOUBLE_ELEMENTS) {
FastPackedArrayReverse<FastPackedDoubleElements, float64>(
FastPackedArrayReverse<array::FastPackedDoubleElements, float64>(
array.elements, array.length);
} else {
goto Slow;
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
namespace array {
namespace array_slice {
macro HandleSimpleArgumentsSlice(
context: Context, args: JSArgumentsObjectWithLength, start: Smi,
count: Smi): JSArray
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
namespace array {
namespace array_splice {
// Given {elements}, we want to create a non-zero length array of type
// FixedArrayType. Most of this behavior is outsourced to ExtractFixedArray(),
// but the special case of wanting to have a FixedDoubleArray when given a
......@@ -39,7 +39,7 @@ namespace array {
macro StoreHoles<FixedArrayType: type>(
elements: FixedArrayType, holeStartIndex: Smi, holeEndIndex: Smi): void {
for (let i: Smi = holeStartIndex; i < holeEndIndex; i++) {
StoreArrayHole(elements, i);
array::StoreArrayHole(elements, i);
}
}
......@@ -57,7 +57,7 @@ namespace array {
lengthDelta: Smi, actualStart: Smi, insertCount: Smi,
actualDeleteCount: Smi): void labels Bailout {
// Make sure elements are writable.
EnsureWriteableFastElements(a);
array::EnsureWriteableFastElements(a);
if (insertCount != actualDeleteCount) {
const elements: FixedArrayBase = a.elements;
......
......@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
namespace array {
namespace array_unshift {
extern builtin ArrayUnshift(Context, JSFunction, Object, int32);
macro TryFastArrayUnshift(
context: Context, receiver: Object, arguments: constexpr Arguments): never
labels Slow {
const array: FastJSArray = Cast<FastJSArray>(receiver) otherwise Slow;
EnsureWriteableFastElements(array);
array::EnsureWriteableFastElements(array);
const map: Map = array.map;
if (!IsExtensibleMap(map)) goto Slow;
......
......@@ -4,7 +4,7 @@
#include 'src/builtins/builtins-constructor-gen.h'
namespace typed_array {
namespace typed_array_createtypedarray {
extern builtin IterableToListMayPreserveHoles(Context, Object, Callable):
JSArray;
extern builtin TypedArrayInitialize(implicit context: Context)(
......@@ -29,7 +29,7 @@ namespace typed_array {
macro TypedArrayInitializeWithBuffer(
typedArray: JSTypedArray, length: PositiveSmi, buffer: JSArrayBuffer,
elementsInfo: TypedArrayElementsInfo, byteOffset: Number) {
elementsInfo: typed_array::TypedArrayElementsInfo, byteOffset: Number) {
const byteLength: Number = SmiMul(length, elementsInfo.size);
SetupTypedArray(
......@@ -43,7 +43,7 @@ namespace typed_array {
// ES #sec-typedarray-length
macro ConstructByLength(implicit context: Context)(
typedArray: JSTypedArray, length: Object,
elementsInfo: TypedArrayElementsInfo): void {
elementsInfo: typed_array::TypedArrayElementsInfo): void {
const convertedLength: Number =
ToInteger_Inline(context, length, kTruncateMinusZero);
// The maximum length of a TypedArray is MaxSmi().
......@@ -63,7 +63,7 @@ namespace typed_array {
// ES #sec-typedarray-object
macro ConstructByArrayLike(implicit context: Context)(
typedArray: JSTypedArray, arrayLike: HeapObject, initialLength: Object,
elementsInfo: TypedArrayElementsInfo,
elementsInfo: typed_array::TypedArrayElementsInfo,
bufferConstructor: JSReceiver): void {
// The caller has looked up length on arrayLike, which is observable.
const length: PositiveSmi = ToSmiLength(initialLength)
......@@ -99,7 +99,7 @@ namespace typed_array {
// ES #sec-typedarray-object
macro ConstructByIterable(implicit context: Context)(
typedArray: JSTypedArray, iterable: JSReceiver, iteratorFn: Callable,
elementsInfo: TypedArrayElementsInfo): void {
elementsInfo: typed_array::TypedArrayElementsInfo): void {
const array: JSArray =
IterableToListMayPreserveHoles(context, iterable, iteratorFn);
ConstructByArrayLike(
......@@ -111,7 +111,7 @@ namespace typed_array {
// ES #sec-typedarray-typedarray
macro ConstructByTypedArray(implicit context: Context)(
typedArray: JSTypedArray, srcTypedArray: JSTypedArray,
elementsInfo: TypedArrayElementsInfo): void {
elementsInfo: typed_array::TypedArrayElementsInfo): void {
let bufferConstructor: JSReceiver = GetArrayBufferFunction();
const srcBuffer: JSArrayBuffer = srcTypedArray.buffer;
// TODO(petermarshall): Throw on detached typedArray.
......@@ -144,7 +144,7 @@ namespace typed_array {
// ES #sec-typedarray-buffer-byteoffset-length
macro ConstructByArrayBuffer(implicit context: Context)(
typedArray: JSTypedArray, buffer: JSArrayBuffer, byteOffset: Object,
length: Object, elementsInfo: TypedArrayElementsInfo): void {
length: Object, elementsInfo: typed_array::TypedArrayElementsInfo): void {
try {
let offset: Number = FromConstexpr<Smi>(0);
if (byteOffset != Undefined) {
......@@ -220,7 +220,7 @@ namespace typed_array {
transitioning macro ConstructByJSReceiver(implicit context: Context)(
array: JSTypedArray, obj: JSReceiver,
elementsInfo: TypedArrayElementsInfo) {
elementsInfo: typed_array::TypedArrayElementsInfo) {
try {
const iteratorMethod: Object =
GetIteratorMethod(obj) otherwise IfIteratorUndefined;
......@@ -259,8 +259,8 @@ namespace typed_array {
// 5. Let elementSize be the Number value of the Element Size value in Table
// 56 for constructorName.
const elementsInfo: TypedArrayElementsInfo =
GetTypedArrayElementsInfo(array);
const elementsInfo: typed_array::TypedArrayElementsInfo =
typed_array::GetTypedArrayElementsInfo(array);
try {
typeswitch (arg1) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment