Rename fields to names or members

Rename variables and flag names so that the classes can be reused
by private methods implementation.

In particular:

Rename "fields" to "members" in the initializer so that we can
initialize both fields and private methods/accessors there,
for example:

instance_fields_initializer -> instance_members_initializer
InitializeClassFieldsStatement -> InitializeClassMembersStatement

Rename "private field" to "private name" for the private symbols
used to implement private fields so that we can use them to
store private methods/accessors later as well, for example:

private_field_name_var -> private_name_var
NewPrivateFieldSymbol -> NewPrivateNameSymbol

The follow-on is in
https://chromium-review.googlesource.com/c/v8/v8/+/1301018

The design doc is in
https://docs.google.com/document/d/1T-Ql6HOIH2U_8YjWkwK2rTfywwb7b3Qe8d3jkz72KwA/edit?usp=sharing

Bug: v8:8330
Change-Id: I1cdca8def711da879b6e4d67c5ff0a5a4a36abbe
Reviewed-on: https://chromium-review.googlesource.com/c/1312597
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Joyee Cheung <joyee@igalia.com>
Cr-Commit-Position: refs/heads/master@{#57289}
This commit is contained in:
Joyee Cheung 2018-11-06 20:06:39 +08:00 committed by Commit Bot
parent e42abbfebe
commit 6c3d784c16
34 changed files with 186 additions and 188 deletions

View File

@ -484,8 +484,8 @@ void AstTraversalVisitor<Subclass>::VisitClassLiteral(ClassLiteral* expr) {
if (expr->static_fields_initializer() != nullptr) {
RECURSE_EXPRESSION(Visit(expr->static_fields_initializer()));
}
if (expr->instance_fields_initializer_function() != nullptr) {
RECURSE_EXPRESSION(Visit(expr->instance_fields_initializer_function()));
if (expr->instance_members_initializer_function() != nullptr) {
RECURSE_EXPRESSION(Visit(expr->instance_members_initializer_function()));
}
ZonePtrList<ClassLiteral::Property>* props = expr->properties();
for (int i = 0; i < props->length(); ++i) {
@ -498,8 +498,8 @@ void AstTraversalVisitor<Subclass>::VisitClassLiteral(ClassLiteral* expr) {
}
template <class Subclass>
void AstTraversalVisitor<Subclass>::VisitInitializeClassFieldsStatement(
InitializeClassFieldsStatement* stmt) {
void AstTraversalVisitor<Subclass>::VisitInitializeClassMembersStatement(
InitializeClassMembersStatement* stmt) {
PROCESS_NODE(stmt);
ZonePtrList<ClassLiteral::Property>* props = stmt->fields();
for (int i = 0; i < props->length(); ++i) {

View File

@ -65,7 +65,7 @@ namespace internal {
V(TryCatchStatement) \
V(TryFinallyStatement) \
V(DebuggerStatement) \
V(InitializeClassFieldsStatement)
V(InitializeClassMembersStatement)
#define LITERAL_NODE_LIST(V) \
V(RegExpLiteral) \
@ -1598,9 +1598,9 @@ class VariableProxy final : public Expression {
HoleCheckModeField::update(bit_field_, HoleCheckMode::kRequired);
}
bool is_private_field() const { return IsPrivateField::decode(bit_field_); }
void set_is_private_field() {
bit_field_ = IsPrivateField::update(bit_field_, true);
bool is_private_name() const { return IsPrivateName::decode(bit_field_); }
void set_is_private_name() {
bit_field_ = IsPrivateName::update(bit_field_, true);
}
// Bind this proxy to the variable var.
@ -1631,7 +1631,7 @@ class VariableProxy final : public Expression {
IsAssignedField::encode(false) |
IsResolvedField::encode(false) |
HoleCheckModeField::encode(HoleCheckMode::kElided) |
IsPrivateField::encode(false);
IsPrivateName::encode(false);
}
explicit VariableProxy(const VariableProxy* copy_from);
@ -1643,7 +1643,7 @@ class VariableProxy final : public Expression {
class IsNewTargetField : public BitField<bool, IsResolvedField::kNext, 1> {};
class HoleCheckModeField
: public BitField<HoleCheckMode, IsNewTargetField::kNext, 1> {};
class IsPrivateField : public BitField<bool, HoleCheckModeField::kNext, 1> {};
class IsPrivateName : public BitField<bool, HoleCheckModeField::kNext, 1> {};
union {
const AstRawString* raw_name_; // if !is_resolved_
@ -2401,11 +2401,11 @@ class FunctionLiteral final : public Expression {
function_literal_id_ = function_literal_id;
}
void set_requires_instance_fields_initializer(bool value) {
bit_field_ = RequiresInstanceFieldsInitializer::update(bit_field_, value);
void set_requires_instance_members_initializer(bool value) {
bit_field_ = RequiresInstanceMembersInitializer::update(bit_field_, value);
}
bool requires_instance_fields_initializer() const {
return RequiresInstanceFieldsInitializer::decode(bit_field_);
bool requires_instance_members_initializer() const {
return RequiresInstanceMembersInitializer::decode(bit_field_);
}
ProducedPreParsedScopeData* produced_preparsed_scope_data() const {
@ -2440,7 +2440,7 @@ class FunctionLiteral final : public Expression {
HasDuplicateParameters::encode(has_duplicate_parameters ==
kHasDuplicateParameters) |
DontOptimizeReasonField::encode(BailoutReason::kNoReason) |
RequiresInstanceFieldsInitializer::encode(false) |
RequiresInstanceMembersInitializer::encode(false) |
HasBracesField::encode(has_braces) | IIFEBit::encode(false);
if (eager_compile_hint == kShouldEagerCompile) SetShouldEagerCompile();
body.CopyTo(&body_, zone);
@ -2452,10 +2452,10 @@ class FunctionLiteral final : public Expression {
class HasDuplicateParameters : public BitField<bool, Pretenure::kNext, 1> {};
class DontOptimizeReasonField
: public BitField<BailoutReason, HasDuplicateParameters::kNext, 8> {};
class RequiresInstanceFieldsInitializer
class RequiresInstanceMembersInitializer
: public BitField<bool, DontOptimizeReasonField::kNext, 1> {};
class HasBracesField
: public BitField<bool, RequiresInstanceFieldsInitializer::kNext, 1> {};
: public BitField<bool, RequiresInstanceMembersInitializer::kNext, 1> {};
class IIFEBit : public BitField<bool, HasBracesField::kNext, 1> {};
int expected_property_count_;
@ -2497,12 +2497,12 @@ class ClassLiteralProperty final : public LiteralProperty {
return private_or_computed_name_var_;
}
void set_private_field_name_var(Variable* var) {
void set_private_name_var(Variable* var) {
DCHECK_EQ(FIELD, kind());
DCHECK(is_private());
private_or_computed_name_var_ = var;
}
Variable* private_field_name_var() const {
Variable* private_name_var() const {
DCHECK_EQ(FIELD, kind());
DCHECK(is_private());
return private_or_computed_name_var_;
@ -2520,7 +2520,7 @@ class ClassLiteralProperty final : public LiteralProperty {
Variable* private_or_computed_name_var_;
};
class InitializeClassFieldsStatement final : public Statement {
class InitializeClassMembersStatement final : public Statement {
public:
typedef ClassLiteralProperty Property;
@ -2529,8 +2529,8 @@ class InitializeClassFieldsStatement final : public Statement {
private:
friend class AstNodeFactory;
InitializeClassFieldsStatement(ZonePtrList<Property>* fields, int pos)
: Statement(pos, kInitializeClassFieldsStatement), fields_(fields) {}
InitializeClassMembersStatement(ZonePtrList<Property>* fields, int pos)
: Statement(pos, kInitializeClassMembersStatement), fields_(fields) {}
ZonePtrList<Property>* fields_;
};
@ -2564,8 +2564,8 @@ class ClassLiteral final : public Expression {
return static_fields_initializer_;
}
FunctionLiteral* instance_fields_initializer_function() const {
return instance_fields_initializer_function_;
FunctionLiteral* instance_members_initializer_function() const {
return instance_members_initializer_function_;
}
private:
@ -2574,7 +2574,7 @@ class ClassLiteral final : public Expression {
ClassLiteral(Scope* scope, Variable* class_variable, Expression* extends,
FunctionLiteral* constructor, ZonePtrList<Property>* properties,
FunctionLiteral* static_fields_initializer,
FunctionLiteral* instance_fields_initializer_function,
FunctionLiteral* instance_members_initializer_function,
int start_position, int end_position,
bool has_name_static_property, bool has_static_computed_names,
bool is_anonymous)
@ -2586,8 +2586,8 @@ class ClassLiteral final : public Expression {
constructor_(constructor),
properties_(properties),
static_fields_initializer_(static_fields_initializer),
instance_fields_initializer_function_(
instance_fields_initializer_function) {
instance_members_initializer_function_(
instance_members_initializer_function) {
bit_field_ |= HasNameStaticProperty::encode(has_name_static_property) |
HasStaticComputedNames::encode(has_static_computed_names) |
IsAnonymousExpression::encode(is_anonymous);
@ -2600,7 +2600,7 @@ class ClassLiteral final : public Expression {
FunctionLiteral* constructor_;
ZonePtrList<Property>* properties_;
FunctionLiteral* static_fields_initializer_;
FunctionLiteral* instance_fields_initializer_function_;
FunctionLiteral* instance_members_initializer_function_;
class HasNameStaticProperty
: public BitField<bool, Expression::kNextBitFieldIndex, 1> {};
class HasStaticComputedNames
@ -3337,12 +3337,12 @@ class AstNodeFactory final {
FunctionLiteral* constructor,
ZonePtrList<ClassLiteral::Property>* properties,
FunctionLiteral* static_fields_initializer,
FunctionLiteral* instance_fields_initializer_function, int start_position,
int end_position, bool has_name_static_property,
FunctionLiteral* instance_members_initializer_function,
int start_position, int end_position, bool has_name_static_property,
bool has_static_computed_names, bool is_anonymous) {
return new (zone_) ClassLiteral(
scope, variable, extends, constructor, properties,
static_fields_initializer, instance_fields_initializer_function,
static_fields_initializer, instance_members_initializer_function,
start_position, end_position, has_name_static_property,
has_static_computed_names, is_anonymous);
}
@ -3407,9 +3407,9 @@ class AstNodeFactory final {
return new (zone_) ImportCallExpression(args, pos);
}
InitializeClassFieldsStatement* NewInitializeClassFieldsStatement(
InitializeClassMembersStatement* NewInitializeClassMembersStatement(
ZonePtrList<ClassLiteral::Property>* args, int pos) {
return new (zone_) InitializeClassFieldsStatement(args, pos);
return new (zone_) InitializeClassMembersStatement(args, pos);
}
Zone* zone() const { return zone_; }

View File

@ -205,8 +205,8 @@ void CallPrinter::VisitClassLiteral(ClassLiteral* node) {
}
}
void CallPrinter::VisitInitializeClassFieldsStatement(
InitializeClassFieldsStatement* node) {
void CallPrinter::VisitInitializeClassMembersStatement(
InitializeClassMembersStatement* node) {
for (int i = 0; i < node->fields()->length(); i++) {
Find(node->fields()->at(i)->value());
}
@ -778,7 +778,7 @@ const char* AstPrinter::PrintProgram(FunctionLiteral* program) {
if (program->raw_inferred_name()) {
PrintLiteralIndented("INFERRED NAME", program->raw_inferred_name(), true);
}
if (program->requires_instance_fields_initializer()) {
if (program->requires_instance_members_initializer()) {
Print(" REQUIRES INSTANCE FIELDS INITIALIZER\n");
}
PrintParameters(program->scope());
@ -1036,16 +1036,16 @@ void AstPrinter::VisitClassLiteral(ClassLiteral* node) {
PrintIndentedVisit("STATIC FIELDS INITIALIZER",
node->static_fields_initializer());
}
if (node->instance_fields_initializer_function() != nullptr) {
PrintIndentedVisit("INSTANCE FIELDS INITIALIZER",
node->instance_fields_initializer_function());
if (node->instance_members_initializer_function() != nullptr) {
PrintIndentedVisit("INSTANCE ELEMENTS INITIALIZER",
node->instance_members_initializer_function());
}
PrintClassProperties(node->properties());
}
void AstPrinter::VisitInitializeClassFieldsStatement(
InitializeClassFieldsStatement* node) {
IndentedScope indent(this, "INITIALIZE CLASS FIELDS", node->position());
void AstPrinter::VisitInitializeClassMembersStatement(
InitializeClassMembersStatement* node) {
IndentedScope indent(this, "INITIALIZE CLASS ELEMENTS", node->position());
PrintClassProperties(node->fields());
}

View File

@ -1502,9 +1502,9 @@ void DeclarationScope::AnalyzePartially(AstNodeFactory* ast_node_factory) {
ResolveScopesThenForEachVariable(
this, [=, &new_unresolved_list](VariableProxy* proxy) {
// Don't copy unresolved references to the script scope, unless it's a
// reference to a private field. In that case keep it so we can fail
// later.
if (!outer_scope_->is_script_scope() || proxy->is_private_field()) {
// reference to a private name or method. In that case keep it so we
// can fail later.
if (!outer_scope_->is_script_scope() || proxy->is_private_name()) {
VariableProxy* copy = ast_node_factory->CopyVariableProxy(proxy);
new_unresolved_list.AddFront(copy);
}
@ -1801,7 +1801,7 @@ Variable* Scope::LookupRecursive(ParseInfo* info, VariableProxy* proxy,
// declare them in the outer scope.
if (!is_script_scope()) return nullptr;
if (proxy->is_private_field()) {
if (proxy->is_private_name()) {
info->pending_error_handler()->ReportMessageAt(
proxy->position(), proxy->position() + 1,
MessageTemplate::kInvalidPrivateFieldAccess, proxy->raw_name(),
@ -1878,7 +1878,7 @@ bool Scope::ResolveVariable(ParseInfo* info, VariableProxy* proxy) {
DCHECK(!proxy->is_resolved());
Variable* var = LookupRecursive(info, proxy, nullptr);
if (var == nullptr) {
DCHECK(proxy->is_private_field());
DCHECK(proxy->is_private_name());
return false;
}
ResolveTo(info, proxy, var);
@ -1988,7 +1988,7 @@ bool Scope::ResolveVariablesRecursively(ParseInfo* info) {
for (VariableProxy* proxy : unresolved_list_) {
Variable* var = outer_scope()->LookupRecursive(info, proxy, nullptr);
if (var == nullptr) {
DCHECK(proxy->is_private_field());
DCHECK(proxy->is_private_name());
return false;
}
if (!var->is_dynamic()) {

View File

@ -708,7 +708,7 @@ class V8_EXPORT_PRIVATE DeclarationScope : public Scope {
void set_asm_module();
bool should_ban_arguments() const {
return IsClassFieldsInitializerFunction(function_kind());
return IsClassMembersInitializerFunction(function_kind());
}
void DeclareThis(AstValueFactory* ast_value_factory);
@ -864,7 +864,7 @@ class V8_EXPORT_PRIVATE DeclarationScope : public Scope {
// scope only contains the single lazily compiled function, so this
// doesn't re-allocate variables repeatedly.
//
// Returns false if private fields can not be resolved and
// Returns false if private names can not be resolved and
// ParseInfo's pending_error_handler will be populated with an
// error. Otherwise, returns true.
V8_WARN_UNUSED_RESULT
@ -947,7 +947,7 @@ class V8_EXPORT_PRIVATE DeclarationScope : public Scope {
// parameter is the context in which eval was called. In all other
// cases the context parameter is an empty handle.
//
// Returns false if private fields can not be resolved.
// Returns false if private names can not be resolved.
bool AllocateVariables(ParseInfo* info);
void SetDefaults();

View File

@ -97,7 +97,7 @@ void ScopeIterator::TryParseAndRetrieveScopes(ScopeIterator::Option option) {
// Class fields initializer functions don't have any scope
// information. We short circuit the parsing of the class literal
// and return an empty context here.
if (IsClassFieldsInitializerFunction(shared_info->kind())) {
if (IsClassMembersInitializerFunction(shared_info->kind())) {
current_scope_ = closure_scope_ = nullptr;
context_ = Handle<Context>();
function_ = Handle<JSFunction>();

View File

@ -1121,7 +1121,7 @@ enum FunctionKind : uint8_t {
kSetterFunction,
kAsyncFunction,
kModule,
kClassFieldsInitializerFunction,
kClassMembersInitializerFunction,
kDefaultBaseConstructor,
kDefaultDerivedConstructor,
@ -1170,7 +1170,7 @@ inline bool IsConciseMethod(FunctionKind kind) {
kind == FunctionKind::kConciseGeneratorMethod ||
kind == FunctionKind::kAsyncConciseMethod ||
kind == FunctionKind::kAsyncConciseGeneratorMethod ||
kind == FunctionKind::kClassFieldsInitializerFunction;
kind == FunctionKind::kClassMembersInitializerFunction;
}
inline bool IsGetterFunction(FunctionKind kind) {
@ -1206,8 +1206,8 @@ inline bool IsClassConstructor(FunctionKind kind) {
return IsBaseConstructor(kind) || IsDerivedConstructor(kind);
}
inline bool IsClassFieldsInitializerFunction(FunctionKind kind) {
return kind == FunctionKind::kClassFieldsInitializerFunction;
inline bool IsClassMembersInitializerFunction(FunctionKind kind) {
return kind == FunctionKind::kClassMembersInitializerFunction;
}
inline bool IsConstructable(FunctionKind kind) {
@ -1241,8 +1241,8 @@ inline std::ostream& operator<<(std::ostream& os, FunctionKind kind) {
return os << "AsyncFunction";
case FunctionKind::kModule:
return os << "Module";
case FunctionKind::kClassFieldsInitializerFunction:
return os << "ClassFieldsInitializerFunction";
case FunctionKind::kClassMembersInitializerFunction:
return os << "ClassMembersInitializerFunction";
case FunctionKind::kDefaultBaseConstructor:
return os << "DefaultBaseConstructor";
case FunctionKind::kDefaultDerivedConstructor:

View File

@ -1343,9 +1343,9 @@ Handle<Symbol> Factory::NewPrivateSymbol(PretenureFlag flag) {
return symbol;
}
Handle<Symbol> Factory::NewPrivateFieldSymbol() {
Handle<Symbol> Factory::NewPrivateNameSymbol() {
Handle<Symbol> symbol = NewSymbol();
symbol->set_is_private_field();
symbol->set_is_private_name();
return symbol;
}

View File

@ -361,7 +361,7 @@ class V8_EXPORT_PRIVATE Factory {
// Create a symbol in old or read-only space.
Handle<Symbol> NewSymbol(PretenureFlag pretenure = TENURED);
Handle<Symbol> NewPrivateSymbol(PretenureFlag pretenure = TENURED);
Handle<Symbol> NewPrivateFieldSymbol();
Handle<Symbol> NewPrivateNameSymbol();
// Create a global (but otherwise uninitialized) context.
Handle<NativeContext> NewNativeContext();

View File

@ -447,7 +447,7 @@ MaybeHandle<Object> LoadIC::Load(Handle<Object> object, Handle<Name> name) {
LookupForRead(isolate(), &it);
if (name->IsPrivate()) {
if (name->IsPrivateField() && !it.IsFound()) {
if (name->IsPrivateName() && !it.IsFound()) {
return TypeError(MessageTemplate::kInvalidPrivateFieldAccess, object,
name);
}
@ -1411,7 +1411,7 @@ MaybeHandle<Object> StoreIC::Store(Handle<Object> object, Handle<Name> name,
bool use_ic = FLAG_use_ic;
if (name->IsPrivate()) {
if (name->IsPrivateField() && !it.IsFound()) {
if (name->IsPrivateName() && !it.IsFound()) {
return TypeError(MessageTemplate::kInvalidPrivateFieldAccess, object,
name);
}
@ -2466,7 +2466,7 @@ static bool CanFastCloneObject(Handle<Map> map) {
PropertyDetails details = descriptors->GetDetails(i);
Name* key = descriptors->GetKey(i);
if (details.kind() != kData || !details.IsEnumerable() ||
key->IsPrivateField()) {
key->IsPrivateName()) {
return false;
}
}

View File

@ -1112,9 +1112,9 @@ void BytecodeGenerator::GenerateBytecodeBody() {
// The derived constructor case is handled in VisitCallSuper.
if (IsBaseConstructor(function_kind()) &&
info()->literal()->requires_instance_fields_initializer()) {
BuildInstanceFieldInitialization(Register::function_closure(),
builder()->Receiver());
info()->literal()->requires_instance_members_initializer()) {
BuildInstanceMemberInitialization(Register::function_closure(),
builder()->Receiver());
}
// Visit statements in the function body.
@ -1903,10 +1903,10 @@ void BytecodeGenerator::BuildClassLiteral(ClassLiteral* expr, Register name) {
if (property->kind() == ClassLiteral::Property::FIELD) {
if (property->is_private()) {
builder()->CallRuntime(Runtime::kCreatePrivateFieldSymbol);
DCHECK_NOT_NULL(property->private_field_name_var());
BuildVariableAssignment(property->private_field_name_var(),
Token::INIT, HoleCheckMode::kElided);
builder()->CallRuntime(Runtime::kCreatePrivateNameSymbol);
DCHECK_NOT_NULL(property->private_name_var());
BuildVariableAssignment(property->private_name_var(), Token::INIT,
HoleCheckMode::kElided);
}
// We don't compute field's value here, but instead do it in the
// initializer function.
@ -1931,12 +1931,12 @@ void BytecodeGenerator::BuildClassLiteral(ClassLiteral* expr, Register name) {
HoleCheckMode::kElided);
}
if (expr->instance_fields_initializer_function() != nullptr) {
if (expr->instance_members_initializer_function() != nullptr) {
Register initializer =
VisitForRegisterValue(expr->instance_fields_initializer_function());
VisitForRegisterValue(expr->instance_members_initializer_function());
if (FunctionLiteral::NeedsHomeObject(
expr->instance_fields_initializer_function())) {
expr->instance_members_initializer_function())) {
FeedbackSlot slot = feedback_spec()->AddStoreICSlot(language_mode());
builder()->LoadAccumulatorWithRegister(prototype).StoreHomeObjectProperty(
initializer, feedback_index(slot), language_mode());
@ -2004,8 +2004,8 @@ void BytecodeGenerator::VisitClassLiteral(ClassLiteral* expr, Register name) {
}
}
void BytecodeGenerator::VisitInitializeClassFieldsStatement(
InitializeClassFieldsStatement* stmt) {
void BytecodeGenerator::VisitInitializeClassMembersStatement(
InitializeClassMembersStatement* stmt) {
RegisterList args = register_allocator()->NewRegisterList(3);
Register constructor = args[0], key = args[1], value = args[2];
builder()->MoveRegister(builder()->Receiver(), constructor);
@ -2024,9 +2024,9 @@ void BytecodeGenerator::VisitInitializeClassFieldsStatement(
builder()->StoreAccumulatorInRegister(key);
} else if (property->kind() == ClassLiteral::Property::FIELD &&
property->is_private()) {
Variable* private_field_name_var = property->private_field_name_var();
DCHECK_NOT_NULL(private_field_name_var);
BuildVariableLoad(private_field_name_var, HoleCheckMode::kElided);
Variable* private_name_var = property->private_name_var();
DCHECK_NOT_NULL(private_name_var);
BuildVariableLoad(private_name_var, HoleCheckMode::kElided);
builder()->StoreAccumulatorInRegister(key);
} else {
BuildLoadPropertyKey(property, key);
@ -2045,8 +2045,8 @@ void BytecodeGenerator::VisitInitializeClassFieldsStatement(
}
}
void BytecodeGenerator::BuildInstanceFieldInitialization(Register constructor,
Register instance) {
void BytecodeGenerator::BuildInstanceMemberInitialization(Register constructor,
Register instance) {
RegisterList args = register_allocator()->NewRegisterList(1);
Register initializer = register_allocator()->NewRegister();
@ -3840,11 +3840,11 @@ void BytecodeGenerator::VisitCallSuper(Call* expr) {
// TODO(gsathya): In the future, we could tag nested arrow functions
// or eval with the correct bit so that we do the load conditionally
// if required.
if (info()->literal()->requires_instance_fields_initializer() ||
if (info()->literal()->requires_instance_members_initializer() ||
!IsDerivedConstructor(info()->literal()->kind())) {
Register instance = register_allocator()->NewRegister();
builder()->StoreAccumulatorInRegister(instance);
BuildInstanceFieldInitialization(this_function, instance);
BuildInstanceMemberInitialization(this_function, instance);
builder()->LoadAccumulatorWithRegister(instance);
}
}

View File

@ -198,8 +198,8 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> {
void VisitClassLiteral(ClassLiteral* expr, Register name);
void VisitNewTargetVariable(Variable* variable);
void VisitThisFunctionVariable(Variable* variable);
void BuildInstanceFieldInitialization(Register constructor,
Register instance);
void BuildInstanceMemberInitialization(Register constructor,
Register instance);
void BuildGeneratorObjectVariableInitialization();
void VisitBlockDeclarationsAndStatements(Block* stmt);
void VisitSetHomeObject(Register value, Register home_object,

View File

@ -497,7 +497,7 @@ void LookupIterator::ReconfigureDataProperty(Handle<Object> value,
Handle<JSReceiver> holder = GetHolder<JSReceiver>();
// Property details can never change for private fields.
// Property details can never change for private properties.
if (holder->IsJSProxy()) {
DCHECK(name()->IsPrivate());
return;
@ -700,7 +700,7 @@ void LookupIterator::Delete() {
ElementsAccessor* accessor = object->GetElementsAccessor();
accessor->Delete(object, number_);
} else {
DCHECK(!name()->IsPrivateField());
DCHECK(!name()->IsPrivateName());
bool is_prototype_map = holder->map()->is_prototype_map();
RuntimeCallTimerScope stats_scope(
isolate_, is_prototype_map

View File

@ -446,7 +446,7 @@ void Symbol::SymbolVerify(Isolate* isolate) {
CHECK(HasHashCode());
CHECK_GT(Hash(), 0);
CHECK(name()->IsUndefined(isolate) || name()->IsString());
CHECK_IMPLIES(IsPrivateField(), IsPrivate());
CHECK_IMPLIES(IsPrivateName(), IsPrivate());
}
void ByteArray::ByteArrayVerify(Isolate* isolate) { CHECK(IsByteArray()); }

View File

@ -5321,8 +5321,8 @@ Maybe<bool> Object::RedefineIncompatibleProperty(Isolate* isolate,
Maybe<bool> Object::SetDataProperty(LookupIterator* it, Handle<Object> value) {
DCHECK_IMPLIES(it->GetReceiver()->IsJSProxy(),
it->GetName()->IsPrivateField());
DCHECK_IMPLIES(!it->IsElement() && it->GetName()->IsPrivateField(),
it->GetName()->IsPrivateName());
DCHECK_IMPLIES(!it->IsElement() && it->GetName()->IsPrivateName(),
it->state() == LookupIterator::DATA);
Handle<JSReceiver> receiver = Handle<JSReceiver>::cast(it->GetReceiver());
@ -5385,7 +5385,7 @@ Maybe<bool> Object::AddDataProperty(LookupIterator* it, Handle<Object> value,
// Private symbols should be installed on JSProxy using
// JSProxy::SetPrivateSymbol.
if (it->GetReceiver()->IsJSProxy() && it->GetName()->IsPrivate() &&
!it->GetName()->IsPrivateField()) {
!it->GetName()->IsPrivateName()) {
RETURN_FAILURE(it->isolate(), should_throw,
NewTypeError(MessageTemplate::kProxyPrivate));
}
@ -5393,7 +5393,7 @@ Maybe<bool> Object::AddDataProperty(LookupIterator* it, Handle<Object> value,
DCHECK_NE(LookupIterator::INTEGER_INDEXED_EXOTIC, it->state());
Handle<JSReceiver> receiver = it->GetStoreTarget<JSReceiver>();
DCHECK_IMPLIES(receiver->IsJSProxy(), it->GetName()->IsPrivateField());
DCHECK_IMPLIES(receiver->IsJSProxy(), it->GetName()->IsPrivateName());
DCHECK_IMPLIES(receiver->IsJSProxy(),
it->state() == LookupIterator::NOT_FOUND);
@ -7763,7 +7763,7 @@ Maybe<bool> JSProxy::DefineOwnProperty(Isolate* isolate, Handle<JSProxy> proxy,
ShouldThrow should_throw) {
STACK_CHECK(isolate, Nothing<bool>());
if (key->IsSymbol() && Handle<Symbol>::cast(key)->IsPrivate()) {
DCHECK(!Handle<Symbol>::cast(key)->IsPrivateField());
DCHECK(!Handle<Symbol>::cast(key)->IsPrivateName());
return JSProxy::SetPrivateSymbol(isolate, proxy, Handle<Symbol>::cast(key),
desc, should_throw);
}
@ -7873,7 +7873,7 @@ Maybe<bool> JSProxy::SetPrivateSymbol(Isolate* isolate, Handle<JSProxy> proxy,
Handle<Symbol> private_name,
PropertyDescriptor* desc,
ShouldThrow should_throw) {
DCHECK(!private_name->IsPrivateField());
DCHECK(!private_name->IsPrivateName());
// Despite the generic name, this can only add private data properties.
if (!PropertyDescriptor::IsDataDescriptor(desc) ||
desc->ToAttributes() != DONT_ENUM) {
@ -10189,7 +10189,7 @@ Handle<DescriptorArray> DescriptorArray::CopyForFastObjectClone(
Name* key = src->GetKey(i);
PropertyDetails details = src->GetDetails(i);
DCHECK(!key->IsPrivateField());
DCHECK(!key->IsPrivateName());
DCHECK(details.IsEnumerable());
DCHECK_EQ(details.kind(), kData);
@ -14181,10 +14181,10 @@ void SharedFunctionInfo::InitFromFunctionLiteral(
// FunctionKind must have already been set.
DCHECK(lit->kind() == shared_info->kind());
shared_info->set_needs_home_object(lit->scope()->NeedsHomeObject());
DCHECK_IMPLIES(lit->requires_instance_fields_initializer(),
DCHECK_IMPLIES(lit->requires_instance_members_initializer(),
IsClassConstructor(lit->kind()));
shared_info->set_requires_instance_fields_initializer(
lit->requires_instance_fields_initializer());
shared_info->set_requires_instance_members_initializer(
lit->requires_instance_members_initializer());
shared_info->set_is_toplevel(is_toplevel);
DCHECK(shared_info->outer_scope_info()->IsTheHole());

View File

@ -27,17 +27,17 @@ BIT_FIELD_ACCESSORS(Symbol, flags, is_public, Symbol::IsPublicBit)
BIT_FIELD_ACCESSORS(Symbol, flags, is_interesting_symbol,
Symbol::IsInterestingSymbolBit)
bool Symbol::is_private_field() const {
bool value = Symbol::IsPrivateFieldBit::decode(flags());
bool Symbol::is_private_name() const {
bool value = Symbol::IsPrivateNameBit::decode(flags());
DCHECK_IMPLIES(value, is_private());
return value;
}
void Symbol::set_is_private_field() {
void Symbol::set_is_private_name() {
// TODO(gsathya): Re-order the bits to have these next to each other
// and just do the bit shifts once.
set_flags(Symbol::IsPrivateBit::update(flags(), true));
set_flags(Symbol::IsPrivateFieldBit::update(flags(), true));
set_flags(Symbol::IsPrivateNameBit::update(flags(), true));
}
bool Name::IsUniqueName() const {
@ -98,11 +98,11 @@ bool Name::IsPrivate() {
return this->IsSymbol() && Symbol::cast(this)->is_private();
}
bool Name::IsPrivateField() {
bool is_private_field =
this->IsSymbol() && Symbol::cast(this)->is_private_field();
DCHECK_IMPLIES(is_private_field, IsPrivate());
return is_private_field;
bool Name::IsPrivateName() {
bool is_private_name =
this->IsSymbol() && Symbol::cast(this)->is_private_name();
DCHECK_IMPLIES(is_private_name, IsPrivate());
return is_private_name;
}
bool Name::AsArrayIndex(uint32_t* index) {

View File

@ -45,9 +45,9 @@ class Name : public HeapObject {
// If the name is private, it can only name own properties.
inline bool IsPrivate();
// If the name is a private field, it should behave like a private
// If the name is a private name, it should behave like a private
// symbol but also throw on property access miss.
inline bool IsPrivateField();
inline bool IsPrivateName();
inline bool IsUniqueName() const;
@ -161,13 +161,13 @@ class Symbol : public Name {
// Symbol.keyFor on such a symbol simply needs to return the attached name.
DECL_BOOLEAN_ACCESSORS(is_public)
// [is_private_field]: Whether this is a private field. Private fields
// [is_private_name]: Whether this is a private name. Private names
// are the same as private symbols except they throw on missing
// property access.
//
// This also sets the is_private bit.
inline bool is_private_field() const;
inline void set_is_private_field();
inline bool is_private_name() const;
inline void set_is_private_name();
DECL_CAST(Symbol)
@ -186,7 +186,7 @@ class Symbol : public Name {
V(IsWellKnownSymbolBit, bool, 1, _) \
V(IsPublicBit, bool, 1, _) \
V(IsInterestingSymbolBit, bool, 1, _) \
V(IsPrivateFieldBit, bool, 1, _)
V(IsPrivateNameBit, bool, 1, _)
DEFINE_BIT_FIELDS(FLAGS_BIT_FIELDS)
#undef FLAGS_BIT_FIELDS

View File

@ -163,8 +163,8 @@ BIT_FIELD_ACCESSORS(SharedFunctionInfo, flags, native,
BIT_FIELD_ACCESSORS(SharedFunctionInfo, flags, is_asm_wasm_broken,
SharedFunctionInfo::IsAsmWasmBrokenBit)
BIT_FIELD_ACCESSORS(SharedFunctionInfo, flags,
requires_instance_fields_initializer,
SharedFunctionInfo::RequiresInstanceFieldsInitializer)
requires_instance_members_initializer,
SharedFunctionInfo::RequiresInstanceMembersInitializer)
BIT_FIELD_ACCESSORS(SharedFunctionInfo, flags, name_should_print_as_anonymous,
SharedFunctionInfo::NameShouldPrintAsAnonymousBit)

View File

@ -475,7 +475,7 @@ class SharedFunctionInfo : public HeapObject, public NeverReadOnlySpaceObject {
// initializer. This flag is set when creating the
// SharedFunctionInfo as a reminder to emit the initializer call
// when generating code later.
DECL_BOOLEAN_ACCESSORS(requires_instance_fields_initializer)
DECL_BOOLEAN_ACCESSORS(requires_instance_members_initializer)
// [source code]: Source code for the function.
bool HasSourceCode() const;
@ -634,7 +634,7 @@ class SharedFunctionInfo : public HeapObject, public NeverReadOnlySpaceObject {
V(IsAsmWasmBrokenBit, bool, 1, _) \
V(FunctionMapIndexBits, int, 5, _) \
V(DisabledOptimizationReasonBits, BailoutReason, 4, _) \
V(RequiresInstanceFieldsInitializer, bool, 1, _) \
V(RequiresInstanceMembersInitializer, bool, 1, _) \
V(ConstructAsBuiltinBit, bool, 1, _) \
V(IsAnonymousExpressionBit, bool, 1, _) \
V(NameShouldPrintAsAnonymousBit, bool, 1, _) \

View File

@ -67,8 +67,8 @@ void ParseInfo::SetFunctionInfo(T function) {
set_language_mode(function->language_mode());
set_function_kind(function->kind());
set_declaration(function->is_declaration());
set_requires_instance_fields_initializer(
function->requires_instance_fields_initializer());
set_requires_instance_members_initializer(
function->requires_instance_members_initializer());
set_toplevel(function->is_toplevel());
set_wrapped_as_function(function->is_wrapped());
}

View File

@ -90,9 +90,9 @@ class V8_EXPORT_PRIVATE ParseInfo {
set_wrapped_as_function)
FLAG_ACCESSOR(kAllowEvalCache, allow_eval_cache, set_allow_eval_cache)
FLAG_ACCESSOR(kIsDeclaration, is_declaration, set_declaration)
FLAG_ACCESSOR(kRequiresInstanceFieldsInitializer,
requires_instance_fields_initializer,
set_requires_instance_fields_initializer);
FLAG_ACCESSOR(kRequiresInstanceMembersInitializer,
requires_instance_members_initializer,
set_requires_instance_members_initializer);
#undef FLAG_ACCESSOR
void set_parse_restriction(ParseRestriction restriction) {
@ -283,7 +283,7 @@ class V8_EXPORT_PRIVATE ParseInfo {
kWrappedAsFunction = 1 << 14, // Implicitly wrapped as function.
kAllowEvalCache = 1 << 15,
kIsDeclaration = 1 << 16,
kRequiresInstanceFieldsInitializer = 1 << 17,
kRequiresInstanceMembersInitializer = 1 << 17,
};
//------------- Inputs to parsing and scope analysis -----------------------

View File

@ -552,10 +552,10 @@ class ParserBase {
has_name_static_property(false),
has_static_computed_names(false),
has_static_class_fields(false),
has_instance_class_fields(false),
has_instance_members(false),
is_anonymous(false),
static_fields_scope(nullptr),
instance_fields_scope(nullptr),
instance_members_scope(nullptr),
computed_field_count(0) {}
Variable* variable;
ExpressionT extends;
@ -568,10 +568,10 @@ class ParserBase {
bool has_name_static_property;
bool has_static_computed_names;
bool has_static_class_fields;
bool has_instance_class_fields;
bool has_instance_members;
bool is_anonymous;
DeclarationScope* static_fields_scope;
DeclarationScope* instance_fields_scope;
DeclarationScope* instance_members_scope;
int computed_field_count;
};
@ -1032,8 +1032,8 @@ class ParserBase {
IdentifierT* property_name, bool has_extends, bool* is_computed_name,
ClassLiteralProperty::Kind* property_kind, bool* is_static,
bool* is_private);
ExpressionT ParseClassFieldInitializer(ClassInfo* class_info, int beg_pos,
bool is_static);
ExpressionT ParseMemberInitializer(ClassInfo* class_info, int beg_pos,
bool is_static);
ObjectLiteralPropertyT ParseObjectPropertyDefinition(
ObjectLiteralChecker* checker, bool* is_computed_name,
bool* is_rest_property);
@ -1621,7 +1621,7 @@ ParserBase<Impl>::ParseIdentifierNameOrPrivateName() {
name = impl()->GetSymbol();
auto key_proxy =
impl()->ExpressionFromIdentifier(name, pos, InferName::kNo);
key_proxy->set_is_private_field();
key_proxy->set_is_private_name();
key = key_proxy;
} else {
name = ParseIdentifierName();
@ -2211,8 +2211,8 @@ ParserBase<Impl>::ParseClassPropertyDefinition(
if (!*is_computed_name) {
checker->CheckClassFieldName(*is_static);
}
ExpressionT initializer = ParseClassFieldInitializer(
class_info, property_beg_pos, *is_static);
ExpressionT initializer =
ParseMemberInitializer(class_info, property_beg_pos, *is_static);
ExpectSemicolon();
ClassLiteralPropertyT result = factory()->NewClassLiteralProperty(
name_expression, initializer, *property_kind, *is_static,
@ -2306,16 +2306,15 @@ ParserBase<Impl>::ParseClassPropertyDefinition(
}
template <typename Impl>
typename ParserBase<Impl>::ExpressionT
ParserBase<Impl>::ParseClassFieldInitializer(ClassInfo* class_info, int beg_pos,
bool is_static) {
DeclarationScope* initializer_scope = is_static
? class_info->static_fields_scope
: class_info->instance_fields_scope;
typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseMemberInitializer(
ClassInfo* class_info, int beg_pos, bool is_static) {
DeclarationScope* initializer_scope =
is_static ? class_info->static_fields_scope
: class_info->instance_members_scope;
if (initializer_scope == nullptr) {
initializer_scope =
NewFunctionScope(FunctionKind::kClassFieldsInitializerFunction);
NewFunctionScope(FunctionKind::kClassMembersInitializerFunction);
// TODO(gsathya): Make scopes be non contiguous.
initializer_scope->set_start_position(beg_pos);
initializer_scope->SetLanguageMode(LanguageMode::kStrict);
@ -2344,8 +2343,8 @@ ParserBase<Impl>::ParseClassFieldInitializer(ClassInfo* class_info, int beg_pos,
class_info->static_fields_scope = initializer_scope;
class_info->has_static_class_fields = true;
} else {
class_info->instance_fields_scope = initializer_scope;
class_info->has_instance_class_fields = true;
class_info->instance_members_scope = initializer_scope;
class_info->has_instance_members = true;
}
return initializer;

View File

@ -868,8 +868,8 @@ FunctionLiteral* Parser::DoParseFunction(Isolate* isolate, ParseInfo* info,
}
RETURN_IF_PARSE_ERROR;
result->set_requires_instance_fields_initializer(
info->requires_instance_fields_initializer());
result->set_requires_instance_members_initializer(
info->requires_instance_members_initializer());
}
// Make sure the target stack is empty.
@ -3140,9 +3140,8 @@ void Parser::DeclareClassProperty(const AstRawString* class_name,
}
if (kind == ClassLiteralProperty::FIELD && is_private) {
Variable* private_field_name_var =
CreateSyntheticContextVariable(property_name);
property->set_private_field_name_var(private_field_name_var);
Variable* private_name_var = CreateSyntheticContextVariable(property_name);
property->set_private_name_var(private_name_var);
class_info->properties->Add(property, zone());
}
}
@ -3151,11 +3150,11 @@ FunctionLiteral* Parser::CreateInitializerFunction(
const char* name, DeclarationScope* scope,
ZonePtrList<ClassLiteral::Property>* fields) {
DCHECK_EQ(scope->function_kind(),
FunctionKind::kClassFieldsInitializerFunction);
FunctionKind::kClassMembersInitializerFunction);
// function() { .. class fields initializer .. }
ScopedPtrList<Statement> statements(pointer_buffer());
InitializeClassFieldsStatement* static_fields =
factory()->NewInitializeClassFieldsStatement(fields, kNoSourcePosition);
InitializeClassMembersStatement* static_fields =
factory()->NewInitializeClassMembersStatement(fields, kNoSourcePosition);
statements.Add(static_fields);
return factory()->NewFunctionLiteral(
ast_value_factory()->GetOneByteString(name), scope, statements, 0, 0, 0,
@ -3200,18 +3199,18 @@ Expression* Parser::RewriteClassLiteral(Scope* block_scope,
class_info->static_fields);
}
FunctionLiteral* instance_fields_initializer_function = nullptr;
if (class_info->has_instance_class_fields) {
instance_fields_initializer_function = CreateInitializerFunction(
"<instance_fields_initializer>", class_info->instance_fields_scope,
FunctionLiteral* instance_members_initializer_function = nullptr;
if (class_info->has_instance_members) {
instance_members_initializer_function = CreateInitializerFunction(
"<instance_members_initializer>", class_info->instance_members_scope,
class_info->instance_fields);
class_info->constructor->set_requires_instance_fields_initializer(true);
class_info->constructor->set_requires_instance_members_initializer(true);
}
ClassLiteral* class_literal = factory()->NewClassLiteral(
block_scope, class_info->variable, class_info->extends,
class_info->constructor, class_info->properties,
static_fields_initializer, instance_fields_initializer_function, pos,
static_fields_initializer, instance_members_initializer_function, pos,
end_pos, class_info->has_name_static_property,
class_info->has_static_computed_names, class_info->is_anonymous);
@ -3240,7 +3239,7 @@ bool Parser::IsPropertyWithPrivateFieldKey(Expression* expression) {
if (!property->key()->IsVariableProxy()) return false;
VariableProxy* key = property->key()->AsVariableProxy();
return key->is_private_field();
return key->is_private_name();
}
void Parser::InsertShadowingVarBindingInitializers(Block* inner_block) {

View File

@ -752,7 +752,7 @@ NOT_A_PATTERN(WithStatement)
NOT_A_PATTERN(Yield)
NOT_A_PATTERN(YieldStar)
NOT_A_PATTERN(Await)
NOT_A_PATTERN(InitializeClassFieldsStatement)
NOT_A_PATTERN(InitializeClassMembersStatement)
#undef NOT_A_PATTERN
} // namespace internal

View File

@ -299,12 +299,12 @@ class PreParserExpression {
// and PreParser.
PreParserExpression* operator->() { return this; }
void set_is_private_field() {
void set_is_private_name() {
if (variables_ != nullptr) {
DCHECK(IsIdentifier());
DCHECK(AsIdentifier().IsPrivateName());
DCHECK_EQ(1, variables_->LengthForTest());
variables_->first()->set_is_private_field();
variables_->first()->set_is_private_name();
}
}
@ -1233,7 +1233,7 @@ class PreParser : public ParserBase<PreParser> {
if (class_info->has_static_class_fields) {
GetNextFunctionLiteralId();
}
if (class_info->has_instance_class_fields) {
if (class_info->has_instance_members) {
GetNextFunctionLiteralId();
}
return PreParserExpression::Default();

View File

@ -337,8 +337,8 @@ void Processor::VisitDebuggerStatement(DebuggerStatement* node) {
replacement_ = node;
}
void Processor::VisitInitializeClassFieldsStatement(
InitializeClassFieldsStatement* node) {
void Processor::VisitInitializeClassMembersStatement(
InitializeClassMembersStatement* node) {
replacement_ = node;
}

View File

@ -40,7 +40,7 @@ MaybeHandle<Object> Runtime::GetObjectProperty(Isolate* isolate,
if (is_found_out) *is_found_out = it.IsFound();
if (!it.IsFound() && key->IsSymbol() &&
Symbol::cast(*key)->is_private_field()) {
Symbol::cast(*key)->is_private_name()) {
THROW_NEW_ERROR(
isolate,
NewTypeError(MessageTemplate::kInvalidPrivateFieldAccess, key, object),
@ -358,7 +358,7 @@ MaybeHandle<Object> Runtime::SetObjectProperty(Isolate* isolate,
if (!success) return MaybeHandle<Object>();
if (!it.IsFound() && key->IsSymbol() &&
Symbol::cast(*key)->is_private_field()) {
Symbol::cast(*key)->is_private_name()) {
THROW_NEW_ERROR(
isolate,
NewTypeError(MessageTemplate::kInvalidPrivateFieldAccess, key, object),
@ -1215,7 +1215,7 @@ RUNTIME_FUNCTION(Runtime_AddPrivateField) {
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, o, 0);
CONVERT_ARG_HANDLE_CHECKED(Symbol, key, 1);
CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
DCHECK(key->is_private_field());
DCHECK(key->is_private_name());
LookupIterator it =
LookupIterator::PropertyOrElement(isolate, o, key, LookupIterator::OWN);

View File

@ -23,10 +23,10 @@ RUNTIME_FUNCTION(Runtime_CreatePrivateSymbol) {
return *symbol;
}
RUNTIME_FUNCTION(Runtime_CreatePrivateFieldSymbol) {
RUNTIME_FUNCTION(Runtime_CreatePrivateNameSymbol) {
HandleScope scope(isolate);
DCHECK_EQ(0, args.length());
Handle<Symbol> symbol = isolate->factory()->NewPrivateFieldSymbol();
Handle<Symbol> symbol = isolate->factory()->NewPrivateNameSymbol();
return *symbol;
}

View File

@ -108,7 +108,7 @@ bool Runtime::NeedsExactContext(FunctionId id) {
case Runtime::kAddPrivateField:
case Runtime::kCopyDataProperties:
case Runtime::kCreateDataProperty:
case Runtime::kCreatePrivateFieldSymbol:
case Runtime::kCreatePrivateNameSymbol:
case Runtime::kReThrow:
case Runtime::kThrow:
case Runtime::kThrowApplyNonFunction:

View File

@ -433,7 +433,7 @@ namespace internal {
F(StringTrim, 2, 1)
#define FOR_EACH_INTRINSIC_SYMBOL(F, I) \
F(CreatePrivateFieldSymbol, 0, 1) \
F(CreatePrivateNameSymbol, 0, 1) \
F(CreatePrivateSymbol, -1 /* <= 1 */, 1) \
F(SymbolDescriptiveString, 1, 1) \
F(SymbolIsPrivate, 1, 1)

View File

@ -38,7 +38,7 @@ bytecodes: [
B(Star), R(5),
B(LdaConstant), U8(1),
B(Star), R(6),
B(CallRuntime), U16(Runtime::kCreatePrivateFieldSymbol), R(0), U8(0),
B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(0), U8(0),
B(StaCurrentContextSlot), U8(4),
B(Mov), R(5), R(7),
B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(3),
@ -59,7 +59,7 @@ bytecodes: [
B(Star), R(5),
B(LdaConstant), U8(6),
B(Star), R(6),
B(CallRuntime), U16(Runtime::kCreatePrivateFieldSymbol), R(0), U8(0),
B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(0), U8(0),
B(StaCurrentContextSlot), U8(4),
B(Mov), R(5), R(7),
B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(3),
@ -148,7 +148,7 @@ bytecodes: [
B(Star), R(7),
B(LdaConstant), U8(1),
B(Star), R(8),
B(CallRuntime), U16(Runtime::kCreatePrivateFieldSymbol), R(0), U8(0),
B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(0), U8(0),
B(StaCurrentContextSlot), U8(4),
B(Mov), R(7), R(9),
B(Mov), R(13), R(10),
@ -179,9 +179,9 @@ bytecodes: [
B(Star), R(7),
B(LdaConstant), U8(8),
B(Star), R(8),
B(CallRuntime), U16(Runtime::kCreatePrivateFieldSymbol), R(0), U8(0),
B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(0), U8(0),
B(StaCurrentContextSlot), U8(4),
B(CallRuntime), U16(Runtime::kCreatePrivateFieldSymbol), R(0), U8(0),
B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(0), U8(0),
B(StaCurrentContextSlot), U8(5),
B(CreateClosure), U8(12), U8(7), U8(2),
B(Star), R(11),
@ -205,7 +205,7 @@ bytecodes: [
B(Star), R(7),
B(LdaConstant), U8(16),
B(Star), R(8),
B(CallRuntime), U16(Runtime::kCreatePrivateFieldSymbol), R(0), U8(0),
B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(0), U8(0),
B(StaCurrentContextSlot), U8(4),
B(Mov), R(7), R(9),
B(Mov), R(1), R(10),

View File

@ -187,7 +187,7 @@ Running test: testScopesPaused
lineNumber : 12
scriptId : <scriptId>
}
functionName : <instance_fields_initializer>
functionName : <instance_members_initializer>
location : {
columnNumber : 8
lineNumber : 12
@ -368,7 +368,7 @@ Running test: testScopesPaused
lineNumber : 12
scriptId : <scriptId>
}
functionName : <instance_fields_initializer>
functionName : <instance_members_initializer>
location : {
columnNumber : 14
lineNumber : 13
@ -549,7 +549,7 @@ Running test: testScopesPaused
lineNumber : 12
scriptId : <scriptId>
}
functionName : <instance_fields_initializer>
functionName : <instance_members_initializer>
location : {
columnNumber : 8
lineNumber : 14
@ -802,7 +802,7 @@ Running test: testScopesPaused
lineNumber : 12
scriptId : <scriptId>
}
functionName : <instance_fields_initializer>
functionName : <instance_members_initializer>
location : {
columnNumber : 8
lineNumber : 14

View File

@ -2,6 +2,6 @@
x = foo();
^
ReferenceError: foo is not defined
at X.<instance_fields_initializer> (*%(basename)s:8:7)
at X.<instance_members_initializer> (*%(basename)s:8:7)
at new X (*%(basename)s:7:1)
at *%(basename)s:11:1

View File

@ -75,14 +75,14 @@ function testClassInstantiation() {
// ReferenceError: FAIL is not defined
// at thrower
// at X.<instance_fields_initializer>
// at X.<instance_members_initializer>
// at new X
// at testClassInstantiation
// at testTrace
testTrace(
"during class instantiation",
testClassInstantiation,
["thrower", "X.<instance_fields_initializer>", "new X"],
["thrower", "X.<instance_members_initializer>", "new X"],
["anonymous"]
);
@ -98,14 +98,14 @@ function testClassInstantiationWithSuper() {
// ReferenceError: FAIL is not defined
// at thrower
// at X.<instance_fields_initializer>
// at X.<instance_members_initializer>
// at new X
// at testClassInstantiation
// at testTrace
testTrace(
"during class instantiation with super",
testClassInstantiationWithSuper,
["thrower", "X.<instance_fields_initializer>", "new X"],
["thrower", "X.<instance_members_initializer>", "new X"],
["Base", "anonymous"]
);
@ -124,14 +124,14 @@ function testClassInstantiationWithSuper2() {
// ReferenceError: FAIL is not defined
// at thrower
// at X.<instance_fields_initializer>
// at X.<instance_members_initializer>
// at new X
// at testClassInstantiation
// at testTrace
testTrace(
"during class instantiation with super2",
testClassInstantiationWithSuper2,
["thrower", "X.<instance_fields_initializer>", "new X"],
["thrower", "X.<instance_members_initializer>", "new X"],
["Base", "anonymous"]
);
@ -151,7 +151,7 @@ function testClassInstantiationWithSuper3() {
// ReferenceError: FAIL is not defined
// at thrower
// at X.<instance_fields_initializer>
// at X.<instance_members_initializer>
// at new Base
// at new X
// at testClassInstantiationWithSuper3
@ -159,7 +159,7 @@ function testClassInstantiationWithSuper3() {
testTrace(
"during class instantiation with super3",
testClassInstantiationWithSuper3,
["thrower", "X.<instance_fields_initializer>", "new Base", "new X"],
["thrower", "X.<instance_members_initializer>", "new Base", "new X"],
["anonymous"]
);