Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Unified Diff: src/bootstrapper.cc

Issue 2595893002: [runtime] Remove specific Descriptor subclasses and add respective factory methods instead. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index e20baf0ec8e6975961807fb487cc88df78825f90..d0f1cc76d98a6ab408d6f7436f6759e6403ecd1f 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -834,8 +834,8 @@ static void ReplaceAccessors(Handle<Map> map,
Handle<AccessorPair> accessor_pair) {
DescriptorArray* descriptors = map->instance_descriptors();
int idx = descriptors->SearchWithCache(map->GetIsolate(), *name, *map);
- AccessorConstantDescriptor descriptor(name, accessor_pair, attributes);
- descriptors->Replace(idx, &descriptor);
+ Descriptor d = Descriptor::AccessorConstant(name, accessor_pair, attributes);
+ descriptors->Replace(idx, &d);
}
void Genesis::AddRestrictedFunctionProperties(Handle<JSFunction> empty) {
@@ -1107,8 +1107,8 @@ static void InstallError(Isolate* isolate, Handle<JSObject> global,
Handle<AccessorInfo> error_stack =
Accessors::ErrorStackInfo(isolate, attribs);
{
- AccessorConstantDescriptor d(Handle<Name>(Name::cast(error_stack->name())),
- error_stack, attribs);
+ Descriptor d = Descriptor::AccessorConstant(
+ Handle<Name>(Name::cast(error_stack->name())), error_stack, attribs);
initial_map->AppendDescriptor(&d);
}
}
@@ -1318,7 +1318,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
Handle<AccessorInfo> array_length =
Accessors::ArrayLengthInfo(isolate, attribs);
{ // Add length.
- AccessorConstantDescriptor d(
+ Descriptor d = Descriptor::AccessorConstant(
Handle<Name>(Name::cast(array_length->name())), array_length,
attribs);
initial_map->AppendDescriptor(&d);
@@ -1542,8 +1542,8 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
Accessors::StringLengthInfo(isolate, attribs));
{ // Add length.
- AccessorConstantDescriptor d(factory->length_string(), string_length,
- attribs);
+ Descriptor d = Descriptor::AccessorConstant(factory->length_string(),
+ string_length, attribs);
string_map->AppendDescriptor(&d);
}
@@ -2143,10 +2143,10 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
// ECMA-262, section 15.10.7.5.
PropertyAttributes writable =
static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE);
- DataDescriptor field(factory->lastIndex_string(),
- JSRegExp::kLastIndexFieldIndex, writable,
- Representation::Tagged());
- initial_map->AppendDescriptor(&field);
+ Descriptor d = Descriptor::DataField(factory->lastIndex_string(),
+ JSRegExp::kLastIndexFieldIndex,
+ writable, Representation::Tagged());
+ initial_map->AppendDescriptor(&d);
static const int num_fields = JSRegExp::kInObjectFieldCount;
initial_map->SetInObjectProperties(num_fields);
@@ -2488,9 +2488,9 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
{ // Install @@toStringTag.
PropertyAttributes attribs =
static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY);
- DataConstantDescriptor d(factory->to_string_tag_symbol(),
- factory->NewStringFromAsciiChecked("Module"),
- attribs);
+ Descriptor d = Descriptor::DataConstant(
+ factory->to_string_tag_symbol(),
+ factory->NewStringFromAsciiChecked("Module"), attribs);
map->AppendDescriptor(&d);
}
}
@@ -2502,14 +2502,16 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
Map::EnsureDescriptorSlack(map, 2);
{ // value
- DataDescriptor d(factory->value_string(), JSIteratorResult::kValueIndex,
- NONE, Representation::Tagged());
+ Descriptor d = Descriptor::DataField(factory->value_string(),
+ JSIteratorResult::kValueIndex, NONE,
+ Representation::Tagged());
map->AppendDescriptor(&d);
}
{ // done
- DataDescriptor d(factory->done_string(), JSIteratorResult::kDoneIndex,
- NONE, Representation::Tagged());
+ Descriptor d = Descriptor::DataField(factory->done_string(),
+ JSIteratorResult::kDoneIndex, NONE,
+ Representation::Tagged());
map->AppendDescriptor(&d);
}
@@ -2615,15 +2617,15 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
Handle<AccessorInfo> bound_length =
Accessors::BoundFunctionLengthInfo(isolate, roc_attribs);
{ // length
- AccessorConstantDescriptor d(factory->length_string(), bound_length,
- roc_attribs);
+ Descriptor d = Descriptor::AccessorConstant(factory->length_string(),
+ bound_length, roc_attribs);
map->AppendDescriptor(&d);
}
Handle<AccessorInfo> bound_name =
Accessors::BoundFunctionNameInfo(isolate, roc_attribs);
- { // length
- AccessorConstantDescriptor d(factory->name_string(), bound_name,
- roc_attribs);
+ { // name
+ Descriptor d = Descriptor::AccessorConstant(factory->name_string(),
+ bound_name, roc_attribs);
map->AppendDescriptor(&d);
}
map->SetInObjectProperties(0);
@@ -2650,15 +2652,15 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
Map::EnsureDescriptorSlack(map, 2);
{ // length
- DataDescriptor d(factory->length_string(),
- JSSloppyArgumentsObject::kLengthIndex, DONT_ENUM,
- Representation::Tagged());
+ Descriptor d = Descriptor::DataField(
+ factory->length_string(), JSSloppyArgumentsObject::kLengthIndex,
+ DONT_ENUM, Representation::Tagged());
map->AppendDescriptor(&d);
}
{ // callee
- DataDescriptor d(factory->callee_string(),
- JSSloppyArgumentsObject::kCalleeIndex, DONT_ENUM,
- Representation::Tagged());
+ Descriptor d = Descriptor::DataField(
+ factory->callee_string(), JSSloppyArgumentsObject::kCalleeIndex,
+ DONT_ENUM, Representation::Tagged());
map->AppendDescriptor(&d);
}
// @@iterator method is added later.
@@ -2707,14 +2709,14 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
Map::EnsureDescriptorSlack(map, 2);
{ // length
- DataDescriptor d(factory->length_string(),
- JSStrictArgumentsObject::kLengthIndex, DONT_ENUM,
- Representation::Tagged());
+ Descriptor d = Descriptor::DataField(
+ factory->length_string(), JSStrictArgumentsObject::kLengthIndex,
+ DONT_ENUM, Representation::Tagged());
map->AppendDescriptor(&d);
}
{ // callee
- AccessorConstantDescriptor d(factory->callee_string(), callee,
- attributes);
+ Descriptor d = Descriptor::AccessorConstant(factory->callee_string(),
+ callee, attributes);
map->AppendDescriptor(&d);
}
// @@iterator method is added later.
@@ -3127,7 +3129,7 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
Handle<AccessorInfo> script_column =
Accessors::ScriptColumnOffsetInfo(isolate, attribs);
{
- AccessorConstantDescriptor d(
+ Descriptor d = Descriptor::AccessorConstant(
Handle<Name>(Name::cast(script_column->name())), script_column,
attribs);
script_map->AppendDescriptor(&d);
@@ -3135,8 +3137,8 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
Handle<AccessorInfo> script_id = Accessors::ScriptIdInfo(isolate, attribs);
{
- AccessorConstantDescriptor d(Handle<Name>(Name::cast(script_id->name())),
- script_id, attribs);
+ Descriptor d = Descriptor::AccessorConstant(
+ Handle<Name>(Name::cast(script_id->name())), script_id, attribs);
script_map->AppendDescriptor(&d);
}
@@ -3144,7 +3146,7 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
Handle<AccessorInfo> script_name =
Accessors::ScriptNameInfo(isolate, attribs);
{
- AccessorConstantDescriptor d(
+ Descriptor d = Descriptor::AccessorConstant(
Handle<Name>(Name::cast(script_name->name())), script_name, attribs);
script_map->AppendDescriptor(&d);
}
@@ -3152,7 +3154,7 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
Handle<AccessorInfo> script_line =
Accessors::ScriptLineOffsetInfo(isolate, attribs);
{
- AccessorConstantDescriptor d(
+ Descriptor d = Descriptor::AccessorConstant(
Handle<Name>(Name::cast(script_line->name())), script_line, attribs);
script_map->AppendDescriptor(&d);
}
@@ -3160,7 +3162,7 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
Handle<AccessorInfo> script_source =
Accessors::ScriptSourceInfo(isolate, attribs);
{
- AccessorConstantDescriptor d(
+ Descriptor d = Descriptor::AccessorConstant(
Handle<Name>(Name::cast(script_source->name())), script_source,
attribs);
script_map->AppendDescriptor(&d);
@@ -3169,7 +3171,7 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
Handle<AccessorInfo> script_type =
Accessors::ScriptTypeInfo(isolate, attribs);
{
- AccessorConstantDescriptor d(
+ Descriptor d = Descriptor::AccessorConstant(
Handle<Name>(Name::cast(script_type->name())), script_type, attribs);
script_map->AppendDescriptor(&d);
}
@@ -3177,7 +3179,7 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
Handle<AccessorInfo> script_compilation_type =
Accessors::ScriptCompilationTypeInfo(isolate, attribs);
{
- AccessorConstantDescriptor d(
+ Descriptor d = Descriptor::AccessorConstant(
Handle<Name>(Name::cast(script_compilation_type->name())),
script_compilation_type, attribs);
script_map->AppendDescriptor(&d);
@@ -3186,7 +3188,7 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
Handle<AccessorInfo> script_context_data =
Accessors::ScriptContextDataInfo(isolate, attribs);
{
- AccessorConstantDescriptor d(
+ Descriptor d = Descriptor::AccessorConstant(
Handle<Name>(Name::cast(script_context_data->name())),
script_context_data, attribs);
script_map->AppendDescriptor(&d);
@@ -3195,7 +3197,7 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
Handle<AccessorInfo> script_eval_from_script =
Accessors::ScriptEvalFromScriptInfo(isolate, attribs);
{
- AccessorConstantDescriptor d(
+ Descriptor d = Descriptor::AccessorConstant(
Handle<Name>(Name::cast(script_eval_from_script->name())),
script_eval_from_script, attribs);
script_map->AppendDescriptor(&d);
@@ -3204,7 +3206,7 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
Handle<AccessorInfo> script_eval_from_script_position =
Accessors::ScriptEvalFromScriptPositionInfo(isolate, attribs);
{
- AccessorConstantDescriptor d(
+ Descriptor d = Descriptor::AccessorConstant(
Handle<Name>(Name::cast(script_eval_from_script_position->name())),
script_eval_from_script_position, attribs);
script_map->AppendDescriptor(&d);
@@ -3213,7 +3215,7 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
Handle<AccessorInfo> script_eval_from_function_name =
Accessors::ScriptEvalFromFunctionNameInfo(isolate, attribs);
{
- AccessorConstantDescriptor d(
+ Descriptor d = Descriptor::AccessorConstant(
Handle<Name>(Name::cast(script_eval_from_function_name->name())),
script_eval_from_function_name, attribs);
script_map->AppendDescriptor(&d);
@@ -3222,7 +3224,7 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
Handle<AccessorInfo> script_source_url =
Accessors::ScriptSourceUrlInfo(isolate, attribs);
{
- AccessorConstantDescriptor d(
+ Descriptor d = Descriptor::AccessorConstant(
Handle<Name>(Name::cast(script_source_url->name())),
script_source_url, attribs);
script_map->AppendDescriptor(&d);
@@ -3231,7 +3233,7 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
Handle<AccessorInfo> script_source_mapping_url =
Accessors::ScriptSourceMappingUrlInfo(isolate, attribs);
{
- AccessorConstantDescriptor d(
+ Descriptor d = Descriptor::AccessorConstant(
Handle<Name>(Name::cast(script_source_mapping_url->name())),
script_source_mapping_url, attribs);
script_map->AppendDescriptor(&d);
@@ -3534,8 +3536,8 @@ Handle<JSFunction> Genesis::InstallInternalArray(Handle<JSObject> target,
Handle<AccessorInfo> array_length =
Accessors::ArrayLengthInfo(isolate(), attribs);
{ // Add length.
- AccessorConstantDescriptor d(Handle<Name>(Name::cast(array_length->name())),
- array_length, attribs);
+ Descriptor d = Descriptor::AccessorConstant(
+ Handle<Name>(Name::cast(array_length->name())), array_length, attribs);
initial_map->AppendDescriptor(&d);
}
@@ -3730,27 +3732,29 @@ bool Genesis::InstallNatives(GlobalContextType context_type) {
Map::EnsureDescriptorSlack(map, 4);
{ // get
- DataDescriptor d(factory()->get_string(),
- JSAccessorPropertyDescriptor::kGetIndex, NONE,
- Representation::Tagged());
+ Descriptor d = Descriptor::DataField(
+ factory()->get_string(), JSAccessorPropertyDescriptor::kGetIndex,
+ NONE, Representation::Tagged());
map->AppendDescriptor(&d);
}
{ // set
- DataDescriptor d(factory()->set_string(),
- JSAccessorPropertyDescriptor::kSetIndex, NONE,
- Representation::Tagged());
+ Descriptor d = Descriptor::DataField(
+ factory()->set_string(), JSAccessorPropertyDescriptor::kSetIndex,
+ NONE, Representation::Tagged());
map->AppendDescriptor(&d);
}
{ // enumerable
- DataDescriptor d(factory()->enumerable_string(),
- JSAccessorPropertyDescriptor::kEnumerableIndex, NONE,
- Representation::Tagged());
+ Descriptor d =
+ Descriptor::DataField(factory()->enumerable_string(),
+ JSAccessorPropertyDescriptor::kEnumerableIndex,
+ NONE, Representation::Tagged());
map->AppendDescriptor(&d);
}
{ // configurable
- DataDescriptor d(factory()->configurable_string(),
- JSAccessorPropertyDescriptor::kConfigurableIndex, NONE,
- Representation::Tagged());
+ Descriptor d = Descriptor::DataField(
+ factory()->configurable_string(),
+ JSAccessorPropertyDescriptor::kConfigurableIndex, NONE,
+ Representation::Tagged());
map->AppendDescriptor(&d);
}
@@ -3773,27 +3777,30 @@ bool Genesis::InstallNatives(GlobalContextType context_type) {
Map::EnsureDescriptorSlack(map, 4);
{ // value
- DataDescriptor d(factory()->value_string(),
- JSDataPropertyDescriptor::kValueIndex, NONE,
- Representation::Tagged());
+ Descriptor d = Descriptor::DataField(
+ factory()->value_string(), JSDataPropertyDescriptor::kValueIndex,
+ NONE, Representation::Tagged());
map->AppendDescriptor(&d);
}
{ // writable
- DataDescriptor d(factory()->writable_string(),
- JSDataPropertyDescriptor::kWritableIndex, NONE,
- Representation::Tagged());
+ Descriptor d =
+ Descriptor::DataField(factory()->writable_string(),
+ JSDataPropertyDescriptor::kWritableIndex, NONE,
+ Representation::Tagged());
map->AppendDescriptor(&d);
}
{ // enumerable
- DataDescriptor d(factory()->enumerable_string(),
- JSDataPropertyDescriptor::kEnumerableIndex, NONE,
- Representation::Tagged());
+ Descriptor d =
+ Descriptor::DataField(factory()->enumerable_string(),
+ JSDataPropertyDescriptor::kEnumerableIndex,
+ NONE, Representation::Tagged());
map->AppendDescriptor(&d);
}
{ // configurable
- DataDescriptor d(factory()->configurable_string(),
- JSDataPropertyDescriptor::kConfigurableIndex, NONE,
- Representation::Tagged());
+ Descriptor d =
+ Descriptor::DataField(factory()->configurable_string(),
+ JSDataPropertyDescriptor::kConfigurableIndex,
+ NONE, Representation::Tagged());
map->AppendDescriptor(&d);
}
@@ -3835,23 +3842,23 @@ bool Genesis::InstallNatives(GlobalContextType context_type) {
int old = array_descriptors->SearchWithCache(
isolate(), *length, array_function->initial_map());
DCHECK(old != DescriptorArray::kNotFound);
- AccessorConstantDescriptor desc(
+ Descriptor d = Descriptor::AccessorConstant(
length, handle(array_descriptors->GetValue(old), isolate()),
array_descriptors->GetDetails(old).attributes());
- initial_map->AppendDescriptor(&desc);
+ initial_map->AppendDescriptor(&d);
}
{
- DataDescriptor index_field(factory()->index_string(),
- JSRegExpResult::kIndexIndex, NONE,
- Representation::Tagged());
- initial_map->AppendDescriptor(&index_field);
+ Descriptor d = Descriptor::DataField(factory()->index_string(),
+ JSRegExpResult::kIndexIndex, NONE,
+ Representation::Tagged());
+ initial_map->AppendDescriptor(&d);
}
{
- DataDescriptor input_field(factory()->input_string(),
- JSRegExpResult::kInputIndex, NONE,
- Representation::Tagged());
- initial_map->AppendDescriptor(&input_field);
+ Descriptor d = Descriptor::DataField(factory()->input_string(),
+ JSRegExpResult::kInputIndex, NONE,
+ Representation::Tagged());
+ initial_map->AppendDescriptor(&d);
}
initial_map->SetInObjectProperties(2);
@@ -3866,29 +3873,29 @@ bool Genesis::InstallNatives(GlobalContextType context_type) {
Handle<AccessorInfo> arguments_iterator =
Accessors::ArgumentsIteratorInfo(isolate(), attribs);
{
- AccessorConstantDescriptor d(factory()->iterator_symbol(),
- arguments_iterator, attribs);
+ Descriptor d = Descriptor::AccessorConstant(factory()->iterator_symbol(),
+ arguments_iterator, attribs);
Handle<Map> map(native_context()->sloppy_arguments_map());
Map::EnsureDescriptorSlack(map, 1);
map->AppendDescriptor(&d);
}
{
- AccessorConstantDescriptor d(factory()->iterator_symbol(),
- arguments_iterator, attribs);
+ Descriptor d = Descriptor::AccessorConstant(factory()->iterator_symbol(),
+ arguments_iterator, attribs);
Handle<Map> map(native_context()->fast_aliased_arguments_map());
Map::EnsureDescriptorSlack(map, 1);
map->AppendDescriptor(&d);
}
{
- AccessorConstantDescriptor d(factory()->iterator_symbol(),
- arguments_iterator, attribs);
+ Descriptor d = Descriptor::AccessorConstant(factory()->iterator_symbol(),
+ arguments_iterator, attribs);
Handle<Map> map(native_context()->slow_aliased_arguments_map());
Map::EnsureDescriptorSlack(map, 1);
map->AppendDescriptor(&d);
}
{
- AccessorConstantDescriptor d(factory()->iterator_symbol(),
- arguments_iterator, attribs);
+ Descriptor d = Descriptor::AccessorConstant(factory()->iterator_symbol(),
+ arguments_iterator, attribs);
Handle<Map> map(native_context()->strict_arguments_map());
Map::EnsureDescriptorSlack(map, 1);
map->AppendDescriptor(&d);
« no previous file with comments | « no previous file | src/factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698