From 0c44673ae77ff3255c1f426c82baaa696d43d029 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marja=20H=C3=B6ltt=C3=A4?= Date: Thu, 28 May 2020 09:58:37 +0200 Subject: [PATCH] [Promise.any] Make AggregateError.errors a data property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ä Reviewed-by: Igor Sheludko Reviewed-by: Maya Lekova Reviewed-by: Shu-yu Guo Cr-Commit-Position: refs/heads/master@{#68034} --- BUILD.gn | 4 +- src/builtins/aggregate-error.tq | 44 ++++++++ src/builtins/base.tq | 1 + src/builtins/cast.tq | 8 -- src/builtins/promise-any.tq | 5 +- src/codegen/code-stub-assembler.cc | 11 -- src/codegen/code-stub-assembler.h | 5 +- src/compiler/types.cc | 1 - src/diagnostics/objects-debug.cc | 1 - src/diagnostics/objects-printer.cc | 7 -- src/init/bootstrapper.cc | 26 +---- src/objects/class-definitions-tq-deps-inl.h | 1 - src/objects/js-aggregate-error-inl.h | 25 ----- src/objects/js-aggregate-error.h | 27 ----- src/objects/js-aggregate-error.tq | 81 -------------- src/objects/js-objects.cc | 4 - src/objects/map.cc | 1 - src/objects/object-list-macros.h | 1 - src/objects/objects-body-descriptors-inl.h | 1 - test/mjsunit/harmony/aggregate-error.js | 39 ++----- test/test262/test262.status | 3 + tools/v8heapconst.py | 113 ++++++++++---------- 22 files changed, 121 insertions(+), 288 deletions(-) create mode 100644 src/builtins/aggregate-error.tq delete mode 100644 src/objects/js-aggregate-error-inl.h delete mode 100644 src/objects/js-aggregate-error.h delete mode 100644 src/objects/js-aggregate-error.tq diff --git a/BUILD.gn b/BUILD.gn index 8612e351dc..c1fa35e235 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1010,6 +1010,7 @@ action("postmortem-metadata") { } torque_files = [ + "src/builtins/aggregate-error.tq", "src/builtins/array-copywithin.tq", "src/builtins/array-every.tq", "src/builtins/array-filter.tq", @@ -1136,7 +1137,6 @@ torque_files = [ "src/objects/heap-number.tq", "src/objects/heap-object.tq", "src/objects/intl-objects.tq", - "src/objects/js-aggregate-error.tq", "src/objects/js-array-buffer.tq", "src/objects/js-array.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/intl-objects.cc", "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.cc", "src/objects/js-array-buffer.h", diff --git a/src/builtins/aggregate-error.tq b/src/builtins/aggregate-error.tq new file mode 100644 index 0000000000..3ae13d4e87 --- /dev/null +++ b/src/builtins/aggregate-error.tq @@ -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; +} diff --git a/src/builtins/base.tq b/src/builtins/base.tq index b30034ba26..ec10601d8f 100644 --- a/src/builtins/base.tq +++ b/src/builtins/base.tq @@ -384,6 +384,7 @@ type NumberOrUndefined = Number|Undefined; extern macro DefaultStringConstant(): String; extern macro EmptyStringConstant(): EmptyString; +extern macro ErrorsStringConstant(): String; extern macro FalseConstant(): False; extern macro Int32FalseConstant(): bool; extern macro Int32TrueConstant(): bool; diff --git a/src/builtins/cast.tq b/src/builtins/cast.tq index 7bc0ba03ae..2f29b8a0e2 100644 --- a/src/builtins/cast.tq +++ b/src/builtins/cast.tq @@ -12,7 +12,6 @@ extern macro IsFeedbackCell(HeapObject): bool; extern macro IsFeedbackVector(HeapObject): bool; extern macro IsFixedArray(HeapObject): bool; extern macro IsHeapNumber(HeapObject): bool; -extern macro IsJSAggregateError(HeapObject): bool; extern macro IsJSArray(HeapObject): bool; extern macro IsJSArrayMap(Map): bool; extern macro IsJSBoundFunction(HeapObject): bool; @@ -60,8 +59,6 @@ extern macro TaggedToPositiveSmi(Object): PositiveSmi labels CastError; extern macro TaggedToDirectString(Object): DirectString labels CastError; -extern macro HeapObjectToJSAggregateError(HeapObject): JSAggregateError - labels CastError; extern macro HeapObjectToJSArray(HeapObject): JSArray labels CastError; extern macro HeapObjectToCallable(HeapObject): Callable @@ -386,11 +383,6 @@ Cast(o: HeapObject): Undefined|Callable return HeapObjectToCallable(o) otherwise CastError; } -Cast(o: HeapObject): JSAggregateError - labels CastError { - return HeapObjectToJSAggregateError(o) otherwise CastError; -} - Cast(o: HeapObject): JSArray labels CastError { return HeapObjectToJSArray(o) otherwise CastError; diff --git a/src/builtins/promise-any.tq b/src/builtins/promise-any.tq index 44e5eee9ae..36b2d6f3d5 100644 --- a/src/builtins/promise-any.tq +++ b/src/builtins/promise-any.tq @@ -362,9 +362,10 @@ PromiseAny( transitioning macro ConstructAggregateError(implicit context: Context)( errors: FixedArray): JSObject { - const obj: JSAggregateError = error::ConstructInternalAggregateErrorHelper( + const obj: JSObject = error::ConstructInternalAggregateErrorHelper( context, SmiConstant(MessageTemplate::kAllPromisesRejected)); - obj.errors = errors; + const errorsJSArray = array::CreateJSArrayWithElements(errors); + CreateDataProperty(obj, ErrorsStringConstant(), errorsJSArray); return obj; } diff --git a/src/codegen/code-stub-assembler.cc b/src/codegen/code-stub-assembler.cc index 53dc70ccbc..cb7b5829e4 100644 --- a/src/codegen/code-stub-assembler.cc +++ b/src/codegen/code-stub-assembler.cc @@ -20,7 +20,6 @@ #include "src/objects/descriptor-array.h" #include "src/objects/function-kind.h" #include "src/objects/heap-number.h" -#include "src/objects/js-aggregate-error.h" #include "src/objects/js-generator.h" #include "src/objects/oddball.h" #include "src/objects/ordered-hash-table-inl.h" @@ -4733,12 +4732,6 @@ void CodeStubAssembler::CopyFixedArrayElements( Comment("] CopyFixedArrayElements"); } -TNode CodeStubAssembler::HeapObjectToJSAggregateError( - TNode heap_object, Label* fail) { - GotoIfNot(IsJSAggregateError(heap_object), fail); - return UncheckedCast(heap_object); -} - TNode CodeStubAssembler::HeapObjectToFixedArray( TNode base, Label* cast_fail) { Label fixed_array(this); @@ -5980,10 +5973,6 @@ TNode CodeStubAssembler::IsJSPrimitiveWrapperMap(SloppyTNode map) { return IsJSPrimitiveWrapperInstanceType(LoadMapInstanceType(map)); } -TNode CodeStubAssembler::IsJSAggregateError(TNode object) { - return HasInstanceType(object, JS_AGGREGATE_ERROR_TYPE); -} - TNode CodeStubAssembler::IsJSArrayInstanceType( SloppyTNode instance_type) { return InstanceTypeEqual(instance_type, JS_ARRAY_TYPE); diff --git a/src/codegen/code-stub-assembler.h b/src/codegen/code-stub-assembler.h index 31102b16d8..3fb9176acc 100644 --- a/src/codegen/code-stub-assembler.h +++ b/src/codegen/code-stub-assembler.h @@ -137,6 +137,7 @@ enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol }; EmptySlowElementDictionary) \ V(empty_string, empty_string, EmptyString) \ V(error_to_string, error_to_string, ErrorToString) \ + V(errors_string, errors_string, ErrorsString) \ V(FalseValue, false_value, False) \ V(FeedbackVectorMap, feedback_vector_map, FeedbackVectorMap) \ V(FixedArrayMap, fixed_array_map, FixedArrayMap) \ @@ -469,9 +470,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler return UncheckedCast(value); } - TNode HeapObjectToJSAggregateError( - TNode heap_object, Label* fail); - TNode HeapObjectToJSArray(TNode heap_object, Label* fail) { GotoIfNot(IsJSArray(heap_object), fail); @@ -2572,7 +2570,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler TNode IsOddball(SloppyTNode object); TNode IsOddballInstanceType(SloppyTNode instance_type); TNode IsIndirectStringInstanceType(SloppyTNode instance_type); - TNode IsJSAggregateError(TNode object); TNode IsJSArrayBuffer(SloppyTNode object); TNode IsJSDataView(TNode object); TNode IsJSArrayInstanceType(SloppyTNode instance_type); diff --git a/src/compiler/types.cc b/src/compiler/types.cc index 47280becbd..4f0948903a 100644 --- a/src/compiler/types.cc +++ b/src/compiler/types.cc @@ -224,7 +224,6 @@ Type::bitset BitsetType::Lub(const MapRefLike& map) { case JS_ASYNC_FUNCTION_OBJECT_TYPE: case JS_ASYNC_GENERATOR_OBJECT_TYPE: case JS_MODULE_NAMESPACE_TYPE: - case JS_AGGREGATE_ERROR_TYPE: case JS_ARRAY_BUFFER_TYPE: case JS_ARRAY_ITERATOR_TYPE: case JS_REG_EXP_TYPE: diff --git a/src/diagnostics/objects-debug.cc b/src/diagnostics/objects-debug.cc index 810df0a800..4d16f3c6d8 100644 --- a/src/diagnostics/objects-debug.cc +++ b/src/diagnostics/objects-debug.cc @@ -29,7 +29,6 @@ #include "src/objects/free-space-inl.h" #include "src/objects/function-kind.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/layout-descriptor.h" #include "src/objects/objects-inl.h" diff --git a/src/diagnostics/objects-printer.cc b/src/diagnostics/objects-printer.cc index fd9e77477a..01629f6cde 100644 --- a/src/diagnostics/objects-printer.cc +++ b/src/diagnostics/objects-printer.cc @@ -24,7 +24,6 @@ #include "src/objects/free-space-inl.h" #include "src/objects/hash-table-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-inl.h" #include "src/objects/objects-inl.h" @@ -641,12 +640,6 @@ void JSGeneratorObject::JSGeneratorObjectPrint(std::ostream& os) { // NOLINT 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 JSObjectPrintHeader(os, *this, "JSArray"); os << "\n - length: " << Brief(this->length()); diff --git a/src/init/bootstrapper.cc b/src/init/bootstrapper.cc index 7fd1e40f66..96e613f247 100644 --- a/src/init/bootstrapper.cc +++ b/src/init/bootstrapper.cc @@ -34,7 +34,6 @@ #ifdef V8_INTL_SUPPORT #include "src/objects/intl-objects.h" #endif // V8_INTL_SUPPORT -#include "src/objects/js-aggregate-error.h" #include "src/objects/js-array-buffer-inl.h" #include "src/objects/js-array-inl.h" #ifdef V8_INTL_SUPPORT @@ -1319,18 +1318,16 @@ static void InstallError( Isolate* isolate, Handle global, Handle name, int context_index, Builtins::Name error_constructor = Builtins::kErrorConstructor, - InstanceType error_type = JS_ERROR_TYPE, int error_function_length = 1, - int header_size = JSObject::kHeaderSize) { + int error_function_length = 1, int in_object_properties = 2) { Factory* factory = isolate->factory(); // Most Error objects consist of a message and a stack trace. // Reserve two in-object properties for these. - const int kInObjectPropertiesCount = 2; const int kErrorObjectSize = - header_size + kInObjectPropertiesCount * kTaggedSize; + JSObject::kHeaderSize + in_object_properties * kTaggedSize; Handle error_fun = InstallFunction( - isolate, global, name, error_type, kErrorObjectSize, - kInObjectPropertiesCount, factory->the_hole_value(), error_constructor); + isolate, global, name, JS_ERROR_TYPE, kErrorObjectSize, + in_object_properties, factory->the_hole_value(), error_constructor); error_fun->shared().DontAdaptArguments(); error_fun->shared().set_length(error_function_length); @@ -4234,8 +4231,7 @@ void Genesis::InitializeGlobal_harmony_promise_any() { InstallError(isolate_, global, factory->AggregateError_string(), Context::AGGREGATE_ERROR_FUNCTION_INDEX, - Builtins::kAggregateErrorConstructor, JS_AGGREGATE_ERROR_TYPE, 2, - JSAggregateError::kHeaderSize); + Builtins::kAggregateErrorConstructor, 2, 2); // Setup %AggregateErrorPrototype%. Handle aggregate_error_function( @@ -4244,18 +4240,6 @@ void Genesis::InitializeGlobal_harmony_promise_any() { JSObject::cast(aggregate_error_function->instance_prototype()), isolate()); - Handle getter_name = - Name::ToFunctionName(isolate_, factory->errors_string(), - isolate_->factory()->get_string()) - .ToHandleChecked(); - - Handle getter = SimpleCreateFunction( - isolate(), getter_name, Builtins::kAggregateErrorPrototypeErrorsGetter, 0, - true); - - JSObject::DefineAccessor(prototype, factory->errors_string(), getter, - factory->undefined_value(), DONT_ENUM); - Handle promise_fun( JSFunction::cast( isolate()->native_context()->get(Context::PROMISE_FUNCTION_INDEX)), diff --git a/src/objects/class-definitions-tq-deps-inl.h b/src/objects/class-definitions-tq-deps-inl.h index de81ccfeb6..dafba941ea 100644 --- a/src/objects/class-definitions-tq-deps-inl.h +++ b/src/objects/class-definitions-tq-deps-inl.h @@ -12,7 +12,6 @@ #include "src/objects/arguments-inl.h" #include "src/objects/embedder-data-array-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-generator-inl.h" #include "src/objects/js-regexp-inl.h" diff --git a/src/objects/js-aggregate-error-inl.h b/src/objects/js-aggregate-error-inl.h deleted file mode 100644 index 552012c37f..0000000000 --- a/src/objects/js-aggregate-error-inl.h +++ /dev/null @@ -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_ diff --git a/src/objects/js-aggregate-error.h b/src/objects/js-aggregate-error.h deleted file mode 100644 index c77633d44e..0000000000 --- a/src/objects/js-aggregate-error.h +++ /dev/null @@ -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 { - public: - DECL_PRINTER(JSAggregateError) - TQ_OBJECT_CONSTRUCTORS(JSAggregateError) -}; - -} // namespace internal -} // namespace v8 - -#endif // V8_OBJECTS_JS_AGGREGATE_ERROR_H_ diff --git a/src/objects/js-aggregate-error.tq b/src/objects/js-aggregate-error.tq deleted file mode 100644 index efa416e9fb..0000000000 --- a/src/objects/js-aggregate-error.tq +++ /dev/null @@ -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(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); -} diff --git a/src/objects/js-objects.cc b/src/objects/js-objects.cc index d16b075e3a..e5ac753512 100644 --- a/src/objects/js-objects.cc +++ b/src/objects/js-objects.cc @@ -27,7 +27,6 @@ #include "src/objects/field-type.h" #include "src/objects/fixed-array.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-inl.h" #include "src/objects/layout-descriptor.h" @@ -2082,8 +2081,6 @@ int JSObject::GetHeaderSize(InstanceType type, return JSObject::kHeaderSize; case JS_GENERATOR_OBJECT_TYPE: return JSGeneratorObject::kHeaderSize; - case JS_AGGREGATE_ERROR_TYPE: - return JSAggregateError::kHeaderSize; case JS_ASYNC_FUNCTION_OBJECT_TYPE: return JSAsyncFunctionObject::kHeaderSize; case JS_ASYNC_GENERATOR_OBJECT_TYPE: @@ -5204,7 +5201,6 @@ namespace { bool CanSubclassHaveInobjectProperties(InstanceType instance_type) { switch (instance_type) { - case JS_AGGREGATE_ERROR_TYPE: case JS_API_OBJECT_TYPE: case JS_ARRAY_BUFFER_TYPE: case JS_ARRAY_TYPE: diff --git a/src/objects/map.cc b/src/objects/map.cc index de546d1039..f2e45f385f 100644 --- a/src/objects/map.cc +++ b/src/objects/map.cc @@ -270,7 +270,6 @@ VisitorId Map::GetVisitorId(Map map) { case JS_OBJECT_TYPE: case JS_ERROR_TYPE: - case JS_AGGREGATE_ERROR_TYPE: case JS_ARGUMENTS_OBJECT_TYPE: case JS_ASYNC_FROM_SYNC_ITERATOR_TYPE: case JS_CONTEXT_EXTENSION_OBJECT_TYPE: diff --git a/src/objects/object-list-macros.h b/src/objects/object-list-macros.h index 3bfe3e9121..3b8d3f5d53 100644 --- a/src/objects/object-list-macros.h +++ b/src/objects/object-list-macros.h @@ -126,7 +126,6 @@ class ZoneForwardList; V(HandlerTable) \ V(HeapNumber) \ V(InternalizedString) \ - V(JSAggregateError) \ V(JSArgumentsObject) \ V(JSArray) \ V(JSArrayBuffer) \ diff --git a/src/objects/objects-body-descriptors-inl.h b/src/objects/objects-body-descriptors-inl.h index 58b4106e88..fbd3618ade 100644 --- a/src/objects/objects-body-descriptors-inl.h +++ b/src/objects/objects-body-descriptors-inl.h @@ -981,7 +981,6 @@ ReturnType BodyDescriptorApply(InstanceType type, T1 p1, T2 p2, T3 p3, T4 p4) { case JS_ASYNC_GENERATOR_OBJECT_TYPE: case JS_PRIMITIVE_WRAPPER_TYPE: case JS_DATE_TYPE: - case JS_AGGREGATE_ERROR_TYPE: case JS_ARRAY_TYPE: case JS_ARRAY_ITERATOR_TYPE: case JS_MODULE_NAMESPACE_TYPE: diff --git a/test/mjsunit/harmony/aggregate-error.js b/test/mjsunit/harmony/aggregate-error.js index 40ab7508c8..cc83145c51 100644 --- a/test/mjsunit/harmony/aggregate-error.js +++ b/test/mjsunit/harmony/aggregate-error.js @@ -79,35 +79,10 @@ assertFalse(Object.prototype.hasOwnProperty.call(error, 'message')); })(); -(function AggregateErrorPrototypeErrorsCalledWithWrongTypeOfObject() { - 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() { +(function SetErrors() { let e = new AggregateError([1]); e.errors = [4, 5, 6]; - assertEquals([1], e.errors); -})(); - -(function SetErrorsStrict() { - "use strict"; - let e = new AggregateError([1]); - assertThrows(() => { e.errors = [4, 5, 6];}); + assertEquals([4, 5, 6], e.errors); })(); (function SubClassProto() { @@ -135,11 +110,11 @@ assertEquals([8, 9], e.errors); })(); -(function ErrorsIsANewArrayForEachGetterCall(){ +(function ErrorsIsTheSameArray(){ let e = new AggregateError([9, 6, 3]); const errors1 = e.errors; const errors2 = e.errors; - assertNotSame(errors1, errors2); + assertSame(errors1, errors2); })(); (function ErrorsModified(){ @@ -148,7 +123,7 @@ errors1[0] = 50; const errors2 = e.errors; assertEquals([50, 6, 3], errors1); - assertEquals([9, 6, 3], errors2); + assertEquals([50, 6, 3], errors2); })(); (function EmptyErrorsModified1(){ @@ -157,7 +132,7 @@ errors1[0] = 50; const errors2 = e.errors; assertEquals([50], errors1); - assertEquals([], errors2); + assertEquals([50], errors2); })(); (function EmptyErrorsModified2(){ @@ -166,7 +141,7 @@ errors1.push(50); const errors2 = e.errors; assertEquals([50], errors1); - assertEquals([], errors2); + assertEquals([50], errors2); })(); (function AggregateErrorCreation() { diff --git a/test/test262/test262.status b/test/test262/test262.status index 6057d3f74c..e0fad0973f 100644 --- a/test/test262/test262.status +++ b/test/test262/test262.status @@ -614,6 +614,9 @@ 'language/expressions/logical-assignment/lgcl-and-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 ############################# # Test makes unjustified assumptions about the number of calls to SortCompare. diff --git a/tools/v8heapconst.py b/tools/v8heapconst.py index 63c398eb2d..f38b72b6e6 100644 --- a/tools/v8heapconst.py +++ b/tools/v8heapconst.py @@ -166,41 +166,40 @@ INSTANCE_TYPES = { 1054: "JS_WEAK_MAP_TYPE", 1055: "JS_WEAK_SET_TYPE", 1056: "JS_API_OBJECT_TYPE", - 1058: "JS_AGGREGATE_ERROR_TYPE", - 1059: "JS_ARGUMENTS_OBJECT_TYPE", - 1060: "JS_ARRAY_TYPE", - 1061: "JS_ARRAY_BUFFER_TYPE", - 1062: "JS_ARRAY_ITERATOR_TYPE", - 1063: "JS_ASYNC_FROM_SYNC_ITERATOR_TYPE", - 1064: "JS_COLLATOR_TYPE", - 1065: "JS_CONTEXT_EXTENSION_OBJECT_TYPE", - 1066: "JS_DATE_TYPE", - 1067: "JS_DATE_TIME_FORMAT_TYPE", - 1068: "JS_DISPLAY_NAMES_TYPE", - 1069: "JS_ERROR_TYPE", - 1070: "JS_FINALIZATION_REGISTRY_TYPE", - 1071: "JS_LIST_FORMAT_TYPE", - 1072: "JS_LOCALE_TYPE", - 1073: "JS_MESSAGE_OBJECT_TYPE", - 1074: "JS_NUMBER_FORMAT_TYPE", - 1075: "JS_PLURAL_RULES_TYPE", - 1076: "JS_PROMISE_TYPE", - 1077: "JS_REG_EXP_TYPE", - 1078: "JS_REG_EXP_STRING_ITERATOR_TYPE", - 1079: "JS_RELATIVE_TIME_FORMAT_TYPE", - 1080: "JS_SEGMENT_ITERATOR_TYPE", - 1081: "JS_SEGMENTER_TYPE", - 1082: "JS_STRING_ITERATOR_TYPE", - 1083: "JS_V8_BREAK_ITERATOR_TYPE", - 1084: "JS_WEAK_REF_TYPE", - 1085: "WASM_EXCEPTION_OBJECT_TYPE", - 1086: "WASM_GLOBAL_OBJECT_TYPE", - 1087: "WASM_INSTANCE_OBJECT_TYPE", - 1088: "WASM_MEMORY_OBJECT_TYPE", - 1089: "WASM_MODULE_OBJECT_TYPE", - 1090: "WASM_TABLE_OBJECT_TYPE", - 1091: "JS_BOUND_FUNCTION_TYPE", - 1092: "JS_FUNCTION_TYPE", + 1058: "JS_ARGUMENTS_OBJECT_TYPE", + 1059: "JS_ARRAY_TYPE", + 1060: "JS_ARRAY_BUFFER_TYPE", + 1061: "JS_ARRAY_ITERATOR_TYPE", + 1062: "JS_ASYNC_FROM_SYNC_ITERATOR_TYPE", + 1063: "JS_COLLATOR_TYPE", + 1064: "JS_CONTEXT_EXTENSION_OBJECT_TYPE", + 1065: "JS_DATE_TYPE", + 1066: "JS_DATE_TIME_FORMAT_TYPE", + 1067: "JS_DISPLAY_NAMES_TYPE", + 1068: "JS_ERROR_TYPE", + 1069: "JS_FINALIZATION_REGISTRY_TYPE", + 1070: "JS_LIST_FORMAT_TYPE", + 1071: "JS_LOCALE_TYPE", + 1072: "JS_MESSAGE_OBJECT_TYPE", + 1073: "JS_NUMBER_FORMAT_TYPE", + 1074: "JS_PLURAL_RULES_TYPE", + 1075: "JS_PROMISE_TYPE", + 1076: "JS_REG_EXP_TYPE", + 1077: "JS_REG_EXP_STRING_ITERATOR_TYPE", + 1078: "JS_RELATIVE_TIME_FORMAT_TYPE", + 1079: "JS_SEGMENT_ITERATOR_TYPE", + 1080: "JS_SEGMENTER_TYPE", + 1081: "JS_STRING_ITERATOR_TYPE", + 1082: "JS_V8_BREAK_ITERATOR_TYPE", + 1083: "JS_WEAK_REF_TYPE", + 1084: "WASM_EXCEPTION_OBJECT_TYPE", + 1085: "WASM_GLOBAL_OBJECT_TYPE", + 1086: "WASM_INSTANCE_OBJECT_TYPE", + 1087: "WASM_MEMORY_OBJECT_TYPE", + 1088: "WASM_MODULE_OBJECT_TYPE", + 1089: "WASM_TABLE_OBJECT_TYPE", + 1090: "JS_BOUND_FUNCTION_TYPE", + 1091: "JS_FUNCTION_TYPE", } # List of known V8 maps. @@ -356,7 +355,7 @@ KNOWN_MAPS = { ("read_only_space", 0x03c51): (77, "StoreHandler2Map"), ("read_only_space", 0x03c79): (77, "StoreHandler3Map"), ("map_space", 0x00121): (1057, "ExternalMap"), - ("map_space", 0x00149): (1073, "JSMessageObjectMap"), + ("map_space", 0x00149): (1072, "JSMessageObjectMap"), } # List of known V8 objects. @@ -440,27 +439,27 @@ KNOWN_OBJECTS = { ("old_space", 0x009ed): "StringSplitCache", ("old_space", 0x00df5): "RegExpMultipleCache", ("old_space", 0x011fd): "BuiltinsConstantsTable", - ("old_space", 0x015a5): "AsyncFunctionAwaitRejectSharedFun", - ("old_space", 0x015cd): "AsyncFunctionAwaitResolveSharedFun", - ("old_space", 0x015f5): "AsyncGeneratorAwaitRejectSharedFun", - ("old_space", 0x0161d): "AsyncGeneratorAwaitResolveSharedFun", - ("old_space", 0x01645): "AsyncGeneratorYieldResolveSharedFun", - ("old_space", 0x0166d): "AsyncGeneratorReturnResolveSharedFun", - ("old_space", 0x01695): "AsyncGeneratorReturnClosedRejectSharedFun", - ("old_space", 0x016bd): "AsyncGeneratorReturnClosedResolveSharedFun", - ("old_space", 0x016e5): "AsyncIteratorValueUnwrapSharedFun", - ("old_space", 0x0170d): "PromiseAllResolveElementSharedFun", - ("old_space", 0x01735): "PromiseAllSettledResolveElementSharedFun", - ("old_space", 0x0175d): "PromiseAllSettledRejectElementSharedFun", - ("old_space", 0x01785): "PromiseAnyRejectElementSharedFun", - ("old_space", 0x017ad): "PromiseCapabilityDefaultRejectSharedFun", - ("old_space", 0x017d5): "PromiseCapabilityDefaultResolveSharedFun", - ("old_space", 0x017fd): "PromiseCatchFinallySharedFun", - ("old_space", 0x01825): "PromiseGetCapabilitiesExecutorSharedFun", - ("old_space", 0x0184d): "PromiseThenFinallySharedFun", - ("old_space", 0x01875): "PromiseThrowerFinallySharedFun", - ("old_space", 0x0189d): "PromiseValueThunkFinallySharedFun", - ("old_space", 0x018c5): "ProxyRevokeSharedFun", + ("old_space", 0x015a1): "AsyncFunctionAwaitRejectSharedFun", + ("old_space", 0x015c9): "AsyncFunctionAwaitResolveSharedFun", + ("old_space", 0x015f1): "AsyncGeneratorAwaitRejectSharedFun", + ("old_space", 0x01619): "AsyncGeneratorAwaitResolveSharedFun", + ("old_space", 0x01641): "AsyncGeneratorYieldResolveSharedFun", + ("old_space", 0x01669): "AsyncGeneratorReturnResolveSharedFun", + ("old_space", 0x01691): "AsyncGeneratorReturnClosedRejectSharedFun", + ("old_space", 0x016b9): "AsyncGeneratorReturnClosedResolveSharedFun", + ("old_space", 0x016e1): "AsyncIteratorValueUnwrapSharedFun", + ("old_space", 0x01709): "PromiseAllResolveElementSharedFun", + ("old_space", 0x01731): "PromiseAllSettledResolveElementSharedFun", + ("old_space", 0x01759): "PromiseAllSettledRejectElementSharedFun", + ("old_space", 0x01781): "PromiseAnyRejectElementSharedFun", + ("old_space", 0x017a9): "PromiseCapabilityDefaultRejectSharedFun", + ("old_space", 0x017d1): "PromiseCapabilityDefaultResolveSharedFun", + ("old_space", 0x017f9): "PromiseCatchFinallySharedFun", + ("old_space", 0x01821): "PromiseGetCapabilitiesExecutorSharedFun", + ("old_space", 0x01849): "PromiseThenFinallySharedFun", + ("old_space", 0x01871): "PromiseThrowerFinallySharedFun", + ("old_space", 0x01899): "PromiseValueThunkFinallySharedFun", + ("old_space", 0x018c1): "ProxyRevokeSharedFun", } # Lower 32 bits of first page addresses for various heap spaces.