[Promise.any] Make AggregateError.errors a data property

See https://github.com/tc39/proposal-promise-any/pull/64/

Bug: v8:9808
Change-Id: I5f11a5e306d17372ba7c24f313165de985444470
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2214826
Commit-Queue: Marja Hölttä <marja@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68034}
This commit is contained in:
Marja Hölttä 2020-05-28 09:58:37 +02:00 committed by Commit Bot
parent 2d445c4816
commit 0c44673ae7
22 changed files with 121 additions and 288 deletions

View File

@ -1010,6 +1010,7 @@ action("postmortem-metadata") {
} }
torque_files = [ torque_files = [
"src/builtins/aggregate-error.tq",
"src/builtins/array-copywithin.tq", "src/builtins/array-copywithin.tq",
"src/builtins/array-every.tq", "src/builtins/array-every.tq",
"src/builtins/array-filter.tq", "src/builtins/array-filter.tq",
@ -1136,7 +1137,6 @@ torque_files = [
"src/objects/heap-number.tq", "src/objects/heap-number.tq",
"src/objects/heap-object.tq", "src/objects/heap-object.tq",
"src/objects/intl-objects.tq", "src/objects/intl-objects.tq",
"src/objects/js-aggregate-error.tq",
"src/objects/js-array-buffer.tq", "src/objects/js-array-buffer.tq",
"src/objects/js-array.tq", "src/objects/js-array.tq",
"src/objects/js-collection-iterator.tq", "src/objects/js-collection-iterator.tq",
@ -2694,8 +2694,6 @@ v8_source_set("v8_base_without_compiler") {
"src/objects/internal-index.h", "src/objects/internal-index.h",
"src/objects/intl-objects.cc", "src/objects/intl-objects.cc",
"src/objects/intl-objects.h", "src/objects/intl-objects.h",
"src/objects/js-aggregate-error-inl.h",
"src/objects/js-aggregate-error.h",
"src/objects/js-array-buffer-inl.h", "src/objects/js-array-buffer-inl.h",
"src/objects/js-array-buffer.cc", "src/objects/js-array-buffer.cc",
"src/objects/js-array-buffer.h", "src/objects/js-array-buffer.h",

View File

@ -0,0 +1,44 @@
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include 'src/objects/js-objects.h'
namespace error {
transitioning javascript builtin AggregateErrorConstructor(
js-implicit context: NativeContext, target: JSFunction,
newTarget: JSAny)(...arguments): JSAny {
// This function is implementing the spec as suggested by
// https://github.com/tc39/proposal-promise-any/pull/59 . FIXME(marja):
// change this if the PR is declined, otherwise remove the comment.
// 1. If NewTarget is undefined, let newTarget be the active function
// object, else let newTarget be NewTarget.
// 2. Let O be ? OrdinaryCreateFromConstructor(newTarget,
// "%AggregateError.prototype%", « [[ErrorData]], [[AggregateErrors]] »).
// 3. If _message_ is not _undefined_, then
// a. Let msg be ? ToString(_message_).
// b. Let msgDesc be the PropertyDescriptor { [[Value]]: _msg_,
// [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *true*
// c. Perform ! DefinePropertyOrThrow(_O_, *"message"*, _msgDesc_).
const message: JSAny = arguments[1];
const obj: JSObject =
ConstructAggregateErrorHelper(context, target, newTarget, message);
// 4. Let errorsList be ? IterableToList(errors).
const errors: JSAny = arguments[0];
const errorsList = iterator::IterableToListWithSymbolLookup(errors);
// 5. Perform ! CreateDataPropertyOrThrow(_O_, `"errors"`, _errorsList_).
CreateDataProperty(obj, ErrorsStringConstant(), errorsList);
// 6. Return O.
return obj;
}
extern runtime ConstructAggregateErrorHelper(
Context, JSFunction, JSAny, Object): JSObject;
extern runtime ConstructInternalAggregateErrorHelper(Context, Object): JSObject;
}

View File

@ -384,6 +384,7 @@ type NumberOrUndefined = Number|Undefined;
extern macro DefaultStringConstant(): String; extern macro DefaultStringConstant(): String;
extern macro EmptyStringConstant(): EmptyString; extern macro EmptyStringConstant(): EmptyString;
extern macro ErrorsStringConstant(): String;
extern macro FalseConstant(): False; extern macro FalseConstant(): False;
extern macro Int32FalseConstant(): bool; extern macro Int32FalseConstant(): bool;
extern macro Int32TrueConstant(): bool; extern macro Int32TrueConstant(): bool;

View File

@ -12,7 +12,6 @@ extern macro IsFeedbackCell(HeapObject): bool;
extern macro IsFeedbackVector(HeapObject): bool; extern macro IsFeedbackVector(HeapObject): bool;
extern macro IsFixedArray(HeapObject): bool; extern macro IsFixedArray(HeapObject): bool;
extern macro IsHeapNumber(HeapObject): bool; extern macro IsHeapNumber(HeapObject): bool;
extern macro IsJSAggregateError(HeapObject): bool;
extern macro IsJSArray(HeapObject): bool; extern macro IsJSArray(HeapObject): bool;
extern macro IsJSArrayMap(Map): bool; extern macro IsJSArrayMap(Map): bool;
extern macro IsJSBoundFunction(HeapObject): bool; extern macro IsJSBoundFunction(HeapObject): bool;
@ -60,8 +59,6 @@ extern macro TaggedToPositiveSmi(Object): PositiveSmi
labels CastError; labels CastError;
extern macro TaggedToDirectString(Object): DirectString extern macro TaggedToDirectString(Object): DirectString
labels CastError; labels CastError;
extern macro HeapObjectToJSAggregateError(HeapObject): JSAggregateError
labels CastError;
extern macro HeapObjectToJSArray(HeapObject): JSArray extern macro HeapObjectToJSArray(HeapObject): JSArray
labels CastError; labels CastError;
extern macro HeapObjectToCallable(HeapObject): Callable extern macro HeapObjectToCallable(HeapObject): Callable
@ -386,11 +383,6 @@ Cast<Undefined|Callable>(o: HeapObject): Undefined|Callable
return HeapObjectToCallable(o) otherwise CastError; return HeapObjectToCallable(o) otherwise CastError;
} }
Cast<JSAggregateError>(o: HeapObject): JSAggregateError
labels CastError {
return HeapObjectToJSAggregateError(o) otherwise CastError;
}
Cast<JSArray>(o: HeapObject): JSArray Cast<JSArray>(o: HeapObject): JSArray
labels CastError { labels CastError {
return HeapObjectToJSArray(o) otherwise CastError; return HeapObjectToJSArray(o) otherwise CastError;

View File

@ -362,9 +362,10 @@ PromiseAny(
transitioning macro ConstructAggregateError(implicit context: Context)( transitioning macro ConstructAggregateError(implicit context: Context)(
errors: FixedArray): JSObject { errors: FixedArray): JSObject {
const obj: JSAggregateError = error::ConstructInternalAggregateErrorHelper( const obj: JSObject = error::ConstructInternalAggregateErrorHelper(
context, SmiConstant(MessageTemplate::kAllPromisesRejected)); context, SmiConstant(MessageTemplate::kAllPromisesRejected));
obj.errors = errors; const errorsJSArray = array::CreateJSArrayWithElements(errors);
CreateDataProperty(obj, ErrorsStringConstant(), errorsJSArray);
return obj; return obj;
} }

View File

@ -20,7 +20,6 @@
#include "src/objects/descriptor-array.h" #include "src/objects/descriptor-array.h"
#include "src/objects/function-kind.h" #include "src/objects/function-kind.h"
#include "src/objects/heap-number.h" #include "src/objects/heap-number.h"
#include "src/objects/js-aggregate-error.h"
#include "src/objects/js-generator.h" #include "src/objects/js-generator.h"
#include "src/objects/oddball.h" #include "src/objects/oddball.h"
#include "src/objects/ordered-hash-table-inl.h" #include "src/objects/ordered-hash-table-inl.h"
@ -4733,12 +4732,6 @@ void CodeStubAssembler::CopyFixedArrayElements(
Comment("] CopyFixedArrayElements"); Comment("] CopyFixedArrayElements");
} }
TNode<JSAggregateError> CodeStubAssembler::HeapObjectToJSAggregateError(
TNode<HeapObject> heap_object, Label* fail) {
GotoIfNot(IsJSAggregateError(heap_object), fail);
return UncheckedCast<JSAggregateError>(heap_object);
}
TNode<FixedArray> CodeStubAssembler::HeapObjectToFixedArray( TNode<FixedArray> CodeStubAssembler::HeapObjectToFixedArray(
TNode<HeapObject> base, Label* cast_fail) { TNode<HeapObject> base, Label* cast_fail) {
Label fixed_array(this); Label fixed_array(this);
@ -5980,10 +5973,6 @@ TNode<BoolT> CodeStubAssembler::IsJSPrimitiveWrapperMap(SloppyTNode<Map> map) {
return IsJSPrimitiveWrapperInstanceType(LoadMapInstanceType(map)); return IsJSPrimitiveWrapperInstanceType(LoadMapInstanceType(map));
} }
TNode<BoolT> CodeStubAssembler::IsJSAggregateError(TNode<HeapObject> object) {
return HasInstanceType(object, JS_AGGREGATE_ERROR_TYPE);
}
TNode<BoolT> CodeStubAssembler::IsJSArrayInstanceType( TNode<BoolT> CodeStubAssembler::IsJSArrayInstanceType(
SloppyTNode<Int32T> instance_type) { SloppyTNode<Int32T> instance_type) {
return InstanceTypeEqual(instance_type, JS_ARRAY_TYPE); return InstanceTypeEqual(instance_type, JS_ARRAY_TYPE);

View File

@ -137,6 +137,7 @@ enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol };
EmptySlowElementDictionary) \ EmptySlowElementDictionary) \
V(empty_string, empty_string, EmptyString) \ V(empty_string, empty_string, EmptyString) \
V(error_to_string, error_to_string, ErrorToString) \ V(error_to_string, error_to_string, ErrorToString) \
V(errors_string, errors_string, ErrorsString) \
V(FalseValue, false_value, False) \ V(FalseValue, false_value, False) \
V(FeedbackVectorMap, feedback_vector_map, FeedbackVectorMap) \ V(FeedbackVectorMap, feedback_vector_map, FeedbackVectorMap) \
V(FixedArrayMap, fixed_array_map, FixedArrayMap) \ V(FixedArrayMap, fixed_array_map, FixedArrayMap) \
@ -469,9 +470,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
return UncheckedCast<HeapObject>(value); return UncheckedCast<HeapObject>(value);
} }
TNode<JSAggregateError> HeapObjectToJSAggregateError(
TNode<HeapObject> heap_object, Label* fail);
TNode<JSArray> HeapObjectToJSArray(TNode<HeapObject> heap_object, TNode<JSArray> HeapObjectToJSArray(TNode<HeapObject> heap_object,
Label* fail) { Label* fail) {
GotoIfNot(IsJSArray(heap_object), fail); GotoIfNot(IsJSArray(heap_object), fail);
@ -2572,7 +2570,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
TNode<BoolT> IsOddball(SloppyTNode<HeapObject> object); TNode<BoolT> IsOddball(SloppyTNode<HeapObject> object);
TNode<BoolT> IsOddballInstanceType(SloppyTNode<Int32T> instance_type); TNode<BoolT> IsOddballInstanceType(SloppyTNode<Int32T> instance_type);
TNode<BoolT> IsIndirectStringInstanceType(SloppyTNode<Int32T> instance_type); TNode<BoolT> IsIndirectStringInstanceType(SloppyTNode<Int32T> instance_type);
TNode<BoolT> IsJSAggregateError(TNode<HeapObject> object);
TNode<BoolT> IsJSArrayBuffer(SloppyTNode<HeapObject> object); TNode<BoolT> IsJSArrayBuffer(SloppyTNode<HeapObject> object);
TNode<BoolT> IsJSDataView(TNode<HeapObject> object); TNode<BoolT> IsJSDataView(TNode<HeapObject> object);
TNode<BoolT> IsJSArrayInstanceType(SloppyTNode<Int32T> instance_type); TNode<BoolT> IsJSArrayInstanceType(SloppyTNode<Int32T> instance_type);

View File

@ -224,7 +224,6 @@ Type::bitset BitsetType::Lub(const MapRefLike& map) {
case JS_ASYNC_FUNCTION_OBJECT_TYPE: case JS_ASYNC_FUNCTION_OBJECT_TYPE:
case JS_ASYNC_GENERATOR_OBJECT_TYPE: case JS_ASYNC_GENERATOR_OBJECT_TYPE:
case JS_MODULE_NAMESPACE_TYPE: case JS_MODULE_NAMESPACE_TYPE:
case JS_AGGREGATE_ERROR_TYPE:
case JS_ARRAY_BUFFER_TYPE: case JS_ARRAY_BUFFER_TYPE:
case JS_ARRAY_ITERATOR_TYPE: case JS_ARRAY_ITERATOR_TYPE:
case JS_REG_EXP_TYPE: case JS_REG_EXP_TYPE:

View File

@ -29,7 +29,6 @@
#include "src/objects/free-space-inl.h" #include "src/objects/free-space-inl.h"
#include "src/objects/function-kind.h" #include "src/objects/function-kind.h"
#include "src/objects/hash-table-inl.h" #include "src/objects/hash-table-inl.h"
#include "src/objects/js-aggregate-error-inl.h"
#include "src/objects/js-array-inl.h" #include "src/objects/js-array-inl.h"
#include "src/objects/layout-descriptor.h" #include "src/objects/layout-descriptor.h"
#include "src/objects/objects-inl.h" #include "src/objects/objects-inl.h"

View File

@ -24,7 +24,6 @@
#include "src/objects/free-space-inl.h" #include "src/objects/free-space-inl.h"
#include "src/objects/hash-table-inl.h" #include "src/objects/hash-table-inl.h"
#include "src/objects/heap-number-inl.h" #include "src/objects/heap-number-inl.h"
#include "src/objects/js-aggregate-error-inl.h"
#include "src/objects/js-array-buffer-inl.h" #include "src/objects/js-array-buffer-inl.h"
#include "src/objects/js-array-inl.h" #include "src/objects/js-array-inl.h"
#include "src/objects/objects-inl.h" #include "src/objects/objects-inl.h"
@ -641,12 +640,6 @@ void JSGeneratorObject::JSGeneratorObjectPrint(std::ostream& os) { // NOLINT
JSObjectPrintBody(os, *this); JSObjectPrintBody(os, *this);
} }
void JSAggregateError::JSAggregateErrorPrint(std::ostream& os) {
JSObjectPrintHeader(os, *this, "JSAggregateError");
os << "\n - errors: " << Brief(errors());
JSObjectPrintBody(os, *this);
}
void JSArray::JSArrayPrint(std::ostream& os) { // NOLINT void JSArray::JSArrayPrint(std::ostream& os) { // NOLINT
JSObjectPrintHeader(os, *this, "JSArray"); JSObjectPrintHeader(os, *this, "JSArray");
os << "\n - length: " << Brief(this->length()); os << "\n - length: " << Brief(this->length());

View File

@ -34,7 +34,6 @@
#ifdef V8_INTL_SUPPORT #ifdef V8_INTL_SUPPORT
#include "src/objects/intl-objects.h" #include "src/objects/intl-objects.h"
#endif // V8_INTL_SUPPORT #endif // V8_INTL_SUPPORT
#include "src/objects/js-aggregate-error.h"
#include "src/objects/js-array-buffer-inl.h" #include "src/objects/js-array-buffer-inl.h"
#include "src/objects/js-array-inl.h" #include "src/objects/js-array-inl.h"
#ifdef V8_INTL_SUPPORT #ifdef V8_INTL_SUPPORT
@ -1319,18 +1318,16 @@ static void InstallError(
Isolate* isolate, Handle<JSObject> global, Handle<String> name, Isolate* isolate, Handle<JSObject> global, Handle<String> name,
int context_index, int context_index,
Builtins::Name error_constructor = Builtins::kErrorConstructor, Builtins::Name error_constructor = Builtins::kErrorConstructor,
InstanceType error_type = JS_ERROR_TYPE, int error_function_length = 1, int error_function_length = 1, int in_object_properties = 2) {
int header_size = JSObject::kHeaderSize) {
Factory* factory = isolate->factory(); Factory* factory = isolate->factory();
// Most Error objects consist of a message and a stack trace. // Most Error objects consist of a message and a stack trace.
// Reserve two in-object properties for these. // Reserve two in-object properties for these.
const int kInObjectPropertiesCount = 2;
const int kErrorObjectSize = const int kErrorObjectSize =
header_size + kInObjectPropertiesCount * kTaggedSize; JSObject::kHeaderSize + in_object_properties * kTaggedSize;
Handle<JSFunction> error_fun = InstallFunction( Handle<JSFunction> error_fun = InstallFunction(
isolate, global, name, error_type, kErrorObjectSize, isolate, global, name, JS_ERROR_TYPE, kErrorObjectSize,
kInObjectPropertiesCount, factory->the_hole_value(), error_constructor); in_object_properties, factory->the_hole_value(), error_constructor);
error_fun->shared().DontAdaptArguments(); error_fun->shared().DontAdaptArguments();
error_fun->shared().set_length(error_function_length); error_fun->shared().set_length(error_function_length);
@ -4234,8 +4231,7 @@ void Genesis::InitializeGlobal_harmony_promise_any() {
InstallError(isolate_, global, factory->AggregateError_string(), InstallError(isolate_, global, factory->AggregateError_string(),
Context::AGGREGATE_ERROR_FUNCTION_INDEX, Context::AGGREGATE_ERROR_FUNCTION_INDEX,
Builtins::kAggregateErrorConstructor, JS_AGGREGATE_ERROR_TYPE, 2, Builtins::kAggregateErrorConstructor, 2, 2);
JSAggregateError::kHeaderSize);
// Setup %AggregateErrorPrototype%. // Setup %AggregateErrorPrototype%.
Handle<JSFunction> aggregate_error_function( Handle<JSFunction> aggregate_error_function(
@ -4244,18 +4240,6 @@ void Genesis::InitializeGlobal_harmony_promise_any() {
JSObject::cast(aggregate_error_function->instance_prototype()), JSObject::cast(aggregate_error_function->instance_prototype()),
isolate()); isolate());
Handle<String> getter_name =
Name::ToFunctionName(isolate_, factory->errors_string(),
isolate_->factory()->get_string())
.ToHandleChecked();
Handle<JSFunction> getter = SimpleCreateFunction(
isolate(), getter_name, Builtins::kAggregateErrorPrototypeErrorsGetter, 0,
true);
JSObject::DefineAccessor(prototype, factory->errors_string(), getter,
factory->undefined_value(), DONT_ENUM);
Handle<JSFunction> promise_fun( Handle<JSFunction> promise_fun(
JSFunction::cast( JSFunction::cast(
isolate()->native_context()->get(Context::PROMISE_FUNCTION_INDEX)), isolate()->native_context()->get(Context::PROMISE_FUNCTION_INDEX)),

View File

@ -12,7 +12,6 @@
#include "src/objects/arguments-inl.h" #include "src/objects/arguments-inl.h"
#include "src/objects/embedder-data-array-inl.h" #include "src/objects/embedder-data-array-inl.h"
#include "src/objects/free-space-inl.h" #include "src/objects/free-space-inl.h"
#include "src/objects/js-aggregate-error-inl.h"
#include "src/objects/js-collection-inl.h" #include "src/objects/js-collection-inl.h"
#include "src/objects/js-generator-inl.h" #include "src/objects/js-generator-inl.h"
#include "src/objects/js-regexp-inl.h" #include "src/objects/js-regexp-inl.h"

View File

@ -1,25 +0,0 @@
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_OBJECTS_JS_AGGREGATE_ERROR_INL_H_
#define V8_OBJECTS_JS_AGGREGATE_ERROR_INL_H_
#include "src/objects/js-aggregate-error.h"
#include "src/objects/objects-inl.h" // Needed for write barriers
// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"
namespace v8 {
namespace internal {
TQ_OBJECT_CONSTRUCTORS_IMPL(JSAggregateError)
} // namespace internal
} // namespace v8
#include "src/objects/object-macros-undef.h"
#endif // V8_OBJECTS_JS_AGGREGATE_ERROR_INL_H_

View File

@ -1,27 +0,0 @@
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_OBJECTS_JS_AGGREGATE_ERROR_H_
#define V8_OBJECTS_JS_AGGREGATE_ERROR_H_
#include "src/objects/js-objects.h"
#include "torque-generated/builtin-definitions-tq.h"
// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"
namespace v8 {
namespace internal {
class JSAggregateError
: public TorqueGeneratedJSAggregateError<JSAggregateError, JSObject> {
public:
DECL_PRINTER(JSAggregateError)
TQ_OBJECT_CONSTRUCTORS(JSAggregateError)
};
} // namespace internal
} // namespace v8
#endif // V8_OBJECTS_JS_AGGREGATE_ERROR_H_

View File

@ -1,81 +0,0 @@
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include 'src/objects/js-aggregate-error.h'
@generateCppClass
extern class JSAggregateError extends JSObject {
// Only Undefined during AggregateError object creation. In order to make the
// field type FixedArray, we'd need to initialize it in ErrorUtils::Construct
// (after it, it's too late) which we don't want.
errors: FixedArray|Undefined;
}
namespace error {
transitioning javascript builtin AggregateErrorConstructor(
js-implicit context: NativeContext, target: JSFunction,
newTarget: JSAny)(...arguments): JSAny {
// This function is implementing the spec as suggested by
// https://github.com/tc39/proposal-promise-any/pull/59 . FIXME(marja):
// change this if the PR is declined.
// 1. If NewTarget is undefined, let newTarget be the active function
// object, else let newTarget be NewTarget.
// 2. Let O be ? OrdinaryCreateFromConstructor(newTarget,
// "%AggregateError.prototype%", « [[ErrorData]], [[AggregateErrors]] »).
// 3. If _message_ is not _undefined_, then
// a. Let msg be ? ToString(_message_).
// b. Let msgDesc be the PropertyDescriptor { [[Value]]: _msg_,
// [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *true*
// c. Perform ! DefinePropertyOrThrow(_O_, *"message"*, _msgDesc_).
const message: JSAny = arguments[1];
const obj: JSAggregateError =
ConstructAggregateErrorHelper(context, target, newTarget, message);
// 4. Let errorsList be ? IterableToList(errors).
const errors: JSAny = arguments[0];
const errorsArray =
iterator::IterableToFixedArrayWithSymbolLookupSlow(errors);
// errorsArray must be marked copy-on-write, since the "errors" getter
// creates a thin JSArray wrapper around it.
MakeFixedArrayCOW(errorsArray);
// 5. Set O.[[AggregateErrors]] to errorsList.
obj.errors = errorsArray;
// 6. Return O.
return obj;
}
transitioning javascript builtin AggregateErrorPrototypeErrorsGetter(
js-implicit context: NativeContext, receiver: JSAny)(): JSAny {
// 1. Let E be the this value.
// 2. If Type(E) is not Object, throw a TypeError exception.
// 3. If E does not have an [[ErrorData]] internal slot, throw a TypeError
// exception.
// 4. If E does not have an [[AggregateErrors]] internal slot, throw a
// TypeError exception.
// 5. Return ! CreateArrayFromList(E.[[AggregateErrors]]).
typeswitch (receiver) {
case (receiver: JSAggregateError): {
return array::CreateJSArrayWithElements(
UnsafeCast<FixedArray>(receiver.errors));
}
case (Object): {
ThrowTypeError(
MessageTemplate::kNotGeneric, 'JSAggregateError.prototype.errors.get',
'AggregateError');
}
}
}
extern runtime ConstructAggregateErrorHelper(
Context, JSFunction, JSAny, Object): JSAggregateError;
extern runtime ConstructInternalAggregateErrorHelper(
Context, Object): JSAggregateError;
extern macro MakeFixedArrayCOW(FixedArray);
}

View File

@ -27,7 +27,6 @@
#include "src/objects/field-type.h" #include "src/objects/field-type.h"
#include "src/objects/fixed-array.h" #include "src/objects/fixed-array.h"
#include "src/objects/heap-number.h" #include "src/objects/heap-number.h"
#include "src/objects/js-aggregate-error.h"
#include "src/objects/js-array-buffer.h" #include "src/objects/js-array-buffer.h"
#include "src/objects/js-array-inl.h" #include "src/objects/js-array-inl.h"
#include "src/objects/layout-descriptor.h" #include "src/objects/layout-descriptor.h"
@ -2082,8 +2081,6 @@ int JSObject::GetHeaderSize(InstanceType type,
return JSObject::kHeaderSize; return JSObject::kHeaderSize;
case JS_GENERATOR_OBJECT_TYPE: case JS_GENERATOR_OBJECT_TYPE:
return JSGeneratorObject::kHeaderSize; return JSGeneratorObject::kHeaderSize;
case JS_AGGREGATE_ERROR_TYPE:
return JSAggregateError::kHeaderSize;
case JS_ASYNC_FUNCTION_OBJECT_TYPE: case JS_ASYNC_FUNCTION_OBJECT_TYPE:
return JSAsyncFunctionObject::kHeaderSize; return JSAsyncFunctionObject::kHeaderSize;
case JS_ASYNC_GENERATOR_OBJECT_TYPE: case JS_ASYNC_GENERATOR_OBJECT_TYPE:
@ -5204,7 +5201,6 @@ namespace {
bool CanSubclassHaveInobjectProperties(InstanceType instance_type) { bool CanSubclassHaveInobjectProperties(InstanceType instance_type) {
switch (instance_type) { switch (instance_type) {
case JS_AGGREGATE_ERROR_TYPE:
case JS_API_OBJECT_TYPE: case JS_API_OBJECT_TYPE:
case JS_ARRAY_BUFFER_TYPE: case JS_ARRAY_BUFFER_TYPE:
case JS_ARRAY_TYPE: case JS_ARRAY_TYPE:

View File

@ -270,7 +270,6 @@ VisitorId Map::GetVisitorId(Map map) {
case JS_OBJECT_TYPE: case JS_OBJECT_TYPE:
case JS_ERROR_TYPE: case JS_ERROR_TYPE:
case JS_AGGREGATE_ERROR_TYPE:
case JS_ARGUMENTS_OBJECT_TYPE: case JS_ARGUMENTS_OBJECT_TYPE:
case JS_ASYNC_FROM_SYNC_ITERATOR_TYPE: case JS_ASYNC_FROM_SYNC_ITERATOR_TYPE:
case JS_CONTEXT_EXTENSION_OBJECT_TYPE: case JS_CONTEXT_EXTENSION_OBJECT_TYPE:

View File

@ -126,7 +126,6 @@ class ZoneForwardList;
V(HandlerTable) \ V(HandlerTable) \
V(HeapNumber) \ V(HeapNumber) \
V(InternalizedString) \ V(InternalizedString) \
V(JSAggregateError) \
V(JSArgumentsObject) \ V(JSArgumentsObject) \
V(JSArray) \ V(JSArray) \
V(JSArrayBuffer) \ V(JSArrayBuffer) \

View File

@ -981,7 +981,6 @@ ReturnType BodyDescriptorApply(InstanceType type, T1 p1, T2 p2, T3 p3, T4 p4) {
case JS_ASYNC_GENERATOR_OBJECT_TYPE: case JS_ASYNC_GENERATOR_OBJECT_TYPE:
case JS_PRIMITIVE_WRAPPER_TYPE: case JS_PRIMITIVE_WRAPPER_TYPE:
case JS_DATE_TYPE: case JS_DATE_TYPE:
case JS_AGGREGATE_ERROR_TYPE:
case JS_ARRAY_TYPE: case JS_ARRAY_TYPE:
case JS_ARRAY_ITERATOR_TYPE: case JS_ARRAY_ITERATOR_TYPE:
case JS_MODULE_NAMESPACE_TYPE: case JS_MODULE_NAMESPACE_TYPE:

View File

@ -79,35 +79,10 @@
assertFalse(Object.prototype.hasOwnProperty.call(error, 'message')); assertFalse(Object.prototype.hasOwnProperty.call(error, 'message'));
})(); })();
(function AggregateErrorPrototypeErrorsCalledWithWrongTypeOfObject() { (function SetErrors() {
let f = Object.getOwnPropertyDescriptor(AggregateError.prototype, 'errors').get;
// This works:
let error = new AggregateError([3]);
let got_errors = f.call(error);
assertEquals([3], got_errors);
// This doesn't:
assertThrows(() => { f.call({}) } );
})();
(function AggregateErrorPrototypeErrorsCalledWithTooManyArguments() {
let f = Object.getOwnPropertyDescriptor(AggregateError.prototype, 'errors').get;
let error = new AggregateError([3]);
let got_errors = f.call(error, ["unnecessary", "arguments"]);
assertEquals([3], got_errors);
})();
(function SetErrorsSloppy() {
let e = new AggregateError([1]); let e = new AggregateError([1]);
e.errors = [4, 5, 6]; e.errors = [4, 5, 6];
assertEquals([1], e.errors); assertEquals([4, 5, 6], e.errors);
})();
(function SetErrorsStrict() {
"use strict";
let e = new AggregateError([1]);
assertThrows(() => { e.errors = [4, 5, 6];});
})(); })();
(function SubClassProto() { (function SubClassProto() {
@ -135,11 +110,11 @@
assertEquals([8, 9], e.errors); assertEquals([8, 9], e.errors);
})(); })();
(function ErrorsIsANewArrayForEachGetterCall(){ (function ErrorsIsTheSameArray(){
let e = new AggregateError([9, 6, 3]); let e = new AggregateError([9, 6, 3]);
const errors1 = e.errors; const errors1 = e.errors;
const errors2 = e.errors; const errors2 = e.errors;
assertNotSame(errors1, errors2); assertSame(errors1, errors2);
})(); })();
(function ErrorsModified(){ (function ErrorsModified(){
@ -148,7 +123,7 @@
errors1[0] = 50; errors1[0] = 50;
const errors2 = e.errors; const errors2 = e.errors;
assertEquals([50, 6, 3], errors1); assertEquals([50, 6, 3], errors1);
assertEquals([9, 6, 3], errors2); assertEquals([50, 6, 3], errors2);
})(); })();
(function EmptyErrorsModified1(){ (function EmptyErrorsModified1(){
@ -157,7 +132,7 @@
errors1[0] = 50; errors1[0] = 50;
const errors2 = e.errors; const errors2 = e.errors;
assertEquals([50], errors1); assertEquals([50], errors1);
assertEquals([], errors2); assertEquals([50], errors2);
})(); })();
(function EmptyErrorsModified2(){ (function EmptyErrorsModified2(){
@ -166,7 +141,7 @@
errors1.push(50); errors1.push(50);
const errors2 = e.errors; const errors2 = e.errors;
assertEquals([50], errors1); assertEquals([50], errors1);
assertEquals([], errors2); assertEquals([50], errors2);
})(); })();
(function AggregateErrorCreation() { (function AggregateErrorCreation() {

View File

@ -614,6 +614,9 @@
'language/expressions/logical-assignment/lgcl-and-assignment-operator-non-simple-lhs': [FAIL], 'language/expressions/logical-assignment/lgcl-and-assignment-operator-non-simple-lhs': [FAIL],
'language/expressions/logical-assignment/lgcl-nullish-assignment-operator-non-simple-lhs': [FAIL], 'language/expressions/logical-assignment/lgcl-nullish-assignment-operator-non-simple-lhs': [FAIL],
# Waiting for Test262 to catch up with the Promise.any proposal modifications
'built-ins/NativeErrors/AggregateError/prototype/errors/*': [SKIP],
############################ INVALID TESTS ############################# ############################ INVALID TESTS #############################
# Test makes unjustified assumptions about the number of calls to SortCompare. # Test makes unjustified assumptions about the number of calls to SortCompare.

View File

@ -166,41 +166,40 @@ INSTANCE_TYPES = {
1054: "JS_WEAK_MAP_TYPE", 1054: "JS_WEAK_MAP_TYPE",
1055: "JS_WEAK_SET_TYPE", 1055: "JS_WEAK_SET_TYPE",
1056: "JS_API_OBJECT_TYPE", 1056: "JS_API_OBJECT_TYPE",
1058: "JS_AGGREGATE_ERROR_TYPE", 1058: "JS_ARGUMENTS_OBJECT_TYPE",
1059: "JS_ARGUMENTS_OBJECT_TYPE", 1059: "JS_ARRAY_TYPE",
1060: "JS_ARRAY_TYPE", 1060: "JS_ARRAY_BUFFER_TYPE",
1061: "JS_ARRAY_BUFFER_TYPE", 1061: "JS_ARRAY_ITERATOR_TYPE",
1062: "JS_ARRAY_ITERATOR_TYPE", 1062: "JS_ASYNC_FROM_SYNC_ITERATOR_TYPE",
1063: "JS_ASYNC_FROM_SYNC_ITERATOR_TYPE", 1063: "JS_COLLATOR_TYPE",
1064: "JS_COLLATOR_TYPE", 1064: "JS_CONTEXT_EXTENSION_OBJECT_TYPE",
1065: "JS_CONTEXT_EXTENSION_OBJECT_TYPE", 1065: "JS_DATE_TYPE",
1066: "JS_DATE_TYPE", 1066: "JS_DATE_TIME_FORMAT_TYPE",
1067: "JS_DATE_TIME_FORMAT_TYPE", 1067: "JS_DISPLAY_NAMES_TYPE",
1068: "JS_DISPLAY_NAMES_TYPE", 1068: "JS_ERROR_TYPE",
1069: "JS_ERROR_TYPE", 1069: "JS_FINALIZATION_REGISTRY_TYPE",
1070: "JS_FINALIZATION_REGISTRY_TYPE", 1070: "JS_LIST_FORMAT_TYPE",
1071: "JS_LIST_FORMAT_TYPE", 1071: "JS_LOCALE_TYPE",
1072: "JS_LOCALE_TYPE", 1072: "JS_MESSAGE_OBJECT_TYPE",
1073: "JS_MESSAGE_OBJECT_TYPE", 1073: "JS_NUMBER_FORMAT_TYPE",
1074: "JS_NUMBER_FORMAT_TYPE", 1074: "JS_PLURAL_RULES_TYPE",
1075: "JS_PLURAL_RULES_TYPE", 1075: "JS_PROMISE_TYPE",
1076: "JS_PROMISE_TYPE", 1076: "JS_REG_EXP_TYPE",
1077: "JS_REG_EXP_TYPE", 1077: "JS_REG_EXP_STRING_ITERATOR_TYPE",
1078: "JS_REG_EXP_STRING_ITERATOR_TYPE", 1078: "JS_RELATIVE_TIME_FORMAT_TYPE",
1079: "JS_RELATIVE_TIME_FORMAT_TYPE", 1079: "JS_SEGMENT_ITERATOR_TYPE",
1080: "JS_SEGMENT_ITERATOR_TYPE", 1080: "JS_SEGMENTER_TYPE",
1081: "JS_SEGMENTER_TYPE", 1081: "JS_STRING_ITERATOR_TYPE",
1082: "JS_STRING_ITERATOR_TYPE", 1082: "JS_V8_BREAK_ITERATOR_TYPE",
1083: "JS_V8_BREAK_ITERATOR_TYPE", 1083: "JS_WEAK_REF_TYPE",
1084: "JS_WEAK_REF_TYPE", 1084: "WASM_EXCEPTION_OBJECT_TYPE",
1085: "WASM_EXCEPTION_OBJECT_TYPE", 1085: "WASM_GLOBAL_OBJECT_TYPE",
1086: "WASM_GLOBAL_OBJECT_TYPE", 1086: "WASM_INSTANCE_OBJECT_TYPE",
1087: "WASM_INSTANCE_OBJECT_TYPE", 1087: "WASM_MEMORY_OBJECT_TYPE",
1088: "WASM_MEMORY_OBJECT_TYPE", 1088: "WASM_MODULE_OBJECT_TYPE",
1089: "WASM_MODULE_OBJECT_TYPE", 1089: "WASM_TABLE_OBJECT_TYPE",
1090: "WASM_TABLE_OBJECT_TYPE", 1090: "JS_BOUND_FUNCTION_TYPE",
1091: "JS_BOUND_FUNCTION_TYPE", 1091: "JS_FUNCTION_TYPE",
1092: "JS_FUNCTION_TYPE",
} }
# List of known V8 maps. # List of known V8 maps.
@ -356,7 +355,7 @@ KNOWN_MAPS = {
("read_only_space", 0x03c51): (77, "StoreHandler2Map"), ("read_only_space", 0x03c51): (77, "StoreHandler2Map"),
("read_only_space", 0x03c79): (77, "StoreHandler3Map"), ("read_only_space", 0x03c79): (77, "StoreHandler3Map"),
("map_space", 0x00121): (1057, "ExternalMap"), ("map_space", 0x00121): (1057, "ExternalMap"),
("map_space", 0x00149): (1073, "JSMessageObjectMap"), ("map_space", 0x00149): (1072, "JSMessageObjectMap"),
} }
# List of known V8 objects. # List of known V8 objects.
@ -440,27 +439,27 @@ KNOWN_OBJECTS = {
("old_space", 0x009ed): "StringSplitCache", ("old_space", 0x009ed): "StringSplitCache",
("old_space", 0x00df5): "RegExpMultipleCache", ("old_space", 0x00df5): "RegExpMultipleCache",
("old_space", 0x011fd): "BuiltinsConstantsTable", ("old_space", 0x011fd): "BuiltinsConstantsTable",
("old_space", 0x015a5): "AsyncFunctionAwaitRejectSharedFun", ("old_space", 0x015a1): "AsyncFunctionAwaitRejectSharedFun",
("old_space", 0x015cd): "AsyncFunctionAwaitResolveSharedFun", ("old_space", 0x015c9): "AsyncFunctionAwaitResolveSharedFun",
("old_space", 0x015f5): "AsyncGeneratorAwaitRejectSharedFun", ("old_space", 0x015f1): "AsyncGeneratorAwaitRejectSharedFun",
("old_space", 0x0161d): "AsyncGeneratorAwaitResolveSharedFun", ("old_space", 0x01619): "AsyncGeneratorAwaitResolveSharedFun",
("old_space", 0x01645): "AsyncGeneratorYieldResolveSharedFun", ("old_space", 0x01641): "AsyncGeneratorYieldResolveSharedFun",
("old_space", 0x0166d): "AsyncGeneratorReturnResolveSharedFun", ("old_space", 0x01669): "AsyncGeneratorReturnResolveSharedFun",
("old_space", 0x01695): "AsyncGeneratorReturnClosedRejectSharedFun", ("old_space", 0x01691): "AsyncGeneratorReturnClosedRejectSharedFun",
("old_space", 0x016bd): "AsyncGeneratorReturnClosedResolveSharedFun", ("old_space", 0x016b9): "AsyncGeneratorReturnClosedResolveSharedFun",
("old_space", 0x016e5): "AsyncIteratorValueUnwrapSharedFun", ("old_space", 0x016e1): "AsyncIteratorValueUnwrapSharedFun",
("old_space", 0x0170d): "PromiseAllResolveElementSharedFun", ("old_space", 0x01709): "PromiseAllResolveElementSharedFun",
("old_space", 0x01735): "PromiseAllSettledResolveElementSharedFun", ("old_space", 0x01731): "PromiseAllSettledResolveElementSharedFun",
("old_space", 0x0175d): "PromiseAllSettledRejectElementSharedFun", ("old_space", 0x01759): "PromiseAllSettledRejectElementSharedFun",
("old_space", 0x01785): "PromiseAnyRejectElementSharedFun", ("old_space", 0x01781): "PromiseAnyRejectElementSharedFun",
("old_space", 0x017ad): "PromiseCapabilityDefaultRejectSharedFun", ("old_space", 0x017a9): "PromiseCapabilityDefaultRejectSharedFun",
("old_space", 0x017d5): "PromiseCapabilityDefaultResolveSharedFun", ("old_space", 0x017d1): "PromiseCapabilityDefaultResolveSharedFun",
("old_space", 0x017fd): "PromiseCatchFinallySharedFun", ("old_space", 0x017f9): "PromiseCatchFinallySharedFun",
("old_space", 0x01825): "PromiseGetCapabilitiesExecutorSharedFun", ("old_space", 0x01821): "PromiseGetCapabilitiesExecutorSharedFun",
("old_space", 0x0184d): "PromiseThenFinallySharedFun", ("old_space", 0x01849): "PromiseThenFinallySharedFun",
("old_space", 0x01875): "PromiseThrowerFinallySharedFun", ("old_space", 0x01871): "PromiseThrowerFinallySharedFun",
("old_space", 0x0189d): "PromiseValueThunkFinallySharedFun", ("old_space", 0x01899): "PromiseValueThunkFinallySharedFun",
("old_space", 0x018c5): "ProxyRevokeSharedFun", ("old_space", 0x018c1): "ProxyRevokeSharedFun",
} }
# Lower 32 bits of first page addresses for various heap spaces. # Lower 32 bits of first page addresses for various heap spaces.