Commit 1b594a29 authored by Joshua Litt's avatar Joshua Litt Committed by Commit Bot

Revert "[names] Fix some test262 name tests to conform with spec changes"

This reverts commit 48c9ca44.

Reason for revert: Possible clusterfuzz issues
Bug: chromium:1028952

Original change's description:
> [names] Fix some test262 name tests to conform with spec changes
>
> In order to reflect web reality, TC39 has made some slight changes to
> name descriptors, see https://github.com/tc39/ecma262/pull/1490 for
> details. V8 was mostly already in compliance with these changes, but
> ThrowTypeError and anonymous classes needed some slight changes.
>
> Bug: v8:9646
> Change-Id: I163238954938f0c005e3adbc61b90498e01436da
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1764622
> Reviewed-by: Sathya Gunasekaran  <gsathya@chromium.org>
> Commit-Queue: Joshua Litt <joshualitt@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#63373}

TBR=gsathya@chromium.org,joshualitt@chromium.org

Bug: v8:9646
Change-Id: I06dd5527d30052d9c9dfc45a2862be930274aba7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1939948Reviewed-by: 's avatarJoshua Litt <joshualitt@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Joshua Litt <joshualitt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65216}
parent cd674a13
......@@ -650,21 +650,17 @@ Handle<JSFunction> Genesis::GetThrowTypeErrorIntrinsic() {
Handle<JSFunction> function = factory()->NewFunction(args);
function->shared().DontAdaptArguments();
PropertyAttributes ro_attribs =
static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
// %ThrowTypeError% must have a name property with an empty string value.
// Per spec, ThrowTypeError's name must also be non-configurable, otherwise
// we could omit explicitly setting a property attribute here and just fall
// back to the default name attribute on function.
JSObject::SetOwnPropertyIgnoreAttributes(
function, factory()->name_string(), factory()->empty_string(), ro_attribs)
.Assert();
// %ThrowTypeError% must not have a name property.
if (JSReceiver::DeleteProperty(function, factory()->name_string())
.IsNothing()) {
DCHECK(false);
}
// length needs to be non configurable.
Handle<Object> value(Smi::FromInt(function->length()), isolate());
JSObject::SetOwnPropertyIgnoreAttributes(function, factory()->length_string(),
value, ro_attribs)
JSObject::SetOwnPropertyIgnoreAttributes(
function, factory()->length_string(), value,
static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY))
.Assert();
if (JSObject::PreventExtensions(function, kThrowOnError).IsNothing()) {
......
......@@ -524,7 +524,8 @@ Handle<ClassBoilerplate> ClassBoilerplate::BuildClassBoilerplate(
// Add name accessor to the class object if necessary.
bool install_class_name_accessor = false;
if (!expr->has_name_static_property()) {
if (!expr->has_name_static_property() &&
expr->constructor()->has_shared_name()) {
if (static_desc.HasDictionaryProperties()) {
// Install class name accessor if necessary during class literal
// instantiation.
......
......@@ -37,7 +37,7 @@
literal = { __proto__: class {} };
assertEquals('', literal.__proto__.name);
assertEquals(
'', Object.getOwnPropertyDescriptor(literal.__proto__, 'name').value);
undefined, Object.getOwnPropertyDescriptor(literal.__proto__, 'name'));
literal = { __proto__: class F {} };
assertEquals('F', literal.__proto__.name);
......
......@@ -394,7 +394,7 @@
})();
(function testClassNameOrder() {
assertEquals(['length', 'prototype', 'name'], Object.getOwnPropertyNames(class {}));
assertEquals(['length', 'prototype'], Object.getOwnPropertyNames(class {}));
var tmp = {'': class {}};
var Tmp = tmp[''];
......
......@@ -5,12 +5,8 @@
var throwTypeErrorFunction =
Object.getOwnPropertyDescriptor(Function.prototype, 'arguments').get;
var nameDesc =
Object.getOwnPropertyDescriptor(throwTypeErrorFunction, 'name');
assertEquals('', nameDesc.value);
assertFalse(nameDesc.configurable);
assertFalse(nameDesc.enumerable);
assertFalse(nameDesc.writable);
assertFalse(
Object.prototype.hasOwnProperty.call(throwTypeErrorFunction, 'name'));
assertThrows(function() {
'use strict';
throwTypeErrorFunction.name = 'foo';
......
......@@ -43,8 +43,8 @@
configurable: true
};
// Anonymous classes do have a "name" property by default with a value of ''.
assertEquals(descriptor, Object.getOwnPropertyDescriptor(class {}, 'name'));
// Anonymous classes do not have a "name" property by default.
assertSame(undefined, Object.getOwnPropertyDescriptor(class {}, 'name'));
descriptor.value = 'C';
assertEquals(descriptor, Object.getOwnPropertyDescriptor(class C {}, 'name'));
......@@ -55,9 +55,8 @@
let b = { __proto__: class {} };
assertSame('', b.__proto__.name);
descriptor.value = '';
assertEquals(
descriptor, Object.getOwnPropertyDescriptor(b.__proto__, 'name'));
assertSame(
undefined, Object.getOwnPropertyDescriptor(b.__proto__, 'name'));
let c = { fn: class F {} };
assertSame('F', c.fn.name);
......
......@@ -512,6 +512,10 @@
'intl402/Locale/constructor-non-iana-canon': [FAIL],
'intl402/Locale/likely-subtags-grandfathered': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=9646
'built-ins/ThrowTypeError/name': [FAIL],
'language/expressions/class/name': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=9742
'intl402/Locale/getters': [FAIL],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment