[elements] Rename FAST elements kinds
The `FAST_` prefix doesn’t make much sense — they’re all just different cases with their own optimizations. Packedness being implicit (e.g. `FAST_ELEMENTS` vs. `FAST_HOLEY_ELEMENTS`) is not ideal, either. This patch renames the FAST elements kinds as follows: - e.g. FAST_ELEMENTS => PACKED_ELEMENTS - e.g. FAST_HOLEY_ELEMENTS => HOLEY_ELEMENTS The following exceptions are left intact, for lack of a better name: - FAST_SLOPPY_ARGUMENTS_ELEMENTS - SLOW_SLOPPY_ARGUMENTS_ELEMENTS - FAST_STRING_WRAPPER_ELEMENTS - SLOW_STRING_WRAPPER_ELEMENTS This makes it easier to reason about elements kinds, and less confusing to explain how they’re used. R=jkummerow@chromium.org, cbruni@chromium.org BUG=v8:6548 Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng Change-Id: Ie7c6bee85583c3d84b730f7aebbd70c1efa38af9 Reviewed-on: https://chromium-review.googlesource.com/556032 Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Reviewed-by: Camillo Bruni <cbruni@chromium.org> Reviewed-by: Jaroslav Sevcik <jarin@chromium.org> Reviewed-by: Andreas Haas <ahaas@chromium.org> Commit-Queue: Mathias Bynens <mathias@chromium.org> Cr-Commit-Position: refs/heads/master@{#46361}
This commit is contained in:
parent
b57366f2e1
commit
26c00f4a4c
@ -557,7 +557,7 @@ MaybeHandle<JSObject> ApiNatives::InstantiateRemoteObject(
|
||||
Handle<Map> object_map = isolate->factory()->NewMap(
|
||||
JS_SPECIAL_API_OBJECT_TYPE,
|
||||
JSObject::kHeaderSize + data->embedder_field_count() * kPointerSize,
|
||||
FAST_HOLEY_SMI_ELEMENTS);
|
||||
HOLEY_SMI_ELEMENTS);
|
||||
object_map->SetConstructor(*constructor);
|
||||
object_map->set_is_access_check_needed(true);
|
||||
|
||||
@ -690,7 +690,7 @@ Handle<JSFunction> ApiNatives::CreateApiFunction(
|
||||
}
|
||||
|
||||
Handle<Map> map =
|
||||
isolate->factory()->NewMap(type, instance_size, FAST_HOLEY_SMI_ELEMENTS);
|
||||
isolate->factory()->NewMap(type, instance_size, HOLEY_SMI_ELEMENTS);
|
||||
JSFunction::SetInitialMap(result, map, Handle<JSObject>::cast(prototype));
|
||||
|
||||
// Mark as undetectable if needed.
|
||||
|
@ -3016,7 +3016,7 @@ Local<Array> StackTrace::AsArray() {
|
||||
frames->set(i, *frame_obj);
|
||||
}
|
||||
return Utils::ToLocal(isolate->factory()->NewJSArrayWithElements(
|
||||
frames, i::FAST_ELEMENTS, frame_count));
|
||||
frames, i::PACKED_ELEMENTS, frame_count));
|
||||
}
|
||||
|
||||
|
||||
@ -7424,7 +7424,7 @@ i::Handle<i::JSArray> MapAsArray(i::Isolate* isolate, i::Object* table_obj,
|
||||
}
|
||||
DCHECK_EQ(result_index, result->length());
|
||||
DCHECK_EQ(result_index, length);
|
||||
return factory->NewJSArrayWithElements(result, i::FAST_ELEMENTS, length);
|
||||
return factory->NewJSArrayWithElements(result, i::PACKED_ELEMENTS, length);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@ -7524,7 +7524,7 @@ i::Handle<i::JSArray> SetAsArray(i::Isolate* isolate, i::Object* table_obj,
|
||||
}
|
||||
DCHECK_EQ(result_index, result->length());
|
||||
DCHECK_EQ(result_index, length);
|
||||
return factory->NewJSArrayWithElements(result, i::FAST_ELEMENTS, length);
|
||||
return factory->NewJSArrayWithElements(result, i::PACKED_ELEMENTS, length);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
@ -2278,8 +2278,8 @@ static void CreateArrayDispatch(MacroAssembler* masm,
|
||||
T stub(masm->isolate(), GetInitialFastElementsKind(), mode);
|
||||
__ TailCallStub(&stub);
|
||||
} else if (mode == DONT_OVERRIDE) {
|
||||
int last_index = GetSequenceIndexFromFastElementsKind(
|
||||
TERMINAL_FAST_ELEMENTS_KIND);
|
||||
int last_index =
|
||||
GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND);
|
||||
for (int i = 0; i <= last_index; ++i) {
|
||||
ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
|
||||
__ cmp(r3, Operand(kind));
|
||||
@ -2304,12 +2304,12 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
|
||||
// sp[0] - last argument
|
||||
Label normal_sequence;
|
||||
if (mode == DONT_OVERRIDE) {
|
||||
STATIC_ASSERT(FAST_SMI_ELEMENTS == 0);
|
||||
STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
|
||||
STATIC_ASSERT(FAST_ELEMENTS == 2);
|
||||
STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
|
||||
STATIC_ASSERT(FAST_DOUBLE_ELEMENTS == 4);
|
||||
STATIC_ASSERT(FAST_HOLEY_DOUBLE_ELEMENTS == 5);
|
||||
STATIC_ASSERT(PACKED_SMI_ELEMENTS == 0);
|
||||
STATIC_ASSERT(HOLEY_SMI_ELEMENTS == 1);
|
||||
STATIC_ASSERT(PACKED_ELEMENTS == 2);
|
||||
STATIC_ASSERT(HOLEY_ELEMENTS == 3);
|
||||
STATIC_ASSERT(PACKED_DOUBLE_ELEMENTS == 4);
|
||||
STATIC_ASSERT(HOLEY_DOUBLE_ELEMENTS == 5);
|
||||
|
||||
// is the low bit set? If so, we are holey and that is good.
|
||||
__ tst(r3, Operand(1));
|
||||
@ -2355,8 +2355,8 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
|
||||
__ str(r4, FieldMemOperand(r2, AllocationSite::kTransitionInfoOffset));
|
||||
|
||||
__ bind(&normal_sequence);
|
||||
int last_index = GetSequenceIndexFromFastElementsKind(
|
||||
TERMINAL_FAST_ELEMENTS_KIND);
|
||||
int last_index =
|
||||
GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND);
|
||||
for (int i = 0; i <= last_index; ++i) {
|
||||
ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
|
||||
__ cmp(r3, Operand(kind));
|
||||
@ -2374,8 +2374,8 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
|
||||
|
||||
template<class T>
|
||||
static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) {
|
||||
int to_index = GetSequenceIndexFromFastElementsKind(
|
||||
TERMINAL_FAST_ELEMENTS_KIND);
|
||||
int to_index =
|
||||
GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND);
|
||||
for (int i = 0; i <= to_index; ++i) {
|
||||
ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
|
||||
T stub(isolate, kind);
|
||||
@ -2394,7 +2394,7 @@ void CommonArrayConstructorStub::GenerateStubsAheadOfTime(Isolate* isolate) {
|
||||
isolate);
|
||||
ArrayNArgumentsConstructorStub stub(isolate);
|
||||
stub.GetCode();
|
||||
ElementsKind kinds[2] = { FAST_ELEMENTS, FAST_HOLEY_ELEMENTS };
|
||||
ElementsKind kinds[2] = {PACKED_ELEMENTS, HOLEY_ELEMENTS};
|
||||
for (int i = 0; i < 2; i++) {
|
||||
// For internal arrays we only need a few things
|
||||
InternalArrayNoArgumentConstructorStub stubh1(isolate, kinds[i]);
|
||||
@ -2536,21 +2536,21 @@ void InternalArrayConstructorStub::Generate(MacroAssembler* masm) {
|
||||
|
||||
if (FLAG_debug_code) {
|
||||
Label done;
|
||||
__ cmp(r3, Operand(FAST_ELEMENTS));
|
||||
__ cmp(r3, Operand(PACKED_ELEMENTS));
|
||||
__ b(eq, &done);
|
||||
__ cmp(r3, Operand(FAST_HOLEY_ELEMENTS));
|
||||
__ cmp(r3, Operand(HOLEY_ELEMENTS));
|
||||
__ Assert(eq,
|
||||
kInvalidElementsKindForInternalArrayOrInternalPackedArray);
|
||||
__ bind(&done);
|
||||
}
|
||||
|
||||
Label fast_elements_case;
|
||||
__ cmp(r3, Operand(FAST_ELEMENTS));
|
||||
__ cmp(r3, Operand(PACKED_ELEMENTS));
|
||||
__ b(eq, &fast_elements_case);
|
||||
GenerateCase(masm, FAST_HOLEY_ELEMENTS);
|
||||
GenerateCase(masm, HOLEY_ELEMENTS);
|
||||
|
||||
__ bind(&fast_elements_case);
|
||||
GenerateCase(masm, FAST_ELEMENTS);
|
||||
GenerateCase(masm, PACKED_ELEMENTS);
|
||||
}
|
||||
|
||||
static int AddressOffset(ExternalReference ref0, ExternalReference ref1) {
|
||||
|
@ -2488,12 +2488,12 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
|
||||
|
||||
Label normal_sequence;
|
||||
if (mode == DONT_OVERRIDE) {
|
||||
STATIC_ASSERT(FAST_SMI_ELEMENTS == 0);
|
||||
STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
|
||||
STATIC_ASSERT(FAST_ELEMENTS == 2);
|
||||
STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
|
||||
STATIC_ASSERT(FAST_DOUBLE_ELEMENTS == 4);
|
||||
STATIC_ASSERT(FAST_HOLEY_DOUBLE_ELEMENTS == 5);
|
||||
STATIC_ASSERT(PACKED_SMI_ELEMENTS == 0);
|
||||
STATIC_ASSERT(HOLEY_SMI_ELEMENTS == 1);
|
||||
STATIC_ASSERT(PACKED_ELEMENTS == 2);
|
||||
STATIC_ASSERT(HOLEY_ELEMENTS == 3);
|
||||
STATIC_ASSERT(PACKED_DOUBLE_ELEMENTS == 4);
|
||||
STATIC_ASSERT(HOLEY_DOUBLE_ELEMENTS == 5);
|
||||
|
||||
// Is the low bit set? If so, the array is holey.
|
||||
__ Tbnz(kind, 0, &normal_sequence);
|
||||
@ -2562,8 +2562,8 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
|
||||
|
||||
template<class T>
|
||||
static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) {
|
||||
int to_index = GetSequenceIndexFromFastElementsKind(
|
||||
TERMINAL_FAST_ELEMENTS_KIND);
|
||||
int to_index =
|
||||
GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND);
|
||||
for (int i = 0; i <= to_index; ++i) {
|
||||
ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
|
||||
T stub(isolate, kind);
|
||||
@ -2582,7 +2582,7 @@ void CommonArrayConstructorStub::GenerateStubsAheadOfTime(Isolate* isolate) {
|
||||
isolate);
|
||||
ArrayNArgumentsConstructorStub stub(isolate);
|
||||
stub.GetCode();
|
||||
ElementsKind kinds[2] = { FAST_ELEMENTS, FAST_HOLEY_ELEMENTS };
|
||||
ElementsKind kinds[2] = {PACKED_ELEMENTS, HOLEY_ELEMENTS};
|
||||
for (int i = 0; i < 2; i++) {
|
||||
// For internal arrays we only need a few things
|
||||
InternalArrayNoArgumentConstructorStub stubh1(isolate, kinds[i]);
|
||||
@ -2752,17 +2752,17 @@ void InternalArrayConstructorStub::Generate(MacroAssembler* masm) {
|
||||
|
||||
if (FLAG_debug_code) {
|
||||
Label done;
|
||||
__ Cmp(x3, FAST_ELEMENTS);
|
||||
__ Ccmp(x3, FAST_HOLEY_ELEMENTS, ZFlag, ne);
|
||||
__ Cmp(x3, PACKED_ELEMENTS);
|
||||
__ Ccmp(x3, HOLEY_ELEMENTS, ZFlag, ne);
|
||||
__ Assert(eq, kInvalidElementsKindForInternalArrayOrInternalPackedArray);
|
||||
}
|
||||
|
||||
Label fast_elements_case;
|
||||
__ CompareAndBranch(kind, FAST_ELEMENTS, eq, &fast_elements_case);
|
||||
GenerateCase(masm, FAST_HOLEY_ELEMENTS);
|
||||
__ CompareAndBranch(kind, PACKED_ELEMENTS, eq, &fast_elements_case);
|
||||
GenerateCase(masm, HOLEY_ELEMENTS);
|
||||
|
||||
__ Bind(&fast_elements_case);
|
||||
GenerateCase(masm, FAST_ELEMENTS);
|
||||
GenerateCase(masm, PACKED_ELEMENTS);
|
||||
}
|
||||
|
||||
// The number of register that CallApiFunctionAndReturn will need to save on
|
||||
|
@ -911,7 +911,7 @@ void Genesis::CreateJSProxyMaps() {
|
||||
native_context()->set_proxy_function_map(*proxy_function_map);
|
||||
|
||||
Handle<Map> proxy_map =
|
||||
factory()->NewMap(JS_PROXY_TYPE, JSProxy::kSize, FAST_ELEMENTS);
|
||||
factory()->NewMap(JS_PROXY_TYPE, JSProxy::kSize, PACKED_ELEMENTS);
|
||||
proxy_map->set_dictionary_map(true);
|
||||
native_context()->set_proxy_map(*proxy_map);
|
||||
|
||||
@ -3236,7 +3236,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
function->shared()->set_instance_class_name(*arguments_string);
|
||||
|
||||
Handle<Map> map = factory->NewMap(
|
||||
JS_ARGUMENTS_TYPE, JSSloppyArgumentsObject::kSize, FAST_ELEMENTS);
|
||||
JS_ARGUMENTS_TYPE, JSSloppyArgumentsObject::kSize, PACKED_ELEMENTS);
|
||||
// Create the descriptor array for the arguments object.
|
||||
Map::EnsureDescriptorSlack(map, 2);
|
||||
|
||||
@ -3293,7 +3293,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
|
||||
// Create the map. Allocate one in-object field for length.
|
||||
Handle<Map> map = factory->NewMap(
|
||||
JS_ARGUMENTS_TYPE, JSStrictArgumentsObject::kSize, FAST_ELEMENTS);
|
||||
JS_ARGUMENTS_TYPE, JSStrictArgumentsObject::kSize, PACKED_ELEMENTS);
|
||||
// Create the descriptor array for the arguments object.
|
||||
Map::EnsureDescriptorSlack(map, 2);
|
||||
|
||||
@ -4261,7 +4261,7 @@ bool Genesis::InstallNatives(GlobalContextType context_type) {
|
||||
factory()->NewJSObject(isolate()->object_function());
|
||||
native_context()->set_extras_utils_object(*extras_utils);
|
||||
|
||||
InstallInternalArray(extras_utils, "InternalPackedArray", FAST_ELEMENTS);
|
||||
InstallInternalArray(extras_utils, "InternalPackedArray", PACKED_ELEMENTS);
|
||||
|
||||
InstallFunction(extras_utils, isolate()->promise_internal_constructor(),
|
||||
factory()->NewStringFromAsciiChecked("createPromise"));
|
||||
@ -4298,9 +4298,9 @@ bool Genesis::InstallNatives(GlobalContextType context_type) {
|
||||
Handle<JSObject> utils =
|
||||
Handle<JSObject>::cast(isolate()->natives_utils_object());
|
||||
Handle<JSFunction> array_function =
|
||||
InstallInternalArray(utils, "InternalArray", FAST_HOLEY_ELEMENTS);
|
||||
InstallInternalArray(utils, "InternalArray", HOLEY_ELEMENTS);
|
||||
native_context()->set_internal_array_function(*array_function);
|
||||
InstallInternalArray(utils, "InternalPackedArray", FAST_ELEMENTS);
|
||||
InstallInternalArray(utils, "InternalPackedArray", PACKED_ELEMENTS);
|
||||
}
|
||||
|
||||
// Run the rest of the native scripts.
|
||||
@ -5249,7 +5249,7 @@ Genesis::Genesis(Isolate* isolate,
|
||||
DCHECK_EQ(global_proxy_data->embedder_field_count(),
|
||||
global_proxy_template->InternalFieldCount());
|
||||
Handle<Map> global_proxy_map = isolate->factory()->NewMap(
|
||||
JS_GLOBAL_PROXY_TYPE, proxy_size, FAST_HOLEY_SMI_ELEMENTS);
|
||||
JS_GLOBAL_PROXY_TYPE, proxy_size, HOLEY_SMI_ELEMENTS);
|
||||
global_proxy_map->set_is_access_check_needed(true);
|
||||
global_proxy_map->set_has_hidden_prototype(true);
|
||||
|
||||
|
@ -81,7 +81,7 @@ ArgumentsBuiltinsAssembler::AllocateArgumentsObject(Node* map,
|
||||
DCHECK_IMPLIES(empty, parameter_map_count == nullptr);
|
||||
Node* size =
|
||||
empty ? IntPtrConstant(base_size)
|
||||
: ElementOffsetFromIndex(element_count, FAST_ELEMENTS, mode,
|
||||
: ElementOffsetFromIndex(element_count, PACKED_ELEMENTS, mode,
|
||||
base_size + FixedArray::kHeaderSize);
|
||||
Node* result = Allocate(size);
|
||||
Comment("Initialize arguments object");
|
||||
@ -102,7 +102,7 @@ ArgumentsBuiltinsAssembler::AllocateArgumentsObject(Node* map,
|
||||
Node* parameter_map = nullptr;
|
||||
if (parameter_map_count != nullptr) {
|
||||
Node* parameter_map_offset = ElementOffsetFromIndex(
|
||||
arguments_count, FAST_ELEMENTS, mode, FixedArray::kHeaderSize);
|
||||
arguments_count, PACKED_ELEMENTS, mode, FixedArray::kHeaderSize);
|
||||
parameter_map = InnerAllocate(arguments, parameter_map_offset);
|
||||
StoreObjectFieldNoWriteBarrier(result, JSArray::kElementsOffset,
|
||||
parameter_map);
|
||||
@ -169,7 +169,8 @@ Node* ArgumentsBuiltinsAssembler::EmitFastNewRestParameter(Node* context,
|
||||
Node* rest_count =
|
||||
IntPtrOrSmiSub(argument_count, formal_parameter_count, mode);
|
||||
Node* const native_context = LoadNativeContext(context);
|
||||
Node* const array_map = LoadJSArrayElementsMap(FAST_ELEMENTS, native_context);
|
||||
Node* const array_map =
|
||||
LoadJSArrayElementsMap(PACKED_ELEMENTS, native_context);
|
||||
GotoIf(IntPtrOrSmiLessThanOrEqual(rest_count, zero, mode),
|
||||
&no_rest_parameters);
|
||||
|
||||
@ -318,10 +319,10 @@ Node* ArgumentsBuiltinsAssembler::EmitFastNewSloppyArguments(Node* context,
|
||||
|
||||
Comment("Fill in non-mapped parameters");
|
||||
Node* argument_offset =
|
||||
ElementOffsetFromIndex(argument_count, FAST_ELEMENTS, mode,
|
||||
ElementOffsetFromIndex(argument_count, PACKED_ELEMENTS, mode,
|
||||
FixedArray::kHeaderSize - kHeapObjectTag);
|
||||
Node* mapped_offset =
|
||||
ElementOffsetFromIndex(mapped_count, FAST_ELEMENTS, mode,
|
||||
ElementOffsetFromIndex(mapped_count, PACKED_ELEMENTS, mode,
|
||||
FixedArray::kHeaderSize - kHeapObjectTag);
|
||||
CodeStubArguments arguments(this, argument_count, frame_ptr, mode);
|
||||
VARIABLE(current_argument, MachineType::PointerRepresentation());
|
||||
@ -359,7 +360,7 @@ Node* ArgumentsBuiltinsAssembler::EmitFastNewSloppyArguments(Node* context,
|
||||
BitcastTaggedToWord(map_array),
|
||||
IntPtrConstant(kParameterMapHeaderSize - FixedArray::kHeaderSize));
|
||||
Node* zero_offset = ElementOffsetFromIndex(
|
||||
zero, FAST_ELEMENTS, mode, FixedArray::kHeaderSize - kHeapObjectTag);
|
||||
zero, PACKED_ELEMENTS, mode, FixedArray::kHeaderSize - kHeapObjectTag);
|
||||
BuildFastLoop(var_list2, mapped_offset, zero_offset,
|
||||
[this, the_hole, elements, adjusted_map_array, &context_index,
|
||||
mode](Node* offset) {
|
||||
|
@ -118,28 +118,28 @@ class ArrayBuiltinCodeStubAssembler : public CodeStubAssembler {
|
||||
BIND(&fast);
|
||||
{
|
||||
kind = EnsureArrayPushable(a(), &runtime);
|
||||
GotoIf(IsElementsKindGreaterThan(kind, FAST_HOLEY_SMI_ELEMENTS),
|
||||
GotoIf(IsElementsKindGreaterThan(kind, HOLEY_SMI_ELEMENTS),
|
||||
&object_push_pre);
|
||||
|
||||
BuildAppendJSArray(FAST_SMI_ELEMENTS, a(), k_value, &runtime);
|
||||
BuildAppendJSArray(PACKED_SMI_ELEMENTS, a(), k_value, &runtime);
|
||||
Goto(&after_work);
|
||||
}
|
||||
|
||||
BIND(&object_push_pre);
|
||||
{
|
||||
Branch(IsElementsKindGreaterThan(kind, FAST_HOLEY_ELEMENTS),
|
||||
&double_push, &object_push);
|
||||
Branch(IsElementsKindGreaterThan(kind, HOLEY_ELEMENTS), &double_push,
|
||||
&object_push);
|
||||
}
|
||||
|
||||
BIND(&object_push);
|
||||
{
|
||||
BuildAppendJSArray(FAST_ELEMENTS, a(), k_value, &runtime);
|
||||
BuildAppendJSArray(PACKED_ELEMENTS, a(), k_value, &runtime);
|
||||
Goto(&after_work);
|
||||
}
|
||||
|
||||
BIND(&double_push);
|
||||
{
|
||||
BuildAppendJSArray(FAST_DOUBLE_ELEMENTS, a(), k_value, &runtime);
|
||||
BuildAppendJSArray(PACKED_DOUBLE_ELEMENTS, a(), k_value, &runtime);
|
||||
Goto(&after_work);
|
||||
}
|
||||
|
||||
@ -213,29 +213,29 @@ class ArrayBuiltinCodeStubAssembler : public CodeStubAssembler {
|
||||
{
|
||||
kind = EnsureArrayPushable(a(), &runtime);
|
||||
elements = LoadElements(a());
|
||||
GotoIf(IsElementsKindGreaterThan(kind, FAST_HOLEY_SMI_ELEMENTS),
|
||||
GotoIf(IsElementsKindGreaterThan(kind, HOLEY_SMI_ELEMENTS),
|
||||
&object_push_pre);
|
||||
TryStoreArrayElement(FAST_SMI_ELEMENTS, mode, &runtime, elements, k,
|
||||
TryStoreArrayElement(PACKED_SMI_ELEMENTS, mode, &runtime, elements, k,
|
||||
mappedValue);
|
||||
Goto(&finished);
|
||||
}
|
||||
|
||||
BIND(&object_push_pre);
|
||||
{
|
||||
Branch(IsElementsKindGreaterThan(kind, FAST_HOLEY_ELEMENTS), &double_push,
|
||||
Branch(IsElementsKindGreaterThan(kind, HOLEY_ELEMENTS), &double_push,
|
||||
&object_push);
|
||||
}
|
||||
|
||||
BIND(&object_push);
|
||||
{
|
||||
TryStoreArrayElement(FAST_ELEMENTS, mode, &runtime, elements, k,
|
||||
TryStoreArrayElement(PACKED_ELEMENTS, mode, &runtime, elements, k,
|
||||
mappedValue);
|
||||
Goto(&finished);
|
||||
}
|
||||
|
||||
BIND(&double_push);
|
||||
{
|
||||
TryStoreArrayElement(FAST_DOUBLE_ELEMENTS, mode, &runtime, elements, k,
|
||||
TryStoreArrayElement(PACKED_DOUBLE_ELEMENTS, mode, &runtime, elements, k,
|
||||
mappedValue);
|
||||
Goto(&finished);
|
||||
}
|
||||
@ -660,13 +660,13 @@ class ArrayBuiltinCodeStubAssembler : public CodeStubAssembler {
|
||||
|
||||
// Fast case: load the element directly from the elements FixedArray
|
||||
// and call the callback if the element is not the hole.
|
||||
DCHECK(kind == FAST_ELEMENTS || kind == FAST_DOUBLE_ELEMENTS);
|
||||
int base_size = kind == FAST_ELEMENTS
|
||||
DCHECK(kind == PACKED_ELEMENTS || kind == PACKED_DOUBLE_ELEMENTS);
|
||||
int base_size = kind == PACKED_ELEMENTS
|
||||
? FixedArray::kHeaderSize
|
||||
: (FixedArray::kHeaderSize - kHeapObjectTag);
|
||||
Node* offset = ElementOffsetFromIndex(index, kind, mode, base_size);
|
||||
Node* value = nullptr;
|
||||
if (kind == FAST_ELEMENTS) {
|
||||
if (kind == PACKED_ELEMENTS) {
|
||||
value = LoadObjectField(elements, offset);
|
||||
GotoIf(WordEqual(value, TheHoleConstant()), &hole_element);
|
||||
} else {
|
||||
@ -708,13 +708,13 @@ class ArrayBuiltinCodeStubAssembler : public CodeStubAssembler {
|
||||
Node* o_map = LoadMap(o());
|
||||
Node* bit_field2 = LoadMapBitField2(o_map);
|
||||
Node* kind = DecodeWord32<Map::ElementsKindBits>(bit_field2);
|
||||
Branch(IsElementsKindGreaterThan(kind, FAST_HOLEY_ELEMENTS),
|
||||
Branch(IsElementsKindGreaterThan(kind, HOLEY_ELEMENTS),
|
||||
&maybe_double_elements, &fast_elements);
|
||||
|
||||
ParameterMode mode = OptimalParameterMode();
|
||||
BIND(&fast_elements);
|
||||
{
|
||||
VisitAllFastElementsOneKind(FAST_ELEMENTS, processor, slow, mode,
|
||||
VisitAllFastElementsOneKind(PACKED_ELEMENTS, processor, slow, mode,
|
||||
direction);
|
||||
|
||||
action(this);
|
||||
@ -724,12 +724,12 @@ class ArrayBuiltinCodeStubAssembler : public CodeStubAssembler {
|
||||
}
|
||||
|
||||
BIND(&maybe_double_elements);
|
||||
Branch(IsElementsKindGreaterThan(kind, FAST_HOLEY_DOUBLE_ELEMENTS), slow,
|
||||
Branch(IsElementsKindGreaterThan(kind, HOLEY_DOUBLE_ELEMENTS), slow,
|
||||
&fast_double_elements);
|
||||
|
||||
BIND(&fast_double_elements);
|
||||
{
|
||||
VisitAllFastElementsOneKind(FAST_DOUBLE_ELEMENTS, processor, slow, mode,
|
||||
VisitAllFastElementsOneKind(PACKED_DOUBLE_ELEMENTS, processor, slow, mode,
|
||||
direction);
|
||||
|
||||
action(this);
|
||||
@ -767,7 +767,7 @@ class ArrayBuiltinCodeStubAssembler : public CodeStubAssembler {
|
||||
const ElementsKind elements_kind =
|
||||
GetHoleyElementsKind(GetInitialFastElementsKind());
|
||||
Node* array_map = LoadJSArrayElementsMap(elements_kind, native_context);
|
||||
a_.Bind(AllocateJSArray(FAST_SMI_ELEMENTS, array_map, len, len, nullptr,
|
||||
a_.Bind(AllocateJSArray(PACKED_SMI_ELEMENTS, array_map, len, len, nullptr,
|
||||
CodeStubAssembler::SMI_PARAMETERS));
|
||||
|
||||
Goto(&done);
|
||||
@ -865,8 +865,8 @@ TF_BUILTIN(FastArrayPop, CodeStubAssembler) {
|
||||
&return_undefined);
|
||||
|
||||
int32_t header_size = FixedDoubleArray::kHeaderSize - kHeapObjectTag;
|
||||
Node* offset = ElementOffsetFromIndex(
|
||||
new_length, FAST_HOLEY_DOUBLE_ELEMENTS, INTPTR_PARAMETERS, header_size);
|
||||
Node* offset = ElementOffsetFromIndex(new_length, HOLEY_DOUBLE_ELEMENTS,
|
||||
INTPTR_PARAMETERS, header_size);
|
||||
if (Is64()) {
|
||||
Node* double_hole = Int64Constant(kHoleNanInt64);
|
||||
StoreNoWriteBarrier(MachineRepresentation::kWord64, elements, offset,
|
||||
@ -932,10 +932,10 @@ TF_BUILTIN(FastArrayPush, CodeStubAssembler) {
|
||||
{
|
||||
arg_index.Bind(IntPtrConstant(0));
|
||||
kind = EnsureArrayPushable(receiver, &runtime);
|
||||
GotoIf(IsElementsKindGreaterThan(kind, FAST_HOLEY_SMI_ELEMENTS),
|
||||
GotoIf(IsElementsKindGreaterThan(kind, HOLEY_SMI_ELEMENTS),
|
||||
&object_push_pre);
|
||||
|
||||
Node* new_length = BuildAppendJSArray(FAST_SMI_ELEMENTS, receiver, args,
|
||||
Node* new_length = BuildAppendJSArray(PACKED_SMI_ELEMENTS, receiver, args,
|
||||
arg_index, &smi_transition);
|
||||
args.PopAndReturn(new_length);
|
||||
}
|
||||
@ -968,21 +968,21 @@ TF_BUILTIN(FastArrayPush, CodeStubAssembler) {
|
||||
|
||||
BIND(&object_push_pre);
|
||||
{
|
||||
Branch(IsElementsKindGreaterThan(kind, FAST_HOLEY_ELEMENTS), &double_push,
|
||||
Branch(IsElementsKindGreaterThan(kind, HOLEY_ELEMENTS), &double_push,
|
||||
&object_push);
|
||||
}
|
||||
|
||||
BIND(&object_push);
|
||||
{
|
||||
Node* new_length = BuildAppendJSArray(FAST_ELEMENTS, receiver, args,
|
||||
Node* new_length = BuildAppendJSArray(PACKED_ELEMENTS, receiver, args,
|
||||
arg_index, &default_label);
|
||||
args.PopAndReturn(new_length);
|
||||
}
|
||||
|
||||
BIND(&double_push);
|
||||
{
|
||||
Node* new_length = BuildAppendJSArray(FAST_DOUBLE_ELEMENTS, receiver, args,
|
||||
arg_index, &double_transition);
|
||||
Node* new_length = BuildAppendJSArray(PACKED_DOUBLE_ELEMENTS, receiver,
|
||||
args, arg_index, &double_transition);
|
||||
args.PopAndReturn(new_length);
|
||||
}
|
||||
|
||||
@ -1095,9 +1095,9 @@ TF_BUILTIN(FastArrayShift, CodeStubAssembler) {
|
||||
SmiTag(new_length));
|
||||
|
||||
Node* elements_kind = LoadMapElementsKind(LoadMap(receiver));
|
||||
GotoIf(Int32LessThanOrEqual(elements_kind,
|
||||
Int32Constant(FAST_HOLEY_SMI_ELEMENTS)),
|
||||
&fast_elements_untagged);
|
||||
GotoIf(
|
||||
Int32LessThanOrEqual(elements_kind, Int32Constant(HOLEY_SMI_ELEMENTS)),
|
||||
&fast_elements_untagged);
|
||||
GotoIf(Int32LessThanOrEqual(elements_kind,
|
||||
Int32Constant(TERMINAL_FAST_ELEMENTS_KIND)),
|
||||
&fast_elements_tagged);
|
||||
@ -1110,14 +1110,14 @@ TF_BUILTIN(FastArrayShift, CodeStubAssembler) {
|
||||
ExternalConstant(ExternalReference::libc_memmove_function(isolate()));
|
||||
Node* start = IntPtrAdd(
|
||||
BitcastTaggedToWord(elements),
|
||||
ElementOffsetFromIndex(IntPtrConstant(0), FAST_HOLEY_DOUBLE_ELEMENTS,
|
||||
ElementOffsetFromIndex(IntPtrConstant(0), HOLEY_DOUBLE_ELEMENTS,
|
||||
INTPTR_PARAMETERS, header_size));
|
||||
CallCFunction3(MachineType::AnyTagged(), MachineType::Pointer(),
|
||||
MachineType::Pointer(), MachineType::UintPtr(), memmove,
|
||||
start, IntPtrAdd(start, IntPtrConstant(kDoubleSize)),
|
||||
IntPtrMul(new_length, IntPtrConstant(kDoubleSize)));
|
||||
Node* offset = ElementOffsetFromIndex(
|
||||
new_length, FAST_HOLEY_DOUBLE_ELEMENTS, INTPTR_PARAMETERS, header_size);
|
||||
Node* offset = ElementOffsetFromIndex(new_length, HOLEY_DOUBLE_ELEMENTS,
|
||||
INTPTR_PARAMETERS, header_size);
|
||||
if (Is64()) {
|
||||
Node* double_hole = Int64Constant(kHoleNanInt64);
|
||||
StoreNoWriteBarrier(MachineRepresentation::kWord64, elements, offset,
|
||||
@ -1157,7 +1157,7 @@ TF_BUILTIN(FastArrayShift, CodeStubAssembler) {
|
||||
ExternalConstant(ExternalReference::libc_memmove_function(isolate()));
|
||||
Node* start = IntPtrAdd(
|
||||
BitcastTaggedToWord(elements),
|
||||
ElementOffsetFromIndex(IntPtrConstant(0), FAST_HOLEY_SMI_ELEMENTS,
|
||||
ElementOffsetFromIndex(IntPtrConstant(0), HOLEY_SMI_ELEMENTS,
|
||||
INTPTR_PARAMETERS, header_size));
|
||||
CallCFunction3(MachineType::AnyTagged(), MachineType::Pointer(),
|
||||
MachineType::Pointer(), MachineType::UintPtr(), memmove,
|
||||
@ -1732,16 +1732,15 @@ void ArrayIncludesIndexofAssembler::Generate(SearchVariant variant) {
|
||||
|
||||
Node* elements_kind = LoadMapElementsKind(LoadMap(array));
|
||||
Node* elements = LoadElements(array);
|
||||
STATIC_ASSERT(FAST_SMI_ELEMENTS == 0);
|
||||
STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
|
||||
STATIC_ASSERT(FAST_ELEMENTS == 2);
|
||||
STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
|
||||
GotoIf(
|
||||
Uint32LessThanOrEqual(elements_kind, Int32Constant(FAST_HOLEY_ELEMENTS)),
|
||||
&if_smiorobjects);
|
||||
GotoIf(Word32Equal(elements_kind, Int32Constant(FAST_DOUBLE_ELEMENTS)),
|
||||
STATIC_ASSERT(PACKED_SMI_ELEMENTS == 0);
|
||||
STATIC_ASSERT(HOLEY_SMI_ELEMENTS == 1);
|
||||
STATIC_ASSERT(PACKED_ELEMENTS == 2);
|
||||
STATIC_ASSERT(HOLEY_ELEMENTS == 3);
|
||||
GotoIf(Uint32LessThanOrEqual(elements_kind, Int32Constant(HOLEY_ELEMENTS)),
|
||||
&if_smiorobjects);
|
||||
GotoIf(Word32Equal(elements_kind, Int32Constant(PACKED_DOUBLE_ELEMENTS)),
|
||||
&if_packed_doubles);
|
||||
GotoIf(Word32Equal(elements_kind, Int32Constant(FAST_HOLEY_DOUBLE_ELEMENTS)),
|
||||
GotoIf(Word32Equal(elements_kind, Int32Constant(HOLEY_DOUBLE_ELEMENTS)),
|
||||
&if_holey_doubles);
|
||||
Goto(&return_not_found);
|
||||
|
||||
@ -2443,13 +2442,13 @@ TF_BUILTIN(ArrayIteratorPrototypeNext, CodeStubAssembler) {
|
||||
Int32Constant(LAST_ARRAY_KEY_VALUE_ITERATOR_TYPE)),
|
||||
&allocate_iterator_result);
|
||||
|
||||
Node* elements = AllocateFixedArray(FAST_ELEMENTS, IntPtrConstant(2));
|
||||
Node* elements = AllocateFixedArray(PACKED_ELEMENTS, IntPtrConstant(2));
|
||||
StoreFixedArrayElement(elements, 0, index, SKIP_WRITE_BARRIER);
|
||||
StoreFixedArrayElement(elements, 1, var_value.value(), SKIP_WRITE_BARRIER);
|
||||
|
||||
Node* entry = Allocate(JSArray::kSize);
|
||||
Node* map = LoadContextElement(LoadNativeContext(context),
|
||||
Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX);
|
||||
Context::JS_ARRAY_PACKED_ELEMENTS_MAP_INDEX);
|
||||
|
||||
StoreMapNoWriteBarrier(entry, map);
|
||||
StoreObjectFieldRoot(entry, JSArray::kPropertiesOffset,
|
||||
|
@ -132,9 +132,9 @@ inline bool EnsureJSArrayWithWritableFastElements(Isolate* isolate,
|
||||
Object* arg = (*args)[i];
|
||||
if (arg->IsHeapObject()) {
|
||||
if (arg->IsHeapNumber()) {
|
||||
target_kind = FAST_DOUBLE_ELEMENTS;
|
||||
target_kind = PACKED_DOUBLE_ELEMENTS;
|
||||
} else {
|
||||
target_kind = FAST_ELEMENTS;
|
||||
target_kind = PACKED_ELEMENTS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -497,7 +497,7 @@ class ArrayConcatVisitor {
|
||||
Handle<Object> length =
|
||||
isolate_->factory()->NewNumber(static_cast<double>(index_offset_));
|
||||
Handle<Map> map = JSObject::GetElementsTransitionMap(
|
||||
array, fast_elements() ? FAST_HOLEY_ELEMENTS : DICTIONARY_ELEMENTS);
|
||||
array, fast_elements() ? HOLEY_ELEMENTS : DICTIONARY_ELEMENTS);
|
||||
array->set_length(*length);
|
||||
array->set_elements(*storage_fixed_array());
|
||||
array->synchronized_set_map(*map);
|
||||
@ -582,10 +582,10 @@ uint32_t EstimateElementCount(Handle<JSArray> array) {
|
||||
uint32_t length = static_cast<uint32_t>(array->length()->Number());
|
||||
int element_count = 0;
|
||||
switch (array->GetElementsKind()) {
|
||||
case FAST_SMI_ELEMENTS:
|
||||
case FAST_HOLEY_SMI_ELEMENTS:
|
||||
case FAST_ELEMENTS:
|
||||
case FAST_HOLEY_ELEMENTS: {
|
||||
case PACKED_SMI_ELEMENTS:
|
||||
case HOLEY_SMI_ELEMENTS:
|
||||
case PACKED_ELEMENTS:
|
||||
case HOLEY_ELEMENTS: {
|
||||
// Fast elements can't have lengths that are not representable by
|
||||
// a 32-bit signed integer.
|
||||
DCHECK(static_cast<int32_t>(FixedArray::kMaxLength) >= 0);
|
||||
@ -597,8 +597,8 @@ uint32_t EstimateElementCount(Handle<JSArray> array) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FAST_DOUBLE_ELEMENTS:
|
||||
case FAST_HOLEY_DOUBLE_ELEMENTS: {
|
||||
case PACKED_DOUBLE_ELEMENTS:
|
||||
case HOLEY_DOUBLE_ELEMENTS: {
|
||||
// Fast elements can't have lengths that are not representable by
|
||||
// a 32-bit signed integer.
|
||||
DCHECK(static_cast<int32_t>(FixedDoubleArray::kMaxLength) >= 0);
|
||||
@ -657,10 +657,10 @@ void CollectElementIndices(Handle<JSObject> object, uint32_t range,
|
||||
Isolate* isolate = object->GetIsolate();
|
||||
ElementsKind kind = object->GetElementsKind();
|
||||
switch (kind) {
|
||||
case FAST_SMI_ELEMENTS:
|
||||
case FAST_ELEMENTS:
|
||||
case FAST_HOLEY_SMI_ELEMENTS:
|
||||
case FAST_HOLEY_ELEMENTS: {
|
||||
case PACKED_SMI_ELEMENTS:
|
||||
case PACKED_ELEMENTS:
|
||||
case HOLEY_SMI_ELEMENTS:
|
||||
case HOLEY_ELEMENTS: {
|
||||
DisallowHeapAllocation no_gc;
|
||||
FixedArray* elements = FixedArray::cast(object->elements());
|
||||
uint32_t length = static_cast<uint32_t>(elements->length());
|
||||
@ -672,8 +672,8 @@ void CollectElementIndices(Handle<JSObject> object, uint32_t range,
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
||||
case FAST_DOUBLE_ELEMENTS: {
|
||||
case HOLEY_DOUBLE_ELEMENTS:
|
||||
case PACKED_DOUBLE_ELEMENTS: {
|
||||
if (object->elements()->IsFixedArray()) {
|
||||
DCHECK(object->elements()->length() == 0);
|
||||
break;
|
||||
@ -822,10 +822,10 @@ bool IterateElements(Isolate* isolate, Handle<JSReceiver> receiver,
|
||||
Handle<JSObject> array = Handle<JSObject>::cast(receiver);
|
||||
|
||||
switch (array->GetElementsKind()) {
|
||||
case FAST_SMI_ELEMENTS:
|
||||
case FAST_ELEMENTS:
|
||||
case FAST_HOLEY_SMI_ELEMENTS:
|
||||
case FAST_HOLEY_ELEMENTS: {
|
||||
case PACKED_SMI_ELEMENTS:
|
||||
case PACKED_ELEMENTS:
|
||||
case HOLEY_SMI_ELEMENTS:
|
||||
case HOLEY_ELEMENTS: {
|
||||
// Run through the elements FixedArray and use HasElement and GetElement
|
||||
// to check the prototype for missing elements.
|
||||
Handle<FixedArray> elements(FixedArray::cast(array->elements()));
|
||||
@ -850,8 +850,8 @@ bool IterateElements(Isolate* isolate, Handle<JSReceiver> receiver,
|
||||
});
|
||||
break;
|
||||
}
|
||||
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
||||
case FAST_DOUBLE_ELEMENTS: {
|
||||
case HOLEY_DOUBLE_ELEMENTS:
|
||||
case PACKED_DOUBLE_ELEMENTS: {
|
||||
// Empty array is FixedArray but not FixedDoubleArray.
|
||||
if (length == 0) break;
|
||||
// Run through the elements FixedArray and use HasElement and GetElement
|
||||
@ -963,7 +963,7 @@ Object* Slow_ArrayConcat(BuiltinArguments* args, Handle<Object> species,
|
||||
// that mutate other arguments (but will otherwise be precise).
|
||||
// The number of elements is precise if there are no inherited elements.
|
||||
|
||||
ElementsKind kind = FAST_SMI_ELEMENTS;
|
||||
ElementsKind kind = PACKED_SMI_ELEMENTS;
|
||||
|
||||
uint32_t estimate_result_length = 0;
|
||||
uint32_t estimate_nof = 0;
|
||||
@ -983,7 +983,7 @@ Object* Slow_ArrayConcat(BuiltinArguments* args, Handle<Object> species,
|
||||
} else {
|
||||
if (obj->IsHeapObject()) {
|
||||
kind = GetMoreGeneralElementsKind(
|
||||
kind, obj->IsNumber() ? FAST_DOUBLE_ELEMENTS : FAST_ELEMENTS);
|
||||
kind, obj->IsNumber() ? PACKED_DOUBLE_ELEMENTS : PACKED_ELEMENTS);
|
||||
}
|
||||
length_estimate = 1;
|
||||
element_estimate = 1;
|
||||
@ -1008,7 +1008,7 @@ Object* Slow_ArrayConcat(BuiltinArguments* args, Handle<Object> species,
|
||||
(estimate_nof * 2) >= estimate_result_length &&
|
||||
isolate->IsIsConcatSpreadableLookupChainIntact();
|
||||
|
||||
if (fast_case && kind == FAST_DOUBLE_ELEMENTS) {
|
||||
if (fast_case && kind == PACKED_DOUBLE_ELEMENTS) {
|
||||
Handle<FixedArrayBase> storage =
|
||||
isolate->factory()->NewFixedDoubleArray(estimate_result_length);
|
||||
int j = 0;
|
||||
@ -1029,8 +1029,8 @@ Object* Slow_ArrayConcat(BuiltinArguments* args, Handle<Object> species,
|
||||
JSArray* array = JSArray::cast(*obj);
|
||||
uint32_t length = static_cast<uint32_t>(array->length()->Number());
|
||||
switch (array->GetElementsKind()) {
|
||||
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
||||
case FAST_DOUBLE_ELEMENTS: {
|
||||
case HOLEY_DOUBLE_ELEMENTS:
|
||||
case PACKED_DOUBLE_ELEMENTS: {
|
||||
// Empty array is FixedArray but not FixedDoubleArray.
|
||||
if (length == 0) break;
|
||||
FixedDoubleArray* elements =
|
||||
@ -1051,8 +1051,8 @@ Object* Slow_ArrayConcat(BuiltinArguments* args, Handle<Object> species,
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FAST_HOLEY_SMI_ELEMENTS:
|
||||
case FAST_SMI_ELEMENTS: {
|
||||
case HOLEY_SMI_ELEMENTS:
|
||||
case PACKED_SMI_ELEMENTS: {
|
||||
Object* the_hole = isolate->heap()->the_hole_value();
|
||||
FixedArray* elements(FixedArray::cast(array->elements()));
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
@ -1067,8 +1067,8 @@ Object* Slow_ArrayConcat(BuiltinArguments* args, Handle<Object> species,
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FAST_HOLEY_ELEMENTS:
|
||||
case FAST_ELEMENTS:
|
||||
case HOLEY_ELEMENTS:
|
||||
case PACKED_ELEMENTS:
|
||||
case DICTIONARY_ELEMENTS:
|
||||
case NO_ELEMENTS:
|
||||
DCHECK_EQ(0u, length);
|
||||
|
@ -172,13 +172,13 @@ void CallOrConstructBuiltinsAssembler::CallOrConstructWithArrayLike(
|
||||
JSArray::kLengthOffset));
|
||||
|
||||
// Holey arrays and double backing stores need special treatment.
|
||||
STATIC_ASSERT(FAST_SMI_ELEMENTS == 0);
|
||||
STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
|
||||
STATIC_ASSERT(FAST_ELEMENTS == 2);
|
||||
STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
|
||||
STATIC_ASSERT(FAST_DOUBLE_ELEMENTS == 4);
|
||||
STATIC_ASSERT(FAST_HOLEY_DOUBLE_ELEMENTS == 5);
|
||||
STATIC_ASSERT(LAST_FAST_ELEMENTS_KIND == FAST_HOLEY_DOUBLE_ELEMENTS);
|
||||
STATIC_ASSERT(PACKED_SMI_ELEMENTS == 0);
|
||||
STATIC_ASSERT(HOLEY_SMI_ELEMENTS == 1);
|
||||
STATIC_ASSERT(PACKED_ELEMENTS == 2);
|
||||
STATIC_ASSERT(HOLEY_ELEMENTS == 3);
|
||||
STATIC_ASSERT(PACKED_DOUBLE_ELEMENTS == 4);
|
||||
STATIC_ASSERT(HOLEY_DOUBLE_ELEMENTS == 5);
|
||||
STATIC_ASSERT(LAST_FAST_ELEMENTS_KIND == HOLEY_DOUBLE_ELEMENTS);
|
||||
|
||||
Node* kind = LoadMapElementsKind(arguments_list_map);
|
||||
|
||||
@ -257,7 +257,7 @@ void CallOrConstructBuiltinsAssembler::CallOrConstructWithArrayLike(
|
||||
// produce holey double arrays.
|
||||
CallOrConstructDoubleVarargs(target, new_target, elements, length,
|
||||
args_count, context,
|
||||
Int32Constant(FAST_HOLEY_DOUBLE_ELEMENTS));
|
||||
Int32Constant(HOLEY_DOUBLE_ELEMENTS));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -270,7 +270,7 @@ void CallOrConstructBuiltinsAssembler::CallOrConstructDoubleVarargs(
|
||||
Node* args_count, Node* context, Node* kind) {
|
||||
Label if_holey_double(this), if_packed_double(this), if_done(this);
|
||||
|
||||
const ElementsKind new_kind = FAST_ELEMENTS;
|
||||
const ElementsKind new_kind = PACKED_ELEMENTS;
|
||||
const ParameterMode mode = INTPTR_PARAMETERS;
|
||||
const WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER;
|
||||
Node* intptr_length = ChangeInt32ToIntPtr(length);
|
||||
@ -279,13 +279,13 @@ void CallOrConstructBuiltinsAssembler::CallOrConstructDoubleVarargs(
|
||||
Node* new_elements =
|
||||
AllocateFixedArray(new_kind, intptr_length, mode,
|
||||
CodeStubAssembler::kAllowLargeObjectAllocation);
|
||||
Branch(Word32Equal(kind, Int32Constant(FAST_HOLEY_DOUBLE_ELEMENTS)),
|
||||
Branch(Word32Equal(kind, Int32Constant(HOLEY_DOUBLE_ELEMENTS)),
|
||||
&if_holey_double, &if_packed_double);
|
||||
|
||||
BIND(&if_holey_double);
|
||||
{
|
||||
// Fill the FixedArray with pointers to HeapObjects.
|
||||
CopyFixedArrayElements(FAST_HOLEY_DOUBLE_ELEMENTS, elements, new_kind,
|
||||
CopyFixedArrayElements(HOLEY_DOUBLE_ELEMENTS, elements, new_kind,
|
||||
new_elements, intptr_length, intptr_length,
|
||||
barrier_mode);
|
||||
Goto(&if_done);
|
||||
@ -293,7 +293,7 @@ void CallOrConstructBuiltinsAssembler::CallOrConstructDoubleVarargs(
|
||||
|
||||
BIND(&if_packed_double);
|
||||
{
|
||||
CopyFixedArrayElements(FAST_DOUBLE_ELEMENTS, elements, new_kind,
|
||||
CopyFixedArrayElements(PACKED_DOUBLE_ELEMENTS, elements, new_kind,
|
||||
new_elements, intptr_length, intptr_length,
|
||||
barrier_mode);
|
||||
Goto(&if_done);
|
||||
@ -349,13 +349,13 @@ void CallOrConstructBuiltinsAssembler::CallOrConstructWithSpread(
|
||||
|
||||
Node* kind = LoadMapElementsKind(spread_map);
|
||||
|
||||
STATIC_ASSERT(FAST_SMI_ELEMENTS == 0);
|
||||
STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
|
||||
STATIC_ASSERT(FAST_ELEMENTS == 2);
|
||||
STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
|
||||
STATIC_ASSERT(FAST_DOUBLE_ELEMENTS == 4);
|
||||
STATIC_ASSERT(FAST_HOLEY_DOUBLE_ELEMENTS == 5);
|
||||
STATIC_ASSERT(LAST_FAST_ELEMENTS_KIND == FAST_HOLEY_DOUBLE_ELEMENTS);
|
||||
STATIC_ASSERT(PACKED_SMI_ELEMENTS == 0);
|
||||
STATIC_ASSERT(HOLEY_SMI_ELEMENTS == 1);
|
||||
STATIC_ASSERT(PACKED_ELEMENTS == 2);
|
||||
STATIC_ASSERT(HOLEY_ELEMENTS == 3);
|
||||
STATIC_ASSERT(PACKED_DOUBLE_ELEMENTS == 4);
|
||||
STATIC_ASSERT(HOLEY_DOUBLE_ELEMENTS == 5);
|
||||
STATIC_ASSERT(LAST_FAST_ELEMENTS_KIND == HOLEY_DOUBLE_ELEMENTS);
|
||||
|
||||
GotoIf(Int32GreaterThan(kind, Int32Constant(LAST_FAST_ELEMENTS_KIND)),
|
||||
&if_runtime);
|
||||
@ -395,8 +395,8 @@ void CallOrConstructBuiltinsAssembler::CallOrConstructWithSpread(
|
||||
CSA_ASSERT(this, Int32LessThanOrEqual(
|
||||
kind, Int32Constant(LAST_FAST_ELEMENTS_KIND)));
|
||||
|
||||
Branch(Int32GreaterThan(kind, Int32Constant(FAST_HOLEY_ELEMENTS)),
|
||||
&if_double, &if_not_double);
|
||||
Branch(Int32GreaterThan(kind, Int32Constant(HOLEY_ELEMENTS)), &if_double,
|
||||
&if_not_double);
|
||||
|
||||
BIND(&if_not_double);
|
||||
{
|
||||
|
@ -52,7 +52,7 @@ Node* CollectionsBuiltinsAssembler::AllocateOrderedHashTable() {
|
||||
STATIC_ASSERT(kCapacity <= CollectionType::kMaxCapacity);
|
||||
|
||||
// Allocate the table and add the proper map.
|
||||
const ElementsKind elements_kind = FAST_HOLEY_ELEMENTS;
|
||||
const ElementsKind elements_kind = HOLEY_ELEMENTS;
|
||||
Node* const length_intptr = IntPtrConstant(kFixedArrayLength);
|
||||
Node* const table = AllocateFixedArray(elements_kind, length_intptr);
|
||||
CSA_ASSERT(this,
|
||||
|
@ -61,7 +61,7 @@ Node* ConstructorBuiltinsAssembler::CopyFixedArrayBase(Node* fixed_array) {
|
||||
&if_fixed_array);
|
||||
BIND(&if_fixed_double_array);
|
||||
{
|
||||
ElementsKind kind = FAST_DOUBLE_ELEMENTS;
|
||||
ElementsKind kind = PACKED_DOUBLE_ELEMENTS;
|
||||
Node* copy = AllocateFixedArray(kind, capacity);
|
||||
CopyFixedArrayElements(kind, fixed_array, kind, copy, capacity, capacity,
|
||||
SKIP_WRITE_BARRIER);
|
||||
@ -71,7 +71,7 @@ Node* ConstructorBuiltinsAssembler::CopyFixedArrayBase(Node* fixed_array) {
|
||||
|
||||
BIND(&if_fixed_array);
|
||||
{
|
||||
ElementsKind kind = FAST_ELEMENTS;
|
||||
ElementsKind kind = PACKED_ELEMENTS;
|
||||
Node* copy = AllocateFixedArray(kind, capacity);
|
||||
CopyFixedArrayElements(kind, fixed_array, kind, copy, capacity, capacity,
|
||||
UPDATE_WRITE_BARRIER);
|
||||
@ -307,7 +307,7 @@ Node* ConstructorBuiltinsAssembler::EmitFastNewFunctionContext(
|
||||
ParameterMode mode = INTPTR_PARAMETERS;
|
||||
Node* min_context_slots = IntPtrConstant(Context::MIN_CONTEXT_SLOTS);
|
||||
Node* length = IntPtrAdd(slots, min_context_slots);
|
||||
Node* size = GetFixedArrayAllocationSize(length, FAST_ELEMENTS, mode);
|
||||
Node* size = GetFixedArrayAllocationSize(length, PACKED_ELEMENTS, mode);
|
||||
|
||||
// Create a new closure from the given function info in new space
|
||||
Node* function_context = AllocateInNewSpace(size);
|
||||
@ -343,7 +343,7 @@ Node* ConstructorBuiltinsAssembler::EmitFastNewFunctionContext(
|
||||
// Initialize the rest of the slots to undefined.
|
||||
Node* undefined = UndefinedConstant();
|
||||
BuildFastFixedArrayForEach(
|
||||
function_context, FAST_ELEMENTS, min_context_slots, length,
|
||||
function_context, PACKED_ELEMENTS, min_context_slots, length,
|
||||
[this, undefined](Node* context, Node* offset) {
|
||||
StoreNoWriteBarrier(MachineRepresentation::kTagged, context, offset,
|
||||
undefined);
|
||||
@ -475,7 +475,7 @@ Node* ConstructorBuiltinsAssembler::EmitFastCloneShallowArray(
|
||||
if (FLAG_debug_code) CSA_CHECK(this, IsFixedDoubleArrayMap(elements_map));
|
||||
Node* array =
|
||||
NonEmptyShallowClone(boilerplate, boilerplate_map, boilerplate_elements,
|
||||
allocation_site, capacity, FAST_DOUBLE_ELEMENTS);
|
||||
allocation_site, capacity, PACKED_DOUBLE_ELEMENTS);
|
||||
result.Bind(array);
|
||||
Goto(&return_result);
|
||||
}
|
||||
@ -485,7 +485,7 @@ Node* ConstructorBuiltinsAssembler::EmitFastCloneShallowArray(
|
||||
Comment("fast elements path");
|
||||
Node* array =
|
||||
NonEmptyShallowClone(boilerplate, boilerplate_map, boilerplate_elements,
|
||||
allocation_site, capacity, FAST_ELEMENTS);
|
||||
allocation_site, capacity, PACKED_ELEMENTS);
|
||||
result.Bind(array);
|
||||
Goto(&return_result);
|
||||
}
|
||||
@ -515,7 +515,7 @@ Node* ConstructorBuiltinsAssembler::EmitFastCloneShallowArray(
|
||||
BIND(&allocate_without_elements);
|
||||
{
|
||||
Node* array = AllocateUninitializedJSArrayWithoutElements(
|
||||
FAST_ELEMENTS, boilerplate_map, length.value(), allocation_site);
|
||||
PACKED_ELEMENTS, boilerplate_map, length.value(), allocation_site);
|
||||
StoreObjectField(array, JSObject::kElementsOffset, elements.value());
|
||||
result.Bind(array);
|
||||
Goto(&return_result);
|
||||
|
@ -104,7 +104,7 @@ TF_BUILTIN(FastFunctionPrototypeBind, CodeStubAssembler) {
|
||||
Label arguments_done(this, &argument_array);
|
||||
GotoIf(Uint32LessThanOrEqual(argc, Int32Constant(1)), &empty_arguments);
|
||||
Node* elements_length = ChangeUint32ToWord(Int32Sub(argc, Int32Constant(1)));
|
||||
Node* elements = AllocateFixedArray(FAST_ELEMENTS, elements_length);
|
||||
Node* elements = AllocateFixedArray(PACKED_ELEMENTS, elements_length);
|
||||
VARIABLE(index, MachineType::PointerRepresentation());
|
||||
index.Bind(IntPtrConstant(0));
|
||||
VariableList foreach_vars({&index}, zone());
|
||||
|
@ -35,7 +35,7 @@ TF_BUILTIN(CopyFastSmiOrObjectElements, CodeStubAssembler) {
|
||||
Node* length = TaggedToParameter(LoadFixedArrayBaseLength(source), mode);
|
||||
|
||||
// Check if we can allocate in new space.
|
||||
ElementsKind kind = FAST_ELEMENTS;
|
||||
ElementsKind kind = PACKED_ELEMENTS;
|
||||
int max_elements = FixedArrayBase::GetMaxLengthForNewSpaceAllocation(kind);
|
||||
Label if_newspace(this), if_oldspace(this);
|
||||
Branch(UintPtrOrSmiLessThan(length, IntPtrOrSmiConstant(max_elements, mode),
|
||||
@ -68,7 +68,7 @@ TF_BUILTIN(GrowFastDoubleElements, CodeStubAssembler) {
|
||||
|
||||
Label runtime(this, Label::kDeferred);
|
||||
Node* elements = LoadElements(object);
|
||||
elements = TryGrowElementsCapacity(object, elements, FAST_DOUBLE_ELEMENTS,
|
||||
elements = TryGrowElementsCapacity(object, elements, PACKED_DOUBLE_ELEMENTS,
|
||||
key, &runtime);
|
||||
Return(elements);
|
||||
|
||||
@ -84,7 +84,7 @@ TF_BUILTIN(GrowFastSmiOrObjectElements, CodeStubAssembler) {
|
||||
Label runtime(this, Label::kDeferred);
|
||||
Node* elements = LoadElements(object);
|
||||
elements =
|
||||
TryGrowElementsCapacity(object, elements, FAST_ELEMENTS, key, &runtime);
|
||||
TryGrowElementsCapacity(object, elements, PACKED_ELEMENTS, key, &runtime);
|
||||
Return(elements);
|
||||
|
||||
BIND(&runtime);
|
||||
@ -96,7 +96,7 @@ TF_BUILTIN(NewUnmappedArgumentsElements, CodeStubAssembler) {
|
||||
Node* length = SmiToWord(Parameter(Descriptor::kLength));
|
||||
|
||||
// Check if we can allocate in new space.
|
||||
ElementsKind kind = FAST_ELEMENTS;
|
||||
ElementsKind kind = PACKED_ELEMENTS;
|
||||
int max_elements = FixedArray::GetMaxLengthForNewSpaceAllocation(kind);
|
||||
Label if_newspace(this), if_oldspace(this, Label::kDeferred);
|
||||
Branch(IntPtrLessThan(length, IntPtrConstant(max_elements)), &if_newspace,
|
||||
|
@ -157,15 +157,15 @@ TF_BUILTIN(ObjectKeys, ObjectBuiltinsAssembler) {
|
||||
Node* array = nullptr;
|
||||
Node* elements = nullptr;
|
||||
Node* native_context = LoadNativeContext(context);
|
||||
Node* array_map = LoadJSArrayElementsMap(FAST_ELEMENTS, native_context);
|
||||
Node* array_map = LoadJSArrayElementsMap(PACKED_ELEMENTS, native_context);
|
||||
Node* array_length = SmiTag(object_enum_length);
|
||||
std::tie(array, elements) = AllocateUninitializedJSArrayWithElements(
|
||||
FAST_ELEMENTS, array_map, array_length, nullptr, object_enum_length,
|
||||
PACKED_ELEMENTS, array_map, array_length, nullptr, object_enum_length,
|
||||
INTPTR_PARAMETERS);
|
||||
StoreMapNoWriteBarrier(elements, Heap::kFixedArrayMapRootIndex);
|
||||
StoreObjectFieldNoWriteBarrier(elements, FixedArray::kLengthOffset,
|
||||
array_length);
|
||||
CopyFixedArrayElements(FAST_ELEMENTS, object_enum_cache, elements,
|
||||
CopyFixedArrayElements(PACKED_ELEMENTS, object_enum_cache, elements,
|
||||
object_enum_length, SKIP_WRITE_BARRIER);
|
||||
Return(array);
|
||||
}
|
||||
@ -191,9 +191,9 @@ TF_BUILTIN(ObjectKeys, ObjectBuiltinsAssembler) {
|
||||
{
|
||||
// Wrap the elements into a proper JSArray and return that.
|
||||
Node* native_context = LoadNativeContext(context);
|
||||
Node* array_map = LoadJSArrayElementsMap(FAST_ELEMENTS, native_context);
|
||||
Node* array_map = LoadJSArrayElementsMap(PACKED_ELEMENTS, native_context);
|
||||
Node* array = AllocateUninitializedJSArrayWithoutElements(
|
||||
FAST_ELEMENTS, array_map, var_length.value(), nullptr);
|
||||
PACKED_ELEMENTS, array_map, var_length.value(), nullptr);
|
||||
StoreObjectFieldNoWriteBarrier(array, JSArray::kElementsOffset,
|
||||
var_elements.value());
|
||||
Return(array);
|
||||
@ -578,8 +578,8 @@ TF_BUILTIN(CreateGeneratorObject, ObjectBuiltinsAssembler) {
|
||||
Node* frame_size = ChangeInt32ToIntPtr(LoadObjectField(
|
||||
bytecode_array, BytecodeArray::kFrameSizeOffset, MachineType::Int32()));
|
||||
Node* size = WordSar(frame_size, IntPtrConstant(kPointerSizeLog2));
|
||||
Node* register_file = AllocateFixedArray(FAST_HOLEY_ELEMENTS, size);
|
||||
FillFixedArrayWithValue(FAST_HOLEY_ELEMENTS, register_file, IntPtrConstant(0),
|
||||
Node* register_file = AllocateFixedArray(HOLEY_ELEMENTS, size);
|
||||
FillFixedArrayWithValue(HOLEY_ELEMENTS, register_file, IntPtrConstant(0),
|
||||
size, Heap::kUndefinedValueRootIndex);
|
||||
|
||||
Node* const result = AllocateJSObjectFromMap(maybe_map);
|
||||
|
@ -359,7 +359,7 @@ void PromiseBuiltinsAssembler::AppendPromiseCallback(int offset, Node* promise,
|
||||
Node* delta = IntPtrOrSmiConstant(1, mode);
|
||||
Node* new_capacity = IntPtrOrSmiAdd(length, delta, mode);
|
||||
|
||||
const ElementsKind kind = FAST_ELEMENTS;
|
||||
const ElementsKind kind = PACKED_ELEMENTS;
|
||||
const WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER;
|
||||
const CodeStubAssembler::AllocationFlags flags =
|
||||
CodeStubAssembler::kAllowLargeObjectAllocation;
|
||||
@ -519,34 +519,34 @@ Node* PromiseBuiltinsAssembler::InternalPerformPromiseThen(
|
||||
// Create new FixedArrays to store callbacks, and migrate
|
||||
// existing callbacks.
|
||||
Node* const deferred_promise_arr =
|
||||
AllocateFixedArray(FAST_ELEMENTS, IntPtrConstant(2));
|
||||
AllocateFixedArray(PACKED_ELEMENTS, IntPtrConstant(2));
|
||||
StoreFixedArrayElement(deferred_promise_arr, 0,
|
||||
existing_deferred_promise);
|
||||
StoreFixedArrayElement(deferred_promise_arr, 1, deferred_promise);
|
||||
|
||||
Node* const deferred_on_resolve_arr =
|
||||
AllocateFixedArray(FAST_ELEMENTS, IntPtrConstant(2));
|
||||
AllocateFixedArray(PACKED_ELEMENTS, IntPtrConstant(2));
|
||||
StoreFixedArrayElement(
|
||||
deferred_on_resolve_arr, 0,
|
||||
LoadObjectField(promise, JSPromise::kDeferredOnResolveOffset));
|
||||
StoreFixedArrayElement(deferred_on_resolve_arr, 1, deferred_on_resolve);
|
||||
|
||||
Node* const deferred_on_reject_arr =
|
||||
AllocateFixedArray(FAST_ELEMENTS, IntPtrConstant(2));
|
||||
AllocateFixedArray(PACKED_ELEMENTS, IntPtrConstant(2));
|
||||
StoreFixedArrayElement(
|
||||
deferred_on_reject_arr, 0,
|
||||
LoadObjectField(promise, JSPromise::kDeferredOnRejectOffset));
|
||||
StoreFixedArrayElement(deferred_on_reject_arr, 1, deferred_on_reject);
|
||||
|
||||
Node* const fulfill_reactions =
|
||||
AllocateFixedArray(FAST_ELEMENTS, IntPtrConstant(2));
|
||||
AllocateFixedArray(PACKED_ELEMENTS, IntPtrConstant(2));
|
||||
StoreFixedArrayElement(
|
||||
fulfill_reactions, 0,
|
||||
LoadObjectField(promise, JSPromise::kFulfillReactionsOffset));
|
||||
StoreFixedArrayElement(fulfill_reactions, 1, var_on_resolve.value());
|
||||
|
||||
Node* const reject_reactions =
|
||||
AllocateFixedArray(FAST_ELEMENTS, IntPtrConstant(2));
|
||||
AllocateFixedArray(PACKED_ELEMENTS, IntPtrConstant(2));
|
||||
StoreFixedArrayElement(
|
||||
reject_reactions, 0,
|
||||
LoadObjectField(promise, JSPromise::kRejectReactionsOffset));
|
||||
@ -1845,8 +1845,8 @@ Node* PromiseBuiltinsAssembler::PerformPromiseAll(
|
||||
|
||||
Node* const native_context = LoadNativeContext(context);
|
||||
Node* const array_map = LoadContextElement(
|
||||
native_context, Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX);
|
||||
Node* const values_array = AllocateJSArray(FAST_ELEMENTS, array_map,
|
||||
native_context, Context::JS_ARRAY_PACKED_ELEMENTS_MAP_INDEX);
|
||||
Node* const values_array = AllocateJSArray(PACKED_ELEMENTS, array_map,
|
||||
IntPtrConstant(0), SmiConstant(0));
|
||||
Node* const remaining_elements = AllocateSmiCell(1);
|
||||
|
||||
@ -2097,7 +2097,7 @@ TF_BUILTIN(PromiseAllResolveElementClosure, PromiseBuiltinsAssembler) {
|
||||
{
|
||||
VARIABLE(var_elements, MachineRepresentation::kTagged,
|
||||
LoadElements(values_array));
|
||||
PossiblyGrowElementsCapacity(SMI_PARAMETERS, FAST_ELEMENTS, values_array,
|
||||
PossiblyGrowElementsCapacity(SMI_PARAMETERS, PACKED_ELEMENTS, values_array,
|
||||
index, &var_elements, SmiConstant(1),
|
||||
&runtime_set_element);
|
||||
StoreFixedArrayElement(var_elements.value(), index, value,
|
||||
|
@ -500,7 +500,7 @@ Node* RegExpBuiltinsAssembler::RegExpExecInternal(Node* const context,
|
||||
register_count, INT32_ELEMENTS, SMI_PARAMETERS, 0);
|
||||
|
||||
Node* const to_offset = ElementOffsetFromIndex(
|
||||
IntPtrConstant(RegExpMatchInfo::kFirstCaptureIndex), FAST_ELEMENTS,
|
||||
IntPtrConstant(RegExpMatchInfo::kFirstCaptureIndex), PACKED_ELEMENTS,
|
||||
INTPTR_PARAMETERS, RegExpMatchInfo::kHeaderSize - kHeapObjectTag);
|
||||
VARIABLE(var_to_offset, MachineType::PointerRepresentation(), to_offset);
|
||||
|
||||
@ -1813,7 +1813,7 @@ class GrowableFixedArray {
|
||||
Node* ToJSArray(Node* const context) {
|
||||
CodeStubAssembler* a = assembler_;
|
||||
|
||||
const ElementsKind kind = FAST_ELEMENTS;
|
||||
const ElementsKind kind = PACKED_ELEMENTS;
|
||||
|
||||
Node* const native_context = a->LoadNativeContext(context);
|
||||
Node* const array_map = a->LoadJSArrayElementsMap(kind, native_context);
|
||||
@ -1850,7 +1850,7 @@ class GrowableFixedArray {
|
||||
void Initialize() {
|
||||
CodeStubAssembler* a = assembler_;
|
||||
|
||||
const ElementsKind kind = FAST_ELEMENTS;
|
||||
const ElementsKind kind = PACKED_ELEMENTS;
|
||||
|
||||
static const int kInitialArraySize = 8;
|
||||
Node* const capacity = a->IntPtrConstant(kInitialArraySize);
|
||||
@ -1886,7 +1886,7 @@ class GrowableFixedArray {
|
||||
CSA_ASSERT(a, a->IntPtrGreaterThan(new_capacity, a->IntPtrConstant(0)));
|
||||
CSA_ASSERT(a, a->IntPtrGreaterThanOrEqual(new_capacity, element_count));
|
||||
|
||||
const ElementsKind kind = FAST_ELEMENTS;
|
||||
const ElementsKind kind = PACKED_ELEMENTS;
|
||||
const WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER;
|
||||
const CodeStubAssembler::ParameterMode mode =
|
||||
CodeStubAssembler::INTPTR_PARAMETERS;
|
||||
@ -2231,7 +2231,7 @@ void RegExpBuiltinsAssembler::RegExpPrototypeSplitBody(Node* const context,
|
||||
Node* const int_zero = IntPtrConstant(0);
|
||||
Node* const int_limit = SmiUntag(limit);
|
||||
|
||||
const ElementsKind kind = FAST_ELEMENTS;
|
||||
const ElementsKind kind = PACKED_ELEMENTS;
|
||||
const ParameterMode mode = CodeStubAssembler::INTPTR_PARAMETERS;
|
||||
|
||||
Node* const allocation_site = nullptr;
|
||||
@ -2590,7 +2590,7 @@ Node* RegExpBuiltinsAssembler::ReplaceGlobalCallableFastPath(
|
||||
// Allocate {result_array}.
|
||||
Node* result_array;
|
||||
{
|
||||
ElementsKind kind = FAST_ELEMENTS;
|
||||
ElementsKind kind = PACKED_ELEMENTS;
|
||||
Node* const array_map = LoadJSArrayElementsMap(kind, native_context);
|
||||
Node* const capacity = IntPtrConstant(16);
|
||||
Node* const length = smi_zero;
|
||||
|
@ -1420,7 +1420,7 @@ TF_BUILTIN(StringPrototypeSplit, StringBuiltinsAssembler) {
|
||||
Label next(this);
|
||||
GotoIfNot(SmiEqual(limit_number, smi_zero), &next);
|
||||
|
||||
const ElementsKind kind = FAST_ELEMENTS;
|
||||
const ElementsKind kind = PACKED_ELEMENTS;
|
||||
Node* const native_context = LoadNativeContext(context);
|
||||
Node* const array_map = LoadJSArrayElementsMap(kind, native_context);
|
||||
|
||||
@ -1439,7 +1439,7 @@ TF_BUILTIN(StringPrototypeSplit, StringBuiltinsAssembler) {
|
||||
Label next(this);
|
||||
GotoIfNot(IsUndefined(separator), &next);
|
||||
|
||||
const ElementsKind kind = FAST_ELEMENTS;
|
||||
const ElementsKind kind = PACKED_ELEMENTS;
|
||||
Node* const native_context = LoadNativeContext(context);
|
||||
Node* const array_map = LoadJSArrayElementsMap(kind, native_context);
|
||||
|
||||
|
@ -2058,13 +2058,13 @@ void Builtins::Generate_Apply(MacroAssembler* masm) {
|
||||
__ bind(&create_array);
|
||||
__ mov(ecx, FieldOperand(ecx, Map::kBitField2Offset));
|
||||
__ DecodeField<Map::ElementsKindBits>(ecx);
|
||||
STATIC_ASSERT(FAST_SMI_ELEMENTS == 0);
|
||||
STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
|
||||
STATIC_ASSERT(FAST_ELEMENTS == 2);
|
||||
STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
|
||||
__ cmp(ecx, Immediate(FAST_HOLEY_SMI_ELEMENTS));
|
||||
STATIC_ASSERT(PACKED_SMI_ELEMENTS == 0);
|
||||
STATIC_ASSERT(HOLEY_SMI_ELEMENTS == 1);
|
||||
STATIC_ASSERT(PACKED_ELEMENTS == 2);
|
||||
STATIC_ASSERT(HOLEY_ELEMENTS == 3);
|
||||
__ cmp(ecx, Immediate(HOLEY_SMI_ELEMENTS));
|
||||
__ j(equal, &create_holey_array, Label::kNear);
|
||||
__ cmp(ecx, Immediate(FAST_HOLEY_ELEMENTS));
|
||||
__ cmp(ecx, Immediate(HOLEY_ELEMENTS));
|
||||
__ j(equal, &create_holey_array, Label::kNear);
|
||||
__ j(above, &create_runtime);
|
||||
__ mov(ebx, FieldOperand(eax, JSArray::kLengthOffset));
|
||||
@ -2665,12 +2665,12 @@ static void CheckSpreadAndPushToStack(MacroAssembler* masm) {
|
||||
Label no_protector_check;
|
||||
__ mov(scratch, FieldOperand(spread_map, Map::kBitField2Offset));
|
||||
__ DecodeField<Map::ElementsKindBits>(scratch);
|
||||
__ cmp(scratch, Immediate(FAST_HOLEY_ELEMENTS));
|
||||
__ cmp(scratch, Immediate(HOLEY_ELEMENTS));
|
||||
__ j(above, &runtime_call);
|
||||
// For non-FastHoley kinds, we can skip the protector check.
|
||||
__ cmp(scratch, Immediate(FAST_SMI_ELEMENTS));
|
||||
__ cmp(scratch, Immediate(PACKED_SMI_ELEMENTS));
|
||||
__ j(equal, &no_protector_check);
|
||||
__ cmp(scratch, Immediate(FAST_ELEMENTS));
|
||||
__ cmp(scratch, Immediate(PACKED_ELEMENTS));
|
||||
__ j(equal, &no_protector_check);
|
||||
// Check the ArrayProtector cell.
|
||||
__ LoadRoot(scratch, Heap::kArrayProtectorRootIndex);
|
||||
|
@ -1265,7 +1265,7 @@ Node* CodeStubAssembler::LoadFixedArrayElement(Node* object, Node* index_node,
|
||||
ParameterMode parameter_mode) {
|
||||
int32_t header_size =
|
||||
FixedArray::kHeaderSize + additional_offset - kHeapObjectTag;
|
||||
Node* offset = ElementOffsetFromIndex(index_node, FAST_HOLEY_ELEMENTS,
|
||||
Node* offset = ElementOffsetFromIndex(index_node, HOLEY_ELEMENTS,
|
||||
parameter_mode, header_size);
|
||||
return Load(MachineType::AnyTagged(), object, offset);
|
||||
}
|
||||
@ -1345,7 +1345,7 @@ Node* CodeStubAssembler::LoadAndUntagToWord32FixedArrayElement(
|
||||
header_size += kPointerSize / 2;
|
||||
}
|
||||
#endif
|
||||
Node* offset = ElementOffsetFromIndex(index_node, FAST_HOLEY_ELEMENTS,
|
||||
Node* offset = ElementOffsetFromIndex(index_node, HOLEY_ELEMENTS,
|
||||
parameter_mode, header_size);
|
||||
if (Is64()) {
|
||||
return Load(MachineType::Int32(), object, offset);
|
||||
@ -1362,7 +1362,7 @@ Node* CodeStubAssembler::LoadFixedDoubleArrayElement(
|
||||
CSA_ASSERT(this, IsFixedDoubleArray(object));
|
||||
int32_t header_size =
|
||||
FixedDoubleArray::kHeaderSize + additional_offset - kHeapObjectTag;
|
||||
Node* offset = ElementOffsetFromIndex(index_node, FAST_HOLEY_DOUBLE_ELEMENTS,
|
||||
Node* offset = ElementOffsetFromIndex(index_node, HOLEY_DOUBLE_ELEMENTS,
|
||||
parameter_mode, header_size);
|
||||
return LoadDoubleWithHoleCheck(object, offset, if_hole, machine_type);
|
||||
}
|
||||
@ -1532,7 +1532,7 @@ Node* CodeStubAssembler::StoreFixedArrayElement(Node* object, Node* index_node,
|
||||
barrier_mode == UPDATE_WRITE_BARRIER);
|
||||
int header_size =
|
||||
FixedArray::kHeaderSize + additional_offset - kHeapObjectTag;
|
||||
Node* offset = ElementOffsetFromIndex(index_node, FAST_HOLEY_ELEMENTS,
|
||||
Node* offset = ElementOffsetFromIndex(index_node, HOLEY_ELEMENTS,
|
||||
parameter_mode, header_size);
|
||||
if (barrier_mode == SKIP_WRITE_BARRIER) {
|
||||
return StoreNoWriteBarrier(MachineRepresentation::kTagged, object, offset,
|
||||
@ -1547,7 +1547,7 @@ Node* CodeStubAssembler::StoreFixedDoubleArrayElement(
|
||||
CSA_ASSERT(this, IsFixedDoubleArray(object));
|
||||
CSA_SLOW_ASSERT(this, MatchesParameterMode(index_node, parameter_mode));
|
||||
Node* offset =
|
||||
ElementOffsetFromIndex(index_node, FAST_DOUBLE_ELEMENTS, parameter_mode,
|
||||
ElementOffsetFromIndex(index_node, PACKED_DOUBLE_ELEMENTS, parameter_mode,
|
||||
FixedArray::kHeaderSize - kHeapObjectTag);
|
||||
MachineRepresentation rep = MachineRepresentation::kFloat64;
|
||||
return StoreNoWriteBarrier(rep, object, offset, value);
|
||||
@ -2073,7 +2073,7 @@ Node* CodeStubAssembler::AllocateRegExpResult(Node* context, Node* length,
|
||||
|
||||
Node* const zero = IntPtrConstant(0);
|
||||
Node* const length_intptr = SmiUntag(length);
|
||||
const ElementsKind elements_kind = FAST_ELEMENTS;
|
||||
const ElementsKind elements_kind = PACKED_ELEMENTS;
|
||||
|
||||
Node* const elements = AllocateFixedArray(elements_kind, length_intptr);
|
||||
StoreObjectField(result, JSArray::kElementsOffset, elements);
|
||||
@ -2147,7 +2147,7 @@ Node* CodeStubAssembler::CopyNameDictionary(Node* dictionary,
|
||||
large_object_fallback);
|
||||
Node* properties = AllocateNameDictionaryWithCapacity(capacity);
|
||||
Node* length = SmiUntag(LoadFixedArrayBaseLength(dictionary));
|
||||
CopyFixedArrayElements(FAST_ELEMENTS, dictionary, properties, length,
|
||||
CopyFixedArrayElements(PACKED_ELEMENTS, dictionary, properties, length,
|
||||
SKIP_WRITE_BARRIER, INTPTR_PARAMETERS);
|
||||
return properties;
|
||||
}
|
||||
@ -3337,8 +3337,8 @@ Node* CodeStubAssembler::IsFixedArray(Node* object) {
|
||||
// after Array.p.shift, it is replaced by the empty array constant. If it is
|
||||
// later filled with a double element, we try to grow it but pass in a double
|
||||
// elements kind. Usually this would cause a size mismatch (since the source
|
||||
// fixed array has FAST_HOLEY_ELEMENTS and destination has
|
||||
// FAST_HOLEY_DOUBLE_ELEMENTS), but we don't have to worry about it when the
|
||||
// fixed array has HOLEY_ELEMENTS and destination has
|
||||
// HOLEY_DOUBLE_ELEMENTS), but we don't have to worry about it when the
|
||||
// source array is empty.
|
||||
// TODO(jgruber): It might we worth creating an empty_double_array constant to
|
||||
// simplify this case.
|
||||
@ -5794,10 +5794,10 @@ void CodeStubAssembler::TryLookupElement(Node* object, Node* map,
|
||||
// clang-format off
|
||||
int32_t values[] = {
|
||||
// Handled by {if_isobjectorsmi}.
|
||||
FAST_SMI_ELEMENTS, FAST_HOLEY_SMI_ELEMENTS, FAST_ELEMENTS,
|
||||
FAST_HOLEY_ELEMENTS,
|
||||
PACKED_SMI_ELEMENTS, HOLEY_SMI_ELEMENTS, PACKED_ELEMENTS,
|
||||
HOLEY_ELEMENTS,
|
||||
// Handled by {if_isdouble}.
|
||||
FAST_DOUBLE_ELEMENTS, FAST_HOLEY_DOUBLE_ELEMENTS,
|
||||
PACKED_DOUBLE_ELEMENTS, HOLEY_DOUBLE_ELEMENTS,
|
||||
// Handled by {if_isdictionary}.
|
||||
DICTIONARY_ELEMENTS,
|
||||
// Handled by {if_isfaststringwrapper}.
|
||||
@ -9176,7 +9176,7 @@ CodeStubArguments::CodeStubArguments(
|
||||
arguments_(nullptr),
|
||||
fp_(fp != nullptr ? fp : assembler_->LoadFramePointer()) {
|
||||
Node* offset = assembler_->ElementOffsetFromIndex(
|
||||
argc_, FAST_ELEMENTS, param_mode,
|
||||
argc_, PACKED_ELEMENTS, param_mode,
|
||||
(StandardFrameConstants::kFixedSlotCountAboveFp - 1) * kPointerSize);
|
||||
arguments_ = assembler_->IntPtrAdd(fp_, offset);
|
||||
}
|
||||
@ -9192,8 +9192,8 @@ Node* CodeStubArguments::AtIndexPtr(
|
||||
typedef compiler::Node Node;
|
||||
Node* negated_index = assembler_->IntPtrOrSmiSub(
|
||||
assembler_->IntPtrOrSmiConstant(0, mode), index, mode);
|
||||
Node* offset =
|
||||
assembler_->ElementOffsetFromIndex(negated_index, FAST_ELEMENTS, mode, 0);
|
||||
Node* offset = assembler_->ElementOffsetFromIndex(negated_index,
|
||||
PACKED_ELEMENTS, mode, 0);
|
||||
return assembler_->IntPtrAdd(arguments_, offset);
|
||||
}
|
||||
|
||||
@ -9245,10 +9245,10 @@ void CodeStubArguments::ForEach(
|
||||
}
|
||||
Node* start = assembler_->IntPtrSub(
|
||||
arguments_,
|
||||
assembler_->ElementOffsetFromIndex(first, FAST_ELEMENTS, mode));
|
||||
assembler_->ElementOffsetFromIndex(first, PACKED_ELEMENTS, mode));
|
||||
Node* end = assembler_->IntPtrSub(
|
||||
arguments_,
|
||||
assembler_->ElementOffsetFromIndex(last, FAST_ELEMENTS, mode));
|
||||
assembler_->ElementOffsetFromIndex(last, PACKED_ELEMENTS, mode));
|
||||
assembler_->BuildFastLoop(vars, start, end,
|
||||
[this, &body](Node* current) {
|
||||
Node* arg = assembler_->Load(
|
||||
@ -9278,9 +9278,9 @@ Node* CodeStubAssembler::IsFastElementsKind(Node* elements_kind) {
|
||||
Node* CodeStubAssembler::IsHoleyFastElementsKind(Node* elements_kind) {
|
||||
CSA_ASSERT(this, IsFastElementsKind(elements_kind));
|
||||
|
||||
STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == (FAST_SMI_ELEMENTS | 1));
|
||||
STATIC_ASSERT(FAST_HOLEY_ELEMENTS == (FAST_ELEMENTS | 1));
|
||||
STATIC_ASSERT(FAST_HOLEY_DOUBLE_ELEMENTS == (FAST_DOUBLE_ELEMENTS | 1));
|
||||
STATIC_ASSERT(HOLEY_SMI_ELEMENTS == (PACKED_SMI_ELEMENTS | 1));
|
||||
STATIC_ASSERT(HOLEY_ELEMENTS == (PACKED_ELEMENTS | 1));
|
||||
STATIC_ASSERT(HOLEY_DOUBLE_ELEMENTS == (PACKED_DOUBLE_ELEMENTS | 1));
|
||||
return IsSetWord32(elements_kind, 1);
|
||||
}
|
||||
|
||||
|
@ -854,10 +854,11 @@ TF_STUB(StoreFastElementStub, CodeStubAssembler) {
|
||||
// static
|
||||
void StoreFastElementStub::GenerateAheadOfTime(Isolate* isolate) {
|
||||
if (FLAG_minimal) return;
|
||||
StoreFastElementStub(isolate, false, FAST_HOLEY_ELEMENTS, STANDARD_STORE)
|
||||
StoreFastElementStub(isolate, false, HOLEY_ELEMENTS, STANDARD_STORE)
|
||||
.GetCode();
|
||||
StoreFastElementStub(isolate, false, HOLEY_ELEMENTS,
|
||||
STORE_AND_GROW_NO_TRANSITION)
|
||||
.GetCode();
|
||||
StoreFastElementStub(isolate, false, FAST_HOLEY_ELEMENTS,
|
||||
STORE_AND_GROW_NO_TRANSITION).GetCode();
|
||||
for (int i = FIRST_FAST_ELEMENTS_KIND; i <= LAST_FAST_ELEMENTS_KIND; i++) {
|
||||
ElementsKind kind = static_cast<ElementsKind>(i);
|
||||
StoreFastElementStub(isolate, true, kind, STANDARD_STORE).GetCode();
|
||||
|
@ -856,25 +856,25 @@ ElementAccess AccessBuilder::ForFixedArrayElement(ElementsKind kind) {
|
||||
ElementAccess access = {kTaggedBase, FixedArray::kHeaderSize, Type::Any(),
|
||||
MachineType::AnyTagged(), kFullWriteBarrier};
|
||||
switch (kind) {
|
||||
case FAST_SMI_ELEMENTS:
|
||||
case PACKED_SMI_ELEMENTS:
|
||||
access.type = Type::SignedSmall();
|
||||
access.machine_type = MachineType::TaggedSigned();
|
||||
access.write_barrier_kind = kNoWriteBarrier;
|
||||
break;
|
||||
case FAST_HOLEY_SMI_ELEMENTS:
|
||||
case HOLEY_SMI_ELEMENTS:
|
||||
access.type = TypeCache::Get().kHoleySmi;
|
||||
break;
|
||||
case FAST_ELEMENTS:
|
||||
case PACKED_ELEMENTS:
|
||||
access.type = Type::NonInternal();
|
||||
break;
|
||||
case FAST_HOLEY_ELEMENTS:
|
||||
case HOLEY_ELEMENTS:
|
||||
break;
|
||||
case FAST_DOUBLE_ELEMENTS:
|
||||
case PACKED_DOUBLE_ELEMENTS:
|
||||
access.type = Type::Number();
|
||||
access.write_barrier_kind = kNoWriteBarrier;
|
||||
access.machine_type = MachineType::Float64();
|
||||
break;
|
||||
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
||||
case HOLEY_DOUBLE_ELEMENTS:
|
||||
access.type = Type::Number();
|
||||
access.write_barrier_kind = kNoWriteBarrier;
|
||||
access.machine_type = MachineType::Float64();
|
||||
|
@ -2701,7 +2701,7 @@ Node* EffectControlLinearizer::LowerMaybeGrowFastElements(Node* node,
|
||||
ChangeInt32ToSmi(__ Int32Add(index, __ Int32Constant(1)));
|
||||
|
||||
// Update the "length" property of the {object}.
|
||||
__ StoreField(AccessBuilder::ForJSArrayLength(FAST_ELEMENTS), object,
|
||||
__ StoreField(AccessBuilder::ForJSArrayLength(PACKED_ELEMENTS), object,
|
||||
object_length);
|
||||
}
|
||||
__ Goto(&done, done_grow.PhiAt(0));
|
||||
|
@ -416,11 +416,11 @@ Reduction JSBuiltinReducer::ReduceFastArrayIteratorNext(
|
||||
elements, index, etrue1, if_true1);
|
||||
|
||||
// Convert hole to undefined if needed.
|
||||
if (elements_kind == FAST_HOLEY_ELEMENTS ||
|
||||
elements_kind == FAST_HOLEY_SMI_ELEMENTS) {
|
||||
if (elements_kind == HOLEY_ELEMENTS ||
|
||||
elements_kind == HOLEY_SMI_ELEMENTS) {
|
||||
value = graph()->NewNode(simplified()->ConvertTaggedHoleToUndefined(),
|
||||
value);
|
||||
} else if (elements_kind == FAST_HOLEY_DOUBLE_ELEMENTS) {
|
||||
} else if (elements_kind == HOLEY_DOUBLE_ELEMENTS) {
|
||||
// TODO(bmeurer): avoid deopt if not all uses of value are truncated.
|
||||
CheckFloat64HoleMode mode = CheckFloat64HoleMode::kAllowReturnHole;
|
||||
value = etrue1 = graph()->NewNode(
|
||||
@ -847,7 +847,7 @@ Reduction JSBuiltinReducer::ReduceArrayPop(Node* node) {
|
||||
// once we got the hole NaN mess sorted out in TurboFan/V8.
|
||||
if (GetMapWitness(node).ToHandle(&receiver_map) &&
|
||||
CanInlineArrayResizeOperation(receiver_map) &&
|
||||
receiver_map->elements_kind() != FAST_HOLEY_DOUBLE_ELEMENTS) {
|
||||
receiver_map->elements_kind() != HOLEY_DOUBLE_ELEMENTS) {
|
||||
// Install code dependencies on the {receiver} prototype maps and the
|
||||
// global array protector cell.
|
||||
dependencies()->AssumePropertyCell(factory()->array_protector());
|
||||
@ -1039,7 +1039,7 @@ Reduction JSBuiltinReducer::ReduceArrayShift(Node* node) {
|
||||
Handle<Map> receiver_map;
|
||||
if (GetMapWitness(node).ToHandle(&receiver_map) &&
|
||||
CanInlineArrayResizeOperation(receiver_map) &&
|
||||
receiver_map->elements_kind() != FAST_HOLEY_DOUBLE_ELEMENTS) {
|
||||
receiver_map->elements_kind() != HOLEY_DOUBLE_ELEMENTS) {
|
||||
// Install code dependencies on the {receiver} prototype maps and the
|
||||
// global array protector cell.
|
||||
dependencies()->AssumePropertyCell(factory()->array_protector());
|
||||
|
@ -527,7 +527,7 @@ Reduction JSCallReducer::ReduceArrayForEach(Handle<JSFunction> function,
|
||||
Node* k = jsgraph()->ZeroConstant();
|
||||
|
||||
Node* original_length = graph()->NewNode(
|
||||
simplified()->LoadField(AccessBuilder::ForJSArrayLength(FAST_ELEMENTS)),
|
||||
simplified()->LoadField(AccessBuilder::ForJSArrayLength(PACKED_ELEMENTS)),
|
||||
receiver, effect, control);
|
||||
|
||||
Node* loop = control = graph()->NewNode(common()->Loop(2), control, control);
|
||||
@ -573,7 +573,7 @@ Reduction JSCallReducer::ReduceArrayForEach(Handle<JSFunction> function,
|
||||
// Make sure that the access is still in bounds, since the callback could have
|
||||
// changed the array's size.
|
||||
Node* length = graph()->NewNode(
|
||||
simplified()->LoadField(AccessBuilder::ForJSArrayLength(FAST_ELEMENTS)),
|
||||
simplified()->LoadField(AccessBuilder::ForJSArrayLength(PACKED_ELEMENTS)),
|
||||
receiver, effect, control);
|
||||
k = effect =
|
||||
graph()->NewNode(simplified()->CheckBounds(), k, length, effect, control);
|
||||
|
@ -423,7 +423,8 @@ Reduction JSCreateLowering::ReduceJSCreateArguments(Node* node) {
|
||||
a.Store(AccessBuilder::ForMap(), jsarray_map);
|
||||
a.Store(AccessBuilder::ForJSObjectProperties(), properties);
|
||||
a.Store(AccessBuilder::ForJSObjectElements(), elements);
|
||||
a.Store(AccessBuilder::ForJSArrayLength(FAST_ELEMENTS), rest_length);
|
||||
a.Store(AccessBuilder::ForJSArrayLength(PACKED_ELEMENTS),
|
||||
rest_length);
|
||||
RelaxControls(node);
|
||||
a.FinishAndChange(node);
|
||||
} else {
|
||||
@ -541,7 +542,7 @@ Reduction JSCreateLowering::ReduceJSCreateArguments(Node* node) {
|
||||
a.Store(AccessBuilder::ForMap(), jsarray_map);
|
||||
a.Store(AccessBuilder::ForJSObjectProperties(), properties);
|
||||
a.Store(AccessBuilder::ForJSObjectElements(), elements);
|
||||
a.Store(AccessBuilder::ForJSArrayLength(FAST_ELEMENTS),
|
||||
a.Store(AccessBuilder::ForJSArrayLength(PACKED_ELEMENTS),
|
||||
jsgraph()->Constant(length));
|
||||
RelaxControls(node);
|
||||
a.FinishAndChange(node);
|
||||
@ -578,8 +579,8 @@ Reduction JSCreateLowering::ReduceJSCreateGeneratorObject(Node* node) {
|
||||
|
||||
DCHECK(js_function->shared()->HasBytecodeArray());
|
||||
int size = js_function->shared()->bytecode_array()->register_count();
|
||||
Node* elements = effect = AllocateElements(
|
||||
effect, control, FAST_HOLEY_ELEMENTS, size, NOT_TENURED);
|
||||
Node* elements = effect =
|
||||
AllocateElements(effect, control, HOLEY_ELEMENTS, size, NOT_TENURED);
|
||||
|
||||
AllocationBuilder a(jsgraph(), effect, control);
|
||||
a.Allocate(initial_map->instance_size());
|
||||
@ -967,9 +968,9 @@ Reduction JSCreateLowering::ReduceJSCreateKeyValueArray(Node* node) {
|
||||
|
||||
AllocationBuilder aa(jsgraph(), effect, graph()->start());
|
||||
aa.AllocateArray(2, factory()->fixed_array_map());
|
||||
aa.Store(AccessBuilder::ForFixedArrayElement(FAST_ELEMENTS),
|
||||
aa.Store(AccessBuilder::ForFixedArrayElement(PACKED_ELEMENTS),
|
||||
jsgraph()->Constant(0), key);
|
||||
aa.Store(AccessBuilder::ForFixedArrayElement(FAST_ELEMENTS),
|
||||
aa.Store(AccessBuilder::ForFixedArrayElement(PACKED_ELEMENTS),
|
||||
jsgraph()->Constant(1), value);
|
||||
Node* elements = aa.Finish();
|
||||
|
||||
@ -978,7 +979,7 @@ Reduction JSCreateLowering::ReduceJSCreateKeyValueArray(Node* node) {
|
||||
a.Store(AccessBuilder::ForMap(), array_map);
|
||||
a.Store(AccessBuilder::ForJSObjectProperties(), properties);
|
||||
a.Store(AccessBuilder::ForJSObjectElements(), elements);
|
||||
a.Store(AccessBuilder::ForJSArrayLength(FAST_ELEMENTS), length);
|
||||
a.Store(AccessBuilder::ForJSArrayLength(PACKED_ELEMENTS), length);
|
||||
STATIC_ASSERT(JSArray::kSize == 4 * kPointerSize);
|
||||
a.FinishAndChange(node);
|
||||
return Changed(node);
|
||||
|
@ -2130,8 +2130,8 @@ JSNativeContextSpecialization::BuildElementAccess(
|
||||
element_access.type =
|
||||
Type::Union(element_type, Type::Hole(), graph()->zone());
|
||||
}
|
||||
if (elements_kind == FAST_HOLEY_ELEMENTS ||
|
||||
elements_kind == FAST_HOLEY_SMI_ELEMENTS) {
|
||||
if (elements_kind == HOLEY_ELEMENTS ||
|
||||
elements_kind == HOLEY_SMI_ELEMENTS) {
|
||||
element_access.machine_type = MachineType::AnyTagged();
|
||||
}
|
||||
// Perform the actual backing store access.
|
||||
@ -2140,8 +2140,8 @@ JSNativeContextSpecialization::BuildElementAccess(
|
||||
index, effect, control);
|
||||
// Handle loading from holey backing stores correctly, by either mapping
|
||||
// the hole to undefined if possible, or deoptimizing otherwise.
|
||||
if (elements_kind == FAST_HOLEY_ELEMENTS ||
|
||||
elements_kind == FAST_HOLEY_SMI_ELEMENTS) {
|
||||
if (elements_kind == HOLEY_ELEMENTS ||
|
||||
elements_kind == HOLEY_SMI_ELEMENTS) {
|
||||
// Check if we are allowed to turn the hole into undefined.
|
||||
if (CanTreatHoleAsUndefined(receiver_maps)) {
|
||||
// Turn the hole into undefined.
|
||||
@ -2152,7 +2152,7 @@ JSNativeContextSpecialization::BuildElementAccess(
|
||||
value = effect = graph()->NewNode(simplified()->CheckNotTaggedHole(),
|
||||
value, effect, control);
|
||||
}
|
||||
} else if (elements_kind == FAST_HOLEY_DOUBLE_ELEMENTS) {
|
||||
} else if (elements_kind == HOLEY_DOUBLE_ELEMENTS) {
|
||||
// Perform the hole check on the result.
|
||||
CheckFloat64HoleMode mode = CheckFloat64HoleMode::kNeverReturnHole;
|
||||
// Check if we are allowed to return the hole directly.
|
||||
|
@ -271,16 +271,16 @@ enum ContextLookupFlags {
|
||||
V(INTL_COLLATOR_FUNCTION_INDEX, JSFunction, intl_collator_function) \
|
||||
V(INTL_V8_BREAK_ITERATOR_FUNCTION_INDEX, JSFunction, \
|
||||
intl_v8_break_iterator_function) \
|
||||
V(JS_ARRAY_FAST_SMI_ELEMENTS_MAP_INDEX, Map, \
|
||||
V(JS_ARRAY_PACKED_SMI_ELEMENTS_MAP_INDEX, Map, \
|
||||
js_array_fast_smi_elements_map_index) \
|
||||
V(JS_ARRAY_FAST_HOLEY_SMI_ELEMENTS_MAP_INDEX, Map, \
|
||||
V(JS_ARRAY_HOLEY_SMI_ELEMENTS_MAP_INDEX, Map, \
|
||||
js_array_fast_holey_smi_elements_map_index) \
|
||||
V(JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, Map, js_array_fast_elements_map_index) \
|
||||
V(JS_ARRAY_FAST_HOLEY_ELEMENTS_MAP_INDEX, Map, \
|
||||
V(JS_ARRAY_PACKED_ELEMENTS_MAP_INDEX, Map, js_array_fast_elements_map_index) \
|
||||
V(JS_ARRAY_HOLEY_ELEMENTS_MAP_INDEX, Map, \
|
||||
js_array_fast_holey_elements_map_index) \
|
||||
V(JS_ARRAY_FAST_DOUBLE_ELEMENTS_MAP_INDEX, Map, \
|
||||
V(JS_ARRAY_PACKED_DOUBLE_ELEMENTS_MAP_INDEX, Map, \
|
||||
js_array_fast_double_elements_map_index) \
|
||||
V(JS_ARRAY_FAST_HOLEY_DOUBLE_ELEMENTS_MAP_INDEX, Map, \
|
||||
V(JS_ARRAY_HOLEY_DOUBLE_ELEMENTS_MAP_INDEX, Map, \
|
||||
js_array_fast_holey_double_elements_map_index) \
|
||||
V(JS_MAP_FUN_INDEX, JSFunction, js_map_fun) \
|
||||
V(JS_MAP_MAP_INDEX, Map, js_map_map) \
|
||||
@ -519,7 +519,7 @@ class Context: public FixedArray {
|
||||
// Total number of slots.
|
||||
NATIVE_CONTEXT_SLOTS,
|
||||
FIRST_WEAK_SLOT = OPTIMIZED_FUNCTIONS_LIST,
|
||||
FIRST_JS_ARRAY_MAP_SLOT = JS_ARRAY_FAST_SMI_ELEMENTS_MAP_INDEX,
|
||||
FIRST_JS_ARRAY_MAP_SLOT = JS_ARRAY_PACKED_SMI_ELEMENTS_MAP_INDEX,
|
||||
|
||||
MIN_CONTEXT_SLOTS = GLOBAL_PROXY_INDEX,
|
||||
// This slot holds the thrown value in catch contexts.
|
||||
|
@ -27,14 +27,14 @@ int ElementsKindToShiftSize(ElementsKind elements_kind) {
|
||||
case INT32_ELEMENTS:
|
||||
case FLOAT32_ELEMENTS:
|
||||
return 2;
|
||||
case FAST_DOUBLE_ELEMENTS:
|
||||
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
||||
case PACKED_DOUBLE_ELEMENTS:
|
||||
case HOLEY_DOUBLE_ELEMENTS:
|
||||
case FLOAT64_ELEMENTS:
|
||||
return 3;
|
||||
case FAST_SMI_ELEMENTS:
|
||||
case FAST_ELEMENTS:
|
||||
case FAST_HOLEY_SMI_ELEMENTS:
|
||||
case FAST_HOLEY_ELEMENTS:
|
||||
case PACKED_SMI_ELEMENTS:
|
||||
case PACKED_ELEMENTS:
|
||||
case HOLEY_SMI_ELEMENTS:
|
||||
case HOLEY_ELEMENTS:
|
||||
case DICTIONARY_ELEMENTS:
|
||||
case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
|
||||
case SLOW_SLOPPY_ARGUMENTS_ELEMENTS:
|
||||
@ -71,21 +71,21 @@ struct InitializeFastElementsKindSequence {
|
||||
ElementsKind* fast_elements_kind_sequence =
|
||||
new ElementsKind[kFastElementsKindCount];
|
||||
*fast_elements_kind_sequence_ptr = fast_elements_kind_sequence;
|
||||
STATIC_ASSERT(FAST_SMI_ELEMENTS == FIRST_FAST_ELEMENTS_KIND);
|
||||
fast_elements_kind_sequence[0] = FAST_SMI_ELEMENTS;
|
||||
fast_elements_kind_sequence[1] = FAST_HOLEY_SMI_ELEMENTS;
|
||||
fast_elements_kind_sequence[2] = FAST_DOUBLE_ELEMENTS;
|
||||
fast_elements_kind_sequence[3] = FAST_HOLEY_DOUBLE_ELEMENTS;
|
||||
fast_elements_kind_sequence[4] = FAST_ELEMENTS;
|
||||
fast_elements_kind_sequence[5] = FAST_HOLEY_ELEMENTS;
|
||||
STATIC_ASSERT(PACKED_SMI_ELEMENTS == FIRST_FAST_ELEMENTS_KIND);
|
||||
fast_elements_kind_sequence[0] = PACKED_SMI_ELEMENTS;
|
||||
fast_elements_kind_sequence[1] = HOLEY_SMI_ELEMENTS;
|
||||
fast_elements_kind_sequence[2] = PACKED_DOUBLE_ELEMENTS;
|
||||
fast_elements_kind_sequence[3] = HOLEY_DOUBLE_ELEMENTS;
|
||||
fast_elements_kind_sequence[4] = PACKED_ELEMENTS;
|
||||
fast_elements_kind_sequence[5] = HOLEY_ELEMENTS;
|
||||
|
||||
// Verify that kFastElementsKindPackedToHoley is correct.
|
||||
STATIC_ASSERT(FAST_SMI_ELEMENTS + kFastElementsKindPackedToHoley ==
|
||||
FAST_HOLEY_SMI_ELEMENTS);
|
||||
STATIC_ASSERT(FAST_DOUBLE_ELEMENTS + kFastElementsKindPackedToHoley ==
|
||||
FAST_HOLEY_DOUBLE_ELEMENTS);
|
||||
STATIC_ASSERT(FAST_ELEMENTS + kFastElementsKindPackedToHoley ==
|
||||
FAST_HOLEY_ELEMENTS);
|
||||
STATIC_ASSERT(PACKED_SMI_ELEMENTS + kFastElementsKindPackedToHoley ==
|
||||
HOLEY_SMI_ELEMENTS);
|
||||
STATIC_ASSERT(PACKED_DOUBLE_ELEMENTS + kFastElementsKindPackedToHoley ==
|
||||
HOLEY_DOUBLE_ELEMENTS);
|
||||
STATIC_ASSERT(PACKED_ELEMENTS + kFastElementsKindPackedToHoley ==
|
||||
HOLEY_ELEMENTS);
|
||||
}
|
||||
};
|
||||
|
||||
@ -131,21 +131,19 @@ bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind,
|
||||
}
|
||||
if (IsFastElementsKind(from_kind) && IsFastTransitionTarget(to_kind)) {
|
||||
switch (from_kind) {
|
||||
case FAST_SMI_ELEMENTS:
|
||||
return to_kind != FAST_SMI_ELEMENTS;
|
||||
case FAST_HOLEY_SMI_ELEMENTS:
|
||||
return to_kind != FAST_SMI_ELEMENTS &&
|
||||
to_kind != FAST_HOLEY_SMI_ELEMENTS;
|
||||
case FAST_DOUBLE_ELEMENTS:
|
||||
return to_kind != FAST_SMI_ELEMENTS &&
|
||||
to_kind != FAST_HOLEY_SMI_ELEMENTS &&
|
||||
to_kind != FAST_DOUBLE_ELEMENTS;
|
||||
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
||||
return to_kind == FAST_ELEMENTS ||
|
||||
to_kind == FAST_HOLEY_ELEMENTS;
|
||||
case FAST_ELEMENTS:
|
||||
return to_kind == FAST_HOLEY_ELEMENTS;
|
||||
case FAST_HOLEY_ELEMENTS:
|
||||
case PACKED_SMI_ELEMENTS:
|
||||
return to_kind != PACKED_SMI_ELEMENTS;
|
||||
case HOLEY_SMI_ELEMENTS:
|
||||
return to_kind != PACKED_SMI_ELEMENTS && to_kind != HOLEY_SMI_ELEMENTS;
|
||||
case PACKED_DOUBLE_ELEMENTS:
|
||||
return to_kind != PACKED_SMI_ELEMENTS &&
|
||||
to_kind != HOLEY_SMI_ELEMENTS &&
|
||||
to_kind != PACKED_DOUBLE_ELEMENTS;
|
||||
case HOLEY_DOUBLE_ELEMENTS:
|
||||
return to_kind == PACKED_ELEMENTS || to_kind == HOLEY_ELEMENTS;
|
||||
case PACKED_ELEMENTS:
|
||||
return to_kind == HOLEY_ELEMENTS;
|
||||
case HOLEY_ELEMENTS:
|
||||
return false;
|
||||
default:
|
||||
return false;
|
||||
|
@ -14,18 +14,18 @@ namespace internal {
|
||||
enum ElementsKind {
|
||||
// The "fast" kind for elements that only contain SMI values. Must be first
|
||||
// to make it possible to efficiently check maps for this kind.
|
||||
FAST_SMI_ELEMENTS,
|
||||
FAST_HOLEY_SMI_ELEMENTS,
|
||||
PACKED_SMI_ELEMENTS,
|
||||
HOLEY_SMI_ELEMENTS,
|
||||
|
||||
// The "fast" kind for tagged values. Must be second to make it possible to
|
||||
// efficiently check maps for this and the FAST_SMI_ONLY_ELEMENTS kind
|
||||
// efficiently check maps for this and the PACKED_SMI_ELEMENTS kind
|
||||
// together at once.
|
||||
FAST_ELEMENTS,
|
||||
FAST_HOLEY_ELEMENTS,
|
||||
PACKED_ELEMENTS,
|
||||
HOLEY_ELEMENTS,
|
||||
|
||||
// The "fast" kind for unwrapped, non-tagged double values.
|
||||
FAST_DOUBLE_ELEMENTS,
|
||||
FAST_HOLEY_DOUBLE_ELEMENTS,
|
||||
PACKED_DOUBLE_ELEMENTS,
|
||||
HOLEY_DOUBLE_ELEMENTS,
|
||||
|
||||
// The "slow" kind.
|
||||
DICTIONARY_ELEMENTS,
|
||||
@ -54,28 +54,28 @@ enum ElementsKind {
|
||||
NO_ELEMENTS,
|
||||
|
||||
// Derived constants from ElementsKind.
|
||||
FIRST_ELEMENTS_KIND = FAST_SMI_ELEMENTS,
|
||||
FIRST_ELEMENTS_KIND = PACKED_SMI_ELEMENTS,
|
||||
LAST_ELEMENTS_KIND = UINT8_CLAMPED_ELEMENTS,
|
||||
FIRST_FAST_ELEMENTS_KIND = FAST_SMI_ELEMENTS,
|
||||
LAST_FAST_ELEMENTS_KIND = FAST_HOLEY_DOUBLE_ELEMENTS,
|
||||
FIRST_FAST_ELEMENTS_KIND = PACKED_SMI_ELEMENTS,
|
||||
LAST_FAST_ELEMENTS_KIND = HOLEY_DOUBLE_ELEMENTS,
|
||||
FIRST_FIXED_TYPED_ARRAY_ELEMENTS_KIND = UINT8_ELEMENTS,
|
||||
LAST_FIXED_TYPED_ARRAY_ELEMENTS_KIND = UINT8_CLAMPED_ELEMENTS,
|
||||
TERMINAL_FAST_ELEMENTS_KIND = FAST_HOLEY_ELEMENTS
|
||||
TERMINAL_FAST_ELEMENTS_KIND = HOLEY_ELEMENTS
|
||||
};
|
||||
|
||||
const int kElementsKindCount = LAST_ELEMENTS_KIND - FIRST_ELEMENTS_KIND + 1;
|
||||
const int kFastElementsKindCount = LAST_FAST_ELEMENTS_KIND -
|
||||
FIRST_FAST_ELEMENTS_KIND + 1;
|
||||
const int kFastElementsKindCount =
|
||||
LAST_FAST_ELEMENTS_KIND - FIRST_FAST_ELEMENTS_KIND + 1;
|
||||
|
||||
// The number to add to a packed elements kind to reach a holey elements kind
|
||||
const int kFastElementsKindPackedToHoley =
|
||||
FAST_HOLEY_SMI_ELEMENTS - FAST_SMI_ELEMENTS;
|
||||
HOLEY_SMI_ELEMENTS - PACKED_SMI_ELEMENTS;
|
||||
|
||||
int ElementsKindToShiftSize(ElementsKind elements_kind);
|
||||
int GetDefaultHeaderSizeForElementsKind(ElementsKind elements_kind);
|
||||
const char* ElementsKindToString(ElementsKind kind);
|
||||
|
||||
inline ElementsKind GetInitialFastElementsKind() { return FAST_SMI_ELEMENTS; }
|
||||
inline ElementsKind GetInitialFastElementsKind() { return PACKED_SMI_ELEMENTS; }
|
||||
|
||||
ElementsKind GetFastElementsKindFromSequenceIndex(int sequence_number);
|
||||
int GetSequenceIndexFromFastElementsKind(ElementsKind elements_kind);
|
||||
@ -110,7 +110,7 @@ inline bool IsTerminalElementsKind(ElementsKind kind) {
|
||||
|
||||
inline bool IsFastElementsKind(ElementsKind kind) {
|
||||
STATIC_ASSERT(FIRST_FAST_ELEMENTS_KIND == 0);
|
||||
return kind <= FAST_HOLEY_DOUBLE_ELEMENTS;
|
||||
return kind <= HOLEY_DOUBLE_ELEMENTS;
|
||||
}
|
||||
|
||||
|
||||
@ -122,8 +122,7 @@ inline bool IsTransitionElementsKind(ElementsKind kind) {
|
||||
|
||||
|
||||
inline bool IsFastDoubleElementsKind(ElementsKind kind) {
|
||||
return kind == FAST_DOUBLE_ELEMENTS ||
|
||||
kind == FAST_HOLEY_DOUBLE_ELEMENTS;
|
||||
return kind == PACKED_DOUBLE_ELEMENTS || kind == HOLEY_DOUBLE_ELEMENTS;
|
||||
}
|
||||
|
||||
|
||||
@ -138,16 +137,13 @@ inline bool IsDoubleOrFloatElementsKind(ElementsKind kind) {
|
||||
|
||||
|
||||
inline bool IsFastSmiOrObjectElementsKind(ElementsKind kind) {
|
||||
return kind == FAST_SMI_ELEMENTS ||
|
||||
kind == FAST_HOLEY_SMI_ELEMENTS ||
|
||||
kind == FAST_ELEMENTS ||
|
||||
kind == FAST_HOLEY_ELEMENTS;
|
||||
return kind == PACKED_SMI_ELEMENTS || kind == HOLEY_SMI_ELEMENTS ||
|
||||
kind == PACKED_ELEMENTS || kind == HOLEY_ELEMENTS;
|
||||
}
|
||||
|
||||
|
||||
inline bool IsFastSmiElementsKind(ElementsKind kind) {
|
||||
return kind == FAST_SMI_ELEMENTS ||
|
||||
kind == FAST_HOLEY_SMI_ELEMENTS;
|
||||
return kind == PACKED_SMI_ELEMENTS || kind == HOLEY_SMI_ELEMENTS;
|
||||
}
|
||||
|
||||
inline bool IsFastNumberElementsKind(ElementsKind kind) {
|
||||
@ -156,15 +152,13 @@ inline bool IsFastNumberElementsKind(ElementsKind kind) {
|
||||
|
||||
|
||||
inline bool IsFastObjectElementsKind(ElementsKind kind) {
|
||||
return kind == FAST_ELEMENTS ||
|
||||
kind == FAST_HOLEY_ELEMENTS;
|
||||
return kind == PACKED_ELEMENTS || kind == HOLEY_ELEMENTS;
|
||||
}
|
||||
|
||||
|
||||
inline bool IsFastHoleyElementsKind(ElementsKind kind) {
|
||||
return kind == FAST_HOLEY_SMI_ELEMENTS ||
|
||||
kind == FAST_HOLEY_DOUBLE_ELEMENTS ||
|
||||
kind == FAST_HOLEY_ELEMENTS;
|
||||
return kind == HOLEY_SMI_ELEMENTS || kind == HOLEY_DOUBLE_ELEMENTS ||
|
||||
kind == HOLEY_ELEMENTS;
|
||||
}
|
||||
|
||||
|
||||
@ -175,34 +169,34 @@ inline bool IsHoleyElementsKind(ElementsKind kind) {
|
||||
|
||||
|
||||
inline bool IsFastPackedElementsKind(ElementsKind kind) {
|
||||
return kind == FAST_SMI_ELEMENTS || kind == FAST_DOUBLE_ELEMENTS ||
|
||||
kind == FAST_ELEMENTS;
|
||||
return kind == PACKED_SMI_ELEMENTS || kind == PACKED_DOUBLE_ELEMENTS ||
|
||||
kind == PACKED_ELEMENTS;
|
||||
}
|
||||
|
||||
|
||||
inline ElementsKind GetPackedElementsKind(ElementsKind holey_kind) {
|
||||
if (holey_kind == FAST_HOLEY_SMI_ELEMENTS) {
|
||||
return FAST_SMI_ELEMENTS;
|
||||
if (holey_kind == HOLEY_SMI_ELEMENTS) {
|
||||
return PACKED_SMI_ELEMENTS;
|
||||
}
|
||||
if (holey_kind == FAST_HOLEY_DOUBLE_ELEMENTS) {
|
||||
return FAST_DOUBLE_ELEMENTS;
|
||||
if (holey_kind == HOLEY_DOUBLE_ELEMENTS) {
|
||||
return PACKED_DOUBLE_ELEMENTS;
|
||||
}
|
||||
if (holey_kind == FAST_HOLEY_ELEMENTS) {
|
||||
return FAST_ELEMENTS;
|
||||
if (holey_kind == HOLEY_ELEMENTS) {
|
||||
return PACKED_ELEMENTS;
|
||||
}
|
||||
return holey_kind;
|
||||
}
|
||||
|
||||
|
||||
inline ElementsKind GetHoleyElementsKind(ElementsKind packed_kind) {
|
||||
if (packed_kind == FAST_SMI_ELEMENTS) {
|
||||
return FAST_HOLEY_SMI_ELEMENTS;
|
||||
if (packed_kind == PACKED_SMI_ELEMENTS) {
|
||||
return HOLEY_SMI_ELEMENTS;
|
||||
}
|
||||
if (packed_kind == FAST_DOUBLE_ELEMENTS) {
|
||||
return FAST_HOLEY_DOUBLE_ELEMENTS;
|
||||
if (packed_kind == PACKED_DOUBLE_ELEMENTS) {
|
||||
return HOLEY_DOUBLE_ELEMENTS;
|
||||
}
|
||||
if (packed_kind == FAST_ELEMENTS) {
|
||||
return FAST_HOLEY_ELEMENTS;
|
||||
if (packed_kind == PACKED_ELEMENTS) {
|
||||
return HOLEY_ELEMENTS;
|
||||
}
|
||||
return packed_kind;
|
||||
}
|
||||
@ -210,9 +204,7 @@ inline ElementsKind GetHoleyElementsKind(ElementsKind packed_kind) {
|
||||
|
||||
inline ElementsKind FastSmiToObjectElementsKind(ElementsKind from_kind) {
|
||||
DCHECK(IsFastSmiElementsKind(from_kind));
|
||||
return (from_kind == FAST_SMI_ELEMENTS)
|
||||
? FAST_ELEMENTS
|
||||
: FAST_HOLEY_ELEMENTS;
|
||||
return (from_kind == PACKED_SMI_ELEMENTS) ? PACKED_ELEMENTS : HOLEY_ELEMENTS;
|
||||
}
|
||||
|
||||
|
||||
@ -239,7 +231,7 @@ inline ElementsKind GetMoreGeneralElementsKind(ElementsKind from_kind,
|
||||
|
||||
inline bool IsTransitionableFastElementsKind(ElementsKind from_kind) {
|
||||
return IsFastElementsKind(from_kind) &&
|
||||
from_kind != TERMINAL_FAST_ELEMENTS_KIND;
|
||||
from_kind != TERMINAL_FAST_ELEMENTS_KIND;
|
||||
}
|
||||
|
||||
|
||||
|
179
src/elements.cc
179
src/elements.cc
@ -63,13 +63,13 @@ enum Where { AT_START, AT_END };
|
||||
// identical. Note that the order must match that of the ElementsKind enum for
|
||||
// the |accessor_array[]| below to work.
|
||||
#define ELEMENTS_LIST(V) \
|
||||
V(FastPackedSmiElementsAccessor, FAST_SMI_ELEMENTS, FixedArray) \
|
||||
V(FastHoleySmiElementsAccessor, FAST_HOLEY_SMI_ELEMENTS, FixedArray) \
|
||||
V(FastPackedObjectElementsAccessor, FAST_ELEMENTS, FixedArray) \
|
||||
V(FastHoleyObjectElementsAccessor, FAST_HOLEY_ELEMENTS, FixedArray) \
|
||||
V(FastPackedDoubleElementsAccessor, FAST_DOUBLE_ELEMENTS, FixedDoubleArray) \
|
||||
V(FastHoleyDoubleElementsAccessor, FAST_HOLEY_DOUBLE_ELEMENTS, \
|
||||
V(FastPackedSmiElementsAccessor, PACKED_SMI_ELEMENTS, FixedArray) \
|
||||
V(FastHoleySmiElementsAccessor, HOLEY_SMI_ELEMENTS, FixedArray) \
|
||||
V(FastPackedObjectElementsAccessor, PACKED_ELEMENTS, FixedArray) \
|
||||
V(FastHoleyObjectElementsAccessor, HOLEY_ELEMENTS, FixedArray) \
|
||||
V(FastPackedDoubleElementsAccessor, PACKED_DOUBLE_ELEMENTS, \
|
||||
FixedDoubleArray) \
|
||||
V(FastHoleyDoubleElementsAccessor, HOLEY_DOUBLE_ELEMENTS, FixedDoubleArray) \
|
||||
V(DictionaryElementsAccessor, DICTIONARY_ELEMENTS, SeededNumberDictionary) \
|
||||
V(FastSloppyArgumentsElementsAccessor, FAST_SLOPPY_ARGUMENTS_ELEMENTS, \
|
||||
FixedArray) \
|
||||
@ -1192,8 +1192,8 @@ class ElementsAccessorBase : public ElementsAccessor {
|
||||
}
|
||||
|
||||
// Copy over the passed-in property keys.
|
||||
CopyObjectToObjectElements(*keys, FAST_ELEMENTS, 0, *combined_keys,
|
||||
FAST_ELEMENTS, nof_indices, nof_property_keys);
|
||||
CopyObjectToObjectElements(*keys, PACKED_ELEMENTS, 0, *combined_keys,
|
||||
PACKED_ELEMENTS, nof_indices, nof_property_keys);
|
||||
|
||||
// For holey elements and arguments we might have to shrink the collected
|
||||
// keys since the estimates might be off.
|
||||
@ -2037,8 +2037,8 @@ class FastElementsAccessor : public ElementsAccessorBase<Subclass, KindTraits> {
|
||||
(IsFastHoleyElementsKind(KindTraits::Kind) &&
|
||||
backing_store->is_the_hole(isolate, i)));
|
||||
}
|
||||
} else if (KindTraits::Kind == FAST_ELEMENTS ||
|
||||
KindTraits::Kind == FAST_DOUBLE_ELEMENTS) {
|
||||
} else if (KindTraits::Kind == PACKED_ELEMENTS ||
|
||||
KindTraits::Kind == PACKED_DOUBLE_ELEMENTS) {
|
||||
for (int i = 0; i < length; i++) {
|
||||
DCHECK(!backing_store->is_the_hole(isolate, i));
|
||||
}
|
||||
@ -2212,15 +2212,15 @@ class FastElementsAccessor : public ElementsAccessorBase<Subclass, KindTraits> {
|
||||
|
||||
if (!value->IsNumber()) {
|
||||
if (value == undefined) {
|
||||
// Only FAST_ELEMENTS, FAST_HOLEY_ELEMENTS, FAST_HOLEY_SMI_ELEMENTS, and
|
||||
// FAST_HOLEY_DOUBLE_ELEMENTS can have `undefined` as a value.
|
||||
// Only PACKED_ELEMENTS, HOLEY_ELEMENTS, HOLEY_SMI_ELEMENTS, and
|
||||
// HOLEY_DOUBLE_ELEMENTS can have `undefined` as a value.
|
||||
if (!IsFastObjectElementsKind(Subclass::kind()) &&
|
||||
!IsFastHoleyElementsKind(Subclass::kind())) {
|
||||
return Just(false);
|
||||
}
|
||||
|
||||
// Search for `undefined` or The Hole in FAST_ELEMENTS,
|
||||
// FAST_HOLEY_ELEMENTS or FAST_HOLEY_SMI_ELEMENTS
|
||||
// Search for `undefined` or The Hole in PACKED_ELEMENTS,
|
||||
// HOLEY_ELEMENTS or HOLEY_SMI_ELEMENTS
|
||||
if (IsFastSmiOrObjectElementsKind(Subclass::kind())) {
|
||||
auto elements = FixedArray::cast(receiver->elements());
|
||||
|
||||
@ -2238,8 +2238,8 @@ class FastElementsAccessor : public ElementsAccessorBase<Subclass, KindTraits> {
|
||||
}
|
||||
return Just(false);
|
||||
} else {
|
||||
// Seach for The Hole in FAST_HOLEY_DOUBLE_ELEMENTS
|
||||
DCHECK_EQ(Subclass::kind(), FAST_HOLEY_DOUBLE_ELEMENTS);
|
||||
// Seach for The Hole in HOLEY_DOUBLE_ELEMENTS
|
||||
DCHECK_EQ(Subclass::kind(), HOLEY_DOUBLE_ELEMENTS);
|
||||
auto elements = FixedDoubleArray::cast(receiver->elements());
|
||||
|
||||
for (uint32_t k = start_from; k < length; ++k) {
|
||||
@ -2252,13 +2252,13 @@ class FastElementsAccessor : public ElementsAccessorBase<Subclass, KindTraits> {
|
||||
}
|
||||
} else if (!IsFastObjectElementsKind(Subclass::kind())) {
|
||||
// Search for non-number, non-Undefined value, with either
|
||||
// FAST_SMI_ELEMENTS, FAST_DOUBLE_ELEMENTS, FAST_HOLEY_SMI_ELEMENTS or
|
||||
// FAST_HOLEY_DOUBLE_ELEMENTS. Guaranteed to return false, since these
|
||||
// PACKED_SMI_ELEMENTS, PACKED_DOUBLE_ELEMENTS, HOLEY_SMI_ELEMENTS or
|
||||
// HOLEY_DOUBLE_ELEMENTS. Guaranteed to return false, since these
|
||||
// elements kinds can only contain Number values or undefined.
|
||||
return Just(false);
|
||||
} else {
|
||||
// Search for non-number, non-Undefined value with either
|
||||
// FAST_ELEMENTS or FAST_HOLEY_ELEMENTS.
|
||||
// PACKED_ELEMENTS or HOLEY_ELEMENTS.
|
||||
DCHECK(IsFastObjectElementsKind(Subclass::kind()));
|
||||
auto elements = FixedArray::cast(receiver->elements());
|
||||
|
||||
@ -2277,8 +2277,8 @@ class FastElementsAccessor : public ElementsAccessorBase<Subclass, KindTraits> {
|
||||
if (!value->IsNaN()) {
|
||||
double search_value = value->Number();
|
||||
if (IsFastDoubleElementsKind(Subclass::kind())) {
|
||||
// Search for non-NaN Number in FAST_DOUBLE_ELEMENTS or
|
||||
// FAST_HOLEY_DOUBLE_ELEMENTS --- Skip TheHole, and trust UCOMISD or
|
||||
// Search for non-NaN Number in PACKED_DOUBLE_ELEMENTS or
|
||||
// HOLEY_DOUBLE_ELEMENTS --- Skip TheHole, and trust UCOMISD or
|
||||
// similar operation for result.
|
||||
auto elements = FixedDoubleArray::cast(receiver->elements());
|
||||
|
||||
@ -2291,8 +2291,8 @@ class FastElementsAccessor : public ElementsAccessorBase<Subclass, KindTraits> {
|
||||
}
|
||||
return Just(false);
|
||||
} else {
|
||||
// Search for non-NaN Number in FAST_ELEMENTS, FAST_HOLEY_ELEMENTS,
|
||||
// FAST_SMI_ELEMENTS or FAST_HOLEY_SMI_ELEMENTS --- Skip non-Numbers,
|
||||
// Search for non-NaN Number in PACKED_ELEMENTS, HOLEY_ELEMENTS,
|
||||
// PACKED_SMI_ELEMENTS or HOLEY_SMI_ELEMENTS --- Skip non-Numbers,
|
||||
// and trust UCOMISD or similar operation for result
|
||||
auto elements = FixedArray::cast(receiver->elements());
|
||||
|
||||
@ -2306,12 +2306,12 @@ class FastElementsAccessor : public ElementsAccessorBase<Subclass, KindTraits> {
|
||||
}
|
||||
} else {
|
||||
// Search for NaN --- NaN cannot be represented with Smi elements, so
|
||||
// abort if ElementsKind is FAST_SMI_ELEMENTS or FAST_HOLEY_SMI_ELEMENTS
|
||||
// abort if ElementsKind is PACKED_SMI_ELEMENTS or HOLEY_SMI_ELEMENTS
|
||||
if (IsFastSmiElementsKind(Subclass::kind())) return Just(false);
|
||||
|
||||
if (IsFastDoubleElementsKind(Subclass::kind())) {
|
||||
// Search for NaN in FAST_DOUBLE_ELEMENTS or
|
||||
// FAST_HOLEY_DOUBLE_ELEMENTS --- Skip The Hole and trust
|
||||
// Search for NaN in PACKED_DOUBLE_ELEMENTS or
|
||||
// HOLEY_DOUBLE_ELEMENTS --- Skip The Hole and trust
|
||||
// std::isnan(elementK) for result
|
||||
auto elements = FixedDoubleArray::cast(receiver->elements());
|
||||
|
||||
@ -2324,8 +2324,8 @@ class FastElementsAccessor : public ElementsAccessorBase<Subclass, KindTraits> {
|
||||
}
|
||||
return Just(false);
|
||||
} else {
|
||||
// Search for NaN in FAST_ELEMENTS, FAST_HOLEY_ELEMENTS,
|
||||
// FAST_SMI_ELEMENTS or FAST_HOLEY_SMI_ELEMENTS. Return true if
|
||||
// Search for NaN in PACKED_ELEMENTS, HOLEY_ELEMENTS,
|
||||
// PACKED_SMI_ELEMENTS or HOLEY_SMI_ELEMENTS. Return true if
|
||||
// elementK->IsHeapNumber() && std::isnan(elementK->Number())
|
||||
DCHECK(IsFastSmiOrObjectElementsKind(Subclass::kind()));
|
||||
auto elements = FixedArray::cast(receiver->elements());
|
||||
@ -2520,15 +2520,15 @@ class FastSmiOrObjectElementsAccessor
|
||||
DisallowHeapAllocation no_gc;
|
||||
ElementsKind to_kind = KindTraits::Kind;
|
||||
switch (from_kind) {
|
||||
case FAST_SMI_ELEMENTS:
|
||||
case FAST_HOLEY_SMI_ELEMENTS:
|
||||
case FAST_ELEMENTS:
|
||||
case FAST_HOLEY_ELEMENTS:
|
||||
case PACKED_SMI_ELEMENTS:
|
||||
case HOLEY_SMI_ELEMENTS:
|
||||
case PACKED_ELEMENTS:
|
||||
case HOLEY_ELEMENTS:
|
||||
CopyObjectToObjectElements(from, from_kind, from_start, to, to_kind,
|
||||
to_start, copy_size);
|
||||
break;
|
||||
case FAST_DOUBLE_ELEMENTS:
|
||||
case FAST_HOLEY_DOUBLE_ELEMENTS: {
|
||||
case PACKED_DOUBLE_ELEMENTS:
|
||||
case HOLEY_DOUBLE_ELEMENTS: {
|
||||
AllowHeapAllocation allow_allocation;
|
||||
DCHECK(IsFastObjectElementsKind(to_kind));
|
||||
CopyDoubleToObjectElements(from, from_start, to, to_start, copy_size);
|
||||
@ -2582,52 +2582,47 @@ class FastSmiOrObjectElementsAccessor
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class FastPackedSmiElementsAccessor
|
||||
: public FastSmiOrObjectElementsAccessor<
|
||||
FastPackedSmiElementsAccessor,
|
||||
ElementsKindTraits<FAST_SMI_ELEMENTS> > {
|
||||
FastPackedSmiElementsAccessor,
|
||||
ElementsKindTraits<PACKED_SMI_ELEMENTS>> {
|
||||
public:
|
||||
explicit FastPackedSmiElementsAccessor(const char* name)
|
||||
: FastSmiOrObjectElementsAccessor<
|
||||
FastPackedSmiElementsAccessor,
|
||||
ElementsKindTraits<FAST_SMI_ELEMENTS> >(name) {}
|
||||
FastPackedSmiElementsAccessor,
|
||||
ElementsKindTraits<PACKED_SMI_ELEMENTS>>(name) {}
|
||||
};
|
||||
|
||||
|
||||
class FastHoleySmiElementsAccessor
|
||||
: public FastSmiOrObjectElementsAccessor<
|
||||
FastHoleySmiElementsAccessor,
|
||||
ElementsKindTraits<FAST_HOLEY_SMI_ELEMENTS> > {
|
||||
FastHoleySmiElementsAccessor,
|
||||
ElementsKindTraits<HOLEY_SMI_ELEMENTS>> {
|
||||
public:
|
||||
explicit FastHoleySmiElementsAccessor(const char* name)
|
||||
: FastSmiOrObjectElementsAccessor<
|
||||
FastHoleySmiElementsAccessor,
|
||||
ElementsKindTraits<FAST_HOLEY_SMI_ELEMENTS> >(name) {}
|
||||
: FastSmiOrObjectElementsAccessor<FastHoleySmiElementsAccessor,
|
||||
ElementsKindTraits<HOLEY_SMI_ELEMENTS>>(
|
||||
name) {}
|
||||
};
|
||||
|
||||
|
||||
class FastPackedObjectElementsAccessor
|
||||
: public FastSmiOrObjectElementsAccessor<
|
||||
FastPackedObjectElementsAccessor,
|
||||
ElementsKindTraits<FAST_ELEMENTS> > {
|
||||
FastPackedObjectElementsAccessor,
|
||||
ElementsKindTraits<PACKED_ELEMENTS>> {
|
||||
public:
|
||||
explicit FastPackedObjectElementsAccessor(const char* name)
|
||||
: FastSmiOrObjectElementsAccessor<
|
||||
FastPackedObjectElementsAccessor,
|
||||
ElementsKindTraits<FAST_ELEMENTS> >(name) {}
|
||||
: FastSmiOrObjectElementsAccessor<FastPackedObjectElementsAccessor,
|
||||
ElementsKindTraits<PACKED_ELEMENTS>>(
|
||||
name) {}
|
||||
};
|
||||
|
||||
|
||||
class FastHoleyObjectElementsAccessor
|
||||
: public FastSmiOrObjectElementsAccessor<
|
||||
FastHoleyObjectElementsAccessor,
|
||||
ElementsKindTraits<FAST_HOLEY_ELEMENTS> > {
|
||||
FastHoleyObjectElementsAccessor, ElementsKindTraits<HOLEY_ELEMENTS>> {
|
||||
public:
|
||||
explicit FastHoleyObjectElementsAccessor(const char* name)
|
||||
: FastSmiOrObjectElementsAccessor<
|
||||
FastHoleyObjectElementsAccessor,
|
||||
ElementsKindTraits<FAST_HOLEY_ELEMENTS> >(name) {}
|
||||
: FastSmiOrObjectElementsAccessor<FastHoleyObjectElementsAccessor,
|
||||
ElementsKindTraits<HOLEY_ELEMENTS>>(
|
||||
name) {}
|
||||
};
|
||||
|
||||
template <typename Subclass, typename KindTraits>
|
||||
@ -2664,19 +2659,19 @@ class FastDoubleElementsAccessor
|
||||
int copy_size) {
|
||||
DisallowHeapAllocation no_allocation;
|
||||
switch (from_kind) {
|
||||
case FAST_SMI_ELEMENTS:
|
||||
case PACKED_SMI_ELEMENTS:
|
||||
CopyPackedSmiToDoubleElements(from, from_start, to, to_start,
|
||||
packed_size, copy_size);
|
||||
break;
|
||||
case FAST_HOLEY_SMI_ELEMENTS:
|
||||
case HOLEY_SMI_ELEMENTS:
|
||||
CopySmiToDoubleElements(from, from_start, to, to_start, copy_size);
|
||||
break;
|
||||
case FAST_DOUBLE_ELEMENTS:
|
||||
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
||||
case PACKED_DOUBLE_ELEMENTS:
|
||||
case HOLEY_DOUBLE_ELEMENTS:
|
||||
CopyDoubleToDoubleElements(from, from_start, to, to_start, copy_size);
|
||||
break;
|
||||
case FAST_ELEMENTS:
|
||||
case FAST_HOLEY_ELEMENTS:
|
||||
case PACKED_ELEMENTS:
|
||||
case HOLEY_ELEMENTS:
|
||||
CopyObjectToDoubleElements(from, from_start, to, to_start, copy_size);
|
||||
break;
|
||||
case DICTIONARY_ELEMENTS:
|
||||
@ -2732,28 +2727,26 @@ class FastDoubleElementsAccessor
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class FastPackedDoubleElementsAccessor
|
||||
: public FastDoubleElementsAccessor<
|
||||
FastPackedDoubleElementsAccessor,
|
||||
ElementsKindTraits<FAST_DOUBLE_ELEMENTS> > {
|
||||
FastPackedDoubleElementsAccessor,
|
||||
ElementsKindTraits<PACKED_DOUBLE_ELEMENTS>> {
|
||||
public:
|
||||
explicit FastPackedDoubleElementsAccessor(const char* name)
|
||||
: FastDoubleElementsAccessor<
|
||||
FastPackedDoubleElementsAccessor,
|
||||
ElementsKindTraits<FAST_DOUBLE_ELEMENTS> >(name) {}
|
||||
: FastDoubleElementsAccessor<FastPackedDoubleElementsAccessor,
|
||||
ElementsKindTraits<PACKED_DOUBLE_ELEMENTS>>(
|
||||
name) {}
|
||||
};
|
||||
|
||||
|
||||
class FastHoleyDoubleElementsAccessor
|
||||
: public FastDoubleElementsAccessor<
|
||||
FastHoleyDoubleElementsAccessor,
|
||||
ElementsKindTraits<FAST_HOLEY_DOUBLE_ELEMENTS> > {
|
||||
FastHoleyDoubleElementsAccessor,
|
||||
ElementsKindTraits<HOLEY_DOUBLE_ELEMENTS>> {
|
||||
public:
|
||||
explicit FastHoleyDoubleElementsAccessor(const char* name)
|
||||
: FastDoubleElementsAccessor<
|
||||
FastHoleyDoubleElementsAccessor,
|
||||
ElementsKindTraits<FAST_HOLEY_DOUBLE_ELEMENTS> >(name) {}
|
||||
: FastDoubleElementsAccessor<FastHoleyDoubleElementsAccessor,
|
||||
ElementsKindTraits<HOLEY_DOUBLE_ELEMENTS>>(
|
||||
name) {}
|
||||
};
|
||||
|
||||
|
||||
@ -3228,7 +3221,7 @@ class TypedElementsAccessor
|
||||
Object* undefined = isolate->heap()->undefined_value();
|
||||
|
||||
// Fastpath for packed Smi kind.
|
||||
if (kind == FAST_SMI_ELEMENTS) {
|
||||
if (kind == PACKED_SMI_ELEMENTS) {
|
||||
FixedArray* source_store = FixedArray::cast(source->elements());
|
||||
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
@ -3238,7 +3231,7 @@ class TypedElementsAccessor
|
||||
dest->set(i, dest->from(int_value));
|
||||
}
|
||||
return true;
|
||||
} else if (kind == FAST_HOLEY_SMI_ELEMENTS) {
|
||||
} else if (kind == HOLEY_SMI_ELEMENTS) {
|
||||
FixedArray* source_store = FixedArray::cast(source->elements());
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
if (source_store->is_the_hole(isolate, i)) {
|
||||
@ -3251,7 +3244,7 @@ class TypedElementsAccessor
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else if (kind == FAST_DOUBLE_ELEMENTS) {
|
||||
} else if (kind == PACKED_DOUBLE_ELEMENTS) {
|
||||
// Fastpath for packed double kind. We avoid boxing and then immediately
|
||||
// unboxing the double here by using get_scalar.
|
||||
FixedDoubleArray* source_store =
|
||||
@ -3264,7 +3257,7 @@ class TypedElementsAccessor
|
||||
dest->set(i, dest->from(elem));
|
||||
}
|
||||
return true;
|
||||
} else if (kind == FAST_HOLEY_DOUBLE_ELEMENTS) {
|
||||
} else if (kind == HOLEY_DOUBLE_ELEMENTS) {
|
||||
FixedDoubleArray* source_store =
|
||||
FixedDoubleArray::cast(source->elements());
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
@ -3809,8 +3802,8 @@ class FastSloppyArgumentsElementsAccessor
|
||||
uint32_t end) {
|
||||
Isolate* isolate = receiver->GetIsolate();
|
||||
uint32_t result_len = end < start ? 0u : end - start;
|
||||
Handle<JSArray> result_array = isolate->factory()->NewJSArray(
|
||||
FAST_HOLEY_ELEMENTS, result_len, result_len);
|
||||
Handle<JSArray> result_array =
|
||||
isolate->factory()->NewJSArray(HOLEY_ELEMENTS, result_len, result_len);
|
||||
DisallowHeapAllocation no_gc;
|
||||
FixedArray* elements = FixedArray::cast(result_array->elements());
|
||||
FixedArray* parameters = FixedArray::cast(receiver->elements());
|
||||
@ -3898,12 +3891,12 @@ class FastSloppyArgumentsElementsAccessor
|
||||
int copy_size) {
|
||||
DCHECK(!to->IsDictionary());
|
||||
if (from_kind == SLOW_SLOPPY_ARGUMENTS_ELEMENTS) {
|
||||
CopyDictionaryToObjectElements(from, from_start, to, FAST_HOLEY_ELEMENTS,
|
||||
CopyDictionaryToObjectElements(from, from_start, to, HOLEY_ELEMENTS,
|
||||
to_start, copy_size);
|
||||
} else {
|
||||
DCHECK_EQ(FAST_SLOPPY_ARGUMENTS_ELEMENTS, from_kind);
|
||||
CopyObjectToObjectElements(from, FAST_HOLEY_ELEMENTS, from_start, to,
|
||||
FAST_HOLEY_ELEMENTS, to_start, copy_size);
|
||||
CopyObjectToObjectElements(from, HOLEY_ELEMENTS, from_start, to,
|
||||
HOLEY_ELEMENTS, to_start, copy_size);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4074,12 +4067,12 @@ class StringWrapperElementsAccessor
|
||||
int copy_size) {
|
||||
DCHECK(!to->IsDictionary());
|
||||
if (from_kind == SLOW_STRING_WRAPPER_ELEMENTS) {
|
||||
CopyDictionaryToObjectElements(from, from_start, to, FAST_HOLEY_ELEMENTS,
|
||||
CopyDictionaryToObjectElements(from, from_start, to, HOLEY_ELEMENTS,
|
||||
to_start, copy_size);
|
||||
} else {
|
||||
DCHECK_EQ(FAST_STRING_WRAPPER_ELEMENTS, from_kind);
|
||||
CopyObjectToObjectElements(from, FAST_HOLEY_ELEMENTS, from_start, to,
|
||||
FAST_HOLEY_ELEMENTS, to_start, copy_size);
|
||||
CopyObjectToObjectElements(from, HOLEY_ELEMENTS, from_start, to,
|
||||
HOLEY_ELEMENTS, to_start, copy_size);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4226,16 +4219,16 @@ MaybeHandle<Object> ArrayConstructInitializeElements(Handle<JSArray> array,
|
||||
|
||||
// Fill in the content
|
||||
switch (elements_kind) {
|
||||
case FAST_HOLEY_SMI_ELEMENTS:
|
||||
case FAST_SMI_ELEMENTS: {
|
||||
case HOLEY_SMI_ELEMENTS:
|
||||
case PACKED_SMI_ELEMENTS: {
|
||||
Handle<FixedArray> smi_elms = Handle<FixedArray>::cast(elms);
|
||||
for (int entry = 0; entry < number_of_elements; entry++) {
|
||||
smi_elms->set(entry, (*args)[entry], SKIP_WRITE_BARRIER);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FAST_HOLEY_ELEMENTS:
|
||||
case FAST_ELEMENTS: {
|
||||
case HOLEY_ELEMENTS:
|
||||
case PACKED_ELEMENTS: {
|
||||
DisallowHeapAllocation no_gc;
|
||||
WriteBarrierMode mode = elms->GetWriteBarrierMode(no_gc);
|
||||
Handle<FixedArray> object_elms = Handle<FixedArray>::cast(elms);
|
||||
@ -4244,8 +4237,8 @@ MaybeHandle<Object> ArrayConstructInitializeElements(Handle<JSArray> array,
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
||||
case FAST_DOUBLE_ELEMENTS: {
|
||||
case HOLEY_DOUBLE_ELEMENTS:
|
||||
case PACKED_DOUBLE_ELEMENTS: {
|
||||
Handle<FixedDoubleArray> double_elms =
|
||||
Handle<FixedDoubleArray>::cast(elms);
|
||||
for (int entry = 0; entry < number_of_elements; entry++) {
|
||||
|
@ -1521,7 +1521,7 @@ Handle<JSFunction> Factory::NewFunction(Handle<String> name, Handle<Code> code,
|
||||
Handle<JSFunction> function = NewFunction(name, code, prototype, is_strict);
|
||||
|
||||
ElementsKind elements_kind =
|
||||
type == JS_ARRAY_TYPE ? FAST_SMI_ELEMENTS : FAST_HOLEY_SMI_ELEMENTS;
|
||||
type == JS_ARRAY_TYPE ? PACKED_SMI_ELEMENTS : HOLEY_SMI_ELEMENTS;
|
||||
Handle<Map> initial_map = NewMap(type, instance_size, elements_kind);
|
||||
// TODO(littledan): Why do we have this is_generator test when
|
||||
// NewFunctionPrototype already handles finding an appropriately
|
||||
|
@ -382,10 +382,8 @@ class V8_EXPORT_PRIVATE Factory final {
|
||||
// Allocate a tenured AllocationSite. It's payload is null.
|
||||
Handle<AllocationSite> NewAllocationSite();
|
||||
|
||||
Handle<Map> NewMap(
|
||||
InstanceType type,
|
||||
int instance_size,
|
||||
ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND);
|
||||
Handle<Map> NewMap(InstanceType type, int instance_size,
|
||||
ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND);
|
||||
|
||||
Handle<HeapObject> NewFillerObject(int size,
|
||||
bool double_align,
|
||||
|
@ -2328,7 +2328,7 @@ bool Heap::CreateInitialMaps() {
|
||||
}
|
||||
|
||||
ALLOCATE_PARTIAL_MAP(FIXED_ARRAY_TYPE, kVariableSizeSentinel, fixed_array);
|
||||
fixed_array_map()->set_elements_kind(FAST_HOLEY_ELEMENTS);
|
||||
fixed_array_map()->set_elements_kind(HOLEY_ELEMENTS);
|
||||
ALLOCATE_PARTIAL_MAP(ODDBALL_TYPE, Oddball::kSize, undefined);
|
||||
ALLOCATE_PARTIAL_MAP(ODDBALL_TYPE, Oddball::kSize, null);
|
||||
ALLOCATE_PARTIAL_MAP(ODDBALL_TYPE, Oddball::kSize, the_hole);
|
||||
@ -2403,7 +2403,7 @@ bool Heap::CreateInitialMaps() {
|
||||
}
|
||||
|
||||
ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, fixed_cow_array)
|
||||
fixed_cow_array_map()->set_elements_kind(FAST_HOLEY_ELEMENTS);
|
||||
fixed_cow_array_map()->set_elements_kind(HOLEY_ELEMENTS);
|
||||
DCHECK_NE(fixed_array_map(), fixed_cow_array_map());
|
||||
|
||||
ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, scope_info)
|
||||
@ -2454,7 +2454,7 @@ bool Heap::CreateInitialMaps() {
|
||||
}
|
||||
|
||||
ALLOCATE_VARSIZE_MAP(FIXED_DOUBLE_ARRAY_TYPE, fixed_double_array)
|
||||
fixed_double_array_map()->set_elements_kind(FAST_HOLEY_DOUBLE_ELEMENTS);
|
||||
fixed_double_array_map()->set_elements_kind(HOLEY_DOUBLE_ELEMENTS);
|
||||
ALLOCATE_VARSIZE_MAP(BYTE_ARRAY_TYPE, byte_array)
|
||||
ALLOCATE_VARSIZE_MAP(BYTECODE_ARRAY_TYPE, bytecode_array)
|
||||
ALLOCATE_VARSIZE_MAP(FREE_SPACE_TYPE, free_space)
|
||||
|
@ -395,11 +395,11 @@ void ObjectStatsCollector::RecordJSObjectDetails(JSObject* object) {
|
||||
} else {
|
||||
if (IsFastHoleyElementsKind(object->GetElementsKind())) {
|
||||
int used = object->GetFastElementsUsage() * kPointerSize;
|
||||
if (object->GetElementsKind() == FAST_HOLEY_DOUBLE_ELEMENTS) used *= 2;
|
||||
if (object->GetElementsKind() == HOLEY_DOUBLE_ELEMENTS) used *= 2;
|
||||
CHECK_GE(elements->Size(), used);
|
||||
overhead = elements->Size() - used - FixedArray::kHeaderSize;
|
||||
}
|
||||
stats_->RecordFixedArraySubTypeStats(elements, FAST_ELEMENTS_SUB_TYPE,
|
||||
stats_->RecordFixedArraySubTypeStats(elements, PACKED_ELEMENTS_SUB_TYPE,
|
||||
elements->Size(), overhead);
|
||||
}
|
||||
}
|
||||
|
@ -2195,8 +2195,8 @@ static void CreateArrayDispatch(MacroAssembler* masm,
|
||||
mode);
|
||||
__ TailCallStub(&stub);
|
||||
} else if (mode == DONT_OVERRIDE) {
|
||||
int last_index = GetSequenceIndexFromFastElementsKind(
|
||||
TERMINAL_FAST_ELEMENTS_KIND);
|
||||
int last_index =
|
||||
GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND);
|
||||
for (int i = 0; i <= last_index; ++i) {
|
||||
Label next;
|
||||
ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
|
||||
@ -2225,12 +2225,12 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
|
||||
// esp[4] - last argument
|
||||
Label normal_sequence;
|
||||
if (mode == DONT_OVERRIDE) {
|
||||
STATIC_ASSERT(FAST_SMI_ELEMENTS == 0);
|
||||
STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
|
||||
STATIC_ASSERT(FAST_ELEMENTS == 2);
|
||||
STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
|
||||
STATIC_ASSERT(FAST_DOUBLE_ELEMENTS == 4);
|
||||
STATIC_ASSERT(FAST_HOLEY_DOUBLE_ELEMENTS == 5);
|
||||
STATIC_ASSERT(PACKED_SMI_ELEMENTS == 0);
|
||||
STATIC_ASSERT(HOLEY_SMI_ELEMENTS == 1);
|
||||
STATIC_ASSERT(PACKED_ELEMENTS == 2);
|
||||
STATIC_ASSERT(HOLEY_ELEMENTS == 3);
|
||||
STATIC_ASSERT(PACKED_DOUBLE_ELEMENTS == 4);
|
||||
STATIC_ASSERT(HOLEY_DOUBLE_ELEMENTS == 5);
|
||||
|
||||
// is the low bit set? If so, we are holey and that is good.
|
||||
__ test_b(edx, Immediate(1));
|
||||
@ -2276,8 +2276,8 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
|
||||
Immediate(Smi::FromInt(kFastElementsKindPackedToHoley)));
|
||||
|
||||
__ bind(&normal_sequence);
|
||||
int last_index = GetSequenceIndexFromFastElementsKind(
|
||||
TERMINAL_FAST_ELEMENTS_KIND);
|
||||
int last_index =
|
||||
GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND);
|
||||
for (int i = 0; i <= last_index; ++i) {
|
||||
Label next;
|
||||
ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
|
||||
@ -2298,8 +2298,8 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
|
||||
|
||||
template<class T>
|
||||
static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) {
|
||||
int to_index = GetSequenceIndexFromFastElementsKind(
|
||||
TERMINAL_FAST_ELEMENTS_KIND);
|
||||
int to_index =
|
||||
GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND);
|
||||
for (int i = 0; i <= to_index; ++i) {
|
||||
ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
|
||||
T stub(isolate, kind);
|
||||
@ -2319,7 +2319,7 @@ void CommonArrayConstructorStub::GenerateStubsAheadOfTime(Isolate* isolate) {
|
||||
ArrayNArgumentsConstructorStub stub(isolate);
|
||||
stub.GetCode();
|
||||
|
||||
ElementsKind kinds[2] = { FAST_ELEMENTS, FAST_HOLEY_ELEMENTS };
|
||||
ElementsKind kinds[2] = {PACKED_ELEMENTS, HOLEY_ELEMENTS};
|
||||
for (int i = 0; i < 2; i++) {
|
||||
// For internal arrays we only need a few things
|
||||
InternalArrayNoArgumentConstructorStub stubh1(isolate, kinds[i]);
|
||||
@ -2475,21 +2475,21 @@ void InternalArrayConstructorStub::Generate(MacroAssembler* masm) {
|
||||
|
||||
if (FLAG_debug_code) {
|
||||
Label done;
|
||||
__ cmp(ecx, Immediate(FAST_ELEMENTS));
|
||||
__ cmp(ecx, Immediate(PACKED_ELEMENTS));
|
||||
__ j(equal, &done);
|
||||
__ cmp(ecx, Immediate(FAST_HOLEY_ELEMENTS));
|
||||
__ cmp(ecx, Immediate(HOLEY_ELEMENTS));
|
||||
__ Assert(equal,
|
||||
kInvalidElementsKindForInternalArrayOrInternalPackedArray);
|
||||
__ bind(&done);
|
||||
}
|
||||
|
||||
Label fast_elements_case;
|
||||
__ cmp(ecx, Immediate(FAST_ELEMENTS));
|
||||
__ cmp(ecx, Immediate(PACKED_ELEMENTS));
|
||||
__ j(equal, &fast_elements_case);
|
||||
GenerateCase(masm, FAST_HOLEY_ELEMENTS);
|
||||
GenerateCase(masm, HOLEY_ELEMENTS);
|
||||
|
||||
__ bind(&fast_elements_case);
|
||||
GenerateCase(masm, FAST_ELEMENTS);
|
||||
GenerateCase(masm, PACKED_ELEMENTS);
|
||||
}
|
||||
|
||||
// Generates an Operand for saving parameters after PrepareCallApiFunction.
|
||||
|
@ -34,8 +34,7 @@ Node* AccessorAssembler::TryMonomorphicCase(Node* slot, Node* vector,
|
||||
// Adding |header_size| with a separate IntPtrAdd rather than passing it
|
||||
// into ElementOffsetFromIndex() allows it to be folded into a single
|
||||
// [base, index, offset] indirect memory access on x64.
|
||||
Node* offset =
|
||||
ElementOffsetFromIndex(slot, FAST_HOLEY_ELEMENTS, SMI_PARAMETERS);
|
||||
Node* offset = ElementOffsetFromIndex(slot, HOLEY_ELEMENTS, SMI_PARAMETERS);
|
||||
Node* feedback = Load(MachineType::AnyTagged(), vector,
|
||||
IntPtrAdd(offset, IntPtrConstant(header_size)));
|
||||
|
||||
@ -1062,7 +1061,7 @@ void AccessorAssembler::ExtendPropertiesBackingStore(Node* object,
|
||||
// capacity even for a map that think it doesn't have any unused fields.
|
||||
// Perform a bounds check to see if we actually have to grow the array.
|
||||
Node* offset = DecodeWord<StoreHandler::FieldOffsetBits>(handler_word);
|
||||
Node* size = ElementOffsetFromIndex(length, FAST_ELEMENTS, mode,
|
||||
Node* size = ElementOffsetFromIndex(length, PACKED_ELEMENTS, mode,
|
||||
FixedArray::kHeaderSize);
|
||||
GotoIf(UintPtrLessThan(offset, size), &done);
|
||||
|
||||
@ -1070,7 +1069,7 @@ void AccessorAssembler::ExtendPropertiesBackingStore(Node* object,
|
||||
Node* new_capacity = IntPtrOrSmiAdd(length, delta, mode);
|
||||
|
||||
// Grow properties array.
|
||||
ElementsKind kind = FAST_ELEMENTS;
|
||||
ElementsKind kind = PACKED_ELEMENTS;
|
||||
DCHECK(kMaxNumberOfDescriptors + JSObject::kFieldsAdded <
|
||||
FixedArrayBase::GetMaxLengthForNewSpaceAllocation(kind));
|
||||
// The size of a new properties backing store is guaranteed to be small
|
||||
@ -1195,20 +1194,20 @@ void AccessorAssembler::EmitElementLoad(
|
||||
EmitFastElementsBoundsCheck(object, elements, intptr_index,
|
||||
is_jsarray_condition, out_of_bounds);
|
||||
int32_t kinds[] = {// Handled by if_fast_packed.
|
||||
FAST_SMI_ELEMENTS, FAST_ELEMENTS,
|
||||
PACKED_SMI_ELEMENTS, PACKED_ELEMENTS,
|
||||
// Handled by if_fast_holey.
|
||||
FAST_HOLEY_SMI_ELEMENTS, FAST_HOLEY_ELEMENTS,
|
||||
HOLEY_SMI_ELEMENTS, HOLEY_ELEMENTS,
|
||||
// Handled by if_fast_double.
|
||||
FAST_DOUBLE_ELEMENTS,
|
||||
PACKED_DOUBLE_ELEMENTS,
|
||||
// Handled by if_fast_holey_double.
|
||||
FAST_HOLEY_DOUBLE_ELEMENTS};
|
||||
HOLEY_DOUBLE_ELEMENTS};
|
||||
Label* labels[] = {// FAST_{SMI,}_ELEMENTS
|
||||
&if_fast_packed, &if_fast_packed,
|
||||
// FAST_HOLEY_{SMI,}_ELEMENTS
|
||||
&if_fast_holey, &if_fast_holey,
|
||||
// FAST_DOUBLE_ELEMENTS
|
||||
// PACKED_DOUBLE_ELEMENTS
|
||||
&if_fast_double,
|
||||
// FAST_HOLEY_DOUBLE_ELEMENTS
|
||||
// HOLEY_DOUBLE_ELEMENTS
|
||||
&if_fast_holey_double};
|
||||
Switch(elements_kind, unimplemented_elements_kind, kinds, labels,
|
||||
arraysize(kinds));
|
||||
|
10
src/ic/ic.cc
10
src/ic/ic.cc
@ -1400,7 +1400,7 @@ Handle<Object> KeyedLoadIC::LoadElementHandler(Handle<Map> receiver_map) {
|
||||
IsFixedTypedArrayElementsKind(elements_kind));
|
||||
// TODO(jkummerow): Use IsHoleyElementsKind(elements_kind).
|
||||
bool convert_hole_to_undefined =
|
||||
is_js_array && elements_kind == FAST_HOLEY_ELEMENTS &&
|
||||
is_js_array && elements_kind == HOLEY_ELEMENTS &&
|
||||
*receiver_map == isolate()->get_initial_js_array_map(elements_kind);
|
||||
TRACE_HANDLER_STATS(isolate(), KeyedLoadIC_LoadElementDH);
|
||||
return LoadHandler::LoadElement(isolate(), elements_kind,
|
||||
@ -2030,15 +2030,15 @@ Handle<Map> KeyedStoreIC::ComputeTransitionedMap(
|
||||
case STORE_TRANSITION_TO_OBJECT:
|
||||
case STORE_AND_GROW_TRANSITION_TO_OBJECT: {
|
||||
ElementsKind kind = IsFastHoleyElementsKind(map->elements_kind())
|
||||
? FAST_HOLEY_ELEMENTS
|
||||
: FAST_ELEMENTS;
|
||||
? HOLEY_ELEMENTS
|
||||
: PACKED_ELEMENTS;
|
||||
return Map::TransitionElementsTo(map, kind);
|
||||
}
|
||||
case STORE_TRANSITION_TO_DOUBLE:
|
||||
case STORE_AND_GROW_TRANSITION_TO_DOUBLE: {
|
||||
ElementsKind kind = IsFastHoleyElementsKind(map->elements_kind())
|
||||
? FAST_HOLEY_DOUBLE_ELEMENTS
|
||||
: FAST_DOUBLE_ELEMENTS;
|
||||
? HOLEY_DOUBLE_ELEMENTS
|
||||
: PACKED_DOUBLE_ELEMENTS;
|
||||
return Map::TransitionElementsTo(map, kind);
|
||||
}
|
||||
case STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS:
|
||||
|
@ -262,7 +262,7 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity(
|
||||
|
||||
// FixedArray backing store -> Smi or object elements.
|
||||
{
|
||||
Node* offset = ElementOffsetFromIndex(intptr_index, FAST_ELEMENTS,
|
||||
Node* offset = ElementOffsetFromIndex(intptr_index, PACKED_ELEMENTS,
|
||||
INTPTR_PARAMETERS, kHeaderSize);
|
||||
// Check if we're about to overwrite the hole. We can safely do that
|
||||
// only if there can be no setters on the prototype chain.
|
||||
@ -287,7 +287,7 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity(
|
||||
// If we're about to introduce holes, ensure holey elements.
|
||||
if (update_length == kBumpLengthWithGap) {
|
||||
TryChangeToHoleyMapMulti(receiver, receiver_map, elements_kind, context,
|
||||
FAST_SMI_ELEMENTS, FAST_ELEMENTS, slow);
|
||||
PACKED_SMI_ELEMENTS, PACKED_ELEMENTS, slow);
|
||||
}
|
||||
StoreNoWriteBarrier(MachineRepresentation::kTagged, elements, offset,
|
||||
value);
|
||||
@ -299,14 +299,14 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity(
|
||||
// Check if we already have object elements; just do the store if so.
|
||||
{
|
||||
Label must_transition(this);
|
||||
STATIC_ASSERT(FAST_SMI_ELEMENTS == 0);
|
||||
STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
|
||||
STATIC_ASSERT(PACKED_SMI_ELEMENTS == 0);
|
||||
STATIC_ASSERT(HOLEY_SMI_ELEMENTS == 1);
|
||||
GotoIf(Int32LessThanOrEqual(elements_kind,
|
||||
Int32Constant(FAST_HOLEY_SMI_ELEMENTS)),
|
||||
Int32Constant(HOLEY_SMI_ELEMENTS)),
|
||||
&must_transition);
|
||||
if (update_length == kBumpLengthWithGap) {
|
||||
TryChangeToHoleyMap(receiver, receiver_map, elements_kind, context,
|
||||
FAST_ELEMENTS, slow);
|
||||
PACKED_ELEMENTS, slow);
|
||||
}
|
||||
Store(elements, offset, value);
|
||||
MaybeUpdateLengthAndReturn(receiver, intptr_index, value, update_length);
|
||||
@ -325,14 +325,15 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity(
|
||||
// If we're adding holes at the end, always transition to a holey
|
||||
// elements kind, otherwise try to remain packed.
|
||||
ElementsKind target_kind = update_length == kBumpLengthWithGap
|
||||
? FAST_HOLEY_DOUBLE_ELEMENTS
|
||||
: FAST_DOUBLE_ELEMENTS;
|
||||
? HOLEY_DOUBLE_ELEMENTS
|
||||
: PACKED_DOUBLE_ELEMENTS;
|
||||
TryRewriteElements(receiver, receiver_map, elements, native_context,
|
||||
FAST_SMI_ELEMENTS, target_kind, slow);
|
||||
PACKED_SMI_ELEMENTS, target_kind, slow);
|
||||
// Reload migrated elements.
|
||||
Node* double_elements = LoadElements(receiver);
|
||||
Node* double_offset = ElementOffsetFromIndex(
|
||||
intptr_index, FAST_DOUBLE_ELEMENTS, INTPTR_PARAMETERS, kHeaderSize);
|
||||
Node* double_offset =
|
||||
ElementOffsetFromIndex(intptr_index, PACKED_DOUBLE_ELEMENTS,
|
||||
INTPTR_PARAMETERS, kHeaderSize);
|
||||
// Make sure we do not store signalling NaNs into double arrays.
|
||||
Node* double_value = Float64SilenceNaN(LoadHeapNumberValue(value));
|
||||
StoreNoWriteBarrier(MachineRepresentation::kFloat64, double_elements,
|
||||
@ -346,10 +347,10 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity(
|
||||
// If we're adding holes at the end, always transition to a holey
|
||||
// elements kind, otherwise try to remain packed.
|
||||
ElementsKind target_kind = update_length == kBumpLengthWithGap
|
||||
? FAST_HOLEY_ELEMENTS
|
||||
: FAST_ELEMENTS;
|
||||
? HOLEY_ELEMENTS
|
||||
: PACKED_ELEMENTS;
|
||||
TryRewriteElements(receiver, receiver_map, elements, native_context,
|
||||
FAST_SMI_ELEMENTS, target_kind, slow);
|
||||
PACKED_SMI_ELEMENTS, target_kind, slow);
|
||||
// The elements backing store didn't change, no reload necessary.
|
||||
CSA_ASSERT(this, WordEqual(elements, LoadElements(receiver)));
|
||||
Store(elements, offset, value);
|
||||
@ -365,7 +366,7 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity(
|
||||
&check_cow_elements);
|
||||
// FixedDoubleArray backing store -> double elements.
|
||||
{
|
||||
Node* offset = ElementOffsetFromIndex(intptr_index, FAST_DOUBLE_ELEMENTS,
|
||||
Node* offset = ElementOffsetFromIndex(intptr_index, PACKED_DOUBLE_ELEMENTS,
|
||||
INTPTR_PARAMETERS, kHeaderSize);
|
||||
// Check if we're about to overwrite the hole. We can safely do that
|
||||
// only if there can be no setters on the prototype chain.
|
||||
@ -395,7 +396,7 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity(
|
||||
// If we're about to introduce holes, ensure holey elements.
|
||||
if (update_length == kBumpLengthWithGap) {
|
||||
TryChangeToHoleyMap(receiver, receiver_map, elements_kind, context,
|
||||
FAST_DOUBLE_ELEMENTS, slow);
|
||||
PACKED_DOUBLE_ELEMENTS, slow);
|
||||
}
|
||||
StoreNoWriteBarrier(MachineRepresentation::kFloat64, elements, offset,
|
||||
double_value);
|
||||
@ -408,14 +409,14 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity(
|
||||
{
|
||||
Node* native_context = LoadNativeContext(context);
|
||||
ElementsKind target_kind = update_length == kBumpLengthWithGap
|
||||
? FAST_HOLEY_ELEMENTS
|
||||
: FAST_ELEMENTS;
|
||||
? HOLEY_ELEMENTS
|
||||
: PACKED_ELEMENTS;
|
||||
TryRewriteElements(receiver, receiver_map, elements, native_context,
|
||||
FAST_DOUBLE_ELEMENTS, target_kind, slow);
|
||||
PACKED_DOUBLE_ELEMENTS, target_kind, slow);
|
||||
// Reload migrated elements.
|
||||
Node* fast_elements = LoadElements(receiver);
|
||||
Node* fast_offset = ElementOffsetFromIndex(
|
||||
intptr_index, FAST_ELEMENTS, INTPTR_PARAMETERS, kHeaderSize);
|
||||
intptr_index, PACKED_ELEMENTS, INTPTR_PARAMETERS, kHeaderSize);
|
||||
Store(fast_elements, fast_offset, value);
|
||||
MaybeUpdateLengthAndReturn(receiver, intptr_index, value, update_length);
|
||||
}
|
||||
@ -487,7 +488,8 @@ void KeyedStoreGenericAssembler::EmitGenericElementStore(
|
||||
Goto(slow);
|
||||
}
|
||||
|
||||
// Any ElementsKind > LAST_FAST_ELEMENTS_KIND jumps here for further dispatch.
|
||||
// Any ElementsKind > LAST_FAST_ELEMENTS_KIND jumps here for further
|
||||
// dispatch.
|
||||
BIND(&if_nonfast);
|
||||
{
|
||||
STATIC_ASSERT(LAST_ELEMENTS_KIND == LAST_FIXED_TYPED_ARRAY_ELEMENTS_KIND);
|
||||
|
@ -515,14 +515,14 @@ class ElementKindLattice {
|
||||
ElementsKind GetElementsKind() const {
|
||||
switch (value_) {
|
||||
case SMI_ELEMENTS:
|
||||
return FAST_SMI_ELEMENTS;
|
||||
return PACKED_SMI_ELEMENTS;
|
||||
case NUMBER_ELEMENTS:
|
||||
return FAST_DOUBLE_ELEMENTS;
|
||||
return PACKED_DOUBLE_ELEMENTS;
|
||||
case OBJECT_ELEMENTS:
|
||||
return FAST_ELEMENTS;
|
||||
return PACKED_ELEMENTS;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return FAST_ELEMENTS;
|
||||
return PACKED_ELEMENTS;
|
||||
}
|
||||
}
|
||||
|
||||
@ -559,15 +559,15 @@ Handle<Object> JsonParser<seq_one_byte>::ParseJsonArray() {
|
||||
const ElementsKind kind = lattice.GetElementsKind();
|
||||
|
||||
switch (kind) {
|
||||
case FAST_ELEMENTS:
|
||||
case FAST_SMI_ELEMENTS: {
|
||||
case PACKED_ELEMENTS:
|
||||
case PACKED_SMI_ELEMENTS: {
|
||||
Handle<FixedArray> elems =
|
||||
factory()->NewFixedArray(elements.length(), pretenure_);
|
||||
for (int i = 0; i < elements.length(); i++) elems->set(i, *elements[i]);
|
||||
json_array = factory()->NewJSArrayWithElements(elems, kind, pretenure_);
|
||||
break;
|
||||
}
|
||||
case FAST_DOUBLE_ELEMENTS: {
|
||||
case PACKED_DOUBLE_ELEMENTS: {
|
||||
Handle<FixedDoubleArray> elems = Handle<FixedDoubleArray>::cast(
|
||||
factory()->NewFixedDoubleArray(elements.length(), pretenure_));
|
||||
for (int i = 0; i < elements.length(); i++) {
|
||||
|
@ -394,7 +394,7 @@ JsonStringifier::Result JsonStringifier::SerializeJSArray(
|
||||
uint32_t i = 0;
|
||||
if (replacer_function_.is_null()) {
|
||||
switch (object->GetElementsKind()) {
|
||||
case FAST_SMI_ELEMENTS: {
|
||||
case PACKED_SMI_ELEMENTS: {
|
||||
Handle<FixedArray> elements(FixedArray::cast(object->elements()),
|
||||
isolate_);
|
||||
StackLimitCheck interrupt_check(isolate_);
|
||||
@ -410,7 +410,7 @@ JsonStringifier::Result JsonStringifier::SerializeJSArray(
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FAST_DOUBLE_ELEMENTS: {
|
||||
case PACKED_DOUBLE_ELEMENTS: {
|
||||
// Empty array is FixedArray but not FixedDoubleArray.
|
||||
if (length == 0) break;
|
||||
Handle<FixedDoubleArray> elements(
|
||||
@ -428,11 +428,11 @@ JsonStringifier::Result JsonStringifier::SerializeJSArray(
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FAST_ELEMENTS: {
|
||||
case PACKED_ELEMENTS: {
|
||||
Handle<Object> old_length(object->length(), isolate_);
|
||||
while (i < length) {
|
||||
if (object->length() != *old_length ||
|
||||
object->GetElementsKind() != FAST_ELEMENTS) {
|
||||
object->GetElementsKind() != PACKED_ELEMENTS) {
|
||||
// Fall back to slow path.
|
||||
break;
|
||||
}
|
||||
|
@ -2461,8 +2461,8 @@ static void CreateArrayDispatch(MacroAssembler* masm,
|
||||
T stub(masm->isolate(), GetInitialFastElementsKind(), mode);
|
||||
__ TailCallStub(&stub);
|
||||
} else if (mode == DONT_OVERRIDE) {
|
||||
int last_index = GetSequenceIndexFromFastElementsKind(
|
||||
TERMINAL_FAST_ELEMENTS_KIND);
|
||||
int last_index =
|
||||
GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND);
|
||||
for (int i = 0; i <= last_index; ++i) {
|
||||
ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
|
||||
T stub(masm->isolate(), kind);
|
||||
@ -2486,12 +2486,12 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
|
||||
// sp[0] - last argument
|
||||
Label normal_sequence;
|
||||
if (mode == DONT_OVERRIDE) {
|
||||
STATIC_ASSERT(FAST_SMI_ELEMENTS == 0);
|
||||
STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
|
||||
STATIC_ASSERT(FAST_ELEMENTS == 2);
|
||||
STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
|
||||
STATIC_ASSERT(FAST_DOUBLE_ELEMENTS == 4);
|
||||
STATIC_ASSERT(FAST_HOLEY_DOUBLE_ELEMENTS == 5);
|
||||
STATIC_ASSERT(PACKED_SMI_ELEMENTS == 0);
|
||||
STATIC_ASSERT(HOLEY_SMI_ELEMENTS == 1);
|
||||
STATIC_ASSERT(PACKED_ELEMENTS == 2);
|
||||
STATIC_ASSERT(HOLEY_ELEMENTS == 3);
|
||||
STATIC_ASSERT(PACKED_DOUBLE_ELEMENTS == 4);
|
||||
STATIC_ASSERT(HOLEY_DOUBLE_ELEMENTS == 5);
|
||||
|
||||
// is the low bit set? If so, we are holey and that is good.
|
||||
__ And(at, a3, Operand(1));
|
||||
@ -2537,8 +2537,8 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
|
||||
|
||||
|
||||
__ bind(&normal_sequence);
|
||||
int last_index = GetSequenceIndexFromFastElementsKind(
|
||||
TERMINAL_FAST_ELEMENTS_KIND);
|
||||
int last_index =
|
||||
GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND);
|
||||
for (int i = 0; i <= last_index; ++i) {
|
||||
ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
|
||||
ArraySingleArgumentConstructorStub stub(masm->isolate(), kind);
|
||||
@ -2555,8 +2555,8 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
|
||||
|
||||
template<class T>
|
||||
static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) {
|
||||
int to_index = GetSequenceIndexFromFastElementsKind(
|
||||
TERMINAL_FAST_ELEMENTS_KIND);
|
||||
int to_index =
|
||||
GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND);
|
||||
for (int i = 0; i <= to_index; ++i) {
|
||||
ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
|
||||
T stub(isolate, kind);
|
||||
@ -2575,7 +2575,7 @@ void CommonArrayConstructorStub::GenerateStubsAheadOfTime(Isolate* isolate) {
|
||||
isolate);
|
||||
ArrayNArgumentsConstructorStub stub(isolate);
|
||||
stub.GetCode();
|
||||
ElementsKind kinds[2] = { FAST_ELEMENTS, FAST_HOLEY_ELEMENTS };
|
||||
ElementsKind kinds[2] = {PACKED_ELEMENTS, HOLEY_ELEMENTS};
|
||||
for (int i = 0; i < 2; i++) {
|
||||
// For internal arrays we only need a few things.
|
||||
InternalArrayNoArgumentConstructorStub stubh1(isolate, kinds[i]);
|
||||
@ -2720,19 +2720,18 @@ void InternalArrayConstructorStub::Generate(MacroAssembler* masm) {
|
||||
|
||||
if (FLAG_debug_code) {
|
||||
Label done;
|
||||
__ Branch(&done, eq, a3, Operand(FAST_ELEMENTS));
|
||||
__ Assert(
|
||||
eq, kInvalidElementsKindForInternalArrayOrInternalPackedArray,
|
||||
a3, Operand(FAST_HOLEY_ELEMENTS));
|
||||
__ Branch(&done, eq, a3, Operand(PACKED_ELEMENTS));
|
||||
__ Assert(eq, kInvalidElementsKindForInternalArrayOrInternalPackedArray, a3,
|
||||
Operand(HOLEY_ELEMENTS));
|
||||
__ bind(&done);
|
||||
}
|
||||
|
||||
Label fast_elements_case;
|
||||
__ Branch(&fast_elements_case, eq, a3, Operand(FAST_ELEMENTS));
|
||||
GenerateCase(masm, FAST_HOLEY_ELEMENTS);
|
||||
__ Branch(&fast_elements_case, eq, a3, Operand(PACKED_ELEMENTS));
|
||||
GenerateCase(masm, HOLEY_ELEMENTS);
|
||||
|
||||
__ bind(&fast_elements_case);
|
||||
GenerateCase(masm, FAST_ELEMENTS);
|
||||
GenerateCase(masm, PACKED_ELEMENTS);
|
||||
}
|
||||
|
||||
static int AddressOffset(ExternalReference ref0, ExternalReference ref1) {
|
||||
|
@ -2465,8 +2465,8 @@ static void CreateArrayDispatch(MacroAssembler* masm,
|
||||
T stub(masm->isolate(), GetInitialFastElementsKind(), mode);
|
||||
__ TailCallStub(&stub);
|
||||
} else if (mode == DONT_OVERRIDE) {
|
||||
int last_index = GetSequenceIndexFromFastElementsKind(
|
||||
TERMINAL_FAST_ELEMENTS_KIND);
|
||||
int last_index =
|
||||
GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND);
|
||||
for (int i = 0; i <= last_index; ++i) {
|
||||
ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
|
||||
T stub(masm->isolate(), kind);
|
||||
@ -2490,12 +2490,12 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
|
||||
// sp[0] - last argument
|
||||
Label normal_sequence;
|
||||
if (mode == DONT_OVERRIDE) {
|
||||
STATIC_ASSERT(FAST_SMI_ELEMENTS == 0);
|
||||
STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
|
||||
STATIC_ASSERT(FAST_ELEMENTS == 2);
|
||||
STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
|
||||
STATIC_ASSERT(FAST_DOUBLE_ELEMENTS == 4);
|
||||
STATIC_ASSERT(FAST_HOLEY_DOUBLE_ELEMENTS == 5);
|
||||
STATIC_ASSERT(PACKED_SMI_ELEMENTS == 0);
|
||||
STATIC_ASSERT(HOLEY_SMI_ELEMENTS == 1);
|
||||
STATIC_ASSERT(PACKED_ELEMENTS == 2);
|
||||
STATIC_ASSERT(HOLEY_ELEMENTS == 3);
|
||||
STATIC_ASSERT(PACKED_DOUBLE_ELEMENTS == 4);
|
||||
STATIC_ASSERT(HOLEY_DOUBLE_ELEMENTS == 5);
|
||||
|
||||
// is the low bit set? If so, we are holey and that is good.
|
||||
__ And(at, a3, Operand(1));
|
||||
@ -2539,8 +2539,8 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
|
||||
__ Sd(a4, FieldMemOperand(a2, AllocationSite::kTransitionInfoOffset));
|
||||
|
||||
__ bind(&normal_sequence);
|
||||
int last_index = GetSequenceIndexFromFastElementsKind(
|
||||
TERMINAL_FAST_ELEMENTS_KIND);
|
||||
int last_index =
|
||||
GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND);
|
||||
for (int i = 0; i <= last_index; ++i) {
|
||||
ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
|
||||
ArraySingleArgumentConstructorStub stub(masm->isolate(), kind);
|
||||
@ -2557,8 +2557,8 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
|
||||
|
||||
template<class T>
|
||||
static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) {
|
||||
int to_index = GetSequenceIndexFromFastElementsKind(
|
||||
TERMINAL_FAST_ELEMENTS_KIND);
|
||||
int to_index =
|
||||
GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND);
|
||||
for (int i = 0; i <= to_index; ++i) {
|
||||
ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
|
||||
T stub(isolate, kind);
|
||||
@ -2577,7 +2577,7 @@ void CommonArrayConstructorStub::GenerateStubsAheadOfTime(Isolate* isolate) {
|
||||
isolate);
|
||||
ArrayNArgumentsConstructorStub stub(isolate);
|
||||
stub.GetCode();
|
||||
ElementsKind kinds[2] = { FAST_ELEMENTS, FAST_HOLEY_ELEMENTS };
|
||||
ElementsKind kinds[2] = {PACKED_ELEMENTS, HOLEY_ELEMENTS};
|
||||
for (int i = 0; i < 2; i++) {
|
||||
// For internal arrays we only need a few things.
|
||||
InternalArrayNoArgumentConstructorStub stubh1(isolate, kinds[i]);
|
||||
@ -2722,19 +2722,18 @@ void InternalArrayConstructorStub::Generate(MacroAssembler* masm) {
|
||||
|
||||
if (FLAG_debug_code) {
|
||||
Label done;
|
||||
__ Branch(&done, eq, a3, Operand(FAST_ELEMENTS));
|
||||
__ Assert(
|
||||
eq, kInvalidElementsKindForInternalArrayOrInternalPackedArray,
|
||||
a3, Operand(FAST_HOLEY_ELEMENTS));
|
||||
__ Branch(&done, eq, a3, Operand(PACKED_ELEMENTS));
|
||||
__ Assert(eq, kInvalidElementsKindForInternalArrayOrInternalPackedArray, a3,
|
||||
Operand(HOLEY_ELEMENTS));
|
||||
__ bind(&done);
|
||||
}
|
||||
|
||||
Label fast_elements_case;
|
||||
__ Branch(&fast_elements_case, eq, a3, Operand(FAST_ELEMENTS));
|
||||
GenerateCase(masm, FAST_HOLEY_ELEMENTS);
|
||||
__ Branch(&fast_elements_case, eq, a3, Operand(PACKED_ELEMENTS));
|
||||
GenerateCase(masm, HOLEY_ELEMENTS);
|
||||
|
||||
__ bind(&fast_elements_case);
|
||||
GenerateCase(masm, FAST_ELEMENTS);
|
||||
GenerateCase(masm, PACKED_ELEMENTS);
|
||||
}
|
||||
|
||||
static int AddressOffset(ExternalReference ref0, ExternalReference ref1) {
|
||||
|
@ -522,7 +522,7 @@ void SloppyArgumentsElements::SloppyArgumentsElementsVerify(
|
||||
}
|
||||
ElementsAccessor* accessor;
|
||||
if (is_fast) {
|
||||
accessor = ElementsAccessor::ForKind(FAST_HOLEY_ELEMENTS);
|
||||
accessor = ElementsAccessor::ForKind(HOLEY_ELEMENTS);
|
||||
} else {
|
||||
accessor = ElementsAccessor::ForKind(DICTIONARY_ELEMENTS);
|
||||
}
|
||||
@ -1458,12 +1458,12 @@ void JSObject::IncrementSpillStatistics(SpillInformation* info) {
|
||||
}
|
||||
// Indexed properties
|
||||
switch (GetElementsKind()) {
|
||||
case FAST_HOLEY_SMI_ELEMENTS:
|
||||
case FAST_SMI_ELEMENTS:
|
||||
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
||||
case FAST_DOUBLE_ELEMENTS:
|
||||
case FAST_HOLEY_ELEMENTS:
|
||||
case FAST_ELEMENTS:
|
||||
case HOLEY_SMI_ELEMENTS:
|
||||
case PACKED_SMI_ELEMENTS:
|
||||
case HOLEY_DOUBLE_ELEMENTS:
|
||||
case PACKED_DOUBLE_ELEMENTS:
|
||||
case HOLEY_ELEMENTS:
|
||||
case PACKED_ELEMENTS:
|
||||
case FAST_STRING_WRAPPER_ELEMENTS: {
|
||||
info->number_of_objects_with_fast_elements_++;
|
||||
int holes = 0;
|
||||
|
@ -700,9 +700,9 @@ Representation Object::OptimalRepresentation() {
|
||||
|
||||
|
||||
ElementsKind Object::OptimalElementsKind() {
|
||||
if (IsSmi()) return FAST_SMI_ELEMENTS;
|
||||
if (IsNumber()) return FAST_DOUBLE_ELEMENTS;
|
||||
return FAST_ELEMENTS;
|
||||
if (IsSmi()) return PACKED_SMI_ELEMENTS;
|
||||
if (IsNumber()) return PACKED_DOUBLE_ELEMENTS;
|
||||
return PACKED_ELEMENTS;
|
||||
}
|
||||
|
||||
|
||||
@ -1271,9 +1271,9 @@ void JSObject::EnsureCanContainHeapObjectElements(Handle<JSObject> object) {
|
||||
ElementsKind elements_kind = object->map()->elements_kind();
|
||||
if (!IsFastObjectElementsKind(elements_kind)) {
|
||||
if (IsFastHoleyElementsKind(elements_kind)) {
|
||||
TransitionElementsKind(object, FAST_HOLEY_ELEMENTS);
|
||||
TransitionElementsKind(object, HOLEY_ELEMENTS);
|
||||
} else {
|
||||
TransitionElementsKind(object, FAST_ELEMENTS);
|
||||
TransitionElementsKind(object, PACKED_ELEMENTS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1289,7 +1289,7 @@ void JSObject::EnsureCanContainElements(Handle<JSObject> object,
|
||||
DisallowHeapAllocation no_allocation;
|
||||
DCHECK(mode != ALLOW_COPIED_DOUBLE_ELEMENTS);
|
||||
bool is_holey = IsFastHoleyElementsKind(current_kind);
|
||||
if (current_kind == FAST_HOLEY_ELEMENTS) return;
|
||||
if (current_kind == HOLEY_ELEMENTS) return;
|
||||
Object* the_hole = object->GetHeap()->the_hole_value();
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
Object* current = *objects++;
|
||||
@ -1300,16 +1300,16 @@ void JSObject::EnsureCanContainElements(Handle<JSObject> object,
|
||||
if (mode == ALLOW_CONVERTED_DOUBLE_ELEMENTS && current->IsNumber()) {
|
||||
if (IsFastSmiElementsKind(target_kind)) {
|
||||
if (is_holey) {
|
||||
target_kind = FAST_HOLEY_DOUBLE_ELEMENTS;
|
||||
target_kind = HOLEY_DOUBLE_ELEMENTS;
|
||||
} else {
|
||||
target_kind = FAST_DOUBLE_ELEMENTS;
|
||||
target_kind = PACKED_DOUBLE_ELEMENTS;
|
||||
}
|
||||
}
|
||||
} else if (is_holey) {
|
||||
target_kind = FAST_HOLEY_ELEMENTS;
|
||||
target_kind = HOLEY_ELEMENTS;
|
||||
break;
|
||||
} else {
|
||||
target_kind = FAST_ELEMENTS;
|
||||
target_kind = PACKED_ELEMENTS;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1338,18 +1338,18 @@ void JSObject::EnsureCanContainElements(Handle<JSObject> object,
|
||||
}
|
||||
|
||||
DCHECK(mode == ALLOW_COPIED_DOUBLE_ELEMENTS);
|
||||
if (object->GetElementsKind() == FAST_HOLEY_SMI_ELEMENTS) {
|
||||
TransitionElementsKind(object, FAST_HOLEY_DOUBLE_ELEMENTS);
|
||||
} else if (object->GetElementsKind() == FAST_SMI_ELEMENTS) {
|
||||
if (object->GetElementsKind() == HOLEY_SMI_ELEMENTS) {
|
||||
TransitionElementsKind(object, HOLEY_DOUBLE_ELEMENTS);
|
||||
} else if (object->GetElementsKind() == PACKED_SMI_ELEMENTS) {
|
||||
Handle<FixedDoubleArray> double_array =
|
||||
Handle<FixedDoubleArray>::cast(elements);
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
if (double_array->is_the_hole(i)) {
|
||||
TransitionElementsKind(object, FAST_HOLEY_DOUBLE_ELEMENTS);
|
||||
TransitionElementsKind(object, HOLEY_DOUBLE_ELEMENTS);
|
||||
return;
|
||||
}
|
||||
}
|
||||
TransitionElementsKind(object, FAST_DOUBLE_ELEMENTS);
|
||||
TransitionElementsKind(object, PACKED_DOUBLE_ELEMENTS);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6362,7 +6362,7 @@ static inline Handle<Object> MakeEntryPair(Isolate* isolate, uint32_t index,
|
||||
entry_storage->set(1, *value, SKIP_WRITE_BARRIER);
|
||||
}
|
||||
return isolate->factory()->NewJSArrayWithElements(entry_storage,
|
||||
FAST_ELEMENTS, 2);
|
||||
PACKED_ELEMENTS, 2);
|
||||
}
|
||||
|
||||
static inline Handle<Object> MakeEntryPair(Isolate* isolate, Handle<Name> key,
|
||||
@ -6374,7 +6374,7 @@ static inline Handle<Object> MakeEntryPair(Isolate* isolate, Handle<Name> key,
|
||||
entry_storage->set(1, *value, SKIP_WRITE_BARRIER);
|
||||
}
|
||||
return isolate->factory()->NewJSArrayWithElements(entry_storage,
|
||||
FAST_ELEMENTS, 2);
|
||||
PACKED_ELEMENTS, 2);
|
||||
}
|
||||
|
||||
ACCESSORS(JSIteratorResult, value, Object, kValueOffset)
|
||||
|
@ -434,16 +434,16 @@ void JSObject::PrintElements(std::ostream& os) { // NOLINT
|
||||
return;
|
||||
}
|
||||
switch (map()->elements_kind()) {
|
||||
case FAST_HOLEY_SMI_ELEMENTS:
|
||||
case FAST_SMI_ELEMENTS:
|
||||
case FAST_HOLEY_ELEMENTS:
|
||||
case FAST_ELEMENTS:
|
||||
case HOLEY_SMI_ELEMENTS:
|
||||
case PACKED_SMI_ELEMENTS:
|
||||
case HOLEY_ELEMENTS:
|
||||
case PACKED_ELEMENTS:
|
||||
case FAST_STRING_WRAPPER_ELEMENTS: {
|
||||
PrintFixedArrayElements(os, FixedArray::cast(elements()));
|
||||
break;
|
||||
}
|
||||
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
||||
case FAST_DOUBLE_ELEMENTS: {
|
||||
case HOLEY_DOUBLE_ELEMENTS:
|
||||
case PACKED_DOUBLE_ELEMENTS: {
|
||||
DoPrintElements<FixedDoubleArray>(os, elements());
|
||||
break;
|
||||
}
|
||||
|
@ -7312,14 +7312,14 @@ bool JSObject::ReferencesObject(Object* obj) {
|
||||
TYPED_ARRAYS(TYPED_ARRAY_CASE)
|
||||
#undef TYPED_ARRAY_CASE
|
||||
|
||||
case FAST_DOUBLE_ELEMENTS:
|
||||
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
||||
case PACKED_DOUBLE_ELEMENTS:
|
||||
case HOLEY_DOUBLE_ELEMENTS:
|
||||
break;
|
||||
case FAST_SMI_ELEMENTS:
|
||||
case FAST_HOLEY_SMI_ELEMENTS:
|
||||
case PACKED_SMI_ELEMENTS:
|
||||
case HOLEY_SMI_ELEMENTS:
|
||||
break;
|
||||
case FAST_ELEMENTS:
|
||||
case FAST_HOLEY_ELEMENTS:
|
||||
case PACKED_ELEMENTS:
|
||||
case HOLEY_ELEMENTS:
|
||||
case DICTIONARY_ELEMENTS:
|
||||
case FAST_STRING_WRAPPER_ELEMENTS:
|
||||
case SLOW_STRING_WRAPPER_ELEMENTS: {
|
||||
@ -7338,8 +7338,7 @@ bool JSObject::ReferencesObject(Object* obj) {
|
||||
}
|
||||
// Check the arguments.
|
||||
FixedArray* arguments = elements->arguments();
|
||||
kind = arguments->IsDictionary() ? DICTIONARY_ELEMENTS :
|
||||
FAST_HOLEY_ELEMENTS;
|
||||
kind = arguments->IsDictionary() ? DICTIONARY_ELEMENTS : HOLEY_ELEMENTS;
|
||||
if (ReferencesObjectFromElements(arguments, kind, obj)) return true;
|
||||
break;
|
||||
}
|
||||
@ -8019,16 +8018,16 @@ bool JSObject::HasEnumerableElements() {
|
||||
// TODO(cbruni): cleanup
|
||||
JSObject* object = this;
|
||||
switch (object->GetElementsKind()) {
|
||||
case FAST_SMI_ELEMENTS:
|
||||
case FAST_ELEMENTS:
|
||||
case FAST_DOUBLE_ELEMENTS: {
|
||||
case PACKED_SMI_ELEMENTS:
|
||||
case PACKED_ELEMENTS:
|
||||
case PACKED_DOUBLE_ELEMENTS: {
|
||||
int length = object->IsJSArray()
|
||||
? Smi::cast(JSArray::cast(object)->length())->value()
|
||||
: object->elements()->length();
|
||||
return length > 0;
|
||||
}
|
||||
case FAST_HOLEY_SMI_ELEMENTS:
|
||||
case FAST_HOLEY_ELEMENTS: {
|
||||
case HOLEY_SMI_ELEMENTS:
|
||||
case HOLEY_ELEMENTS: {
|
||||
FixedArray* elements = FixedArray::cast(object->elements());
|
||||
int length = object->IsJSArray()
|
||||
? Smi::cast(JSArray::cast(object)->length())->value()
|
||||
@ -8039,7 +8038,7 @@ bool JSObject::HasEnumerableElements() {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
case FAST_HOLEY_DOUBLE_ELEMENTS: {
|
||||
case HOLEY_DOUBLE_ELEMENTS: {
|
||||
int length = object->IsJSArray()
|
||||
? Smi::cast(JSArray::cast(object)->length())->value()
|
||||
: object->elements()->length();
|
||||
@ -8242,7 +8241,7 @@ MaybeHandle<FixedArray> GetOwnValuesOrEntries(Isolate* isolate,
|
||||
entry_storage->set(0, *key);
|
||||
entry_storage->set(1, *value);
|
||||
value = isolate->factory()->NewJSArrayWithElements(entry_storage,
|
||||
FAST_ELEMENTS, 2);
|
||||
PACKED_ELEMENTS, 2);
|
||||
}
|
||||
|
||||
values_or_entries->set(length, *value);
|
||||
@ -15114,15 +15113,15 @@ static ElementsKind BestFittingFastElementsKind(JSObject* object) {
|
||||
}
|
||||
DCHECK(object->HasDictionaryElements());
|
||||
SeededNumberDictionary* dictionary = object->element_dictionary();
|
||||
ElementsKind kind = FAST_HOLEY_SMI_ELEMENTS;
|
||||
ElementsKind kind = HOLEY_SMI_ELEMENTS;
|
||||
for (int i = 0; i < dictionary->Capacity(); i++) {
|
||||
Object* key = dictionary->KeyAt(i);
|
||||
if (key->IsNumber()) {
|
||||
Object* value = dictionary->ValueAt(i);
|
||||
if (!value->IsNumber()) return FAST_HOLEY_ELEMENTS;
|
||||
if (!value->IsNumber()) return HOLEY_ELEMENTS;
|
||||
if (!value->IsSmi()) {
|
||||
if (!FLAG_unbox_double_arrays) return FAST_HOLEY_ELEMENTS;
|
||||
kind = FAST_HOLEY_DOUBLE_ELEMENTS;
|
||||
if (!FLAG_unbox_double_arrays) return HOLEY_ELEMENTS;
|
||||
kind = HOLEY_DOUBLE_ELEMENTS;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -15474,19 +15473,19 @@ static int FastHoleyElementsUsage(JSObject* object, BackingStore* store) {
|
||||
int JSObject::GetFastElementsUsage() {
|
||||
FixedArrayBase* store = elements();
|
||||
switch (GetElementsKind()) {
|
||||
case FAST_SMI_ELEMENTS:
|
||||
case FAST_DOUBLE_ELEMENTS:
|
||||
case FAST_ELEMENTS:
|
||||
case PACKED_SMI_ELEMENTS:
|
||||
case PACKED_DOUBLE_ELEMENTS:
|
||||
case PACKED_ELEMENTS:
|
||||
return IsJSArray() ? Smi::cast(JSArray::cast(this)->length())->value()
|
||||
: store->length();
|
||||
case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
|
||||
store = SloppyArgumentsElements::cast(store)->arguments();
|
||||
// Fall through.
|
||||
case FAST_HOLEY_SMI_ELEMENTS:
|
||||
case FAST_HOLEY_ELEMENTS:
|
||||
case HOLEY_SMI_ELEMENTS:
|
||||
case HOLEY_ELEMENTS:
|
||||
case FAST_STRING_WRAPPER_ELEMENTS:
|
||||
return FastHoleyElementsUsage(this, FixedArray::cast(store));
|
||||
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
||||
case HOLEY_DOUBLE_ELEMENTS:
|
||||
if (elements()->length() == 0) return 0;
|
||||
return FastHoleyElementsUsage(this, FixedDoubleArray::cast(store));
|
||||
|
||||
@ -16460,7 +16459,7 @@ Handle<Object> JSObject::PrepareElementsForSort(Handle<JSObject> object,
|
||||
// Convert to fast elements.
|
||||
|
||||
Handle<Map> new_map =
|
||||
JSObject::GetElementsTransitionMap(object, FAST_HOLEY_ELEMENTS);
|
||||
JSObject::GetElementsTransitionMap(object, HOLEY_ELEMENTS);
|
||||
|
||||
PretenureFlag tenure = isolate->heap()->InNewSpace(*object) ?
|
||||
NOT_TENURED: TENURED;
|
||||
@ -20157,7 +20156,7 @@ ElementsKind JSArrayIterator::ElementsKindForInstanceType(InstanceType type) {
|
||||
|
||||
if (type <= LAST_ARRAY_KEY_ITERATOR_TYPE) {
|
||||
// Should be ignored for key iterators.
|
||||
return FAST_ELEMENTS;
|
||||
return PACKED_ELEMENTS;
|
||||
} else {
|
||||
ElementsKind kind;
|
||||
if (type < FIRST_ARRAY_VALUE_ITERATOR_TYPE) {
|
||||
|
@ -873,7 +873,7 @@ V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
|
||||
V(DICTIONARY_ELEMENTS_SUB_TYPE) \
|
||||
V(DICTIONARY_PROPERTIES_SUB_TYPE) \
|
||||
V(EMPTY_PROPERTIES_DICTIONARY_SUB_TYPE) \
|
||||
V(FAST_ELEMENTS_SUB_TYPE) \
|
||||
V(PACKED_ELEMENTS_SUB_TYPE) \
|
||||
V(FAST_PROPERTIES_SUB_TYPE) \
|
||||
V(FAST_TEMPLATE_INSTANTIATIONS_CACHE_SUB_TYPE) \
|
||||
V(HANDLER_TABLE_SUB_TYPE) \
|
||||
@ -2156,20 +2156,21 @@ class JSObject: public JSReceiver {
|
||||
Handle<FixedArrayBase> elements);
|
||||
inline ElementsKind GetElementsKind();
|
||||
ElementsAccessor* GetElementsAccessor();
|
||||
// Returns true if an object has elements of FAST_SMI_ELEMENTS ElementsKind.
|
||||
// Returns true if an object has elements of PACKED_SMI_ELEMENTS or
|
||||
// HOLEY_SMI_ELEMENTS ElementsKind.
|
||||
inline bool HasFastSmiElements();
|
||||
// Returns true if an object has elements of FAST_ELEMENTS ElementsKind.
|
||||
// Returns true if an object has elements of PACKED_ELEMENTS or
|
||||
// HOLEY_ELEMENTS ElementsKind.
|
||||
inline bool HasFastObjectElements();
|
||||
// Returns true if an object has elements of FAST_ELEMENTS or
|
||||
// FAST_SMI_ONLY_ELEMENTS.
|
||||
// Returns true if an object has elements of PACKED_SMI_ELEMENTS,
|
||||
// HOLEY_SMI_ELEMENTS, PACKED_ELEMENTS, or HOLEY_ELEMENTS.
|
||||
inline bool HasFastSmiOrObjectElements();
|
||||
// Returns true if an object has any of the fast elements kinds.
|
||||
// Returns true if an object has any of the "fast" elements kinds.
|
||||
inline bool HasFastElements();
|
||||
// Returns true if an object has elements of FAST_DOUBLE_ELEMENTS
|
||||
// ElementsKind.
|
||||
// Returns true if an object has elements of PACKED_DOUBLE_ELEMENTS or
|
||||
// HOLEY_DOUBLE_ELEMENTS ElementsKind.
|
||||
inline bool HasFastDoubleElements();
|
||||
// Returns true if an object has elements of FAST_HOLEY_*_ELEMENTS
|
||||
// ElementsKind.
|
||||
// Returns true if an object has elements of HOLEY_*_ELEMENTS ElementsKind.
|
||||
inline bool HasFastHoleyElements();
|
||||
inline bool HasSloppyArgumentsElements();
|
||||
inline bool HasStringWrapperElements();
|
||||
|
@ -68,7 +68,7 @@ class JSStrictArgumentsObject : public JSArgumentsObject {
|
||||
// +---+-----------------------+
|
||||
// | 0 | Context* context |
|
||||
// +---------------------------+
|
||||
// | 1 | FixedArray* arguments +----+ FAST_HOLEY_ELEMENTS
|
||||
// | 1 | FixedArray* arguments +----+ HOLEY_ELEMENTS
|
||||
// +---------------------------+ v-----+-----------+
|
||||
// | 2 | Object* param_1_map | | 0 | the_hole |
|
||||
// |...| ... | | ... | ... |
|
||||
@ -83,7 +83,7 @@ class JSStrictArgumentsObject : public JSArgumentsObject {
|
||||
// object.
|
||||
// The arguments backing store kind depends on the ElementsKind of the outer
|
||||
// JSArgumentsObject:
|
||||
// - FAST_SLOPPY_ARGUMENTS_ELEMENTS: FAST_HOLEY_ELEMENTS
|
||||
// - FAST_SLOPPY_ARGUMENTS_ELEMENTS: HOLEY_ELEMENTS
|
||||
// - SLOW_SLOPPY_ARGUMENTS_ELEMENTS: DICTIONARY_ELEMENTS
|
||||
class SloppyArgumentsElements : public FixedArray {
|
||||
public:
|
||||
|
@ -651,19 +651,19 @@ class Map : public HeapObject {
|
||||
|
||||
// Derived values from bit field 2
|
||||
static const int8_t kMaximumBitField2FastElementValue =
|
||||
static_cast<int8_t>((FAST_ELEMENTS + 1)
|
||||
static_cast<int8_t>((PACKED_ELEMENTS + 1)
|
||||
<< Map::ElementsKindBits::kShift) -
|
||||
1;
|
||||
static const int8_t kMaximumBitField2FastSmiElementValue =
|
||||
static_cast<int8_t>((FAST_SMI_ELEMENTS + 1)
|
||||
static_cast<int8_t>((PACKED_SMI_ELEMENTS + 1)
|
||||
<< Map::ElementsKindBits::kShift) -
|
||||
1;
|
||||
static const int8_t kMaximumBitField2FastHoleyElementValue =
|
||||
static_cast<int8_t>((FAST_HOLEY_ELEMENTS + 1)
|
||||
static_cast<int8_t>((HOLEY_ELEMENTS + 1)
|
||||
<< Map::ElementsKindBits::kShift) -
|
||||
1;
|
||||
static const int8_t kMaximumBitField2FastHoleySmiElementValue =
|
||||
static_cast<int8_t>((FAST_HOLEY_SMI_ELEMENTS + 1)
|
||||
static_cast<int8_t>((HOLEY_SMI_ELEMENTS + 1)
|
||||
<< Map::ElementsKindBits::kShift) -
|
||||
1;
|
||||
|
||||
|
@ -2455,12 +2455,12 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
|
||||
// sp[0] - last argument
|
||||
Label normal_sequence;
|
||||
if (mode == DONT_OVERRIDE) {
|
||||
STATIC_ASSERT(FAST_SMI_ELEMENTS == 0);
|
||||
STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
|
||||
STATIC_ASSERT(FAST_ELEMENTS == 2);
|
||||
STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
|
||||
STATIC_ASSERT(FAST_DOUBLE_ELEMENTS == 4);
|
||||
STATIC_ASSERT(FAST_HOLEY_DOUBLE_ELEMENTS == 5);
|
||||
STATIC_ASSERT(PACKED_SMI_ELEMENTS == 0);
|
||||
STATIC_ASSERT(HOLEY_SMI_ELEMENTS == 1);
|
||||
STATIC_ASSERT(PACKED_ELEMENTS == 2);
|
||||
STATIC_ASSERT(HOLEY_ELEMENTS == 3);
|
||||
STATIC_ASSERT(PACKED_DOUBLE_ELEMENTS == 4);
|
||||
STATIC_ASSERT(HOLEY_DOUBLE_ELEMENTS == 5);
|
||||
|
||||
// is the low bit set? If so, we are holey and that is good.
|
||||
__ andi(r0, r6, Operand(1));
|
||||
@ -2544,7 +2544,7 @@ void CommonArrayConstructorStub::GenerateStubsAheadOfTime(Isolate* isolate) {
|
||||
isolate);
|
||||
ArrayNArgumentsConstructorStub stub(isolate);
|
||||
stub.GetCode();
|
||||
ElementsKind kinds[2] = {FAST_ELEMENTS, FAST_HOLEY_ELEMENTS};
|
||||
ElementsKind kinds[2] = {PACKED_ELEMENTS, HOLEY_ELEMENTS};
|
||||
for (int i = 0; i < 2; i++) {
|
||||
// For internal arrays we only need a few things
|
||||
InternalArrayNoArgumentConstructorStub stubh1(isolate, kinds[i]);
|
||||
@ -2685,20 +2685,20 @@ void InternalArrayConstructorStub::Generate(MacroAssembler* masm) {
|
||||
|
||||
if (FLAG_debug_code) {
|
||||
Label done;
|
||||
__ cmpi(r6, Operand(FAST_ELEMENTS));
|
||||
__ cmpi(r6, Operand(PACKED_ELEMENTS));
|
||||
__ beq(&done);
|
||||
__ cmpi(r6, Operand(FAST_HOLEY_ELEMENTS));
|
||||
__ cmpi(r6, Operand(HOLEY_ELEMENTS));
|
||||
__ Assert(eq, kInvalidElementsKindForInternalArrayOrInternalPackedArray);
|
||||
__ bind(&done);
|
||||
}
|
||||
|
||||
Label fast_elements_case;
|
||||
__ cmpi(r6, Operand(FAST_ELEMENTS));
|
||||
__ cmpi(r6, Operand(PACKED_ELEMENTS));
|
||||
__ beq(&fast_elements_case);
|
||||
GenerateCase(masm, FAST_HOLEY_ELEMENTS);
|
||||
GenerateCase(masm, HOLEY_ELEMENTS);
|
||||
|
||||
__ bind(&fast_elements_case);
|
||||
GenerateCase(masm, FAST_ELEMENTS);
|
||||
GenerateCase(masm, PACKED_ELEMENTS);
|
||||
}
|
||||
|
||||
static int AddressOffset(ExternalReference ref0, ExternalReference ref1) {
|
||||
|
@ -1960,12 +1960,12 @@ RUNTIME_FUNCTION(Runtime_DebugCollectCoverage) {
|
||||
}
|
||||
|
||||
Handle<JSArray> script_obj =
|
||||
factory->NewJSArrayWithElements(ranges_array, FAST_ELEMENTS);
|
||||
factory->NewJSArrayWithElements(ranges_array, PACKED_ELEMENTS);
|
||||
Handle<JSObject> wrapper = Script::GetWrapper(script_data.script);
|
||||
JSObject::AddProperty(script_obj, script_string, wrapper, NONE);
|
||||
scripts_array->set(i, *script_obj);
|
||||
}
|
||||
return *factory->NewJSArrayWithElements(scripts_array, FAST_ELEMENTS);
|
||||
return *factory->NewJSArrayWithElements(scripts_array, PACKED_ELEMENTS);
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_DebugTogglePreciseCoverage) {
|
||||
|
@ -143,8 +143,8 @@ MaybeHandle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk(
|
||||
|
||||
// Deep copy own elements.
|
||||
switch (copy->GetElementsKind()) {
|
||||
case FAST_ELEMENTS:
|
||||
case FAST_HOLEY_ELEMENTS: {
|
||||
case PACKED_ELEMENTS:
|
||||
case HOLEY_ELEMENTS: {
|
||||
Handle<FixedArray> elements(FixedArray::cast(copy->elements()));
|
||||
if (elements->map() == isolate->heap()->fixed_cow_array_map()) {
|
||||
#ifdef DEBUG
|
||||
@ -195,10 +195,10 @@ MaybeHandle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk(
|
||||
UNREACHABLE();
|
||||
break;
|
||||
|
||||
case FAST_SMI_ELEMENTS:
|
||||
case FAST_HOLEY_SMI_ELEMENTS:
|
||||
case FAST_DOUBLE_ELEMENTS:
|
||||
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
||||
case PACKED_SMI_ELEMENTS:
|
||||
case HOLEY_SMI_ELEMENTS:
|
||||
case PACKED_DOUBLE_ELEMENTS:
|
||||
case HOLEY_DOUBLE_ELEMENTS:
|
||||
case NO_ELEMENTS:
|
||||
// No contained objects, nothing to do.
|
||||
break;
|
||||
|
@ -95,14 +95,14 @@ static MaybeHandle<Object> KeyedGetObjectProperty(Isolate* isolate,
|
||||
// that subsequent accesses will also call the runtime. Proactively
|
||||
// transition elements to FAST_*_ELEMENTS to avoid excessive boxing of
|
||||
// doubles for those future calls in the case that the elements would
|
||||
// become FAST_DOUBLE_ELEMENTS.
|
||||
// become PACKED_DOUBLE_ELEMENTS.
|
||||
Handle<JSObject> js_object = Handle<JSObject>::cast(receiver_obj);
|
||||
ElementsKind elements_kind = js_object->GetElementsKind();
|
||||
if (IsFastDoubleElementsKind(elements_kind)) {
|
||||
if (Smi::cast(*key_obj)->value() >= js_object->elements()->length()) {
|
||||
elements_kind = IsFastHoleyElementsKind(elements_kind)
|
||||
? FAST_HOLEY_ELEMENTS
|
||||
: FAST_ELEMENTS;
|
||||
? HOLEY_ELEMENTS
|
||||
: PACKED_ELEMENTS;
|
||||
JSObject::TransitionElementsKind(js_object, elements_kind);
|
||||
}
|
||||
} else {
|
||||
|
@ -52,7 +52,7 @@ RUNTIME_FUNCTION(Runtime_JSProxyCall) {
|
||||
}
|
||||
// 7. Let argArray be CreateArrayFromList(argumentsList).
|
||||
Handle<JSArray> arg_array = isolate->factory()->NewJSArray(
|
||||
FAST_ELEMENTS, arguments_length, arguments_length);
|
||||
PACKED_ELEMENTS, arguments_length, arguments_length);
|
||||
ElementsAccessor* accessor = arg_array->GetElementsAccessor();
|
||||
{
|
||||
DisallowHeapAllocation no_gc;
|
||||
@ -108,7 +108,7 @@ RUNTIME_FUNCTION(Runtime_JSProxyConstruct) {
|
||||
}
|
||||
// 7. Let argArray be CreateArrayFromList(argumentsList).
|
||||
Handle<JSArray> arg_array = isolate->factory()->NewJSArray(
|
||||
FAST_ELEMENTS, arguments_length, arguments_length);
|
||||
PACKED_ELEMENTS, arguments_length, arguments_length);
|
||||
ElementsAccessor* accessor = arg_array->GetElementsAccessor();
|
||||
{
|
||||
DisallowHeapAllocation no_gc;
|
||||
|
@ -869,7 +869,7 @@ RUNTIME_FUNCTION(Runtime_StringSplit) {
|
||||
int part_count = indices->length();
|
||||
|
||||
Handle<JSArray> result =
|
||||
isolate->factory()->NewJSArray(FAST_ELEMENTS, part_count, part_count,
|
||||
isolate->factory()->NewJSArray(PACKED_ELEMENTS, part_count, part_count,
|
||||
INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE);
|
||||
|
||||
DCHECK(result->HasFastObjectElements());
|
||||
|
@ -563,9 +563,9 @@ RUNTIME_FUNCTION(Runtime_NewRestParameter) {
|
||||
std::unique_ptr<Handle<Object>[]> arguments =
|
||||
GetCallerArguments(isolate, &argument_count);
|
||||
int num_elements = std::max(0, argument_count - start_index);
|
||||
Handle<JSObject> result =
|
||||
isolate->factory()->NewJSArray(FAST_ELEMENTS, num_elements, num_elements,
|
||||
DONT_INITIALIZE_ARRAY_ELEMENTS);
|
||||
Handle<JSObject> result = isolate->factory()->NewJSArray(
|
||||
PACKED_ELEMENTS, num_elements, num_elements,
|
||||
DONT_INITIALIZE_ARRAY_ELEMENTS);
|
||||
{
|
||||
DisallowHeapAllocation no_gc;
|
||||
FixedArray* elements = FixedArray::cast(result->elements());
|
||||
|
@ -2406,12 +2406,12 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
|
||||
// sp[0] - last argument
|
||||
Label normal_sequence;
|
||||
if (mode == DONT_OVERRIDE) {
|
||||
STATIC_ASSERT(FAST_SMI_ELEMENTS == 0);
|
||||
STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
|
||||
STATIC_ASSERT(FAST_ELEMENTS == 2);
|
||||
STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
|
||||
STATIC_ASSERT(FAST_DOUBLE_ELEMENTS == 4);
|
||||
STATIC_ASSERT(FAST_HOLEY_DOUBLE_ELEMENTS == 5);
|
||||
STATIC_ASSERT(PACKED_SMI_ELEMENTS == 0);
|
||||
STATIC_ASSERT(HOLEY_SMI_ELEMENTS == 1);
|
||||
STATIC_ASSERT(PACKED_ELEMENTS == 2);
|
||||
STATIC_ASSERT(HOLEY_ELEMENTS == 3);
|
||||
STATIC_ASSERT(PACKED_DOUBLE_ELEMENTS == 4);
|
||||
STATIC_ASSERT(HOLEY_DOUBLE_ELEMENTS == 5);
|
||||
|
||||
// is the low bit set? If so, we are holey and that is good.
|
||||
__ AndP(r0, r5, Operand(1));
|
||||
@ -2490,7 +2490,7 @@ void CommonArrayConstructorStub::GenerateStubsAheadOfTime(Isolate* isolate) {
|
||||
isolate);
|
||||
ArrayNArgumentsConstructorStub stub(isolate);
|
||||
stub.GetCode();
|
||||
ElementsKind kinds[2] = {FAST_ELEMENTS, FAST_HOLEY_ELEMENTS};
|
||||
ElementsKind kinds[2] = {PACKED_ELEMENTS, HOLEY_ELEMENTS};
|
||||
for (int i = 0; i < 2; i++) {
|
||||
// For internal arrays we only need a few things
|
||||
InternalArrayNoArgumentConstructorStub stubh1(isolate, kinds[i]);
|
||||
@ -2627,20 +2627,20 @@ void InternalArrayConstructorStub::Generate(MacroAssembler* masm) {
|
||||
|
||||
if (FLAG_debug_code) {
|
||||
Label done;
|
||||
__ CmpP(r5, Operand(FAST_ELEMENTS));
|
||||
__ CmpP(r5, Operand(PACKED_ELEMENTS));
|
||||
__ beq(&done);
|
||||
__ CmpP(r5, Operand(FAST_HOLEY_ELEMENTS));
|
||||
__ CmpP(r5, Operand(HOLEY_ELEMENTS));
|
||||
__ Assert(eq, kInvalidElementsKindForInternalArrayOrInternalPackedArray);
|
||||
__ bind(&done);
|
||||
}
|
||||
|
||||
Label fast_elements_case;
|
||||
__ CmpP(r5, Operand(FAST_ELEMENTS));
|
||||
__ CmpP(r5, Operand(PACKED_ELEMENTS));
|
||||
__ beq(&fast_elements_case);
|
||||
GenerateCase(masm, FAST_HOLEY_ELEMENTS);
|
||||
GenerateCase(masm, HOLEY_ELEMENTS);
|
||||
|
||||
__ bind(&fast_elements_case);
|
||||
GenerateCase(masm, FAST_ELEMENTS);
|
||||
GenerateCase(masm, PACKED_ELEMENTS);
|
||||
}
|
||||
|
||||
static int AddressOffset(ExternalReference ref0, ExternalReference ref1) {
|
||||
|
@ -568,16 +568,16 @@ Maybe<bool> ValueSerializer::WriteJSArray(Handle<JSArray> array) {
|
||||
WriteVarint<uint32_t>(length);
|
||||
uint32_t i = 0;
|
||||
|
||||
// Fast paths. Note that FAST_ELEMENTS in particular can bail due to the
|
||||
// Fast paths. Note that PACKED_ELEMENTS in particular can bail due to the
|
||||
// structure of the elements changing.
|
||||
switch (array->GetElementsKind()) {
|
||||
case FAST_SMI_ELEMENTS: {
|
||||
case PACKED_SMI_ELEMENTS: {
|
||||
Handle<FixedArray> elements(FixedArray::cast(array->elements()),
|
||||
isolate_);
|
||||
for (; i < length; i++) WriteSmi(Smi::cast(elements->get(i)));
|
||||
break;
|
||||
}
|
||||
case FAST_DOUBLE_ELEMENTS: {
|
||||
case PACKED_DOUBLE_ELEMENTS: {
|
||||
// Elements are empty_fixed_array, not a FixedDoubleArray, if the array
|
||||
// is empty. No elements to encode in this case anyhow.
|
||||
if (length == 0) break;
|
||||
@ -589,11 +589,11 @@ Maybe<bool> ValueSerializer::WriteJSArray(Handle<JSArray> array) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FAST_ELEMENTS: {
|
||||
case PACKED_ELEMENTS: {
|
||||
Handle<Object> old_length(array->length(), isolate_);
|
||||
for (; i < length; i++) {
|
||||
if (array->length() != *old_length ||
|
||||
array->GetElementsKind() != FAST_ELEMENTS) {
|
||||
array->GetElementsKind() != PACKED_ELEMENTS) {
|
||||
// Fall back to slow path.
|
||||
break;
|
||||
}
|
||||
@ -1364,7 +1364,7 @@ MaybeHandle<JSArray> ValueDeserializer::ReadDenseJSArray() {
|
||||
uint32_t id = next_id_++;
|
||||
HandleScope scope(isolate_);
|
||||
Handle<JSArray> array = isolate_->factory()->NewJSArray(
|
||||
FAST_HOLEY_ELEMENTS, length, length, INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE,
|
||||
HOLEY_ELEMENTS, length, length, INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE,
|
||||
pretenure_);
|
||||
AddObjectWithID(id, array);
|
||||
|
||||
|
@ -562,7 +562,7 @@ Handle<JSArray> wasm::GetImports(Isolate* isolate,
|
||||
// Create the result array.
|
||||
WasmModule* module = compiled_module->module();
|
||||
int num_imports = static_cast<int>(module->import_table.size());
|
||||
Handle<JSArray> array_object = factory->NewJSArray(FAST_ELEMENTS, 0, 0);
|
||||
Handle<JSArray> array_object = factory->NewJSArray(PACKED_ELEMENTS, 0, 0);
|
||||
Handle<FixedArray> storage = factory->NewFixedArray(num_imports);
|
||||
JSArray::SetContent(array_object, storage);
|
||||
array_object->set_length(Smi::FromInt(num_imports));
|
||||
@ -631,7 +631,7 @@ Handle<JSArray> wasm::GetExports(Isolate* isolate,
|
||||
// Create the result array.
|
||||
WasmModule* module = compiled_module->module();
|
||||
int num_exports = static_cast<int>(module->export_table.size());
|
||||
Handle<JSArray> array_object = factory->NewJSArray(FAST_ELEMENTS, 0, 0);
|
||||
Handle<JSArray> array_object = factory->NewJSArray(PACKED_ELEMENTS, 0, 0);
|
||||
Handle<FixedArray> storage = factory->NewFixedArray(num_exports);
|
||||
JSArray::SetContent(array_object, storage);
|
||||
array_object->set_length(Smi::FromInt(num_exports));
|
||||
@ -730,7 +730,7 @@ Handle<JSArray> wasm::GetCustomSections(Isolate* isolate,
|
||||
}
|
||||
|
||||
int num_custom_sections = static_cast<int>(matching_sections.size());
|
||||
Handle<JSArray> array_object = factory->NewJSArray(FAST_ELEMENTS, 0, 0);
|
||||
Handle<JSArray> array_object = factory->NewJSArray(PACKED_ELEMENTS, 0, 0);
|
||||
Handle<FixedArray> storage = factory->NewFixedArray(num_custom_sections);
|
||||
JSArray::SetContent(array_object, storage);
|
||||
array_object->set_length(Smi::FromInt(num_custom_sections));
|
||||
|
@ -2152,8 +2152,8 @@ static void CreateArrayDispatch(MacroAssembler* masm,
|
||||
T stub(masm->isolate(), GetInitialFastElementsKind(), mode);
|
||||
__ TailCallStub(&stub);
|
||||
} else if (mode == DONT_OVERRIDE) {
|
||||
int last_index = GetSequenceIndexFromFastElementsKind(
|
||||
TERMINAL_FAST_ELEMENTS_KIND);
|
||||
int last_index =
|
||||
GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND);
|
||||
for (int i = 0; i <= last_index; ++i) {
|
||||
Label next;
|
||||
ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
|
||||
@ -2183,12 +2183,12 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
|
||||
|
||||
Label normal_sequence;
|
||||
if (mode == DONT_OVERRIDE) {
|
||||
STATIC_ASSERT(FAST_SMI_ELEMENTS == 0);
|
||||
STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
|
||||
STATIC_ASSERT(FAST_ELEMENTS == 2);
|
||||
STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
|
||||
STATIC_ASSERT(FAST_DOUBLE_ELEMENTS == 4);
|
||||
STATIC_ASSERT(FAST_HOLEY_DOUBLE_ELEMENTS == 5);
|
||||
STATIC_ASSERT(PACKED_SMI_ELEMENTS == 0);
|
||||
STATIC_ASSERT(HOLEY_SMI_ELEMENTS == 1);
|
||||
STATIC_ASSERT(PACKED_ELEMENTS == 2);
|
||||
STATIC_ASSERT(HOLEY_ELEMENTS == 3);
|
||||
STATIC_ASSERT(PACKED_DOUBLE_ELEMENTS == 4);
|
||||
STATIC_ASSERT(HOLEY_DOUBLE_ELEMENTS == 5);
|
||||
|
||||
// is the low bit set? If so, we are holey and that is good.
|
||||
__ testb(rdx, Immediate(1));
|
||||
@ -2235,8 +2235,8 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
|
||||
Smi::FromInt(kFastElementsKindPackedToHoley));
|
||||
|
||||
__ bind(&normal_sequence);
|
||||
int last_index = GetSequenceIndexFromFastElementsKind(
|
||||
TERMINAL_FAST_ELEMENTS_KIND);
|
||||
int last_index =
|
||||
GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND);
|
||||
for (int i = 0; i <= last_index; ++i) {
|
||||
Label next;
|
||||
ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
|
||||
@ -2257,8 +2257,8 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
|
||||
|
||||
template<class T>
|
||||
static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) {
|
||||
int to_index = GetSequenceIndexFromFastElementsKind(
|
||||
TERMINAL_FAST_ELEMENTS_KIND);
|
||||
int to_index =
|
||||
GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND);
|
||||
for (int i = 0; i <= to_index; ++i) {
|
||||
ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
|
||||
T stub(isolate, kind);
|
||||
@ -2278,7 +2278,7 @@ void CommonArrayConstructorStub::GenerateStubsAheadOfTime(Isolate* isolate) {
|
||||
ArrayNArgumentsConstructorStub stub(isolate);
|
||||
stub.GetCode();
|
||||
|
||||
ElementsKind kinds[2] = { FAST_ELEMENTS, FAST_HOLEY_ELEMENTS };
|
||||
ElementsKind kinds[2] = {PACKED_ELEMENTS, HOLEY_ELEMENTS};
|
||||
for (int i = 0; i < 2; i++) {
|
||||
// For internal arrays we only need a few things
|
||||
InternalArrayNoArgumentConstructorStub stubh1(isolate, kinds[i]);
|
||||
@ -2437,21 +2437,21 @@ void InternalArrayConstructorStub::Generate(MacroAssembler* masm) {
|
||||
|
||||
if (FLAG_debug_code) {
|
||||
Label done;
|
||||
__ cmpl(rcx, Immediate(FAST_ELEMENTS));
|
||||
__ cmpl(rcx, Immediate(PACKED_ELEMENTS));
|
||||
__ j(equal, &done);
|
||||
__ cmpl(rcx, Immediate(FAST_HOLEY_ELEMENTS));
|
||||
__ cmpl(rcx, Immediate(HOLEY_ELEMENTS));
|
||||
__ Assert(equal,
|
||||
kInvalidElementsKindForInternalArrayOrInternalPackedArray);
|
||||
__ bind(&done);
|
||||
}
|
||||
|
||||
Label fast_elements_case;
|
||||
__ cmpl(rcx, Immediate(FAST_ELEMENTS));
|
||||
__ cmpl(rcx, Immediate(PACKED_ELEMENTS));
|
||||
__ j(equal, &fast_elements_case);
|
||||
GenerateCase(masm, FAST_HOLEY_ELEMENTS);
|
||||
GenerateCase(masm, HOLEY_ELEMENTS);
|
||||
|
||||
__ bind(&fast_elements_case);
|
||||
GenerateCase(masm, FAST_ELEMENTS);
|
||||
GenerateCase(masm, PACKED_ELEMENTS);
|
||||
}
|
||||
|
||||
static int Offset(ExternalReference ref0, ExternalReference ref1) {
|
||||
|
@ -2230,12 +2230,12 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
|
||||
// esp[4] - last argument
|
||||
Label normal_sequence;
|
||||
if (mode == DONT_OVERRIDE) {
|
||||
STATIC_ASSERT(FAST_SMI_ELEMENTS == 0);
|
||||
STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
|
||||
STATIC_ASSERT(FAST_ELEMENTS == 2);
|
||||
STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
|
||||
STATIC_ASSERT(FAST_DOUBLE_ELEMENTS == 4);
|
||||
STATIC_ASSERT(FAST_HOLEY_DOUBLE_ELEMENTS == 5);
|
||||
STATIC_ASSERT(PACKED_SMI_ELEMENTS == 0);
|
||||
STATIC_ASSERT(HOLEY_SMI_ELEMENTS == 1);
|
||||
STATIC_ASSERT(PACKED_ELEMENTS == 2);
|
||||
STATIC_ASSERT(HOLEY_ELEMENTS == 3);
|
||||
STATIC_ASSERT(PACKED_DOUBLE_ELEMENTS == 4);
|
||||
STATIC_ASSERT(HOLEY_DOUBLE_ELEMENTS == 5);
|
||||
|
||||
// is the low bit set? If so, we are holey and that is good.
|
||||
__ test_b(edx, Immediate(1));
|
||||
@ -2321,7 +2321,7 @@ void CommonArrayConstructorStub::GenerateStubsAheadOfTime(Isolate* isolate) {
|
||||
ArrayNArgumentsConstructorStub stub(isolate);
|
||||
stub.GetCode();
|
||||
|
||||
ElementsKind kinds[2] = {FAST_ELEMENTS, FAST_HOLEY_ELEMENTS};
|
||||
ElementsKind kinds[2] = {PACKED_ELEMENTS, HOLEY_ELEMENTS};
|
||||
for (int i = 0; i < 2; i++) {
|
||||
// For internal arrays we only need a few things
|
||||
InternalArrayNoArgumentConstructorStub stubh1(isolate, kinds[i]);
|
||||
@ -2475,20 +2475,20 @@ void InternalArrayConstructorStub::Generate(MacroAssembler* masm) {
|
||||
|
||||
if (FLAG_debug_code) {
|
||||
Label done;
|
||||
__ cmp(ecx, Immediate(FAST_ELEMENTS));
|
||||
__ cmp(ecx, Immediate(PACKED_ELEMENTS));
|
||||
__ j(equal, &done);
|
||||
__ cmp(ecx, Immediate(FAST_HOLEY_ELEMENTS));
|
||||
__ cmp(ecx, Immediate(HOLEY_ELEMENTS));
|
||||
__ Assert(equal, kInvalidElementsKindForInternalArrayOrInternalPackedArray);
|
||||
__ bind(&done);
|
||||
}
|
||||
|
||||
Label fast_elements_case;
|
||||
__ cmp(ecx, Immediate(FAST_ELEMENTS));
|
||||
__ cmp(ecx, Immediate(PACKED_ELEMENTS));
|
||||
__ j(equal, &fast_elements_case);
|
||||
GenerateCase(masm, FAST_HOLEY_ELEMENTS);
|
||||
GenerateCase(masm, HOLEY_ELEMENTS);
|
||||
|
||||
__ bind(&fast_elements_case);
|
||||
GenerateCase(masm, FAST_ELEMENTS);
|
||||
GenerateCase(masm, PACKED_ELEMENTS);
|
||||
}
|
||||
|
||||
void FastNewRestParameterStub::Generate(MacroAssembler* masm) {
|
||||
@ -2546,7 +2546,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) {
|
||||
__ bind(&done_allocate);
|
||||
|
||||
// Setup the rest parameter array in rax.
|
||||
__ LoadGlobalFunction(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, ecx);
|
||||
__ LoadGlobalFunction(Context::JS_ARRAY_PACKED_ELEMENTS_MAP_INDEX, ecx);
|
||||
__ mov(FieldOperand(eax, JSArray::kMapOffset), ecx);
|
||||
__ mov(ecx, isolate()->factory()->empty_fixed_array());
|
||||
__ mov(FieldOperand(eax, JSArray::kPropertiesOffset), ecx);
|
||||
@ -2609,7 +2609,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) {
|
||||
// Setup the rest parameter array in edi.
|
||||
__ lea(edi,
|
||||
Operand(edx, eax, times_half_pointer_size, FixedArray::kHeaderSize));
|
||||
__ LoadGlobalFunction(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, ecx);
|
||||
__ LoadGlobalFunction(Context::JS_ARRAY_PACKED_ELEMENTS_MAP_INDEX, ecx);
|
||||
__ mov(FieldOperand(edi, JSArray::kMapOffset), ecx);
|
||||
__ mov(FieldOperand(edi, JSArray::kPropertiesOffset),
|
||||
isolate()->factory()->empty_fixed_array());
|
||||
|
@ -1195,8 +1195,7 @@ TEST(Iteration) {
|
||||
|
||||
// Allocate a JS array to OLD_SPACE and NEW_SPACE
|
||||
objs[next_objs_index++] = factory->NewJSArray(10);
|
||||
objs[next_objs_index++] =
|
||||
factory->NewJSArray(10, FAST_HOLEY_ELEMENTS, TENURED);
|
||||
objs[next_objs_index++] = factory->NewJSArray(10, HOLEY_ELEMENTS, TENURED);
|
||||
|
||||
// Allocate a small string to OLD_DATA_SPACE and NEW_SPACE
|
||||
objs[next_objs_index++] = factory->NewStringFromStaticChars("abcdefghij");
|
||||
@ -3714,7 +3713,7 @@ TEST(Regress169928) {
|
||||
JSArray::kSize + AllocationMemento::kSize + kPointerSize);
|
||||
|
||||
Handle<JSArray> array =
|
||||
factory->NewJSArrayWithElements(array_data, FAST_SMI_ELEMENTS);
|
||||
factory->NewJSArrayWithElements(array_data, PACKED_SMI_ELEMENTS);
|
||||
|
||||
CHECK_EQ(Smi::FromInt(2), array->length());
|
||||
CHECK(array->HasFastSmiOrObjectElements());
|
||||
|
@ -2152,7 +2152,7 @@ TEST(InterpreterTestIn) {
|
||||
isolate->heap()->HashSeed());
|
||||
// Allocate an array
|
||||
Handle<i::JSArray> array =
|
||||
factory->NewJSArray(0, i::ElementsKind::FAST_SMI_ELEMENTS);
|
||||
factory->NewJSArray(0, i::ElementsKind::PACKED_SMI_ELEMENTS);
|
||||
// Check for these properties on the array object
|
||||
const char* properties[] = {"length", "fuzzle", "x", "0"};
|
||||
for (size_t i = 0; i < arraysize(properties); i++) {
|
||||
|
@ -22730,19 +22730,19 @@ THREADED_TEST(JSONParseArray) {
|
||||
HandleScope scope(context->GetIsolate());
|
||||
|
||||
TestJSONParseArray(context.local(), "[0, 1, 2]", "[0,1,2]",
|
||||
i::FAST_SMI_ELEMENTS);
|
||||
i::PACKED_SMI_ELEMENTS);
|
||||
TestJSONParseArray(context.local(), "[0, 1.2, 2]", "[0,1.2,2]",
|
||||
i::FAST_DOUBLE_ELEMENTS);
|
||||
i::PACKED_DOUBLE_ELEMENTS);
|
||||
TestJSONParseArray(context.local(), "[0.2, 1, 2]", "[0.2,1,2]",
|
||||
i::FAST_DOUBLE_ELEMENTS);
|
||||
i::PACKED_DOUBLE_ELEMENTS);
|
||||
TestJSONParseArray(context.local(), "[0, \"a\", 2]", "[0,\"a\",2]",
|
||||
i::FAST_ELEMENTS);
|
||||
i::PACKED_ELEMENTS);
|
||||
TestJSONParseArray(context.local(), "[\"a\", 1, 2]", "[\"a\",1,2]",
|
||||
i::FAST_ELEMENTS);
|
||||
i::PACKED_ELEMENTS);
|
||||
TestJSONParseArray(context.local(), "[\"a\", 1.2, 2]", "[\"a\",1.2,2]",
|
||||
i::FAST_ELEMENTS);
|
||||
i::PACKED_ELEMENTS);
|
||||
TestJSONParseArray(context.local(), "[0, 1.2, \"a\"]", "[0,1.2,\"a\"]",
|
||||
i::FAST_ELEMENTS);
|
||||
i::PACKED_ELEMENTS);
|
||||
}
|
||||
|
||||
THREADED_TEST(JSONStringifyObject) {
|
||||
|
@ -45,7 +45,7 @@ TEST(CodeCache) {
|
||||
HandleScope handle_scope(isolate);
|
||||
|
||||
Handle<Map> map =
|
||||
factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize, FAST_ELEMENTS);
|
||||
factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize, PACKED_ELEMENTS);
|
||||
|
||||
// This number should be large enough to cause the code cache to use its
|
||||
// hash table storage format.
|
||||
|
@ -1246,10 +1246,10 @@ TEST(TryLookupElement) {
|
||||
}
|
||||
|
||||
{
|
||||
Handle<JSArray> object = factory->NewJSArray(0, FAST_SMI_ELEMENTS);
|
||||
Handle<JSArray> object = factory->NewJSArray(0, PACKED_SMI_ELEMENTS);
|
||||
AddElement(object, 0, smi0);
|
||||
AddElement(object, 1, smi0);
|
||||
CHECK_EQ(FAST_SMI_ELEMENTS, object->map()->elements_kind());
|
||||
CHECK_EQ(PACKED_SMI_ELEMENTS, object->map()->elements_kind());
|
||||
|
||||
CHECK_FOUND(object, 0);
|
||||
CHECK_FOUND(object, 1);
|
||||
@ -1259,10 +1259,10 @@ TEST(TryLookupElement) {
|
||||
}
|
||||
|
||||
{
|
||||
Handle<JSArray> object = factory->NewJSArray(0, FAST_HOLEY_SMI_ELEMENTS);
|
||||
Handle<JSArray> object = factory->NewJSArray(0, HOLEY_SMI_ELEMENTS);
|
||||
AddElement(object, 0, smi0);
|
||||
AddElement(object, 13, smi0);
|
||||
CHECK_EQ(FAST_HOLEY_SMI_ELEMENTS, object->map()->elements_kind());
|
||||
CHECK_EQ(HOLEY_SMI_ELEMENTS, object->map()->elements_kind());
|
||||
|
||||
CHECK_FOUND(object, 0);
|
||||
CHECK_NOT_FOUND(object, 1);
|
||||
@ -1272,10 +1272,10 @@ TEST(TryLookupElement) {
|
||||
}
|
||||
|
||||
{
|
||||
Handle<JSArray> object = factory->NewJSArray(0, FAST_ELEMENTS);
|
||||
Handle<JSArray> object = factory->NewJSArray(0, PACKED_ELEMENTS);
|
||||
AddElement(object, 0, smi0);
|
||||
AddElement(object, 1, smi0);
|
||||
CHECK_EQ(FAST_ELEMENTS, object->map()->elements_kind());
|
||||
CHECK_EQ(PACKED_ELEMENTS, object->map()->elements_kind());
|
||||
|
||||
CHECK_FOUND(object, 0);
|
||||
CHECK_FOUND(object, 1);
|
||||
@ -1285,10 +1285,10 @@ TEST(TryLookupElement) {
|
||||
}
|
||||
|
||||
{
|
||||
Handle<JSArray> object = factory->NewJSArray(0, FAST_HOLEY_ELEMENTS);
|
||||
Handle<JSArray> object = factory->NewJSArray(0, HOLEY_ELEMENTS);
|
||||
AddElement(object, 0, smi0);
|
||||
AddElement(object, 13, smi0);
|
||||
CHECK_EQ(FAST_HOLEY_ELEMENTS, object->map()->elements_kind());
|
||||
CHECK_EQ(HOLEY_ELEMENTS, object->map()->elements_kind());
|
||||
|
||||
CHECK_FOUND(object, 0);
|
||||
CHECK_NOT_FOUND(object, 1);
|
||||
@ -1854,63 +1854,63 @@ class AppendJSArrayCodeStubAssembler : public CodeStubAssembler {
|
||||
TEST(BuildAppendJSArrayFastElement) {
|
||||
Isolate* isolate(CcTest::InitIsolateOnce());
|
||||
AppendJSArrayCodeStubAssembler::TestAppendJSArray(
|
||||
isolate, FAST_ELEMENTS, Smi::FromInt(3), Smi::FromInt(4), Smi::FromInt(5),
|
||||
Smi::FromInt(6), 6, 6);
|
||||
isolate, PACKED_ELEMENTS, Smi::FromInt(3), Smi::FromInt(4),
|
||||
Smi::FromInt(5), Smi::FromInt(6), 6, 6);
|
||||
}
|
||||
|
||||
TEST(BuildAppendJSArrayFastElementGrow) {
|
||||
Isolate* isolate(CcTest::InitIsolateOnce());
|
||||
AppendJSArrayCodeStubAssembler::TestAppendJSArray(
|
||||
isolate, FAST_ELEMENTS, Smi::FromInt(3), Smi::FromInt(4), Smi::FromInt(5),
|
||||
Smi::FromInt(6), 2, 6);
|
||||
isolate, PACKED_ELEMENTS, Smi::FromInt(3), Smi::FromInt(4),
|
||||
Smi::FromInt(5), Smi::FromInt(6), 2, 6);
|
||||
}
|
||||
|
||||
TEST(BuildAppendJSArrayFastSmiElement) {
|
||||
Isolate* isolate(CcTest::InitIsolateOnce());
|
||||
AppendJSArrayCodeStubAssembler::TestAppendJSArray(
|
||||
isolate, FAST_SMI_ELEMENTS, Smi::FromInt(3), Smi::FromInt(4),
|
||||
isolate, PACKED_SMI_ELEMENTS, Smi::FromInt(3), Smi::FromInt(4),
|
||||
Smi::FromInt(5), Smi::FromInt(6), 6, 6);
|
||||
}
|
||||
|
||||
TEST(BuildAppendJSArrayFastSmiElementGrow) {
|
||||
Isolate* isolate(CcTest::InitIsolateOnce());
|
||||
AppendJSArrayCodeStubAssembler::TestAppendJSArray(
|
||||
isolate, FAST_SMI_ELEMENTS, Smi::FromInt(3), Smi::FromInt(4),
|
||||
isolate, PACKED_SMI_ELEMENTS, Smi::FromInt(3), Smi::FromInt(4),
|
||||
Smi::FromInt(5), Smi::FromInt(6), 2, 6);
|
||||
}
|
||||
|
||||
TEST(BuildAppendJSArrayFastSmiElementObject) {
|
||||
Isolate* isolate(CcTest::InitIsolateOnce());
|
||||
AppendJSArrayCodeStubAssembler::TestAppendJSArray(
|
||||
isolate, FAST_SMI_ELEMENTS, Smi::FromInt(3), Smi::FromInt(4),
|
||||
isolate, PACKED_SMI_ELEMENTS, Smi::FromInt(3), Smi::FromInt(4),
|
||||
isolate->heap()->undefined_value(), Smi::FromInt(6), 6, 4);
|
||||
}
|
||||
|
||||
TEST(BuildAppendJSArrayFastSmiElementObjectGrow) {
|
||||
Isolate* isolate(CcTest::InitIsolateOnce());
|
||||
AppendJSArrayCodeStubAssembler::TestAppendJSArray(
|
||||
isolate, FAST_SMI_ELEMENTS, Smi::FromInt(3), Smi::FromInt(4),
|
||||
isolate, PACKED_SMI_ELEMENTS, Smi::FromInt(3), Smi::FromInt(4),
|
||||
isolate->heap()->undefined_value(), Smi::FromInt(6), 2, 4);
|
||||
}
|
||||
|
||||
TEST(BuildAppendJSArrayFastDoubleElements) {
|
||||
Isolate* isolate(CcTest::InitIsolateOnce());
|
||||
AppendJSArrayCodeStubAssembler::TestAppendJSArray(
|
||||
isolate, FAST_DOUBLE_ELEMENTS, Smi::FromInt(3), Smi::FromInt(4),
|
||||
isolate, PACKED_DOUBLE_ELEMENTS, Smi::FromInt(3), Smi::FromInt(4),
|
||||
Smi::FromInt(5), Smi::FromInt(6), 6, 6);
|
||||
}
|
||||
|
||||
TEST(BuildAppendJSArrayFastDoubleElementsGrow) {
|
||||
Isolate* isolate(CcTest::InitIsolateOnce());
|
||||
AppendJSArrayCodeStubAssembler::TestAppendJSArray(
|
||||
isolate, FAST_DOUBLE_ELEMENTS, Smi::FromInt(3), Smi::FromInt(4),
|
||||
isolate, PACKED_DOUBLE_ELEMENTS, Smi::FromInt(3), Smi::FromInt(4),
|
||||
Smi::FromInt(5), Smi::FromInt(6), 2, 6);
|
||||
}
|
||||
|
||||
TEST(BuildAppendJSArrayFastDoubleElementsObject) {
|
||||
Isolate* isolate(CcTest::InitIsolateOnce());
|
||||
AppendJSArrayCodeStubAssembler::TestAppendJSArray(
|
||||
isolate, FAST_DOUBLE_ELEMENTS, Smi::FromInt(3), Smi::FromInt(4),
|
||||
isolate, PACKED_DOUBLE_ELEMENTS, Smi::FromInt(3), Smi::FromInt(4),
|
||||
isolate->heap()->undefined_value(), Smi::FromInt(6), 6, 4);
|
||||
}
|
||||
|
||||
@ -2008,10 +2008,11 @@ TEST(AllocatePromiseReactionJobInfo) {
|
||||
PromiseBuiltinsAssembler p(data.state());
|
||||
|
||||
Node* const context = m.Parameter(kNumParams + 2);
|
||||
Node* const tasks = m.AllocateFixedArray(FAST_ELEMENTS, m.IntPtrConstant(1));
|
||||
Node* const tasks =
|
||||
m.AllocateFixedArray(PACKED_ELEMENTS, m.IntPtrConstant(1));
|
||||
m.StoreFixedArrayElement(tasks, 0, m.UndefinedConstant());
|
||||
Node* const deferred_promise =
|
||||
m.AllocateFixedArray(FAST_ELEMENTS, m.IntPtrConstant(1));
|
||||
m.AllocateFixedArray(PACKED_ELEMENTS, m.IntPtrConstant(1));
|
||||
m.StoreFixedArrayElement(deferred_promise, 0, m.UndefinedConstant());
|
||||
Node* const info = m.AllocatePromiseReactionJobInfo(
|
||||
m.SmiConstant(1), tasks, deferred_promise, m.UndefinedConstant(),
|
||||
@ -2188,7 +2189,7 @@ TEST(CreatePromiseResolvingFunctions) {
|
||||
std::tie(resolve, reject) = m.CreatePromiseResolvingFunctions(
|
||||
promise, m.BooleanConstant(false), native_context);
|
||||
Node* const kSize = m.IntPtrConstant(2);
|
||||
Node* const arr = m.AllocateFixedArray(FAST_ELEMENTS, kSize);
|
||||
Node* const arr = m.AllocateFixedArray(PACKED_ELEMENTS, kSize);
|
||||
m.StoreFixedArrayElement(arr, 0, resolve);
|
||||
m.StoreFixedArrayElement(arr, 1, reject);
|
||||
m.Return(arr);
|
||||
|
@ -78,7 +78,7 @@ TEST(JSObjectAddingProperties) {
|
||||
|
||||
Handle<JSObject> object = factory->NewJSObject(function);
|
||||
Handle<Map> previous_map(object->map());
|
||||
CHECK_EQ(FAST_HOLEY_ELEMENTS, previous_map->elements_kind());
|
||||
CHECK_EQ(HOLEY_ELEMENTS, previous_map->elements_kind());
|
||||
CHECK(EQUALS(object->properties(), empty_fixed_array));
|
||||
CHECK(EQUALS(object->elements(), empty_fixed_array));
|
||||
|
||||
@ -88,7 +88,7 @@ TEST(JSObjectAddingProperties) {
|
||||
JSObject::DefinePropertyOrElementIgnoreAttributes(object, name, value, NONE)
|
||||
.Check();
|
||||
CHECK_NE(object->map(), *previous_map);
|
||||
CHECK_EQ(FAST_HOLEY_ELEMENTS, object->map()->elements_kind());
|
||||
CHECK_EQ(HOLEY_ELEMENTS, object->map()->elements_kind());
|
||||
CHECK_LE(1, object->properties()->length());
|
||||
CHECK(EQUALS(object->elements(), empty_fixed_array));
|
||||
}
|
||||
@ -109,7 +109,7 @@ TEST(JSObjectInObjectAddingProperties) {
|
||||
|
||||
Handle<JSObject> object = factory->NewJSObject(function);
|
||||
Handle<Map> previous_map(object->map());
|
||||
CHECK_EQ(FAST_HOLEY_ELEMENTS, previous_map->elements_kind());
|
||||
CHECK_EQ(HOLEY_ELEMENTS, previous_map->elements_kind());
|
||||
CHECK(EQUALS(object->properties(), empty_fixed_array));
|
||||
CHECK(EQUALS(object->elements(), empty_fixed_array));
|
||||
|
||||
@ -121,7 +121,7 @@ TEST(JSObjectInObjectAddingProperties) {
|
||||
.Check();
|
||||
}
|
||||
CHECK_NE(object->map(), *previous_map);
|
||||
CHECK_EQ(FAST_HOLEY_ELEMENTS, object->map()->elements_kind());
|
||||
CHECK_EQ(HOLEY_ELEMENTS, object->map()->elements_kind());
|
||||
CHECK(EQUALS(object->properties(), empty_fixed_array));
|
||||
CHECK(EQUALS(object->elements(), empty_fixed_array));
|
||||
|
||||
@ -132,7 +132,7 @@ TEST(JSObjectInObjectAddingProperties) {
|
||||
JSObject::DefinePropertyOrElementIgnoreAttributes(object, name, value, NONE)
|
||||
.Check();
|
||||
CHECK_NE(object->map(), *previous_map);
|
||||
CHECK_EQ(FAST_HOLEY_ELEMENTS, object->map()->elements_kind());
|
||||
CHECK_EQ(HOLEY_ELEMENTS, object->map()->elements_kind());
|
||||
// there must be at least 1 element in the properies store
|
||||
CHECK_LE(1, object->properties()->length());
|
||||
CHECK(EQUALS(object->elements(), empty_fixed_array));
|
||||
@ -152,7 +152,7 @@ TEST(JSObjectAddingElements) {
|
||||
|
||||
Handle<JSObject> object = factory->NewJSObject(function);
|
||||
Handle<Map> previous_map(object->map());
|
||||
CHECK_EQ(FAST_HOLEY_ELEMENTS, previous_map->elements_kind());
|
||||
CHECK_EQ(HOLEY_ELEMENTS, previous_map->elements_kind());
|
||||
CHECK(EQUALS(object->properties(), empty_fixed_array));
|
||||
CHECK(EQUALS(object->elements(), empty_fixed_array));
|
||||
|
||||
@ -162,7 +162,7 @@ TEST(JSObjectAddingElements) {
|
||||
.Check();
|
||||
// no change in elements_kind => no map transition
|
||||
CHECK_EQ(object->map(), *previous_map);
|
||||
CHECK_EQ(FAST_HOLEY_ELEMENTS, object->map()->elements_kind());
|
||||
CHECK_EQ(HOLEY_ELEMENTS, object->map()->elements_kind());
|
||||
CHECK(EQUALS(object->properties(), empty_fixed_array));
|
||||
CHECK_LE(1, object->elements()->length());
|
||||
|
||||
@ -175,7 +175,7 @@ TEST(JSObjectAddingElements) {
|
||||
}
|
||||
// no change in elements_kind => no map transition
|
||||
CHECK_EQ(object->map(), *previous_map);
|
||||
CHECK_EQ(FAST_HOLEY_ELEMENTS, object->map()->elements_kind());
|
||||
CHECK_EQ(HOLEY_ELEMENTS, object->map()->elements_kind());
|
||||
CHECK(EQUALS(object->properties(), empty_fixed_array));
|
||||
CHECK_LE(non_dict_backing_store_limit, object->elements()->length());
|
||||
|
||||
@ -202,9 +202,9 @@ TEST(JSArrayAddingProperties) {
|
||||
Handle<Object> value(Smi::FromInt(42), isolate);
|
||||
|
||||
Handle<JSArray> array =
|
||||
factory->NewJSArray(ElementsKind::FAST_SMI_ELEMENTS, 0, 0);
|
||||
factory->NewJSArray(ElementsKind::PACKED_SMI_ELEMENTS, 0, 0);
|
||||
Handle<Map> previous_map(array->map());
|
||||
CHECK_EQ(FAST_SMI_ELEMENTS, previous_map->elements_kind());
|
||||
CHECK_EQ(PACKED_SMI_ELEMENTS, previous_map->elements_kind());
|
||||
CHECK(EQUALS(array->properties(), empty_fixed_array));
|
||||
CHECK(EQUALS(array->elements(), empty_fixed_array));
|
||||
CHECK_EQ(0, Smi::cast(array->length())->value());
|
||||
@ -216,7 +216,7 @@ TEST(JSArrayAddingProperties) {
|
||||
.Check();
|
||||
// No change in elements_kind but added property => new map
|
||||
CHECK_NE(array->map(), *previous_map);
|
||||
CHECK_EQ(FAST_SMI_ELEMENTS, array->map()->elements_kind());
|
||||
CHECK_EQ(PACKED_SMI_ELEMENTS, array->map()->elements_kind());
|
||||
CHECK_LE(1, array->properties()->length());
|
||||
CHECK(EQUALS(array->elements(), empty_fixed_array));
|
||||
CHECK_EQ(0, Smi::cast(array->length())->value());
|
||||
@ -234,9 +234,9 @@ TEST(JSArrayAddingElements) {
|
||||
Handle<Object> value(Smi::FromInt(42), isolate);
|
||||
|
||||
Handle<JSArray> array =
|
||||
factory->NewJSArray(ElementsKind::FAST_SMI_ELEMENTS, 0, 0);
|
||||
factory->NewJSArray(ElementsKind::PACKED_SMI_ELEMENTS, 0, 0);
|
||||
Handle<Map> previous_map(array->map());
|
||||
CHECK_EQ(FAST_SMI_ELEMENTS, previous_map->elements_kind());
|
||||
CHECK_EQ(PACKED_SMI_ELEMENTS, previous_map->elements_kind());
|
||||
CHECK(EQUALS(array->properties(), empty_fixed_array));
|
||||
CHECK(EQUALS(array->elements(), empty_fixed_array));
|
||||
CHECK_EQ(0, Smi::cast(array->length())->value());
|
||||
@ -247,7 +247,7 @@ TEST(JSArrayAddingElements) {
|
||||
.Check();
|
||||
// no change in elements_kind => no map transition
|
||||
CHECK_EQ(array->map(), *previous_map);
|
||||
CHECK_EQ(FAST_SMI_ELEMENTS, array->map()->elements_kind());
|
||||
CHECK_EQ(PACKED_SMI_ELEMENTS, array->map()->elements_kind());
|
||||
CHECK(EQUALS(array->properties(), empty_fixed_array));
|
||||
CHECK_LE(1, array->elements()->length());
|
||||
CHECK_EQ(1, Smi::cast(array->length())->value());
|
||||
@ -261,7 +261,7 @@ TEST(JSArrayAddingElements) {
|
||||
}
|
||||
// no change in elements_kind => no map transition
|
||||
CHECK_EQ(array->map(), *previous_map);
|
||||
CHECK_EQ(FAST_SMI_ELEMENTS, array->map()->elements_kind());
|
||||
CHECK_EQ(PACKED_SMI_ELEMENTS, array->map()->elements_kind());
|
||||
CHECK(EQUALS(array->properties(), empty_fixed_array));
|
||||
CHECK_LE(non_dict_backing_store_limit, array->elements()->length());
|
||||
CHECK_EQ(non_dict_backing_store_limit, Smi::cast(array->length())->value());
|
||||
@ -294,9 +294,9 @@ TEST(JSArrayAddingElementsGeneralizingiFastSmiElements) {
|
||||
Handle<Object> value_double = factory->NewNumber(3.1415);
|
||||
|
||||
Handle<JSArray> array =
|
||||
factory->NewJSArray(ElementsKind::FAST_SMI_ELEMENTS, 0, 0);
|
||||
factory->NewJSArray(ElementsKind::PACKED_SMI_ELEMENTS, 0, 0);
|
||||
Handle<Map> previous_map(array->map());
|
||||
CHECK_EQ(FAST_SMI_ELEMENTS, previous_map->elements_kind());
|
||||
CHECK_EQ(PACKED_SMI_ELEMENTS, previous_map->elements_kind());
|
||||
CHECK_EQ(0, Smi::cast(array->length())->value());
|
||||
|
||||
// `array[0] = smi_value` doesn't change the elements_kind
|
||||
@ -306,14 +306,14 @@ TEST(JSArrayAddingElementsGeneralizingiFastSmiElements) {
|
||||
.Check();
|
||||
// no change in elements_kind => no map transition
|
||||
CHECK_EQ(array->map(), *previous_map);
|
||||
CHECK_EQ(FAST_SMI_ELEMENTS, array->map()->elements_kind());
|
||||
CHECK_EQ(PACKED_SMI_ELEMENTS, array->map()->elements_kind());
|
||||
CHECK_EQ(1, Smi::cast(array->length())->value());
|
||||
|
||||
// `delete array[0]` does not alter length, but changes the elments_kind
|
||||
name = MakeString("0");
|
||||
CHECK(JSReceiver::DeletePropertyOrElement(array, name).FromMaybe(false));
|
||||
CHECK_NE(array->map(), *previous_map);
|
||||
CHECK_EQ(FAST_HOLEY_SMI_ELEMENTS, array->map()->elements_kind());
|
||||
CHECK_EQ(HOLEY_SMI_ELEMENTS, array->map()->elements_kind());
|
||||
CHECK_EQ(1, Smi::cast(array->length())->value());
|
||||
previous_map = handle(array->map());
|
||||
|
||||
@ -327,7 +327,7 @@ TEST(JSArrayAddingElementsGeneralizingiFastSmiElements) {
|
||||
NONE)
|
||||
.Check();
|
||||
CHECK_EQ(array->map(), *previous_map);
|
||||
CHECK_EQ(FAST_HOLEY_SMI_ELEMENTS, array->map()->elements_kind());
|
||||
CHECK_EQ(HOLEY_SMI_ELEMENTS, array->map()->elements_kind());
|
||||
CHECK_EQ(2, Smi::cast(array->length())->value());
|
||||
|
||||
// Adding a string to the array changes from FAST_HOLEY_SMI to FAST_HOLEY
|
||||
@ -336,7 +336,7 @@ TEST(JSArrayAddingElementsGeneralizingiFastSmiElements) {
|
||||
NONE)
|
||||
.Check();
|
||||
CHECK_NE(array->map(), *previous_map);
|
||||
CHECK_EQ(FAST_HOLEY_ELEMENTS, array->map()->elements_kind());
|
||||
CHECK_EQ(HOLEY_ELEMENTS, array->map()->elements_kind());
|
||||
CHECK_EQ(2, Smi::cast(array->length())->value());
|
||||
previous_map = handle(array->map());
|
||||
|
||||
@ -367,9 +367,9 @@ TEST(JSArrayAddingElementsGeneralizingFastElements) {
|
||||
Handle<Object> value_string(MakeString("value"));
|
||||
|
||||
Handle<JSArray> array =
|
||||
factory->NewJSArray(ElementsKind::FAST_ELEMENTS, 0, 0);
|
||||
factory->NewJSArray(ElementsKind::PACKED_ELEMENTS, 0, 0);
|
||||
Handle<Map> previous_map(array->map());
|
||||
CHECK_EQ(FAST_ELEMENTS, previous_map->elements_kind());
|
||||
CHECK_EQ(PACKED_ELEMENTS, previous_map->elements_kind());
|
||||
CHECK_EQ(0, Smi::cast(array->length())->value());
|
||||
|
||||
// `array[0] = smi_value` doesn't change the elements_kind
|
||||
@ -379,14 +379,14 @@ TEST(JSArrayAddingElementsGeneralizingFastElements) {
|
||||
.Check();
|
||||
// no change in elements_kind => no map transition
|
||||
CHECK_EQ(array->map(), *previous_map);
|
||||
CHECK_EQ(FAST_ELEMENTS, array->map()->elements_kind());
|
||||
CHECK_EQ(PACKED_ELEMENTS, array->map()->elements_kind());
|
||||
CHECK_EQ(1, Smi::cast(array->length())->value());
|
||||
|
||||
// `delete array[0]` does not alter length, but changes the elments_kind
|
||||
name = MakeString("0");
|
||||
CHECK(JSReceiver::DeletePropertyOrElement(array, name).FromMaybe(false));
|
||||
CHECK_NE(array->map(), *previous_map);
|
||||
CHECK_EQ(FAST_HOLEY_ELEMENTS, array->map()->elements_kind());
|
||||
CHECK_EQ(HOLEY_ELEMENTS, array->map()->elements_kind());
|
||||
CHECK_EQ(1, Smi::cast(array->length())->value());
|
||||
previous_map = handle(array->map());
|
||||
|
||||
@ -400,7 +400,7 @@ TEST(JSArrayAddingElementsGeneralizingFastElements) {
|
||||
NONE)
|
||||
.Check();
|
||||
CHECK_EQ(array->map(), *previous_map);
|
||||
CHECK_EQ(FAST_HOLEY_ELEMENTS, array->map()->elements_kind());
|
||||
CHECK_EQ(HOLEY_ELEMENTS, array->map()->elements_kind());
|
||||
CHECK_EQ(2, Smi::cast(array->length())->value());
|
||||
}
|
||||
|
||||
@ -417,16 +417,16 @@ TEST(JSArrayAddingElementsGeneralizingiFastDoubleElements) {
|
||||
Handle<Object> value_double = factory->NewNumber(3.1415);
|
||||
|
||||
Handle<JSArray> array =
|
||||
factory->NewJSArray(ElementsKind::FAST_SMI_ELEMENTS, 0, 0);
|
||||
factory->NewJSArray(ElementsKind::PACKED_SMI_ELEMENTS, 0, 0);
|
||||
Handle<Map> previous_map(array->map());
|
||||
|
||||
// `array[0] = value_double` changes |elements_kind| to FAST_DOUBLE_ELEMENTS
|
||||
// `array[0] = value_double` changes |elements_kind| to PACKED_DOUBLE_ELEMENTS
|
||||
name = MakeString("0");
|
||||
JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value_double,
|
||||
NONE)
|
||||
.Check();
|
||||
CHECK_NE(array->map(), *previous_map);
|
||||
CHECK_EQ(FAST_DOUBLE_ELEMENTS, array->map()->elements_kind());
|
||||
CHECK_EQ(PACKED_DOUBLE_ELEMENTS, array->map()->elements_kind());
|
||||
CHECK_EQ(1, Smi::cast(array->length())->value());
|
||||
previous_map = handle(array->map());
|
||||
|
||||
@ -436,14 +436,14 @@ TEST(JSArrayAddingElementsGeneralizingiFastDoubleElements) {
|
||||
NONE)
|
||||
.Check();
|
||||
CHECK_EQ(array->map(), *previous_map);
|
||||
CHECK_EQ(FAST_DOUBLE_ELEMENTS, array->map()->elements_kind());
|
||||
CHECK_EQ(PACKED_DOUBLE_ELEMENTS, array->map()->elements_kind());
|
||||
CHECK_EQ(2, Smi::cast(array->length())->value());
|
||||
|
||||
// `delete array[0]` does not alter length, but changes the elments_kind
|
||||
name = MakeString("0");
|
||||
CHECK(JSReceiver::DeletePropertyOrElement(array, name).FromMaybe(false));
|
||||
CHECK_NE(array->map(), *previous_map);
|
||||
CHECK_EQ(FAST_HOLEY_DOUBLE_ELEMENTS, array->map()->elements_kind());
|
||||
CHECK_EQ(HOLEY_DOUBLE_ELEMENTS, array->map()->elements_kind());
|
||||
CHECK_EQ(2, Smi::cast(array->length())->value());
|
||||
previous_map = handle(array->map());
|
||||
|
||||
@ -453,16 +453,16 @@ TEST(JSArrayAddingElementsGeneralizingiFastDoubleElements) {
|
||||
NONE)
|
||||
.Check();
|
||||
CHECK_EQ(array->map(), *previous_map);
|
||||
CHECK_EQ(FAST_HOLEY_DOUBLE_ELEMENTS, array->map()->elements_kind());
|
||||
CHECK_EQ(HOLEY_DOUBLE_ELEMENTS, array->map()->elements_kind());
|
||||
CHECK_EQ(2, Smi::cast(array->length())->value());
|
||||
|
||||
// Adding a string to the array changes to elements_kind FAST_ELEMENTS
|
||||
// Adding a string to the array changes to elements_kind PACKED_ELEMENTS
|
||||
name = MakeString("1");
|
||||
JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value_string,
|
||||
NONE)
|
||||
.Check();
|
||||
CHECK_NE(array->map(), *previous_map);
|
||||
CHECK_EQ(FAST_HOLEY_ELEMENTS, array->map()->elements_kind());
|
||||
CHECK_EQ(HOLEY_ELEMENTS, array->map()->elements_kind());
|
||||
CHECK_EQ(2, Smi::cast(array->length())->value());
|
||||
previous_map = handle(array->map());
|
||||
|
||||
|
@ -1696,14 +1696,14 @@ static void TestReconfigureElementsKind_GeneralizeField(
|
||||
const CRFTData& from, const CRFTData& to, const CRFTData& expected) {
|
||||
Isolate* isolate = CcTest::i_isolate();
|
||||
|
||||
Expectations expectations(isolate, FAST_SMI_ELEMENTS);
|
||||
Expectations expectations(isolate, PACKED_SMI_ELEMENTS);
|
||||
|
||||
// Create a map, add required properties to it and initialize expectations.
|
||||
Handle<Map> initial_map = Map::Create(isolate, 0);
|
||||
initial_map->set_elements_kind(FAST_SMI_ELEMENTS);
|
||||
initial_map->set_elements_kind(PACKED_SMI_ELEMENTS);
|
||||
|
||||
Handle<Map> map = initial_map;
|
||||
map = expectations.AsElementsKind(map, FAST_ELEMENTS);
|
||||
map = expectations.AsElementsKind(map, PACKED_ELEMENTS);
|
||||
for (int i = 0; i < kPropCount; i++) {
|
||||
map = expectations.AddDataField(map, NONE, from.constness,
|
||||
from.representation, from.type);
|
||||
@ -1715,7 +1715,7 @@ static void TestReconfigureElementsKind_GeneralizeField(
|
||||
// Create another branch in transition tree (property at index |kDiffProp|
|
||||
// has different representatio/field type), initialize expectations.
|
||||
const int kDiffProp = kPropCount / 2;
|
||||
Expectations expectations2(isolate, FAST_SMI_ELEMENTS);
|
||||
Expectations expectations2(isolate, PACKED_SMI_ELEMENTS);
|
||||
|
||||
Handle<Map> map2 = initial_map;
|
||||
for (int i = 0; i < kPropCount; i++) {
|
||||
@ -1739,7 +1739,7 @@ static void TestReconfigureElementsKind_GeneralizeField(
|
||||
|
||||
// Reconfigure elements kinds of |map2|, which should generalize
|
||||
// representations in |map|.
|
||||
Handle<Map> new_map = Map::ReconfigureElementsKind(map2, FAST_ELEMENTS);
|
||||
Handle<Map> new_map = Map::ReconfigureElementsKind(map2, PACKED_ELEMENTS);
|
||||
|
||||
// |map2| should be left unchanged but marked unstable.
|
||||
CHECK(!map2->is_stable());
|
||||
@ -1790,14 +1790,14 @@ static void TestReconfigureElementsKind_GeneralizeFieldTrivial(
|
||||
bool expected_field_type_dependency = true) {
|
||||
Isolate* isolate = CcTest::i_isolate();
|
||||
|
||||
Expectations expectations(isolate, FAST_SMI_ELEMENTS);
|
||||
Expectations expectations(isolate, PACKED_SMI_ELEMENTS);
|
||||
|
||||
// Create a map, add required properties to it and initialize expectations.
|
||||
Handle<Map> initial_map = Map::Create(isolate, 0);
|
||||
initial_map->set_elements_kind(FAST_SMI_ELEMENTS);
|
||||
initial_map->set_elements_kind(PACKED_SMI_ELEMENTS);
|
||||
|
||||
Handle<Map> map = initial_map;
|
||||
map = expectations.AsElementsKind(map, FAST_ELEMENTS);
|
||||
map = expectations.AsElementsKind(map, PACKED_ELEMENTS);
|
||||
for (int i = 0; i < kPropCount; i++) {
|
||||
map = expectations.AddDataField(map, NONE, from.constness,
|
||||
from.representation, from.type);
|
||||
@ -1809,7 +1809,7 @@ static void TestReconfigureElementsKind_GeneralizeFieldTrivial(
|
||||
// Create another branch in transition tree (property at index |kDiffProp|
|
||||
// has different attributes), initialize expectations.
|
||||
const int kDiffProp = kPropCount / 2;
|
||||
Expectations expectations2(isolate, FAST_SMI_ELEMENTS);
|
||||
Expectations expectations2(isolate, PACKED_SMI_ELEMENTS);
|
||||
|
||||
Handle<Map> map2 = initial_map;
|
||||
for (int i = 0; i < kPropCount; i++) {
|
||||
@ -1833,7 +1833,7 @@ static void TestReconfigureElementsKind_GeneralizeFieldTrivial(
|
||||
|
||||
// Reconfigure elements kinds of |map2|, which should generalize
|
||||
// representations in |map|.
|
||||
Handle<Map> new_map = Map::ReconfigureElementsKind(map2, FAST_ELEMENTS);
|
||||
Handle<Map> new_map = Map::ReconfigureElementsKind(map2, PACKED_ELEMENTS);
|
||||
|
||||
// |map2| should be left unchanged but marked unstable.
|
||||
CHECK(!map2->is_stable());
|
||||
|
@ -1086,7 +1086,7 @@ TEST(DoScavenge) {
|
||||
CcTest::CollectGarbage(i::NEW_SPACE);
|
||||
|
||||
// Create temp object in the new space.
|
||||
Handle<JSArray> temp = factory->NewJSArray(0, FAST_ELEMENTS);
|
||||
Handle<JSArray> temp = factory->NewJSArray(0, PACKED_ELEMENTS);
|
||||
CHECK(isolate->heap()->new_space()->Contains(*temp));
|
||||
|
||||
// Construct a double value that looks like a pointer to the new space object
|
||||
@ -1140,7 +1140,7 @@ TEST(DoScavengeWithIncrementalWriteBarrier) {
|
||||
AlwaysAllocateScope always_allocate(isolate);
|
||||
// Make sure |obj_value| is placed on an old-space evacuation candidate.
|
||||
heap::SimulateFullSpace(old_space);
|
||||
obj_value = factory->NewJSArray(32 * KB, FAST_HOLEY_ELEMENTS, TENURED);
|
||||
obj_value = factory->NewJSArray(32 * KB, HOLEY_ELEMENTS, TENURED);
|
||||
ec_page = Page::FromAddress(obj_value->address());
|
||||
}
|
||||
|
||||
@ -1484,7 +1484,7 @@ static void TestIncrementalWriteBarrier(Handle<Map> map, Handle<Map> new_map,
|
||||
|
||||
// Make sure |obj_value| is placed on an old-space evacuation candidate.
|
||||
heap::SimulateFullSpace(old_space);
|
||||
obj_value = factory->NewJSArray(32 * KB, FAST_HOLEY_ELEMENTS, TENURED);
|
||||
obj_value = factory->NewJSArray(32 * KB, HOLEY_ELEMENTS, TENURED);
|
||||
ec_page = Page::FromAddress(obj_value->address());
|
||||
CHECK_NE(ec_page, Page::FromAddress(obj->address()));
|
||||
}
|
||||
|
@ -11,32 +11,32 @@ var obj = {};
|
||||
array = [];
|
||||
%DebugPrint(array);
|
||||
|
||||
// FAST_SMI_ELEMENTS
|
||||
// PACKED_SMI_ELEMENTS
|
||||
array = [1, 2, 3];
|
||||
%DebugPrint(array);
|
||||
|
||||
// FAST_HOLEY_SMI_ELEMENTS
|
||||
// HOLEY_SMI_ELEMENTS
|
||||
array[10] = 100;
|
||||
array[11] = 100;
|
||||
%DebugPrint(array);
|
||||
|
||||
// FAST_ELEMENTS
|
||||
// PACKED_ELEMENTS
|
||||
array = [1, obj, obj];
|
||||
%DebugPrint(array);
|
||||
|
||||
// FAST_HOLEY_ELEMENTS
|
||||
// HOLEY_ELEMENTS
|
||||
array[100] = obj;
|
||||
array[101] = obj;
|
||||
%DebugPrint(array);
|
||||
|
||||
// FAST_DOUBLE_ELEMENTS
|
||||
// PACKED_DOUBLE_ELEMENTS
|
||||
array = [1.1, 2.2, 3.3, 3.3, 3.3, NaN];
|
||||
%DebugPrint(array);
|
||||
array.push(NaN);
|
||||
array.push(NaN);
|
||||
%DebugPrint(array);
|
||||
|
||||
// FAST_HOLEY_DOUBLE_ELEMENTS
|
||||
// HOLEY_DOUBLE_ELEMENTS
|
||||
array[100] = 1.2;
|
||||
array[101] = 1.2;
|
||||
%DebugPrint(array);
|
||||
|
@ -58,9 +58,9 @@ function ReturnArgsBabelFunction(unused) {
|
||||
}
|
||||
|
||||
function ReturnArgsBabelSetup() {
|
||||
// Warm up with FAST_HOLEY_ELEMENTS
|
||||
// Warm up with HOLEY_ELEMENTS
|
||||
result = ReturnArgsBabelFunction(...strings);
|
||||
// Warm up with FAST_HOLEY_SMI_ELEMENTS
|
||||
// Warm up with HOLEY_SMI_ELEMENTS
|
||||
result = ReturnArgsBabelFunction(...numbers);
|
||||
}
|
||||
|
||||
@ -80,9 +80,9 @@ function ReturnArgsNativeFunction(unused, ...args) {
|
||||
}
|
||||
|
||||
function ReturnArgsNativeSetup() {
|
||||
// Warm up with FAST_HOLEY_ELEMENTS
|
||||
// Warm up with HOLEY_ELEMENTS
|
||||
result = ReturnArgsNativeFunction(...strings);
|
||||
// Warm up with FAST_HOLEY_SMI_ELEMENTS
|
||||
// Warm up with HOLEY_SMI_ELEMENTS
|
||||
result = ReturnArgsNativeFunction(...numbers);
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
var kIterCount = 1;
|
||||
var kTests = {
|
||||
Array: {
|
||||
FAST_ELEMENTS() {
|
||||
PACKED_ELEMENTS() {
|
||||
var r = /foo/;
|
||||
var s = new String("bar");
|
||||
var p = new Proxy({}, {});
|
||||
@ -26,7 +26,7 @@ var kTests = {
|
||||
}
|
||||
},
|
||||
|
||||
FAST_HOLEY_ELEMENTS() {
|
||||
HOLEY_ELEMENTS() {
|
||||
var r = /foo/;
|
||||
var p = new Proxy({}, {});
|
||||
var o = {};
|
||||
@ -41,7 +41,7 @@ var kTests = {
|
||||
}
|
||||
},
|
||||
|
||||
FAST_SMI_ELEMENTS() {
|
||||
PACKED_SMI_ELEMENTS() {
|
||||
var array = [0, 88, 9999, 1, -5, 7];
|
||||
assertTrue(%HasFastSmiElements(array));
|
||||
assertFalse(%HasFastHoleyElements(array));
|
||||
@ -55,7 +55,7 @@ var kTests = {
|
||||
}
|
||||
},
|
||||
|
||||
FAST_HOLEY_SMI_ELEMENTS() {
|
||||
HOLEY_SMI_ELEMENTS() {
|
||||
var array = [49, , , 72, , , 67, -48];
|
||||
assertTrue(%HasFastSmiElements(array));
|
||||
assertTrue(%HasFastHoleyElements(array));
|
||||
@ -70,7 +70,7 @@ var kTests = {
|
||||
}
|
||||
},
|
||||
|
||||
FAST_DOUBLE_ELEMENTS() {
|
||||
PACKED_DOUBLE_ELEMENTS() {
|
||||
var array = [7.00000001, -13000.89412, 73451.4124,
|
||||
5824.48, 6.0000495, 48.3488, 44.0, 76.35, NaN, 78.4];
|
||||
assertTrue(%HasFastDoubleElements(array));
|
||||
@ -87,7 +87,7 @@ var kTests = {
|
||||
}
|
||||
},
|
||||
|
||||
FAST_HOLEY_DOUBLE_ELEMENTS() {
|
||||
HOLEY_DOUBLE_ELEMENTS() {
|
||||
var array = [7.00000001, -13000.89412, ,
|
||||
5824.48, , 48.3488, , NaN, , 78.4];
|
||||
assertTrue(%HasFastDoubleElements(array));
|
||||
@ -123,7 +123,7 @@ var kTests = {
|
||||
},
|
||||
|
||||
Object: {
|
||||
FAST_ELEMENTS() {
|
||||
PACKED_ELEMENTS() {
|
||||
var r = /foo/;
|
||||
var s = new String("bar");
|
||||
var p = new Proxy({}, {});
|
||||
@ -131,7 +131,7 @@ var kTests = {
|
||||
|
||||
var object = { 0: r, 1: s, 2: p, length: 3 };
|
||||
assertTrue(%HasFastObjectElements(object));
|
||||
// TODO(caitp): JSObjects always seem to start with FAST_HOLEY_ELEMENTS
|
||||
// TODO(caitp): JSObjects always seem to start with HOLEY_ELEMENTS
|
||||
// assertFalse(%HasFastHoleyElements(object));
|
||||
|
||||
for (var i = 0; i < kIterCount; ++i) {
|
||||
@ -140,7 +140,7 @@ var kTests = {
|
||||
}
|
||||
},
|
||||
|
||||
FAST_HOLEY_ELEMENTS() {
|
||||
HOLEY_ELEMENTS() {
|
||||
var r = /foo/;
|
||||
var p = new Proxy({}, {});
|
||||
var o = {};
|
||||
@ -155,9 +155,9 @@ var kTests = {
|
||||
}
|
||||
},
|
||||
|
||||
FAST_SMI_ELEMENTS() {
|
||||
PACKED_SMI_ELEMENTS() {
|
||||
var object = { 0: 0, 1: 88, 2: 9999, 3: 1, 4: -5, 5: 7, length: 6 };
|
||||
// TODO(caitp): JSObjects always seem to start with FAST_HOLEY_ELEMENTS
|
||||
// TODO(caitp): JSObjects always seem to start with HOLEY_ELEMENTS
|
||||
// assertTrue(%HasFastSmiElements(object));
|
||||
// assertFalse(%HasFastHoleyElements(object));
|
||||
|
||||
@ -170,9 +170,9 @@ var kTests = {
|
||||
}
|
||||
},
|
||||
|
||||
FAST_HOLEY_SMI_ELEMENTS() {
|
||||
HOLEY_SMI_ELEMENTS() {
|
||||
var object = { 0: 49, 3: 72, 6: 67, 7: -48, length: 8 };
|
||||
// TODO(caitp): JSObjects always seem to start with FAST_HOLEY_ELEMENTS
|
||||
// TODO(caitp): JSObjects always seem to start with HOLEY_ELEMENTS
|
||||
// assertTrue(%HasFastSmiElements(object));
|
||||
// assertTrue(%HasFastHoleyElements(object));
|
||||
|
||||
@ -186,11 +186,11 @@ var kTests = {
|
||||
}
|
||||
},
|
||||
|
||||
FAST_DOUBLE_ELEMENTS() {
|
||||
PACKED_DOUBLE_ELEMENTS() {
|
||||
var object = { 0: 7.00000001, 1: -13000.89412, 2: 73451.4124,
|
||||
3: 5824.48, 4: 6.0000495, 5: 48.3488, 6: 44.0, 7: 76.35,
|
||||
8: NaN, 9: 78.4, length: 10 };
|
||||
// TODO(caitp): JSObjects always seem to start with FAST_HOLEY_ELEMENTS
|
||||
// TODO(caitp): JSObjects always seem to start with HOLEY_ELEMENTS
|
||||
// assertTrue(%HasFastDoubleElements(object));
|
||||
// assertFalse(%HasFastHoleyElements(object));
|
||||
|
||||
@ -205,10 +205,10 @@ var kTests = {
|
||||
}
|
||||
},
|
||||
|
||||
FAST_HOLEY_DOUBLE_ELEMENTS() {
|
||||
HOLEY_DOUBLE_ELEMENTS() {
|
||||
var object = { 0: 7.00000001, 1: -13000.89412, 3: 5824.48, 5: 48.3488,
|
||||
7: NaN, 9: 78.4, length: 10 };
|
||||
// TODO(caitp): JSObjects always seem to start with FAST_HOLEY_ELEMENTS
|
||||
// TODO(caitp): JSObjects always seem to start with HOLEY_ELEMENTS
|
||||
// assertTrue(%HasFastDoubleElements(object));
|
||||
// assertTrue(%HasFastHoleyElements(object));
|
||||
|
||||
|
@ -95,8 +95,8 @@ function test_wrapper() {
|
||||
a[1] = 2.5;
|
||||
}
|
||||
a.foo = object; // This map check should NOT be hoistable because it
|
||||
// includes a check for the FAST_ELEMENTS map as well as
|
||||
// the FAST_DOUBLE_ELEMENTS map, which depends on the
|
||||
// includes a check for the PACKED_ELEMENTS map as well as
|
||||
// the PACKED_DOUBLE_ELEMENTS map, which depends on the
|
||||
// double transition above in the if, which cannot be
|
||||
// hoisted.
|
||||
} while (--count > 0);
|
||||
|
@ -11,13 +11,13 @@ let global = this;
|
||||
let tests = {
|
||||
FastElementsKind() {
|
||||
let runners = {
|
||||
FAST_SMI_ELEMENTS(array) {
|
||||
PACKED_SMI_ELEMENTS(array) {
|
||||
let sum = 0;
|
||||
for (let x of array) sum += x;
|
||||
return sum;
|
||||
},
|
||||
|
||||
FAST_HOLEY_SMI_ELEMENTS(array) {
|
||||
HOLEY_SMI_ELEMENTS(array) {
|
||||
let sum = 0;
|
||||
for (let x of array) {
|
||||
if (x) sum += x;
|
||||
@ -25,25 +25,25 @@ let tests = {
|
||||
return sum;
|
||||
},
|
||||
|
||||
FAST_ELEMENTS(array) {
|
||||
PACKED_ELEMENTS(array) {
|
||||
let ret = "";
|
||||
for (let str of array) ret += `> ${str}`;
|
||||
return ret;
|
||||
},
|
||||
|
||||
FAST_HOLEY_ELEMENTS(array) {
|
||||
HOLEY_ELEMENTS(array) {
|
||||
let ret = "";
|
||||
for (let str of array) ret += `> ${str}`;
|
||||
return ret;
|
||||
},
|
||||
|
||||
FAST_DOUBLE_ELEMENTS(array) {
|
||||
PACKED_DOUBLE_ELEMENTS(array) {
|
||||
let sum = 0.0;
|
||||
for (let x of array) sum += x;
|
||||
return sum;
|
||||
},
|
||||
|
||||
FAST_HOLEY_DOUBLE_ELEMENTS(array) {
|
||||
HOLEY_DOUBLE_ELEMENTS(array) {
|
||||
let sum = 0.0;
|
||||
for (let x of array) {
|
||||
if (x) sum += x;
|
||||
@ -53,38 +53,38 @@ let tests = {
|
||||
};
|
||||
|
||||
let tests = {
|
||||
FAST_SMI_ELEMENTS: {
|
||||
PACKED_SMI_ELEMENTS: {
|
||||
array: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
||||
expected: 55,
|
||||
array2: [1, 2, 3],
|
||||
expected2: 6
|
||||
},
|
||||
FAST_HOLEY_SMI_ELEMENTS: {
|
||||
HOLEY_SMI_ELEMENTS: {
|
||||
array: [1, , 3, , 5, , 7, , 9, ,],
|
||||
expected: 25,
|
||||
array2: [1, , 3],
|
||||
expected2: 4
|
||||
},
|
||||
FAST_ELEMENTS: {
|
||||
PACKED_ELEMENTS: {
|
||||
array: ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"],
|
||||
expected: "> a> b> c> d> e> f> g> h> i> j",
|
||||
array2: ["a", "b", "c"],
|
||||
expected2: "> a> b> c"
|
||||
},
|
||||
FAST_HOLEY_ELEMENTS: {
|
||||
HOLEY_ELEMENTS: {
|
||||
array: ["a", , "c", , "e", , "g", , "i", ,],
|
||||
expected: "> a> undefined> c> undefined> e> undefined> g" +
|
||||
"> undefined> i> undefined",
|
||||
array2: ["a", , "c"],
|
||||
expected2: "> a> undefined> c"
|
||||
},
|
||||
FAST_DOUBLE_ELEMENTS: {
|
||||
PACKED_DOUBLE_ELEMENTS: {
|
||||
array: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0],
|
||||
expected: 5.5,
|
||||
array2: [0.6, 0.4, 0.2],
|
||||
expected2: 1.2
|
||||
},
|
||||
FAST_HOLEY_DOUBLE_ELEMENTS: {
|
||||
HOLEY_DOUBLE_ELEMENTS: {
|
||||
array: [0.1, , 0.3, , 0.5, , 0.7, , 0.9, ,],
|
||||
expected: 2.5,
|
||||
array2: [0.1, , 0.3],
|
||||
|
@ -12,7 +12,7 @@
|
||||
var kIterCount = 1;
|
||||
var kTests = {
|
||||
Array: {
|
||||
FAST_ELEMENTS() {
|
||||
PACKED_ELEMENTS() {
|
||||
var r = /foo/;
|
||||
var s = new String("bar");
|
||||
var p = new Proxy({}, {});
|
||||
@ -28,7 +28,7 @@ var kTests = {
|
||||
}
|
||||
},
|
||||
|
||||
FAST_HOLEY_ELEMENTS() {
|
||||
HOLEY_ELEMENTS() {
|
||||
var r = /foo/;
|
||||
var p = new Proxy({}, {});
|
||||
var o = {};
|
||||
@ -43,7 +43,7 @@ var kTests = {
|
||||
}
|
||||
},
|
||||
|
||||
FAST_SMI_ELEMENTS() {
|
||||
PACKED_SMI_ELEMENTS() {
|
||||
var array = [0, 88, 9999, 1, -5, 7];
|
||||
assertTrue(%HasFastSmiElements(array));
|
||||
assertFalse(%HasFastHoleyElements(array));
|
||||
@ -57,7 +57,7 @@ var kTests = {
|
||||
}
|
||||
},
|
||||
|
||||
FAST_HOLEY_SMI_ELEMENTS() {
|
||||
HOLEY_SMI_ELEMENTS() {
|
||||
var array = [49, , , 72, , , 67, -48];
|
||||
assertTrue(%HasFastSmiElements(array));
|
||||
assertTrue(%HasFastHoleyElements(array));
|
||||
@ -72,7 +72,7 @@ var kTests = {
|
||||
}
|
||||
},
|
||||
|
||||
FAST_DOUBLE_ELEMENTS() {
|
||||
PACKED_DOUBLE_ELEMENTS() {
|
||||
var array = [7.00000001, -13000.89412, 73451.4124,
|
||||
5824.48, 6.0000495, 48.3488, 44.0, 76.35, NaN, 78.4];
|
||||
assertTrue(%HasFastDoubleElements(array));
|
||||
@ -89,7 +89,7 @@ var kTests = {
|
||||
}
|
||||
},
|
||||
|
||||
FAST_HOLEY_DOUBLE_ELEMENTS() {
|
||||
HOLEY_DOUBLE_ELEMENTS() {
|
||||
var array = [7.00000001, -13000.89412, ,
|
||||
5824.48, , 48.3488, , NaN, , 78.4];
|
||||
assertTrue(%HasFastDoubleElements(array));
|
||||
@ -125,7 +125,7 @@ var kTests = {
|
||||
},
|
||||
|
||||
Object: {
|
||||
FAST_ELEMENTS() {
|
||||
PACKED_ELEMENTS() {
|
||||
var r = /foo/;
|
||||
var s = new String("bar");
|
||||
var p = new Proxy({}, {});
|
||||
@ -133,7 +133,7 @@ var kTests = {
|
||||
|
||||
var object = { 0: r, 1: s, 2: p, length: 3 };
|
||||
assertTrue(%HasFastObjectElements(object));
|
||||
// TODO(caitp): JSObjects always seem to start with FAST_HOLEY_ELEMENTS
|
||||
// TODO(caitp): JSObjects always seem to start with HOLEY_ELEMENTS
|
||||
// assertFalse(%HasFastHoleyElements(object));
|
||||
|
||||
for (var i = 0; i < kIterCount; ++i) {
|
||||
@ -142,7 +142,7 @@ var kTests = {
|
||||
}
|
||||
},
|
||||
|
||||
FAST_HOLEY_ELEMENTS() {
|
||||
HOLEY_ELEMENTS() {
|
||||
var r = /foo/;
|
||||
var p = new Proxy({}, {});
|
||||
var o = {};
|
||||
@ -157,9 +157,9 @@ var kTests = {
|
||||
}
|
||||
},
|
||||
|
||||
FAST_SMI_ELEMENTS() {
|
||||
PACKED_SMI_ELEMENTS() {
|
||||
var object = { 0: 0, 1: 88, 2: 9999, 3: 1, 4: -5, 5: 7, length: 6 };
|
||||
// TODO(caitp): JSObjects always seem to start with FAST_HOLEY_ELEMENTS
|
||||
// TODO(caitp): JSObjects always seem to start with HOLEY_ELEMENTS
|
||||
// assertTrue(%HasFastSmiElements(object));
|
||||
// assertFalse(%HasFastHoleyElements(object));
|
||||
|
||||
@ -172,9 +172,9 @@ var kTests = {
|
||||
}
|
||||
},
|
||||
|
||||
FAST_HOLEY_SMI_ELEMENTS() {
|
||||
HOLEY_SMI_ELEMENTS() {
|
||||
var object = { 0: 49, 3: 72, 6: 67, 7: -48, length: 8 };
|
||||
// TODO(caitp): JSObjects always seem to start with FAST_HOLEY_ELEMENTS
|
||||
// TODO(caitp): JSObjects always seem to start with HOLEY_ELEMENTS
|
||||
// assertTrue(%HasFastSmiElements(object));
|
||||
// assertTrue(%HasFastHoleyElements(object));
|
||||
|
||||
@ -188,11 +188,11 @@ var kTests = {
|
||||
}
|
||||
},
|
||||
|
||||
FAST_DOUBLE_ELEMENTS() {
|
||||
PACKED_DOUBLE_ELEMENTS() {
|
||||
var object = { 0: 7.00000001, 1: -13000.89412, 2: 73451.4124,
|
||||
3: 5824.48, 4: 6.0000495, 5: 48.3488, 6: 44.0, 7: 76.35,
|
||||
8: NaN, 9: 78.4, length: 10 };
|
||||
// TODO(caitp): JSObjects always seem to start with FAST_HOLEY_ELEMENTS
|
||||
// TODO(caitp): JSObjects always seem to start with HOLEY_ELEMENTS
|
||||
// assertTrue(%HasFastDoubleElements(object));
|
||||
// assertFalse(%HasFastHoleyElements(object));
|
||||
|
||||
@ -207,10 +207,10 @@ var kTests = {
|
||||
}
|
||||
},
|
||||
|
||||
FAST_HOLEY_DOUBLE_ELEMENTS() {
|
||||
HOLEY_DOUBLE_ELEMENTS() {
|
||||
var object = { 0: 7.00000001, 1: -13000.89412, 3: 5824.48, 5: 48.3488,
|
||||
7: NaN, 9: 78.4, length: 10 };
|
||||
// TODO(caitp): JSObjects always seem to start with FAST_HOLEY_ELEMENTS
|
||||
// TODO(caitp): JSObjects always seem to start with HOLEY_ELEMENTS
|
||||
// assertTrue(%HasFastDoubleElements(object));
|
||||
// assertTrue(%HasFastHoleyElements(object));
|
||||
|
||||
|
@ -276,12 +276,12 @@ TestMutateDuringEnumeration();
|
||||
}
|
||||
|
||||
var element_kinds = {
|
||||
FAST_SMI_ELEMENTS: [ [1, 2, 3], [ ["0", 1], ["1", 2], ["2", 3] ] ],
|
||||
FAST_HOLEY_SMI_ELEMENTS: [ [, , 3], [ ["2", 3] ] ],
|
||||
FAST_ELEMENTS: [ [O1, O2, O3], [ ["0", O1], ["1", O2], ["2", O3] ] ],
|
||||
FAST_HOLEY_ELEMENTS: [ [, , O3], [ ["2", O3] ] ],
|
||||
FAST_DOUBLE_ELEMENTS: [ [E, NaN, PI], [ ["0", E], ["1", NaN], ["2", PI] ] ],
|
||||
FAST_HOLEY_DOUBLE_ELEMENTS: [ [, , NaN], [ ["2", NaN] ] ],
|
||||
PACKED_SMI_ELEMENTS: [ [1, 2, 3], [ ["0", 1], ["1", 2], ["2", 3] ] ],
|
||||
HOLEY_SMI_ELEMENTS: [ [, , 3], [ ["2", 3] ] ],
|
||||
PACKED_ELEMENTS: [ [O1, O2, O3], [ ["0", O1], ["1", O2], ["2", O3] ] ],
|
||||
HOLEY_ELEMENTS: [ [, , O3], [ ["2", O3] ] ],
|
||||
PACKED_DOUBLE_ELEMENTS: [ [E, NaN, PI], [ ["0", E], ["1", NaN], ["2", PI] ] ],
|
||||
HOLEY_DOUBLE_ELEMENTS: [ [, , NaN], [ ["2", NaN] ] ],
|
||||
|
||||
DICTIONARY_ELEMENTS: [ Object.defineProperties({ 10000: "world" }, {
|
||||
100: { enumerable: true, value: "hello" },
|
||||
|
@ -256,12 +256,12 @@ TestMutateDuringEnumeration();
|
||||
}
|
||||
|
||||
var element_kinds = {
|
||||
FAST_SMI_ELEMENTS: [ [1, 2, 3], [1, 2, 3] ],
|
||||
FAST_HOLEY_SMI_ELEMENTS: [ [, , 3], [ 3 ] ],
|
||||
FAST_ELEMENTS: [ [O1, O2, O3], [O1, O2, O3] ],
|
||||
FAST_HOLEY_ELEMENTS: [ [, , O3], [O3] ],
|
||||
FAST_DOUBLE_ELEMENTS: [ [E, NaN, PI], [E, NaN, PI] ],
|
||||
FAST_HOLEY_DOUBLE_ELEMENTS: [ [, , NaN], [NaN] ],
|
||||
PACKED_SMI_ELEMENTS: [ [1, 2, 3], [1, 2, 3] ],
|
||||
HOLEY_SMI_ELEMENTS: [ [, , 3], [ 3 ] ],
|
||||
PACKED_ELEMENTS: [ [O1, O2, O3], [O1, O2, O3] ],
|
||||
HOLEY_ELEMENTS: [ [, , O3], [O3] ],
|
||||
PACKED_DOUBLE_ELEMENTS: [ [E, NaN, PI], [E, NaN, PI] ],
|
||||
HOLEY_DOUBLE_ELEMENTS: [ [, , NaN], [NaN] ],
|
||||
|
||||
DICTIONARY_ELEMENTS: [ Object.defineProperties({ 10000: "world" }, {
|
||||
100: { enumerable: true, value: "hello" },
|
||||
|
@ -80,7 +80,7 @@ function base_getter_test(create_func) {
|
||||
assertUnoptimized(foo);
|
||||
// Smi and Double elements transition the KeyedLoadIC to Generic state
|
||||
// here, because they miss twice with the same map when loading the hole.
|
||||
// For FAST_HOLEY_ELEMENTS, however, the IC knows how to convert the hole
|
||||
// For HOLEY_ELEMENTS, however, the IC knows how to convert the hole
|
||||
// to undefined if the prototype is the original array prototype, so it
|
||||
// stays monomorphic for now...
|
||||
foo(a);
|
||||
|
@ -19,10 +19,10 @@ function foo() {
|
||||
keyed_store(obj, "dbl", 100);
|
||||
keyed_store(obj, "obj", 100);
|
||||
|
||||
// Now call with a FAST_SMI_ELEMENTS object.
|
||||
// Now call with a PACKED_SMI_ELEMENTS object.
|
||||
var smi_array = [5, 1, 1];
|
||||
keyed_store(smi_array, 1, 6);
|
||||
// Transition from FAST_SMI_ELEMENTS to FAST_DOUBLE_ELEMENTS.
|
||||
// Transition from PACKED_SMI_ELEMENTS to PACKED_DOUBLE_ELEMENTS.
|
||||
keyed_store(smi_array, 2, 1.2);
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
function boom(a1, a2) {
|
||||
// Do something with a2 that needs a map check (for DOUBLE_ELEMENTS).
|
||||
var s = a2[0];
|
||||
// Emit a load that transitions a1 to FAST_ELEMENTS.
|
||||
// Emit a load that transitions a1 to PACKED_ELEMENTS.
|
||||
var t = a1[0];
|
||||
// Emit a store to a2 that assumes DOUBLE_ELEMENTS.
|
||||
// The map check is considered redundant and will be eliminated.
|
||||
|
@ -8,7 +8,7 @@ function getRandomProperty(v, rand) { var properties = Object.getOwnPropertyName
|
||||
var __v_4 = {};
|
||||
|
||||
__v_2 = {
|
||||
FAST_ELEMENTS() {
|
||||
PACKED_ELEMENTS() {
|
||||
return {
|
||||
get 0() {
|
||||
} };
|
||||
|
@ -49,12 +49,12 @@ function g(x) {
|
||||
return [1.1, 1.2, 1.3, f(x)];
|
||||
}
|
||||
|
||||
// Step 1: Optimize g() to contain a FAST_DOUBLE_ELEMENTS boilerplate.
|
||||
// Step 1: Optimize g() to contain a PACKED_DOUBLE_ELEMENTS boilerplate.
|
||||
assertEquals([1.1, 1.2, 1.3, 1.4], g(1));
|
||||
assertEquals([1.1, 1.2, 1.3, 1.5], g(2));
|
||||
%OptimizeFunctionOnNextCall(g);
|
||||
|
||||
// Step 2: Deoptimize g() and transition to FAST_ELEMENTS boilerplate.
|
||||
// Step 2: Deoptimize g() and transition to PACKED_ELEMENTS boilerplate.
|
||||
assertEquals([1.1, 1.2, 1.3, {}], g(3));
|
||||
|
||||
// Step 3: Cause a GC while broken clone of boilerplate is on the heap,
|
||||
|
@ -154,9 +154,9 @@ consts_misc = [
|
||||
'value': 'DescriptorArray::kEntrySize' },
|
||||
|
||||
{ 'name': 'elements_fast_holey_elements',
|
||||
'value': 'FAST_HOLEY_ELEMENTS' },
|
||||
'value': 'HOLEY_ELEMENTS' },
|
||||
{ 'name': 'elements_fast_elements',
|
||||
'value': 'FAST_ELEMENTS' },
|
||||
'value': 'PACKED_ELEMENTS' },
|
||||
{ 'name': 'elements_dictionary_elements',
|
||||
'value': 'DICTIONARY_ELEMENTS' },
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user