Massive renaming of PropertyType values and other implied stuff.

PropertyKind:
  DATA -> kData
  ACCESSOR -> kAccessor

PropertyType:
  FIELD -> DATA
  CONSTANT -> DATA_CONSTANT
  ACCESSOR_FIELD -> ACCESSOR
  CALLBACKS -> ACCESSOR_CONSTANT

PropertyLocation:
  IN_OBJECT -> kField
  IN_DESCRIPTOR -> kDescriptor

StoreMode:
  FORCE_IN_OBJECT -> FORCE_FIELD

FieldDescriptor -> DataDescriptor
ConstantDescriptor -> DataConstantDescriptor
CallbacksDescriptor -> AccessorConstantDescriptor

Review URL: https://codereview.chromium.org/856503002

Cr-Commit-Position: refs/heads/master@{#26146}
This commit is contained in:
ishell 2015-01-19 09:49:13 -08:00 committed by Commit bot
parent 0ef9ce4ad8
commit 33994b4a22
41 changed files with 435 additions and 428 deletions

View File

@ -1708,7 +1708,7 @@ void MacroAssembler::LoadFromNumberDictionary(Label* miss,
const int kDetailsOffset =
SeededNumberDictionary::kElementsStartOffset + 2 * kPointerSize;
ldr(t1, FieldMemOperand(t2, kDetailsOffset));
DCHECK_EQ(FIELD, 0);
DCHECK_EQ(DATA, 0);
tst(t1, Operand(Smi::FromInt(PropertyDetails::TypeField::kMask)));
b(ne, miss);

View File

@ -4237,7 +4237,7 @@ void MacroAssembler::LoadFromNumberDictionary(Label* miss,
const int kDetailsOffset =
SeededNumberDictionary::kElementsStartOffset + 2 * kPointerSize;
Ldrsw(scratch1, UntagSmiFieldMemOperand(scratch2, kDetailsOffset));
DCHECK_EQ(FIELD, 0);
DCHECK_EQ(DATA, 0);
TestAndBranchIfAnySet(scratch1, PropertyDetails::TypeField::kMask, miss);
// Get the value at the masked, scaled index and return.

View File

@ -418,29 +418,29 @@ void Genesis::SetFunctionInstanceDescriptor(
Handle<AccessorInfo> length =
Accessors::FunctionLengthInfo(isolate(), attribs);
{ // Add length.
CallbacksDescriptor d(Handle<Name>(Name::cast(length->name())),
length, attribs);
AccessorConstantDescriptor d(Handle<Name>(Name::cast(length->name())),
length, attribs);
map->AppendDescriptor(&d);
}
Handle<AccessorInfo> name =
Accessors::FunctionNameInfo(isolate(), attribs);
{ // Add name.
CallbacksDescriptor d(Handle<Name>(Name::cast(name->name())),
name, attribs);
AccessorConstantDescriptor d(Handle<Name>(Name::cast(name->name())), name,
attribs);
map->AppendDescriptor(&d);
}
Handle<AccessorInfo> args =
Accessors::FunctionArgumentsInfo(isolate(), attribs);
{ // Add arguments.
CallbacksDescriptor d(Handle<Name>(Name::cast(args->name())),
args, attribs);
AccessorConstantDescriptor d(Handle<Name>(Name::cast(args->name())), args,
attribs);
map->AppendDescriptor(&d);
}
Handle<AccessorInfo> caller =
Accessors::FunctionCallerInfo(isolate(), attribs);
{ // Add caller.
CallbacksDescriptor d(Handle<Name>(Name::cast(caller->name())),
caller, attribs);
AccessorConstantDescriptor d(Handle<Name>(Name::cast(caller->name())),
caller, attribs);
map->AppendDescriptor(&d);
}
if (IsFunctionModeWithPrototype(function_mode)) {
@ -449,8 +449,8 @@ void Genesis::SetFunctionInstanceDescriptor(
}
Handle<AccessorInfo> prototype =
Accessors::FunctionPrototypeInfo(isolate(), attribs);
CallbacksDescriptor d(Handle<Name>(Name::cast(prototype->name())),
prototype, attribs);
AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())),
prototype, attribs);
map->AppendDescriptor(&d);
}
}
@ -574,7 +574,7 @@ void Genesis::SetStrictFunctionInstanceDescriptor(
// Add length.
if (function_mode == BOUND_FUNCTION) {
Handle<String> length_string = isolate()->factory()->length_string();
FieldDescriptor d(length_string, 0, ro_attribs, Representation::Tagged());
DataDescriptor d(length_string, 0, ro_attribs, Representation::Tagged());
map->AppendDescriptor(&d);
} else {
DCHECK(function_mode == FUNCTION_WITH_WRITEABLE_PROTOTYPE ||
@ -582,24 +582,25 @@ void Genesis::SetStrictFunctionInstanceDescriptor(
function_mode == FUNCTION_WITHOUT_PROTOTYPE);
Handle<AccessorInfo> length =
Accessors::FunctionLengthInfo(isolate(), ro_attribs);
CallbacksDescriptor d(Handle<Name>(Name::cast(length->name())),
length, ro_attribs);
AccessorConstantDescriptor d(Handle<Name>(Name::cast(length->name())),
length, ro_attribs);
map->AppendDescriptor(&d);
}
Handle<AccessorInfo> name =
Accessors::FunctionNameInfo(isolate(), ro_attribs);
{ // Add name.
CallbacksDescriptor d(Handle<Name>(Name::cast(name->name())),
name, ro_attribs);
AccessorConstantDescriptor d(Handle<Name>(Name::cast(name->name())), name,
ro_attribs);
map->AppendDescriptor(&d);
}
{ // Add arguments.
CallbacksDescriptor d(factory()->arguments_string(), arguments,
rw_attribs);
AccessorConstantDescriptor d(factory()->arguments_string(), arguments,
rw_attribs);
map->AppendDescriptor(&d);
}
{ // Add caller.
CallbacksDescriptor d(factory()->caller_string(), caller, rw_attribs);
AccessorConstantDescriptor d(factory()->caller_string(), caller,
rw_attribs);
map->AppendDescriptor(&d);
}
if (IsFunctionModeWithPrototype(function_mode)) {
@ -609,8 +610,8 @@ void Genesis::SetStrictFunctionInstanceDescriptor(
: ro_attribs;
Handle<AccessorInfo> prototype =
Accessors::FunctionPrototypeInfo(isolate(), attribs);
CallbacksDescriptor d(Handle<Name>(Name::cast(prototype->name())),
prototype, attribs);
AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())),
prototype, attribs);
map->AppendDescriptor(&d);
}
}
@ -709,7 +710,7 @@ static void ReplaceAccessors(Handle<Map> map,
Handle<AccessorPair> accessor_pair) {
DescriptorArray* descriptors = map->instance_descriptors();
int idx = descriptors->SearchWithCache(*name, *map);
CallbacksDescriptor descriptor(name, accessor_pair, attributes);
AccessorConstantDescriptor descriptor(name, accessor_pair, attributes);
descriptors->Replace(idx, &descriptor);
}
@ -949,9 +950,9 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> global_object,
Handle<AccessorInfo> array_length =
Accessors::ArrayLengthInfo(isolate, attribs);
{ // Add length.
CallbacksDescriptor d(
Handle<Name>(Name::cast(array_length->name())),
array_length, attribs);
AccessorConstantDescriptor d(
Handle<Name>(Name::cast(array_length->name())), array_length,
attribs);
initial_map->AppendDescriptor(&d);
}
@ -1003,7 +1004,8 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> global_object,
Accessors::StringLengthInfo(isolate, attribs));
{ // Add length.
CallbacksDescriptor d(factory->length_string(), string_length, attribs);
AccessorConstantDescriptor d(factory->length_string(), string_length,
attribs);
string_map->AppendDescriptor(&d);
}
}
@ -1048,41 +1050,38 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> global_object,
// ECMA-262, section 15.10.7.1.
Handle<AccessorInfo> regexp_source(
Accessors::RegExpSourceInfo(isolate, final));
CallbacksDescriptor d(factory->source_string(), regexp_source, final);
AccessorConstantDescriptor d(factory->source_string(), regexp_source,
final);
initial_map->AppendDescriptor(&d);
}
{
// ECMA-262, section 15.10.7.2.
FieldDescriptor field(factory->global_string(),
JSRegExp::kGlobalFieldIndex,
final,
Representation::Tagged());
DataDescriptor field(factory->global_string(),
JSRegExp::kGlobalFieldIndex, final,
Representation::Tagged());
initial_map->AppendDescriptor(&field);
}
{
// ECMA-262, section 15.10.7.3.
FieldDescriptor field(factory->ignore_case_string(),
JSRegExp::kIgnoreCaseFieldIndex,
final,
Representation::Tagged());
DataDescriptor field(factory->ignore_case_string(),
JSRegExp::kIgnoreCaseFieldIndex, final,
Representation::Tagged());
initial_map->AppendDescriptor(&field);
}
{
// ECMA-262, section 15.10.7.4.
FieldDescriptor field(factory->multiline_string(),
JSRegExp::kMultilineFieldIndex,
final,
Representation::Tagged());
DataDescriptor field(factory->multiline_string(),
JSRegExp::kMultilineFieldIndex, final,
Representation::Tagged());
initial_map->AppendDescriptor(&field);
}
{
// ECMA-262, section 15.10.7.5.
PropertyAttributes writable =
static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE);
FieldDescriptor field(factory->last_index_string(),
JSRegExp::kLastIndexFieldIndex,
writable,
Representation::Tagged());
DataDescriptor field(factory->last_index_string(),
JSRegExp::kLastIndexFieldIndex, writable,
Representation::Tagged());
initial_map->AppendDescriptor(&field);
}
@ -1179,14 +1178,14 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> global_object,
Map::EnsureDescriptorSlack(iterator_result_map,
JSGeneratorObject::kResultPropertyCount);
FieldDescriptor value_descr(factory->value_string(),
JSGeneratorObject::kResultValuePropertyIndex,
NONE, Representation::Tagged());
DataDescriptor value_descr(factory->value_string(),
JSGeneratorObject::kResultValuePropertyIndex,
NONE, Representation::Tagged());
iterator_result_map->AppendDescriptor(&value_descr);
FieldDescriptor done_descr(factory->done_string(),
JSGeneratorObject::kResultDonePropertyIndex,
NONE, Representation::Tagged());
DataDescriptor done_descr(factory->done_string(),
JSGeneratorObject::kResultDonePropertyIndex, NONE,
Representation::Tagged());
iterator_result_map->AppendDescriptor(&done_descr);
iterator_result_map->set_unused_property_fields(0);
@ -1220,13 +1219,13 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> global_object,
Map::EnsureDescriptorSlack(map, 2);
{ // length
FieldDescriptor d(factory->length_string(), Heap::kArgumentsLengthIndex,
DONT_ENUM, Representation::Tagged());
DataDescriptor d(factory->length_string(), Heap::kArgumentsLengthIndex,
DONT_ENUM, Representation::Tagged());
map->AppendDescriptor(&d);
}
{ // callee
FieldDescriptor d(factory->callee_string(), Heap::kArgumentsCalleeIndex,
DONT_ENUM, Representation::Tagged());
DataDescriptor d(factory->callee_string(), Heap::kArgumentsCalleeIndex,
DONT_ENUM, Representation::Tagged());
map->AppendDescriptor(&d);
}
// @@iterator method is added later.
@ -1277,16 +1276,18 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> global_object,
Map::EnsureDescriptorSlack(map, 3);
{ // length
FieldDescriptor d(factory->length_string(), Heap::kArgumentsLengthIndex,
DONT_ENUM, Representation::Tagged());
DataDescriptor d(factory->length_string(), Heap::kArgumentsLengthIndex,
DONT_ENUM, Representation::Tagged());
map->AppendDescriptor(&d);
}
{ // callee
CallbacksDescriptor d(factory->callee_string(), callee, attributes);
AccessorConstantDescriptor d(factory->callee_string(), callee,
attributes);
map->AppendDescriptor(&d);
}
{ // caller
CallbacksDescriptor d(factory->caller_string(), caller, attributes);
AccessorConstantDescriptor d(factory->caller_string(), caller,
attributes);
map->AppendDescriptor(&d);
}
// @@iterator method is added later.
@ -1688,8 +1689,8 @@ Handle<JSFunction> Genesis::InstallInternalArray(
Handle<AccessorInfo> array_length =
Accessors::ArrayLengthInfo(isolate(), attribs);
{ // Add length.
CallbacksDescriptor d(
Handle<Name>(Name::cast(array_length->name())), array_length, attribs);
AccessorConstantDescriptor d(Handle<Name>(Name::cast(array_length->name())),
array_length, attribs);
initial_map->AppendDescriptor(&d);
}
@ -1771,16 +1772,17 @@ bool Genesis::InstallNatives() {
Handle<AccessorInfo> script_column =
Accessors::ScriptColumnOffsetInfo(isolate(), attribs);
{
CallbacksDescriptor d(Handle<Name>(Name::cast(script_column->name())),
script_column, attribs);
AccessorConstantDescriptor d(
Handle<Name>(Name::cast(script_column->name())), script_column,
attribs);
script_map->AppendDescriptor(&d);
}
Handle<AccessorInfo> script_id =
Accessors::ScriptIdInfo(isolate(), attribs);
{
CallbacksDescriptor d(Handle<Name>(Name::cast(script_id->name())),
script_id, attribs);
AccessorConstantDescriptor d(Handle<Name>(Name::cast(script_id->name())),
script_id, attribs);
script_map->AppendDescriptor(&d);
}
@ -1788,39 +1790,40 @@ bool Genesis::InstallNatives() {
Handle<AccessorInfo> script_name =
Accessors::ScriptNameInfo(isolate(), attribs);
{
CallbacksDescriptor d(Handle<Name>(Name::cast(script_name->name())),
script_name, attribs);
AccessorConstantDescriptor d(
Handle<Name>(Name::cast(script_name->name())), script_name, attribs);
script_map->AppendDescriptor(&d);
}
Handle<AccessorInfo> script_line =
Accessors::ScriptLineOffsetInfo(isolate(), attribs);
{
CallbacksDescriptor d(Handle<Name>(Name::cast(script_line->name())),
script_line, attribs);
AccessorConstantDescriptor d(
Handle<Name>(Name::cast(script_line->name())), script_line, attribs);
script_map->AppendDescriptor(&d);
}
Handle<AccessorInfo> script_source =
Accessors::ScriptSourceInfo(isolate(), attribs);
{
CallbacksDescriptor d(Handle<Name>(Name::cast(script_source->name())),
script_source, attribs);
AccessorConstantDescriptor d(
Handle<Name>(Name::cast(script_source->name())), script_source,
attribs);
script_map->AppendDescriptor(&d);
}
Handle<AccessorInfo> script_type =
Accessors::ScriptTypeInfo(isolate(), attribs);
{
CallbacksDescriptor d(Handle<Name>(Name::cast(script_type->name())),
script_type, attribs);
AccessorConstantDescriptor d(
Handle<Name>(Name::cast(script_type->name())), script_type, attribs);
script_map->AppendDescriptor(&d);
}
Handle<AccessorInfo> script_compilation_type =
Accessors::ScriptCompilationTypeInfo(isolate(), attribs);
{
CallbacksDescriptor d(
AccessorConstantDescriptor d(
Handle<Name>(Name::cast(script_compilation_type->name())),
script_compilation_type, attribs);
script_map->AppendDescriptor(&d);
@ -1829,15 +1832,16 @@ bool Genesis::InstallNatives() {
Handle<AccessorInfo> script_line_ends =
Accessors::ScriptLineEndsInfo(isolate(), attribs);
{
CallbacksDescriptor d(Handle<Name>(Name::cast(script_line_ends->name())),
script_line_ends, attribs);
AccessorConstantDescriptor d(
Handle<Name>(Name::cast(script_line_ends->name())), script_line_ends,
attribs);
script_map->AppendDescriptor(&d);
}
Handle<AccessorInfo> script_context_data =
Accessors::ScriptContextDataInfo(isolate(), attribs);
{
CallbacksDescriptor d(
AccessorConstantDescriptor d(
Handle<Name>(Name::cast(script_context_data->name())),
script_context_data, attribs);
script_map->AppendDescriptor(&d);
@ -1846,7 +1850,7 @@ bool Genesis::InstallNatives() {
Handle<AccessorInfo> script_eval_from_script =
Accessors::ScriptEvalFromScriptInfo(isolate(), attribs);
{
CallbacksDescriptor d(
AccessorConstantDescriptor d(
Handle<Name>(Name::cast(script_eval_from_script->name())),
script_eval_from_script, attribs);
script_map->AppendDescriptor(&d);
@ -1855,7 +1859,7 @@ bool Genesis::InstallNatives() {
Handle<AccessorInfo> script_eval_from_script_position =
Accessors::ScriptEvalFromScriptPositionInfo(isolate(), attribs);
{
CallbacksDescriptor d(
AccessorConstantDescriptor d(
Handle<Name>(Name::cast(script_eval_from_script_position->name())),
script_eval_from_script_position, attribs);
script_map->AppendDescriptor(&d);
@ -1864,7 +1868,7 @@ bool Genesis::InstallNatives() {
Handle<AccessorInfo> script_eval_from_function_name =
Accessors::ScriptEvalFromFunctionNameInfo(isolate(), attribs);
{
CallbacksDescriptor d(
AccessorConstantDescriptor d(
Handle<Name>(Name::cast(script_eval_from_function_name->name())),
script_eval_from_function_name, attribs);
script_map->AppendDescriptor(&d);
@ -1873,15 +1877,16 @@ bool Genesis::InstallNatives() {
Handle<AccessorInfo> script_source_url =
Accessors::ScriptSourceUrlInfo(isolate(), attribs);
{
CallbacksDescriptor d(Handle<Name>(Name::cast(script_source_url->name())),
script_source_url, attribs);
AccessorConstantDescriptor d(
Handle<Name>(Name::cast(script_source_url->name())),
script_source_url, attribs);
script_map->AppendDescriptor(&d);
}
Handle<AccessorInfo> script_source_mapping_url =
Accessors::ScriptSourceMappingUrlInfo(isolate(), attribs);
{
CallbacksDescriptor d(
AccessorConstantDescriptor d(
Handle<Name>(Name::cast(script_source_mapping_url->name())),
script_source_mapping_url, attribs);
script_map->AppendDescriptor(&d);
@ -2106,25 +2111,22 @@ bool Genesis::InstallNatives() {
int old = array_descriptors->SearchWithCache(
*length, array_function->initial_map());
DCHECK(old != DescriptorArray::kNotFound);
CallbacksDescriptor desc(length,
handle(array_descriptors->GetValue(old),
isolate()),
array_descriptors->GetDetails(old).attributes());
AccessorConstantDescriptor desc(
length, handle(array_descriptors->GetValue(old), isolate()),
array_descriptors->GetDetails(old).attributes());
initial_map->AppendDescriptor(&desc);
}
{
FieldDescriptor index_field(factory()->index_string(),
JSRegExpResult::kIndexIndex,
NONE,
Representation::Tagged());
DataDescriptor index_field(factory()->index_string(),
JSRegExpResult::kIndexIndex, NONE,
Representation::Tagged());
initial_map->AppendDescriptor(&index_field);
}
{
FieldDescriptor input_field(factory()->input_string(),
JSRegExpResult::kInputIndex,
NONE,
Representation::Tagged());
DataDescriptor input_field(factory()->input_string(),
JSRegExpResult::kInputIndex, NONE,
Representation::Tagged());
initial_map->AppendDescriptor(&input_field);
}
@ -2141,22 +2143,22 @@ bool Genesis::InstallNatives() {
Handle<AccessorInfo> arguments_iterator =
Accessors::ArgumentsIteratorInfo(isolate(), attribs);
{
CallbacksDescriptor d(factory()->iterator_symbol(), arguments_iterator,
attribs);
AccessorConstantDescriptor d(factory()->iterator_symbol(),
arguments_iterator, attribs);
Handle<Map> map(native_context()->sloppy_arguments_map());
Map::EnsureDescriptorSlack(map, 1);
map->AppendDescriptor(&d);
}
{
CallbacksDescriptor d(factory()->iterator_symbol(), arguments_iterator,
attribs);
AccessorConstantDescriptor d(factory()->iterator_symbol(),
arguments_iterator, attribs);
Handle<Map> map(native_context()->aliased_arguments_map());
Map::EnsureDescriptorSlack(map, 1);
map->AppendDescriptor(&d);
}
{
CallbacksDescriptor d(factory()->iterator_symbol(), arguments_iterator,
attribs);
AccessorConstantDescriptor d(factory()->iterator_symbol(),
arguments_iterator, attribs);
Handle<Map> map(native_context()->strict_arguments_map());
Map::EnsureDescriptorSlack(map, 1);
map->AppendDescriptor(&d);
@ -2582,7 +2584,7 @@ void Genesis::TransferNamedProperties(Handle<JSObject> from,
for (int i = 0; i < from->map()->NumberOfOwnDescriptors(); i++) {
PropertyDetails details = descs->GetDetails(i);
switch (details.type()) {
case FIELD: {
case DATA: {
HandleScope inner(isolate());
Handle<Name> key = Handle<Name>(descs->GetKey(i));
FieldIndex index = FieldIndex::ForDescriptor(from->map(), i);
@ -2592,16 +2594,16 @@ void Genesis::TransferNamedProperties(Handle<JSObject> from,
JSObject::AddProperty(to, key, value, details.attributes());
break;
}
case CONSTANT: {
case DATA_CONSTANT: {
HandleScope inner(isolate());
Handle<Name> key = Handle<Name>(descs->GetKey(i));
Handle<Object> constant(descs->GetConstant(i), isolate());
JSObject::AddProperty(to, key, constant, details.attributes());
break;
}
case ACCESSOR_FIELD:
case ACCESSOR:
UNREACHABLE();
case CALLBACKS: {
case ACCESSOR_CONSTANT: {
Handle<Name> key(descs->GetKey(i));
LookupIterator it(to, key, LookupIterator::OWN_SKIP_INTERCEPTOR);
CHECK_NE(LookupIterator::ACCESS_CHECK, it.state());
@ -2611,7 +2613,7 @@ void Genesis::TransferNamedProperties(Handle<JSObject> from,
DCHECK(!to->HasFastProperties());
// Add to dictionary.
Handle<Object> callbacks(descs->GetCallbacksObject(i), isolate());
PropertyDetails d(details.attributes(), CALLBACKS, i + 1);
PropertyDetails d(details.attributes(), ACCESSOR_CONSTANT, i + 1);
JSObject::SetNormalizedProperty(to, key, callbacks, d);
break;
}
@ -2639,7 +2641,7 @@ void Genesis::TransferNamedProperties(Handle<JSObject> from,
isolate());
}
PropertyDetails details = properties->DetailsAt(i);
DCHECK_EQ(DATA, details.kind());
DCHECK_EQ(kData, details.kind());
JSObject::AddProperty(to, key, value, details.attributes());
}
}

View File

@ -1466,7 +1466,7 @@ class DictionaryElementsAccessor
if (entry != SeededNumberDictionary::kNotFound) {
Handle<Object> element(backing_store->ValueAt(entry), isolate);
PropertyDetails details = backing_store->DetailsAt(entry);
if (details.type() == CALLBACKS) {
if (details.type() == ACCESSOR_CONSTANT) {
return JSObject::GetElementWithCallback(
obj, receiver, element, key, obj);
} else {
@ -1499,7 +1499,7 @@ class DictionaryElementsAccessor
Handle<SeededNumberDictionary>::cast(store);
int entry = backing_store->FindEntry(key);
if (entry != SeededNumberDictionary::kNotFound &&
backing_store->DetailsAt(entry).type() == CALLBACKS &&
backing_store->DetailsAt(entry).type() == ACCESSOR_CONSTANT &&
backing_store->ValueAt(entry)->IsAccessorPair()) {
return handle(AccessorPair::cast(backing_store->ValueAt(entry)));
}

View File

@ -1575,8 +1575,9 @@ Handle<GlobalObject> Factory::NewGlobalObject(Handle<JSFunction> constructor) {
Handle<DescriptorArray> descs(map->instance_descriptors());
for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) {
PropertyDetails details = descs->GetDetails(i);
DCHECK(details.type() == CALLBACKS); // Only accessors are expected.
PropertyDetails d(details.attributes(), CALLBACKS, i + 1);
// Only accessors are expected.
DCHECK_EQ(ACCESSOR_CONSTANT, details.type());
PropertyDetails d(details.attributes(), ACCESSOR_CONSTANT, i + 1);
Handle<Name> name(descs->GetKey(i));
Handle<Object> value(descs->GetCallbacksObject(i), isolate());
Handle<PropertyCell> cell = NewPropertyCell(value);

View File

@ -1622,7 +1622,7 @@ void V8HeapExplorer::ExtractPropertyReferences(JSObject* js_obj, int entry) {
for (int i = 0; i < real_size; i++) {
PropertyDetails details = descs->GetDetails(i);
switch (details.location()) {
case IN_OBJECT: {
case kField: {
Representation r = details.representation();
if (r.IsSmi() || r.IsDouble()) break;
@ -1642,7 +1642,7 @@ void V8HeapExplorer::ExtractPropertyReferences(JSObject* js_obj, int entry) {
}
break;
}
case IN_DESCRIPTOR:
case kDescriptor:
SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry,
descs->GetKey(i),
descs->GetValue(i));
@ -2031,7 +2031,7 @@ void V8HeapExplorer::SetDataOrAccessorPropertyReference(
PropertyKind kind, JSObject* parent_obj, int parent_entry,
Name* reference_name, Object* child_obj, const char* name_format_string,
int field_offset) {
if (kind == ACCESSOR) {
if (kind == kAccessor) {
ExtractAccessorPairProperty(parent_obj, parent_entry, reference_name,
child_obj, field_offset);
} else {

View File

@ -5543,7 +5543,7 @@ static bool IsFastLiteral(Handle<JSObject> boilerplate,
int limit = boilerplate->map()->NumberOfOwnDescriptors();
for (int i = 0; i < limit; i++) {
PropertyDetails details = descriptors->GetDetails(i);
if (details.type() != FIELD) continue;
if (details.type() != DATA) continue;
if ((*max_properties)-- == 0) return false;
FieldIndex field_index = FieldIndex::ForDescriptor(boilerplate->map(), i);
if (boilerplate->IsUnboxedDoubleField(field_index)) continue;
@ -5662,7 +5662,7 @@ void HOptimizedGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
PropertyAccessInfo info(this, STORE, ToType(map), name);
if (info.CanAccessMonomorphic()) {
HValue* checked_literal = Add<HCheckMaps>(literal, map);
DCHECK(!info.IsAccessor());
DCHECK(!info.IsAccessorConstant());
store = BuildMonomorphicAccess(
&info, literal, checked_literal, value,
BailoutId::None(), BailoutId::None());
@ -5974,17 +5974,17 @@ bool HOptimizedGraphBuilder::PropertyAccessInfo::IsCompatible(
// chain.
if (info->has_holder()) return false;
if (IsAccessor()) {
if (IsAccessorConstant()) {
return accessor_.is_identical_to(info->accessor_) &&
api_holder_.is_identical_to(info->api_holder_);
}
if (IsConstant()) {
if (IsDataConstant()) {
return constant_.is_identical_to(info->constant_);
}
DCHECK(IsField());
if (!info->IsField()) return false;
DCHECK(IsData());
if (!info->IsData()) return false;
Representation r = access_.representation();
if (IsLoad()) {
@ -6031,14 +6031,14 @@ bool HOptimizedGraphBuilder::PropertyAccessInfo::LoadResult(Handle<Map> map) {
return false;
}
if (IsField()) {
if (IsData()) {
// Construct the object field access.
int index = GetLocalFieldIndexFromMap(map);
access_ = HObjectAccess::ForField(map, index, representation(), name_);
// Load field map for heap objects.
LoadFieldMaps(map);
} else if (IsAccessor()) {
} else if (IsAccessorConstant()) {
Handle<Object> accessors = GetAccessorsFromMap(map);
if (!accessors->IsAccessorPair()) return false;
Object* raw_accessor =
@ -6056,7 +6056,7 @@ bool HOptimizedGraphBuilder::PropertyAccessInfo::LoadResult(Handle<Map> map) {
}
}
accessor_ = accessor;
} else if (IsConstant()) {
} else if (IsDataConstant()) {
constant_ = GetConstantFromMap(map);
}
@ -6135,10 +6135,10 @@ bool HOptimizedGraphBuilder::PropertyAccessInfo::CanAccessMonomorphic() {
if (!LookupInPrototypes()) return false;
if (IsLoad()) return true;
if (IsAccessor()) return true;
if (IsAccessorConstant()) return true;
Handle<Map> map = this->map();
map->LookupTransition(NULL, *name_, NONE, &lookup_);
if (lookup_.IsTransitionToField() && map->unused_property_fields() > 0) {
if (lookup_.IsTransitionToData() && map->unused_property_fields() > 0) {
// Construct the object field access.
int descriptor = transition()->LastAdded();
int index =
@ -6242,7 +6242,7 @@ HInstruction* HOptimizedGraphBuilder::BuildMonomorphicAccess(
return graph()->GetConstantUndefined();
}
if (info->IsField()) {
if (info->IsData()) {
if (info->IsLoad()) {
return BuildLoadNamedField(info, checked_holder);
} else {
@ -6255,7 +6255,7 @@ HInstruction* HOptimizedGraphBuilder::BuildMonomorphicAccess(
return BuildStoreNamedField(info, checked_object, value);
}
if (info->IsAccessor()) {
if (info->IsAccessorConstant()) {
Push(checked_object);
int argument_count = 1;
if (!info->IsLoad()) {
@ -6279,7 +6279,7 @@ HInstruction* HOptimizedGraphBuilder::BuildMonomorphicAccess(
return BuildCallConstantFunction(info->accessor(), argument_count);
}
DCHECK(info->IsConstant());
DCHECK(info->IsDataConstant());
if (info->IsLoad()) {
return New<HConstant>(info->constant());
} else {
@ -7615,7 +7615,7 @@ void HOptimizedGraphBuilder::HandlePolymorphicCallNamed(
for (i = 0; i < types->length() && ordered_functions < kMaxCallPolymorphism;
++i) {
PropertyAccessInfo info(this, LOAD, ToType(types->at(i)), name);
if (info.CanAccessMonomorphic() && info.IsConstant() &&
if (info.CanAccessMonomorphic() && info.IsDataConstant() &&
info.constant()->IsJSFunction()) {
if (info.type()->Is(Type::String())) {
if (handled_string) continue;
@ -11250,7 +11250,7 @@ void HOptimizedGraphBuilder::BuildEmitInObjectProperties(
int copied_fields = 0;
for (int i = 0; i < limit; i++) {
PropertyDetails details = descriptors->GetDetails(i);
if (details.type() != FIELD) continue;
if (details.type() != DATA) continue;
copied_fields++;
FieldIndex field_index = FieldIndex::ForDescriptor(*boilerplate_map, i);

View File

@ -2518,9 +2518,9 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor {
bool IsFound() const { return lookup_.IsFound(); }
bool IsProperty() const { return lookup_.IsProperty(); }
bool IsField() const { return lookup_.IsField(); }
bool IsConstant() const { return lookup_.IsConstant(); }
bool IsAccessor() const { return lookup_.IsPropertyCallbacks(); }
bool IsData() const { return lookup_.IsData(); }
bool IsDataConstant() const { return lookup_.IsDataConstant(); }
bool IsAccessorConstant() const { return lookup_.IsAccessorConstant(); }
bool IsTransition() const { return lookup_.IsTransition(); }
bool IsConfigurable() const { return lookup_.IsConfigurable(); }

View File

@ -1359,7 +1359,7 @@ void MacroAssembler::LoadFromNumberDictionary(Label* miss,
// Check that the value is a field property.
const int kDetailsOffset =
SeededNumberDictionary::kElementsStartOffset + 2 * kPointerSize;
DCHECK_EQ(FIELD, 0);
DCHECK_EQ(DATA, 0);
test(FieldOperand(elements, r2, times_pointer_size, kDetailsOffset),
Immediate(PropertyDetails::TypeField::kMask << kSmiTagSize));
j(not_zero, miss);

View File

@ -270,7 +270,7 @@ void NamedLoadHandlerCompiler::InterceptorVectorSlotPop(Register holder_reg,
Handle<Code> NamedLoadHandlerCompiler::CompileLoadInterceptor(
LookupIterator* it) {
// So far the most popular follow ups for interceptor loads are FIELD and
// So far the most popular follow ups for interceptor loads are DATA and
// ExecutableAccessorInfo, so inline only them. Other cases may be added
// later.
bool inline_followup = false;
@ -284,7 +284,7 @@ Handle<Code> NamedLoadHandlerCompiler::CompileLoadInterceptor(
break;
case LookupIterator::DATA:
inline_followup =
it->property_details().type() == FIELD && !it->is_dictionary_holder();
it->property_details().type() == DATA && !it->is_dictionary_holder();
break;
case LookupIterator::ACCESSOR: {
Handle<Object> accessors = it->GetAccessors();
@ -337,7 +337,7 @@ void NamedLoadHandlerCompiler::GenerateLoadPostInterceptor(
case LookupIterator::TRANSITION:
UNREACHABLE();
case LookupIterator::DATA: {
DCHECK_EQ(FIELD, it->property_details().type());
DCHECK_EQ(DATA, it->property_details().type());
__ Move(receiver(), reg);
LoadFieldStub stub(isolate(), it->GetFieldIndex());
GenerateTailCall(masm(), stub.GetCode());
@ -392,7 +392,7 @@ Handle<Code> NamedStoreHandlerCompiler::CompileStoreTransition(
DCHECK(!transition->is_access_check_needed());
// Call to respective StoreTransitionStub.
if (details.type() == CONSTANT) {
if (details.type() == DATA_CONSTANT) {
GenerateRestoreMap(transition, scratch2(), &miss);
DCHECK(descriptors->GetValue(descriptor)->IsJSFunction());
Register map_reg = StoreTransitionDescriptor::MapRegister();

View File

@ -1259,7 +1259,7 @@ Handle<Code> LoadIC::CompileHandler(LookupIterator* lookup,
}
// -------------- Fields --------------
if (lookup->property_details().type() == FIELD) {
if (lookup->property_details().type() == DATA) {
FieldIndex field = lookup->GetFieldIndex();
if (receiver_is_holder) {
return SimpleFieldLoad(field);
@ -1270,7 +1270,7 @@ Handle<Code> LoadIC::CompileHandler(LookupIterator* lookup,
}
// -------------- Constant properties --------------
DCHECK(lookup->property_details().type() == CONSTANT);
DCHECK(lookup->property_details().type() == DATA_CONSTANT);
if (receiver_is_holder) {
LoadConstantStub stub(isolate(), lookup->GetConstantIndex());
return stub.GetCode();
@ -1761,7 +1761,7 @@ Handle<Code> StoreIC::CompileHandler(LookupIterator* lookup,
}
// -------------- Fields --------------
if (lookup->property_details().type() == FIELD) {
if (lookup->property_details().type() == DATA) {
bool use_stub = true;
if (lookup->representation().IsHeapObject()) {
// Only use a generic stub if no types need to be tracked.
@ -1779,7 +1779,7 @@ Handle<Code> StoreIC::CompileHandler(LookupIterator* lookup,
}
// -------------- Constant properties --------------
DCHECK(lookup->property_details().type() == CONSTANT);
DCHECK(lookup->property_details().type() == DATA_CONSTANT);
TRACE_GENERIC_IC(isolate(), "StoreIC", "constant property");
break;
}
@ -1795,7 +1795,8 @@ Handle<Code> StoreIC::CompileHandler(LookupIterator* lookup,
Handle<Code> KeyedStoreIC::StoreElementStub(Handle<JSObject> receiver,
KeyedAccessStoreMode store_mode) {
// Don't handle megamorphic property accesses for INTERCEPTORS or CALLBACKS
// Don't handle megamorphic property accesses for INTERCEPTORS or
// ACCESSOR_CONSTANT
// via megamorphic stubs, since they don't have a map in their relocation info
// and so the stubs can't be harvested for the object needed for a map check.
if (target()->type() != Code::NORMAL) {

View File

@ -539,7 +539,7 @@ BasicJsonStringifier::Result BasicJsonStringifier::SerializeJSObject(
PropertyDetails details = map->instance_descriptors()->GetDetails(i);
if (details.IsDontEnum()) continue;
Handle<Object> property;
if (details.type() == FIELD && *map == object->map()) {
if (details.type() == DATA && *map == object->map()) {
FieldIndex field_index = FieldIndex::ForDescriptor(*map, i);
Isolate* isolate = object->GetIsolate();
if (object->IsUnboxedDoubleField(field_index)) {

View File

@ -39,7 +39,7 @@ Handle<LayoutDescriptor> LayoutDescriptor::New(Isolate* isolate, int length) {
bool LayoutDescriptor::InobjectUnboxedField(int inobject_properties,
PropertyDetails details) {
if (details.type() != FIELD || !details.representation().IsDouble()) {
if (details.type() != DATA || !details.representation().IsDouble()) {
return false;
}
// We care only about in-object properties.

View File

@ -64,9 +64,9 @@ LookupIterator::State LookupIterator::LookupInHolder(Map* map,
}
has_property_ = true;
switch (property_details_.kind()) {
case v8::internal::DATA:
case v8::internal::kData:
return DATA;
case v8::internal::ACCESSOR:
case v8::internal::kAccessor:
return ACCESSOR;
}
case ACCESSOR:

View File

@ -102,7 +102,7 @@ void LookupIterator::ReconfigureDataProperty(Handle<Object> value,
DCHECK(HolderIsReceiverOrHiddenPrototype());
Handle<JSObject> holder = GetHolder<JSObject>();
if (holder_map_->is_dictionary_map()) {
PropertyDetails details(attributes, FIELD, 0);
PropertyDetails details(attributes, v8::internal::DATA, 0);
JSObject::SetNormalizedProperty(holder, name(), value, details);
} else {
holder_map_ = Map::ReconfigureDataProperty(holder_map_, descriptor_number(),
@ -173,7 +173,7 @@ void LookupIterator::TransitionToAccessorProperty(
}
// Install the accessor into the dictionary-mode object.
PropertyDetails details(attributes, CALLBACKS, 0);
PropertyDetails details(attributes, ACCESSOR_CONSTANT, 0);
Handle<AccessorPair> pair;
if (state() == ACCESSOR && GetAccessors()->IsAccessorPair()) {
pair = Handle<AccessorPair>::cast(GetAccessors());
@ -227,7 +227,7 @@ Handle<Object> LookupIterator::FetchValue() const {
if (holder_map_->IsGlobalObjectMap()) {
result = PropertyCell::cast(result)->value();
}
} else if (property_details_.type() == v8::internal::FIELD) {
} else if (property_details_.type() == v8::internal::DATA) {
FieldIndex field_index = FieldIndex::ForDescriptor(*holder_map_, number_);
return JSObject::FastPropertyAt(holder, property_details_.representation(),
field_index);
@ -241,7 +241,7 @@ Handle<Object> LookupIterator::FetchValue() const {
int LookupIterator::GetConstantIndex() const {
DCHECK(has_property_);
DCHECK(!holder_map_->is_dictionary_map());
DCHECK_EQ(v8::internal::CONSTANT, property_details_.type());
DCHECK_EQ(v8::internal::DATA_CONSTANT, property_details_.type());
return descriptor_number();
}
@ -249,7 +249,7 @@ int LookupIterator::GetConstantIndex() const {
FieldIndex LookupIterator::GetFieldIndex() const {
DCHECK(has_property_);
DCHECK(!holder_map_->is_dictionary_map());
DCHECK_EQ(v8::internal::FIELD, property_details_.type());
DCHECK_EQ(v8::internal::DATA, property_details_.type());
int index =
holder_map_->instance_descriptors()->GetFieldIndex(descriptor_number());
bool is_double = representation().IsDouble();
@ -260,7 +260,7 @@ FieldIndex LookupIterator::GetFieldIndex() const {
Handle<HeapType> LookupIterator::GetFieldType() const {
DCHECK(has_property_);
DCHECK(!holder_map_->is_dictionary_map());
DCHECK_EQ(v8::internal::FIELD, property_details_.type());
DCHECK_EQ(v8::internal::DATA, property_details_.type());
return handle(
holder_map_->instance_descriptors()->GetFieldType(descriptor_number()),
isolate_);
@ -300,10 +300,10 @@ Handle<Object> LookupIterator::WriteDataValue(Handle<Object> value) {
} else {
property_dictionary->ValueAtPut(dictionary_entry(), *value);
}
} else if (property_details_.type() == v8::internal::FIELD) {
} else if (property_details_.type() == v8::internal::DATA) {
holder->WriteToField(descriptor_number(), *value);
} else {
DCHECK_EQ(v8::internal::CONSTANT, property_details_.type());
DCHECK_EQ(v8::internal::DATA_CONSTANT, property_details_.type());
}
return value;
}

View File

@ -46,7 +46,7 @@ class LookupIterator FINAL BASE_EMBEDDED {
Configuration configuration = PROTOTYPE_CHAIN)
: configuration_(ComputeConfiguration(configuration, name)),
state_(NOT_FOUND),
property_details_(NONE, FIELD, 0),
property_details_(NONE, v8::internal::DATA, 0),
isolate_(name->GetIsolate()),
name_(name),
receiver_(receiver),
@ -61,7 +61,7 @@ class LookupIterator FINAL BASE_EMBEDDED {
Configuration configuration = PROTOTYPE_CHAIN)
: configuration_(ComputeConfiguration(configuration, name)),
state_(NOT_FOUND),
property_details_(NONE, FIELD, 0),
property_details_(NONE, v8::internal::DATA, 0),
isolate_(name->GetIsolate()),
name_(name),
holder_map_(holder->map(), isolate_),

View File

@ -596,7 +596,7 @@ void MacroAssembler::LoadFromNumberDictionary(Label* miss,
const int kDetailsOffset =
SeededNumberDictionary::kElementsStartOffset + 2 * kPointerSize;
lw(reg1, FieldMemOperand(reg2, kDetailsOffset));
DCHECK_EQ(FIELD, 0);
DCHECK_EQ(DATA, 0);
And(at, reg1, Operand(Smi::FromInt(PropertyDetails::TypeField::kMask)));
Branch(miss, ne, at, Operand(zero_reg));

View File

@ -601,7 +601,7 @@ void MacroAssembler::LoadFromNumberDictionary(Label* miss,
const int kDetailsOffset =
SeededNumberDictionary::kElementsStartOffset + 2 * kPointerSize;
ld(reg1, FieldMemOperand(reg2, kDetailsOffset));
DCHECK_EQ(FIELD, 0);
DCHECK_EQ(DATA, 0);
And(at, reg1, Operand(Smi::FromInt(PropertyDetails::TypeField::kMask)));
Branch(miss, ne, at, Operand(zero_reg));

View File

@ -180,9 +180,9 @@ PropertyKind.Indexed = 2;
// A copy of the PropertyType enum from property-details.h
var PropertyType = {};
PropertyType.Field = 0;
PropertyType.Constant = 1;
PropertyType.Callbacks = 3;
PropertyType.Data = 0;
PropertyType.DataConstant = 2;
PropertyType.AccessorConstant = 3;
// Different attributes for a property.
@ -848,7 +848,7 @@ ObjectMirror.prototype.lookupProperty = function(value) {
// Skip properties which are defined through assessors.
var property = properties[i];
if (property.propertyType() != PropertyType.Callbacks) {
if (property.propertyType() != PropertyType.AccessorConstant) {
if (%_ObjectEquals(property.value_, value.value_)) {
return property;
}
@ -1659,7 +1659,7 @@ PropertyMirror.prototype.setter = function() {
*/
PropertyMirror.prototype.isNative = function() {
return this.is_interceptor_ ||
((this.propertyType() == PropertyType.Callbacks) &&
((this.propertyType() == PropertyType.AccessorConstant) &&
!this.hasGetter() && !this.hasSetter());
};

View File

@ -276,7 +276,7 @@ void JSObject::JSObjectVerify() {
}
DescriptorArray* descriptors = map()->instance_descriptors();
for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) {
if (descriptors->GetDetails(i).type() == FIELD) {
if (descriptors->GetDetails(i).type() == DATA) {
Representation r = descriptors->GetDetails(i).representation();
FieldIndex index = FieldIndex::ForDescriptor(map(), i);
if (IsUnboxedDoubleField(index)) {
@ -1173,7 +1173,7 @@ bool LayoutDescriptor::IsConsistentWithMap(Map* map) {
int nof_descriptors = map->NumberOfOwnDescriptors();
for (int i = 0; i < nof_descriptors; i++) {
PropertyDetails details = descriptors->GetDetails(i);
if (details.type() != FIELD) continue;
if (details.type() != DATA) continue;
FieldIndex field_index = FieldIndex::ForDescriptor(map, i);
bool tagged_expected =
!field_index.is_inobject() || !details.representation().IsDouble();
@ -1191,13 +1191,13 @@ bool LayoutDescriptor::IsConsistentWithMap(Map* map) {
bool TransitionArray::IsSortedNoDuplicates(int valid_entries) {
DCHECK(valid_entries == -1);
Name* prev_key = NULL;
PropertyKind prev_kind = DATA;
PropertyKind prev_kind = kData;
PropertyAttributes prev_attributes = NONE;
uint32_t prev_hash = 0;
for (int i = 0; i < number_of_transitions(); i++) {
Name* key = GetSortedKey(i);
uint32_t hash = key->Hash();
PropertyKind kind = DATA;
PropertyKind kind = kData;
PropertyAttributes attributes = NONE;
if (!IsSpecialTransition(key)) {
Map* target = GetTarget(i);

View File

@ -58,7 +58,7 @@ PropertyDetails PropertyDetails::AsDeleted() const {
int PropertyDetails::field_width_in_words() const {
DCHECK(type() == FIELD);
DCHECK(type() == DATA);
if (!FLAG_unbox_double_fields) return 1;
if (kDoubleSize == kPointerSize) return 1;
return representation().IsDouble() ? kDoubleSize / kPointerSize : 1;
@ -1879,7 +1879,7 @@ Handle<String> Map::ExpectedTransitionKey(Handle<Map> map) {
int transition = TransitionArray::kSimpleTransitionIndex;
PropertyDetails details = transitions->GetTargetDetails(transition);
Name* name = transitions->GetKey(transition);
if (details.type() != FIELD) return Handle<String>::null();
if (details.type() != DATA) return Handle<String>::null();
if (details.attributes() != NONE) return Handle<String>::null();
if (!name->IsString()) return Handle<String>::null();
return Handle<String>(String::cast(name));
@ -1897,10 +1897,10 @@ Handle<Map> Map::FindTransitionToField(Handle<Map> map, Handle<Name> key) {
DisallowHeapAllocation no_allocation;
if (!map->HasTransitionArray()) return Handle<Map>::null();
TransitionArray* transitions = map->transitions();
int transition = transitions->Search(DATA, *key, NONE);
int transition = transitions->Search(kData, *key, NONE);
if (transition == TransitionArray::kNotFound) return Handle<Map>::null();
PropertyDetails details = transitions->GetTargetDetails(transition);
if (details.type() != FIELD) return Handle<Map>::null();
if (details.type() != DATA) return Handle<Map>::null();
DCHECK_EQ(NONE, details.attributes());
return Handle<Map>(transitions->GetTarget(transition));
}
@ -3038,7 +3038,7 @@ void Map::LookupDescriptor(JSObject* holder,
void Map::LookupTransition(JSObject* holder, Name* name,
PropertyAttributes attributes,
LookupResult* result) {
int transition_index = this->SearchTransition(DATA, name, attributes);
int transition_index = this->SearchTransition(kData, name, attributes);
if (transition_index == TransitionArray::kNotFound) return result->NotFound();
result->TransitionResult(holder, this->GetTransition(transition_index));
}
@ -3147,13 +3147,13 @@ PropertyType DescriptorArray::GetType(int descriptor_number) {
int DescriptorArray::GetFieldIndex(int descriptor_number) {
DCHECK(GetDetails(descriptor_number).type() == FIELD);
DCHECK(GetDetails(descriptor_number).type() == DATA);
return GetDetails(descriptor_number).field_index();
}
HeapType* DescriptorArray::GetFieldType(int descriptor_number) {
DCHECK(GetDetails(descriptor_number).type() == FIELD);
DCHECK(GetDetails(descriptor_number).type() == DATA);
return HeapType::cast(GetValue(descriptor_number));
}
@ -3164,13 +3164,13 @@ Object* DescriptorArray::GetConstant(int descriptor_number) {
Object* DescriptorArray::GetCallbacksObject(int descriptor_number) {
DCHECK(GetType(descriptor_number) == CALLBACKS);
DCHECK(GetType(descriptor_number) == ACCESSOR_CONSTANT);
return GetValue(descriptor_number);
}
AccessorDescriptor* DescriptorArray::GetCallbacks(int descriptor_number) {
DCHECK(GetType(descriptor_number) == CALLBACKS);
DCHECK(GetType(descriptor_number) == ACCESSOR_CONSTANT);
Foreign* p = Foreign::cast(GetCallbacksObject(descriptor_number));
return reinterpret_cast<AccessorDescriptor*>(p->foreign_address());
}
@ -4693,7 +4693,7 @@ bool Map::CanBeDeprecated() {
if (details.representation().IsSmi()) return true;
if (details.representation().IsDouble()) return true;
if (details.representation().IsHeapObject()) return true;
if (details.type() == CONSTANT) return true;
if (details.type() == DATA_CONSTANT) return true;
}
return false;
}
@ -5313,7 +5313,7 @@ void Map::AppendDescriptor(Descriptor* desc) {
// it should never try to (otherwise, layout descriptor must be updated too).
#ifdef DEBUG
PropertyDetails details = desc->GetDetails();
CHECK(details.type() != FIELD || !details.representation().IsDouble());
CHECK(details.type() != DATA || !details.representation().IsDouble());
#endif
}

View File

@ -231,26 +231,27 @@ void JSObject::PrintProperties(std::ostream& os) { // NOLINT
descs->GetKey(i)->NamePrint(os);
os << ": ";
switch (descs->GetType(i)) {
case FIELD: {
case DATA: {
FieldIndex index = FieldIndex::ForDescriptor(map(), i);
if (IsUnboxedDoubleField(index)) {
os << "<unboxed double> " << RawFastDoublePropertyAt(index);
} else {
os << Brief(RawFastPropertyAt(index));
}
os << " (field at offset " << index.property_index() << ")\n";
os << " (data field at offset " << index.property_index() << ")\n";
break;
}
case ACCESSOR_FIELD: {
case ACCESSOR: {
FieldIndex index = FieldIndex::ForDescriptor(map(), i);
os << " (accessor at offset " << index.property_index() << ")\n";
os << " (accessor field at offset " << index.property_index()
<< ")\n";
break;
}
case CONSTANT:
os << Brief(descs->GetConstant(i)) << " (constant)\n";
case DATA_CONSTANT:
os << Brief(descs->GetConstant(i)) << " (data constant)\n";
break;
case CALLBACKS:
os << Brief(descs->GetCallbacksObject(i)) << " (callbacks)\n";
case ACCESSOR_CONSTANT:
os << Brief(descs->GetCallbacksObject(i)) << " (accessor constant)\n";
break;
}
}
@ -1169,11 +1170,11 @@ void TransitionArray::PrintTransitions(std::ostream& os,
} else {
PropertyDetails details = GetTargetDetails(key, target);
os << " (transition to ";
if (details.location() == IN_DESCRIPTOR) {
if (details.location() == kDescriptor) {
os << "immutable ";
}
os << (details.kind() == DATA ? "data" : "accessor");
if (details.location() == IN_DESCRIPTOR) {
os << (details.kind() == kData ? "data" : "accessor");
if (details.location() == kDescriptor) {
os << " " << Brief(GetTargetValue(i));
}
os << "), attrs: " << details.attributes();

View File

@ -1269,8 +1269,8 @@ void JSObject::PrintInstanceMigration(FILE* file,
if (!o_r.Equals(n_r)) {
String::cast(o->GetKey(i))->PrintOn(file);
PrintF(file, ":%s->%s ", o_r.Mnemonic(), n_r.Mnemonic());
} else if (o->GetDetails(i).type() == CONSTANT &&
n->GetDetails(i).type() == FIELD) {
} else if (o->GetDetails(i).type() == DATA_CONSTANT &&
n->GetDetails(i).type() == DATA) {
Name* name = o->GetKey(i);
if (name->IsString()) {
String::cast(name)->PrintOn(file);
@ -1648,7 +1648,7 @@ MaybeHandle<Map> Map::CopyWithField(Handle<Map> map,
type = HeapType::Any(isolate);
}
FieldDescriptor new_field_desc(name, index, type, attributes, representation);
DataDescriptor new_field_desc(name, index, type, attributes, representation);
Handle<Map> new_map = Map::CopyAddDescriptor(map, &new_field_desc, flag);
int unused_property_fields = new_map->unused_property_fields() - 1;
if (unused_property_fields < 0) {
@ -1670,7 +1670,7 @@ MaybeHandle<Map> Map::CopyWithConstant(Handle<Map> map,
}
// Allocate new instance descriptors with (name, constant) added.
ConstantDescriptor new_constant_desc(name, constant, attributes);
DataConstantDescriptor new_constant_desc(name, constant, attributes);
return Map::CopyAddDescriptor(map, &new_constant_desc, flag);
}
@ -1691,7 +1691,7 @@ void JSObject::AddSlowProperty(Handle<JSObject> object,
// Assign an enumeration index to the property and update
// SetNextEnumerationIndex.
int index = dict->NextEnumerationIndex();
PropertyDetails details(attributes, FIELD, index);
PropertyDetails details(attributes, DATA, index);
dict->SetNextEnumerationIndex(index + 1);
dict->SetEntry(entry, name, cell, details);
return;
@ -1700,7 +1700,7 @@ void JSObject::AddSlowProperty(Handle<JSObject> object,
PropertyCell::SetValueInferType(cell, value);
value = cell;
}
PropertyDetails details(attributes, FIELD, 0);
PropertyDetails details(attributes, DATA, 0);
Handle<NameDictionary> result =
NameDictionary::Add(dict, name, value, details);
if (*dict != *result) object->set_properties(*result);
@ -1895,7 +1895,7 @@ void JSObject::MigrateFastToFast(Handle<JSObject> object, Handle<Map> new_map) {
} else {
value = isolate->factory()->uninitialized_value();
}
DCHECK(details.type() == FIELD);
DCHECK(details.type() == DATA);
int target_index = details.field_index() - inobject;
DCHECK(target_index >= 0); // Must be a backing store index.
new_storage->set(target_index, *value);
@ -1921,18 +1921,17 @@ void JSObject::MigrateFastToFast(Handle<JSObject> object, Handle<Map> new_map) {
for (int i = 0; i < old_nof; i++) {
PropertyDetails details = new_descriptors->GetDetails(i);
if (details.type() != FIELD) continue;
if (details.type() != DATA) continue;
PropertyDetails old_details = old_descriptors->GetDetails(i);
if (old_details.type() == CALLBACKS) {
if (old_details.type() == ACCESSOR_CONSTANT) {
DCHECK(details.representation().IsTagged());
continue;
}
Representation old_representation = old_details.representation();
Representation representation = details.representation();
DCHECK(old_details.type() == CONSTANT ||
old_details.type() == FIELD);
DCHECK(old_details.type() == DATA_CONSTANT || old_details.type() == DATA);
Handle<Object> value;
if (old_details.type() == CONSTANT) {
if (old_details.type() == DATA_CONSTANT) {
value = handle(old_descriptors->GetValue(i), isolate);
DCHECK(!old_representation.IsDouble() && !representation.IsDouble());
} else {
@ -1963,7 +1962,7 @@ void JSObject::MigrateFastToFast(Handle<JSObject> object, Handle<Map> new_map) {
for (int i = old_nof; i < new_nof; i++) {
PropertyDetails details = new_descriptors->GetDetails(i);
if (details.type() != FIELD) continue;
if (details.type() != DATA) continue;
Handle<Object> value;
if (details.representation().IsDouble()) {
value = isolate->factory()->NewHeapNumber(0, MUTABLE);
@ -2026,7 +2025,7 @@ int Map::NumberOfFields() {
DescriptorArray* descriptors = instance_descriptors();
int result = 0;
for (int i = 0; i < NumberOfOwnDescriptors(); i++) {
if (descriptors->GetDetails(i).type() == FIELD) result++;
if (descriptors->GetDetails(i).type() == DATA) result++;
}
return result;
}
@ -2045,7 +2044,7 @@ Handle<Map> Map::CopyGeneralizeAllRepresentations(Handle<Map> map,
for (int i = 0; i < number_of_own_descriptors; i++) {
descriptors->SetRepresentation(i, Representation::Tagged());
if (descriptors->GetDetails(i).type() == FIELD) {
if (descriptors->GetDetails(i).type() == DATA) {
descriptors->SetValue(i, HeapType::Any());
}
}
@ -2058,14 +2057,14 @@ Handle<Map> Map::CopyGeneralizeAllRepresentations(Handle<Map> map,
// Unless the instance is being migrated, ensure that modify_index is a field.
PropertyDetails details = descriptors->GetDetails(modify_index);
if (store_mode == FORCE_IN_OBJECT &&
(details.type() != FIELD || details.attributes() != attributes)) {
int field_index = details.type() == FIELD ? details.field_index()
: new_map->NumberOfFields();
FieldDescriptor d(handle(descriptors->GetKey(modify_index), isolate),
field_index, attributes, Representation::Tagged());
if (store_mode == FORCE_FIELD &&
(details.type() != DATA || details.attributes() != attributes)) {
int field_index = details.type() == DATA ? details.field_index()
: new_map->NumberOfFields();
DataDescriptor d(handle(descriptors->GetKey(modify_index), isolate),
field_index, attributes, Representation::Tagged());
descriptors->Replace(modify_index, &d);
if (details.type() != FIELD) {
if (details.type() != DATA) {
int unused_property_fields = new_map->unused_property_fields() - 1;
if (unused_property_fields < 0) {
unused_property_fields += JSObject::kFieldsAdded;
@ -2077,13 +2076,14 @@ Handle<Map> Map::CopyGeneralizeAllRepresentations(Handle<Map> map,
}
if (FLAG_trace_generalization) {
HeapType* field_type = (details.type() == FIELD)
? map->instance_descriptors()->GetFieldType(modify_index)
: NULL;
HeapType* field_type =
(details.type() == DATA)
? map->instance_descriptors()->GetFieldType(modify_index)
: NULL;
map->PrintGeneralization(
stdout, reason, modify_index, new_map->NumberOfOwnDescriptors(),
new_map->NumberOfOwnDescriptors(),
details.type() == CONSTANT && store_mode == FORCE_IN_OBJECT,
details.type() == DATA_CONSTANT && store_mode == FORCE_FIELD,
details.representation(), Representation::Tagged(), field_type,
HeapType::Any());
}
@ -2191,7 +2191,7 @@ Map* Map::FindLastMatchMap(int verbatim,
if (details.type() != next_details.type()) break;
if (details.attributes() != next_details.attributes()) break;
if (!details.representation().Equals(next_details.representation())) break;
if (next_details.type() == FIELD) {
if (next_details.type() == DATA) {
if (!descriptors->GetFieldType(i)->NowIs(
next_descriptors->GetFieldType(i))) break;
} else {
@ -2206,7 +2206,7 @@ Map* Map::FindLastMatchMap(int verbatim,
Map* Map::FindFieldOwner(int descriptor) {
DisallowHeapAllocation no_allocation;
DCHECK_EQ(FIELD, instance_descriptors()->GetDetails(descriptor).type());
DCHECK_EQ(DATA, instance_descriptors()->GetDetails(descriptor).type());
Map* result = this;
while (true) {
Object* back = result->GetBackPointer();
@ -2224,7 +2224,7 @@ void Map::UpdateFieldType(int descriptor, Handle<Name> name,
Handle<HeapType> new_type) {
DisallowHeapAllocation no_allocation;
PropertyDetails details = instance_descriptors()->GetDetails(descriptor);
if (details.type() != FIELD) return;
if (details.type() != DATA) return;
if (HasTransitionArray()) {
TransitionArray* transitions = this->transitions();
for (int i = 0; i < transitions->number_of_transitions(); ++i) {
@ -2238,8 +2238,8 @@ void Map::UpdateFieldType(int descriptor, Handle<Name> name,
// Skip if already updated the shared descriptor.
if (instance_descriptors()->GetFieldType(descriptor) == *new_type) return;
FieldDescriptor d(name, instance_descriptors()->GetFieldIndex(descriptor),
new_type, details.attributes(), new_representation);
DataDescriptor d(name, instance_descriptors()->GetFieldIndex(descriptor),
new_type, details.attributes(), new_representation);
instance_descriptors()->Replace(descriptor, &d);
}
@ -2351,7 +2351,7 @@ Handle<Map> Map::GeneralizeRepresentation(Handle<Map> old_map,
// Doubles, however, would require a box allocation.
if (old_representation.IsNone() && !new_representation.IsNone() &&
!new_representation.IsDouble()) {
DCHECK(old_details.type() == FIELD);
DCHECK(old_details.type() == DATA);
if (FLAG_trace_generalization) {
old_map->PrintGeneralization(
stdout, "uninitialized field",
@ -2379,8 +2379,8 @@ Handle<Map> Map::GeneralizeRepresentation(Handle<Map> old_map,
int root_nof = root_map->NumberOfOwnDescriptors();
if (modify_index < root_nof) {
PropertyDetails old_details = old_descriptors->GetDetails(modify_index);
if ((old_details.type() != FIELD && store_mode == FORCE_IN_OBJECT) ||
(old_details.type() == FIELD &&
if ((old_details.type() != DATA && store_mode == FORCE_FIELD) ||
(old_details.type() == DATA &&
(!new_field_type->NowIs(old_descriptors->GetFieldType(modify_index)) ||
!new_representation.fits_into(old_details.representation())))) {
return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode,
@ -2404,7 +2404,7 @@ Handle<Map> Map::GeneralizeRepresentation(Handle<Map> old_map,
PropertyType old_type = old_details.type();
PropertyType tmp_type = tmp_details.type();
DCHECK_EQ(old_details.attributes(), tmp_details.attributes());
if ((tmp_type == CALLBACKS || old_type == CALLBACKS) &&
if ((tmp_type == ACCESSOR_CONSTANT || old_type == ACCESSOR_CONSTANT) &&
(tmp_type != old_type ||
tmp_descriptors->GetValue(i) != old_descriptors->GetValue(i))) {
return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode,
@ -2417,19 +2417,19 @@ Handle<Map> Map::GeneralizeRepresentation(Handle<Map> old_map,
modify_index == i)) {
break;
}
if (tmp_type == FIELD) {
if (tmp_type == DATA) {
// Generalize the field type as necessary.
Handle<HeapType> old_field_type = (old_type == FIELD)
? handle(old_descriptors->GetFieldType(i), isolate)
: old_descriptors->GetValue(i)->OptimalType(
isolate, tmp_representation);
Handle<HeapType> old_field_type =
(old_type == DATA) ? handle(old_descriptors->GetFieldType(i), isolate)
: old_descriptors->GetValue(i)
->OptimalType(isolate, tmp_representation);
if (modify_index == i) {
old_field_type = GeneralizeFieldType(
new_field_type, old_field_type, isolate);
}
GeneralizeFieldType(tmp_map, i, tmp_representation, old_field_type);
} else if (tmp_type == CONSTANT) {
if (old_type != CONSTANT ||
} else if (tmp_type == DATA_CONSTANT) {
if (old_type != DATA_CONSTANT ||
old_descriptors->GetConstant(i) != tmp_descriptors->GetConstant(i)) {
break;
}
@ -2445,14 +2445,14 @@ Handle<Map> Map::GeneralizeRepresentation(Handle<Map> old_map,
target_map->instance_descriptors(), isolate);
int target_nof = target_map->NumberOfOwnDescriptors();
if (target_nof == old_nof &&
(store_mode != FORCE_IN_OBJECT ||
target_descriptors->GetDetails(modify_index).type() == FIELD)) {
(store_mode != FORCE_FIELD ||
target_descriptors->GetDetails(modify_index).type() == DATA)) {
DCHECK(modify_index < target_nof);
DCHECK(new_representation.fits_into(
target_descriptors->GetDetails(modify_index).representation()));
DCHECK(target_descriptors->GetDetails(modify_index).type() != FIELD ||
new_field_type->NowIs(
target_descriptors->GetFieldType(modify_index)));
DCHECK(
target_descriptors->GetDetails(modify_index).type() != DATA ||
new_field_type->NowIs(target_descriptors->GetFieldType(modify_index)));
return target_map;
}
@ -2470,7 +2470,8 @@ Handle<Map> Map::GeneralizeRepresentation(Handle<Map> old_map,
// Check if target map is compatible.
PropertyDetails tmp_details = tmp_descriptors->GetDetails(i);
DCHECK_EQ(old_details.attributes(), tmp_details.attributes());
if ((tmp_details.type() == CALLBACKS || old_details.type() == CALLBACKS) &&
if ((tmp_details.type() == ACCESSOR_CONSTANT ||
old_details.type() == ACCESSOR_CONSTANT) &&
(tmp_details.type() != old_details.type() ||
tmp_descriptors->GetValue(i) != old_descriptors->GetValue(i))) {
return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode,
@ -2498,7 +2499,7 @@ Handle<Map> Map::GeneralizeRepresentation(Handle<Map> old_map,
int current_offset = 0;
for (int i = 0; i < root_nof; ++i) {
PropertyDetails old_details = old_descriptors->GetDetails(i);
if (old_details.type() == FIELD) {
if (old_details.type() == DATA) {
current_offset += old_details.field_width_in_words();
}
Descriptor d(handle(old_descriptors->GetKey(i), isolate),
@ -2520,30 +2521,32 @@ Handle<Map> Map::GeneralizeRepresentation(Handle<Map> old_map,
new_representation.generalize(target_details.representation()));
}
DCHECK_EQ(old_details.attributes(), target_details.attributes());
if (old_details.type() == FIELD || target_details.type() == FIELD ||
(modify_index == i && store_mode == FORCE_IN_OBJECT) ||
if (old_details.type() == DATA || target_details.type() == DATA ||
(modify_index == i && store_mode == FORCE_FIELD) ||
(target_descriptors->GetValue(i) != old_descriptors->GetValue(i))) {
Handle<HeapType> old_field_type = (old_details.type() == FIELD)
? handle(old_descriptors->GetFieldType(i), isolate)
: old_descriptors->GetValue(i)->OptimalType(
isolate, target_details.representation());
Handle<HeapType> target_field_type = (target_details.type() == FIELD)
? handle(target_descriptors->GetFieldType(i), isolate)
: target_descriptors->GetValue(i)->OptimalType(
isolate, target_details.representation());
Handle<HeapType> old_field_type =
(old_details.type() == DATA)
? handle(old_descriptors->GetFieldType(i), isolate)
: old_descriptors->GetValue(i)
->OptimalType(isolate, target_details.representation());
Handle<HeapType> target_field_type =
(target_details.type() == DATA)
? handle(target_descriptors->GetFieldType(i), isolate)
: target_descriptors->GetValue(i)
->OptimalType(isolate, target_details.representation());
target_field_type = GeneralizeFieldType(
target_field_type, old_field_type, isolate);
if (modify_index == i) {
target_field_type = GeneralizeFieldType(
target_field_type, new_field_type, isolate);
}
FieldDescriptor d(target_key, current_offset, target_field_type,
target_details.attributes(),
target_details.representation());
DataDescriptor d(target_key, current_offset, target_field_type,
target_details.attributes(),
target_details.representation());
current_offset += d.GetDetails().field_width_in_words();
new_descriptors->Set(i, &d);
} else {
DCHECK_NE(FIELD, target_details.type());
DCHECK_NE(DATA, target_details.type());
Descriptor d(target_key,
handle(target_descriptors->GetValue(i), isolate),
target_details);
@ -2559,21 +2562,22 @@ Handle<Map> Map::GeneralizeRepresentation(Handle<Map> old_map,
old_details = old_details.CopyWithRepresentation(
new_representation.generalize(old_details.representation()));
}
if (old_details.type() == FIELD) {
if (old_details.type() == DATA) {
Handle<HeapType> old_field_type(
old_descriptors->GetFieldType(i), isolate);
if (modify_index == i) {
old_field_type = GeneralizeFieldType(
old_field_type, new_field_type, isolate);
}
FieldDescriptor d(old_key, current_offset, old_field_type,
old_details.attributes(), old_details.representation());
DataDescriptor d(old_key, current_offset, old_field_type,
old_details.attributes(), old_details.representation());
current_offset += d.GetDetails().field_width_in_words();
new_descriptors->Set(i, &d);
} else {
DCHECK(old_details.type() == CONSTANT || old_details.type() == CALLBACKS);
if (modify_index == i && store_mode == FORCE_IN_OBJECT) {
FieldDescriptor d(
DCHECK(old_details.type() == DATA_CONSTANT ||
old_details.type() == ACCESSOR_CONSTANT);
if (modify_index == i && store_mode == FORCE_FIELD) {
DataDescriptor d(
old_key, current_offset,
GeneralizeFieldType(old_descriptors->GetValue(i)->OptimalType(
isolate, old_details.representation()),
@ -2582,7 +2586,7 @@ Handle<Map> Map::GeneralizeRepresentation(Handle<Map> old_map,
current_offset += d.GetDetails().field_width_in_words();
new_descriptors->Set(i, &d);
} else {
DCHECK_NE(FIELD, old_details.type());
DCHECK_NE(DATA, old_details.type());
Descriptor d(old_key,
handle(old_descriptors->GetValue(i), isolate),
old_details);
@ -2593,8 +2597,8 @@ Handle<Map> Map::GeneralizeRepresentation(Handle<Map> old_map,
new_descriptors->Sort();
DCHECK(store_mode != FORCE_IN_OBJECT ||
new_descriptors->GetDetails(modify_index).type() == FIELD);
DCHECK(store_mode != FORCE_FIELD ||
new_descriptors->GetDetails(modify_index).type() == DATA);
Handle<Map> split_map(root_map->FindLastMatchMap(
root_nof, old_nof, *new_descriptors), isolate);
@ -2620,17 +2624,21 @@ Handle<Map> Map::GeneralizeRepresentation(Handle<Map> old_map,
if (FLAG_trace_generalization) {
PropertyDetails old_details = old_descriptors->GetDetails(modify_index);
PropertyDetails new_details = new_descriptors->GetDetails(modify_index);
Handle<HeapType> old_field_type = (old_details.type() == FIELD)
? handle(old_descriptors->GetFieldType(modify_index), isolate)
: HeapType::Constant(handle(old_descriptors->GetValue(modify_index),
isolate), isolate);
Handle<HeapType> new_field_type = (new_details.type() == FIELD)
? handle(new_descriptors->GetFieldType(modify_index), isolate)
: HeapType::Constant(handle(new_descriptors->GetValue(modify_index),
isolate), isolate);
Handle<HeapType> old_field_type =
(old_details.type() == DATA)
? handle(old_descriptors->GetFieldType(modify_index), isolate)
: HeapType::Constant(
handle(old_descriptors->GetValue(modify_index), isolate),
isolate);
Handle<HeapType> new_field_type =
(new_details.type() == DATA)
? handle(new_descriptors->GetFieldType(modify_index), isolate)
: HeapType::Constant(
handle(new_descriptors->GetValue(modify_index), isolate),
isolate);
old_map->PrintGeneralization(
stdout, "", modify_index, split_nof, old_nof,
old_details.type() == CONSTANT && store_mode == FORCE_IN_OBJECT,
old_details.type() == DATA_CONSTANT && store_mode == FORCE_FIELD,
old_details.representation(), new_details.representation(),
*old_field_type, *new_field_type);
}
@ -2646,15 +2654,15 @@ Handle<Map> Map::GeneralizeRepresentation(Handle<Map> old_map,
}
// Generalize the representation of all FIELD descriptors.
// Generalize the representation of all DATA descriptors.
Handle<Map> Map::GeneralizeAllFieldRepresentations(
Handle<Map> map) {
Handle<DescriptorArray> descriptors(map->instance_descriptors());
for (int i = 0; i < map->NumberOfOwnDescriptors(); ++i) {
if (descriptors->GetDetails(i).type() == FIELD) {
if (descriptors->GetDetails(i).type() == DATA) {
map = GeneralizeRepresentation(map, i, Representation::Tagged(),
HeapType::Any(map->GetIsolate()),
FORCE_IN_OBJECT);
FORCE_FIELD);
}
}
return map;
@ -2718,27 +2726,27 @@ MaybeHandle<Map> Map::TryUpdateInternal(Handle<Map> old_map) {
Object* new_value = new_descriptors->GetValue(i);
Object* old_value = old_descriptors->GetValue(i);
switch (new_details.type()) {
case FIELD: {
case DATA: {
PropertyType old_type = old_details.type();
if (old_type == FIELD) {
if (old_type == DATA) {
if (!HeapType::cast(old_value)->NowIs(HeapType::cast(new_value))) {
return MaybeHandle<Map>();
}
} else {
DCHECK(old_type == CONSTANT);
DCHECK(old_type == DATA_CONSTANT);
if (!HeapType::cast(new_value)->NowContains(old_value)) {
return MaybeHandle<Map>();
}
}
break;
}
case ACCESSOR_FIELD:
case ACCESSOR:
DCHECK(HeapType::Any()->Is(HeapType::cast(new_value)));
break;
case CONSTANT:
case CALLBACKS:
if (old_details.location() == IN_OBJECT || old_value != new_value) {
case DATA_CONSTANT:
case ACCESSOR_CONSTANT:
if (old_details.location() == kField || old_value != new_value) {
return MaybeHandle<Map>();
}
break;
@ -3036,7 +3044,7 @@ MaybeHandle<Object> JSObject::SetElementWithCallbackSetterInPrototypes(
int entry = dictionary->FindEntry(index);
if (entry != SeededNumberDictionary::kNotFound) {
PropertyDetails details = dictionary->DetailsAt(entry);
if (details.type() == CALLBACKS) {
if (details.type() == ACCESSOR_CONSTANT) {
*found = true;
Handle<Object> structure(dictionary->ValueAt(entry), isolate);
return SetElementWithCallback(object, structure, index, value, js_proto,
@ -3143,7 +3151,7 @@ struct DescriptorArrayAppender {
int valid_descriptors,
Handle<DescriptorArray> array) {
DisallowHeapAllocation no_gc;
CallbacksDescriptor desc(key, entry, entry->property_attributes());
AccessorConstantDescriptor desc(key, entry, entry->property_attributes());
array->Append(&desc);
}
};
@ -3773,7 +3781,7 @@ void JSObject::WriteToField(int descriptor, Object* value) {
DescriptorArray* desc = map()->instance_descriptors();
PropertyDetails details = desc->GetDetails(descriptor);
DCHECK(details.type() == FIELD);
DCHECK(details.type() == DATA);
FieldIndex index = FieldIndex::ForDescriptor(map(), descriptor);
if (details.representation().IsDouble()) {
@ -4211,13 +4219,13 @@ void JSObject::MigrateFastToSlow(Handle<JSObject> object,
PropertyDetails details = descs->GetDetails(i);
Handle<Name> key(descs->GetKey(i));
switch (details.type()) {
case CONSTANT: {
case DATA_CONSTANT: {
Handle<Object> value(descs->GetConstant(i), isolate);
PropertyDetails d(details.attributes(), FIELD, i + 1);
PropertyDetails d(details.attributes(), DATA, i + 1);
dictionary = NameDictionary::Add(dictionary, key, value, d);
break;
}
case FIELD: {
case DATA: {
FieldIndex index = FieldIndex::ForDescriptor(*map, i);
Handle<Object> value;
if (object->IsUnboxedDoubleField(index)) {
@ -4231,20 +4239,20 @@ void JSObject::MigrateFastToSlow(Handle<JSObject> object,
value = isolate->factory()->NewHeapNumber(old->value());
}
}
PropertyDetails d(details.attributes(), FIELD, i + 1);
PropertyDetails d(details.attributes(), DATA, i + 1);
dictionary = NameDictionary::Add(dictionary, key, value, d);
break;
}
case ACCESSOR_FIELD: {
case ACCESSOR: {
FieldIndex index = FieldIndex::ForDescriptor(*map, i);
Handle<Object> value(object->RawFastPropertyAt(index), isolate);
PropertyDetails d(details.attributes(), CALLBACKS, i + 1);
PropertyDetails d(details.attributes(), ACCESSOR_CONSTANT, i + 1);
dictionary = NameDictionary::Add(dictionary, key, value, d);
break;
}
case CALLBACKS: {
case ACCESSOR_CONSTANT: {
Handle<Object> value(descs->GetCallbacksObject(i), isolate);
PropertyDetails d(details.attributes(), CALLBACKS, i + 1);
PropertyDetails d(details.attributes(), ACCESSOR_CONSTANT, i + 1);
dictionary = NameDictionary::Add(dictionary, key, value, d);
break;
}
@ -4328,7 +4336,7 @@ void JSObject::MigrateSlowToFast(Handle<JSObject> object,
Object* value = dictionary->ValueAt(index);
PropertyType type = dictionary->DetailsAt(index).type();
if (type == FIELD && !value->IsJSFunction()) {
if (type == DATA && !value->IsJSFunction()) {
number_of_fields += 1;
}
}
@ -4397,9 +4405,10 @@ void JSObject::MigrateSlowToFast(Handle<JSObject> object,
PropertyType type = details.type();
if (value->IsJSFunction()) {
ConstantDescriptor d(key, handle(value, isolate), details.attributes());
DataConstantDescriptor d(key, handle(value, isolate),
details.attributes());
descriptors->Set(enumeration_index - 1, &d);
} else if (type == FIELD) {
} else if (type == DATA) {
if (current_offset < inobject_props) {
object->InObjectPropertyAtPut(current_offset, value,
UPDATE_WRITE_BARRIER);
@ -4407,13 +4416,14 @@ void JSObject::MigrateSlowToFast(Handle<JSObject> object,
int offset = current_offset - inobject_props;
fields->set(offset, value);
}
FieldDescriptor d(key, current_offset, details.attributes(),
// TODO(verwaest): value->OptimalRepresentation();
Representation::Tagged());
DataDescriptor d(key, current_offset, details.attributes(),
// TODO(verwaest): value->OptimalRepresentation();
Representation::Tagged());
current_offset += d.GetDetails().field_width_in_words();
descriptors->Set(enumeration_index - 1, &d);
} else if (type == CALLBACKS) {
CallbacksDescriptor d(key, handle(value, isolate), details.attributes());
} else if (type == ACCESSOR_CONSTANT) {
AccessorConstantDescriptor d(key, handle(value, isolate),
details.attributes());
descriptors->Set(enumeration_index - 1, &d);
} else {
UNREACHABLE();
@ -4475,7 +4485,7 @@ static Handle<SeededNumberDictionary> CopyFastElementsToDictionary(
value = handle(Handle<FixedArray>::cast(array)->get(i), isolate);
}
if (!value->IsTheHole()) {
PropertyDetails details(NONE, FIELD, 0);
PropertyDetails details(NONE, DATA, 0);
dictionary =
SeededNumberDictionary::AddNumberEntry(dictionary, i, value, details);
}
@ -4744,7 +4754,7 @@ Object* JSObject::GetHiddenPropertiesHashTable() {
int sorted_index = descriptors->GetSortedKeyIndex(0);
if (descriptors->GetKey(sorted_index) == GetHeap()->hidden_string() &&
sorted_index < map()->NumberOfOwnDescriptors()) {
DCHECK(descriptors->GetType(sorted_index) == FIELD);
DCHECK(descriptors->GetType(sorted_index) == DATA);
DCHECK(descriptors->GetDetails(sorted_index).representation().
IsCompatibleForLoad(Representation::Tagged()));
FieldIndex index = FieldIndex::ForDescriptor(this->map(),
@ -5285,7 +5295,7 @@ static void ApplyAttributesToDictionary(Dictionary* dictionary,
PropertyDetails details = dictionary->DetailsAt(i);
int attrs = attributes;
// READ_ONLY is an invalid attribute for JS setters/getters.
if ((attributes & READ_ONLY) && details.type() == CALLBACKS) {
if ((attributes & READ_ONLY) && details.type() == ACCESSOR_CONSTANT) {
Object* v = dictionary->ValueAt(i);
if (v->IsPropertyCell()) v = PropertyCell::cast(v)->value();
if (v->IsAccessorPair()) attrs &= ~READ_ONLY;
@ -5525,7 +5535,7 @@ MaybeHandle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk(
int limit = copy->map()->NumberOfOwnDescriptors();
for (int i = 0; i < limit; i++) {
PropertyDetails details = descriptors->GetDetails(i);
if (details.type() != FIELD) continue;
if (details.type() != DATA) continue;
FieldIndex index = FieldIndex::ForDescriptor(copy->map(), i);
if (object->IsUnboxedDoubleField(index)) {
if (copying) {
@ -5750,7 +5760,7 @@ int Map::NextFreePropertyIndex() {
DescriptorArray* descs = instance_descriptors();
for (int i = 0; i < number_of_own_descriptors; i++) {
PropertyDetails details = descs->GetDetails(i);
if (details.type() == FIELD) {
if (details.type() == DATA) {
int candidate = details.field_index() + details.field_width_in_words();
if (candidate > free_index) free_index = candidate;
}
@ -5841,7 +5851,7 @@ static Handle<FixedArray> GetEnumPropertyKeys(Handle<JSObject> object,
if (!(details.IsDontEnum() || key->IsSymbol())) {
storage->set(index, key);
if (!indices.is_null()) {
if (details.type() != FIELD) {
if (details.type() != DATA) {
indices = Handle<FixedArray>();
} else {
FieldIndex field_index = FieldIndex::ForDescriptor(*map, i);
@ -6004,12 +6014,11 @@ static bool UpdateGetterSetterInDictionary(
if (entry != SeededNumberDictionary::kNotFound) {
Object* result = dictionary->ValueAt(entry);
PropertyDetails details = dictionary->DetailsAt(entry);
if (details.type() == CALLBACKS && result->IsAccessorPair()) {
if (details.type() == ACCESSOR_CONSTANT && result->IsAccessorPair()) {
DCHECK(details.IsConfigurable());
if (details.attributes() != attributes) {
dictionary->DetailsAtPut(
entry,
PropertyDetails(attributes, CALLBACKS, index));
entry, PropertyDetails(attributes, ACCESSOR_CONSTANT, index));
}
AccessorPair::cast(result)->SetComponents(getter, setter);
return true;
@ -6111,14 +6120,14 @@ void JSObject::SetElementCallback(Handle<JSObject> object,
Handle<Object> structure,
PropertyAttributes attributes) {
Heap* heap = object->GetHeap();
PropertyDetails details = PropertyDetails(attributes, CALLBACKS, 0);
PropertyDetails details = PropertyDetails(attributes, ACCESSOR_CONSTANT, 0);
// Normalize elements to make this operation simple.
bool had_dictionary_elements = object->HasDictionaryElements();
Handle<SeededNumberDictionary> dictionary = NormalizeElements(object);
DCHECK(object->HasDictionaryElements() ||
object->HasDictionaryArgumentsElements());
// Update the dictionary with the new CALLBACKS property.
// Update the dictionary with the new ACCESSOR_CONSTANT property.
dictionary = SeededNumberDictionary::Set(dictionary, index, structure,
details);
dictionary->set_requires_slow_elements();
@ -6176,8 +6185,8 @@ void JSObject::SetPropertyCallback(Handle<JSObject> object,
Deoptimizer::DeoptimizeGlobalObject(*object);
}
// Update the dictionary with the new CALLBACKS property.
PropertyDetails details = PropertyDetails(attributes, CALLBACKS, 0);
// Update the dictionary with the new ACCESSOR_CONSTANT property.
PropertyDetails details = PropertyDetails(attributes, ACCESSOR_CONSTANT, 0);
SetNormalizedProperty(object, name, structure, details);
ReoptimizeIfPrototype(object);
@ -6391,7 +6400,7 @@ MaybeHandle<Object> JSObject::GetAccessor(Handle<JSObject> object,
int entry = dictionary->FindEntry(index);
if (entry != SeededNumberDictionary::kNotFound) {
Object* element = dictionary->ValueAt(entry);
if (dictionary->DetailsAt(entry).type() == CALLBACKS &&
if (dictionary->DetailsAt(entry).type() == ACCESSOR_CONSTANT &&
element->IsAccessorPair()) {
return handle(AccessorPair::cast(element)->GetComponent(component),
isolate);
@ -6442,7 +6451,7 @@ Object* JSObject::SlowReverseLookup(Object* value) {
DescriptorArray* descs = map()->instance_descriptors();
bool value_is_number = value->IsNumber();
for (int i = 0; i < number_of_own_descriptors; i++) {
if (descs->GetType(i) == FIELD) {
if (descs->GetType(i) == DATA) {
FieldIndex field_index = FieldIndex::ForDescriptor(map(), i);
if (IsUnboxedDoubleField(field_index)) {
if (value_is_number) {
@ -6462,7 +6471,7 @@ Object* JSObject::SlowReverseLookup(Object* value) {
return descs->GetKey(i);
}
}
} else if (descs->GetType(i) == CONSTANT) {
} else if (descs->GetType(i) == DATA_CONSTANT) {
if (descs->GetConstant(i) == value) {
return descs->GetKey(i);
}
@ -6707,7 +6716,7 @@ Handle<Map> Map::CopyReplaceDescriptors(
int length = descriptors->number_of_descriptors();
for (int i = 0; i < length; i++) {
descriptors->SetRepresentation(i, Representation::Tagged());
if (descriptors->GetDetails(i).type() == FIELD) {
if (descriptors->GetDetails(i).type() == DATA) {
descriptors->SetValue(i, HeapType::Any());
}
}
@ -6746,7 +6755,7 @@ Handle<Map> Map::CopyInstallDescriptors(
int unused_property_fields = map->unused_property_fields();
PropertyDetails details = descriptors->GetDetails(new_descriptor);
if (details.type() == FIELD) {
if (details.type() == DATA) {
unused_property_fields = map->unused_property_fields() - 1;
if (unused_property_fields < 0) {
unused_property_fields += JSObject::kFieldsAdded;
@ -6910,17 +6919,17 @@ Handle<Map> Map::CopyForPreventExtensions(Handle<Map> map,
bool DescriptorArray::CanHoldValue(int descriptor, Object* value) {
PropertyDetails details = GetDetails(descriptor);
switch (details.type()) {
case FIELD:
case DATA:
return value->FitsRepresentation(details.representation()) &&
GetFieldType(descriptor)->NowContains(value);
case CONSTANT:
case DATA_CONSTANT:
DCHECK(GetConstant(descriptor) != value ||
value->FitsRepresentation(details.representation()));
return GetConstant(descriptor) == value;
case ACCESSOR_FIELD:
case CALLBACKS:
case ACCESSOR:
case ACCESSOR_CONSTANT:
return false;
}
@ -6946,7 +6955,7 @@ Handle<Map> Map::PrepareForDataProperty(Handle<Map> map, int descriptor,
Handle<HeapType> type = value->OptimalType(isolate, representation);
return GeneralizeRepresentation(map, descriptor, representation, type,
FORCE_IN_OBJECT);
FORCE_FIELD);
}
@ -6960,7 +6969,7 @@ Handle<Map> Map::TransitionToDataProperty(Handle<Map> map, Handle<Name> name,
// Migrate to the newest map before storing the property.
map = Update(map);
int index = map->SearchTransition(DATA, *name, attributes);
int index = map->SearchTransition(kData, *name, attributes);
if (index != TransitionArray::kNotFound) {
Handle<Map> transition(map->GetTransition(index));
int descriptor = transition->LastAdded();
@ -7010,9 +7019,8 @@ Handle<Map> Map::ReconfigureDataProperty(Handle<Map> map, int descriptor,
// For now, give up on transitioning and just create a unique map.
// TODO(verwaest/ishell): Cache transitions with different attributes.
return CopyGeneralizeAllRepresentations(map, descriptor, FORCE_IN_OBJECT,
attributes,
"GenAll_AttributesMismatch");
return CopyGeneralizeAllRepresentations(
map, descriptor, FORCE_FIELD, attributes, "GenAll_AttributesMismatch");
}
@ -7038,14 +7046,14 @@ Handle<Map> Map::TransitionToAccessorProperty(Handle<Map> map,
? KEEP_INOBJECT_PROPERTIES
: CLEAR_INOBJECT_PROPERTIES;
int index = map->SearchTransition(ACCESSOR, *name, attributes);
int index = map->SearchTransition(kAccessor, *name, attributes);
if (index != TransitionArray::kNotFound) {
Handle<Map> transition(map->GetTransition(index));
DescriptorArray* descriptors = transition->instance_descriptors();
int descriptor = transition->LastAdded();
DCHECK(descriptors->GetKey(descriptor)->Equals(*name));
DCHECK_EQ(ACCESSOR, descriptors->GetDetails(descriptor).kind());
DCHECK_EQ(kAccessor, descriptors->GetDetails(descriptor).kind());
DCHECK_EQ(attributes, descriptors->GetDetails(descriptor).attributes());
Handle<Object> maybe_pair(descriptors->GetValue(descriptor), isolate);
@ -7069,7 +7077,7 @@ Handle<Map> Map::TransitionToAccessorProperty(Handle<Map> map,
return Map::Normalize(map, mode, "AccessorsOverwritingNonLast");
}
PropertyDetails old_details = old_descriptors->GetDetails(descriptor);
if (old_details.type() != CALLBACKS) {
if (old_details.type() != ACCESSOR_CONSTANT) {
return Map::Normalize(map, mode, "AccessorsOverwritingNonAccessors");
}
@ -7099,7 +7107,7 @@ Handle<Map> Map::TransitionToAccessorProperty(Handle<Map> map,
pair->set(component, *accessor);
TransitionFlag flag = INSERT_TRANSITION;
CallbacksDescriptor new_desc(name, pair, attributes);
AccessorConstantDescriptor new_desc(name, pair, attributes);
return Map::CopyInsertDescriptor(map, &new_desc, flag);
}
@ -7183,7 +7191,7 @@ Handle<DescriptorArray> DescriptorArray::CopyUpToAddAttributes(
if (!key->IsSymbol() || !Symbol::cast(key)->is_private()) {
int mask = DONT_DELETE | DONT_ENUM;
// READ_ONLY is an invalid attribute for JS setters/getters.
if (details.type() != CALLBACKS || !value->IsAccessorPair()) {
if (details.type() != ACCESSOR_CONSTANT || !value->IsAccessorPair()) {
mask |= READ_ONLY;
}
details = details.CopyAddAttributes(
@ -9650,7 +9658,7 @@ void JSObject::OptimizeAsPrototype(Handle<JSObject> object,
if (object->IsGlobalObject()) return;
if (object->IsJSGlobalProxy()) return;
if (mode == FAST_PROTOTYPE && !object->map()->is_prototype_map()) {
// First normalize to ensure all JSFunctions are CONSTANT.
// First normalize to ensure all JSFunctions are DATA_CONSTANT.
JSObject::NormalizeProperties(object, KEEP_INOBJECT_PROPERTIES, 0,
"NormalizeAsPrototype");
}
@ -12429,7 +12437,7 @@ MaybeHandle<Object> JSObject::SetDictionaryElement(
if (entry != SeededNumberDictionary::kNotFound) {
Handle<Object> element(dictionary->ValueAt(entry), isolate);
PropertyDetails details = dictionary->DetailsAt(entry);
if (details.type() == CALLBACKS && set_mode == SET_PROPERTY) {
if (details.type() == ACCESSOR_CONSTANT && set_mode == SET_PROPERTY) {
return SetElementWithCallback(object, element, index, value, object,
strict_mode);
} else {
@ -12438,8 +12446,7 @@ MaybeHandle<Object> JSObject::SetDictionaryElement(
// is read-only (a declared const that has not been initialized). If a
// value is being defined we skip attribute checks completely.
if (set_mode == DEFINE_PROPERTY) {
details =
PropertyDetails(attributes, FIELD, details.dictionary_index());
details = PropertyDetails(attributes, DATA, details.dictionary_index());
dictionary->DetailsAtPut(entry, details);
} else if (details.IsReadOnly() && !element->IsTheHole()) {
if (strict_mode == SLOPPY) {
@ -12490,7 +12497,7 @@ MaybeHandle<Object> JSObject::SetDictionaryElement(
}
}
PropertyDetails details(attributes, FIELD, 0);
PropertyDetails details(attributes, DATA, 0);
Handle<SeededNumberDictionary> new_dictionary =
SeededNumberDictionary::AddNumberEntry(dictionary, index, value,
details);
@ -14583,7 +14590,7 @@ Handle<Object> JSObject::PrepareSlowElementsForSort(
HandleScope scope(isolate);
Handle<Object> value(dict->ValueAt(i), isolate);
PropertyDetails details = dict->DetailsAt(i);
if (details.type() == CALLBACKS || details.IsReadOnly()) {
if (details.type() == ACCESSOR_CONSTANT || details.IsReadOnly()) {
// Bail out and do the sorting of undefineds and array holes in JS.
// Also bail out if the element is not supposed to be moved.
return bailout;
@ -14617,7 +14624,7 @@ Handle<Object> JSObject::PrepareSlowElementsForSort(
}
uint32_t result = pos;
PropertyDetails no_details(NONE, FIELD, 0);
PropertyDetails no_details(NONE, DATA, 0);
while (undefs > 0) {
if (pos > static_cast<uint32_t>(Smi::kMaxValue)) {
// Adding an entry with the key beyond smi-range requires
@ -15003,7 +15010,7 @@ Handle<PropertyCell> JSGlobalObject::EnsurePropertyCell(
Isolate* isolate = global->GetIsolate();
Handle<PropertyCell> cell = isolate->factory()->NewPropertyCell(
isolate->factory()->the_hole_value());
PropertyDetails details(NONE, FIELD, 0);
PropertyDetails details(NONE, DATA, 0);
details = details.AsDeleted();
Handle<NameDictionary> dictionary = NameDictionary::Add(
handle(global->property_dictionary()), name, cell, details);
@ -15483,7 +15490,7 @@ Handle<Derived> Dictionary<Derived, Shape, Key>::AtPut(
#ifdef DEBUG
USE(Shape::AsHandle(dictionary->GetIsolate(), key));
#endif
PropertyDetails details(NONE, FIELD, 0);
PropertyDetails details(NONE, DATA, 0);
AddEntry(dictionary, key, value, details, dictionary->Hash(key));
return dictionary;
@ -15571,7 +15578,7 @@ Handle<UnseededNumberDictionary> UnseededNumberDictionary::AddNumberEntry(
uint32_t key,
Handle<Object> value) {
SLOW_DCHECK(dictionary->FindEntry(key) == kNotFound);
return Add(dictionary, key, value, PropertyDetails(NONE, FIELD, 0));
return Add(dictionary, key, value, PropertyDetails(NONE, DATA, 0));
}
@ -15659,7 +15666,7 @@ bool Dictionary<Derived, Shape, Key>::HasComplexElements() {
if (DerivedHashTable::IsKey(k) && !FilterKey(k, NONE)) {
PropertyDetails details = DetailsAt(i);
if (details.IsDeleted()) continue;
if (details.type() == CALLBACKS) return true;
if (details.type() == ACCESSOR_CONSTANT) return true;
PropertyAttributes attr = details.attributes();
if (attr & (READ_ONLY | DONT_DELETE | DONT_ENUM)) return true;
}

View File

@ -242,7 +242,7 @@ enum WriteBarrierMode { SKIP_WRITE_BARRIER, UPDATE_WRITE_BARRIER };
// Indicates whether a value can be loaded as a constant.
enum StoreMode { ALLOW_IN_DESCRIPTOR, FORCE_IN_OBJECT };
enum StoreMode { ALLOW_IN_DESCRIPTOR, FORCE_FIELD };
// PropertyNormalizationMode is used to specify whether to keep

View File

@ -1515,7 +1515,7 @@ void MacroAssembler::LoadFromNumberDictionary(Label* miss, Register elements,
SeededNumberDictionary::kElementsStartOffset + 2 * kPointerSize;
LoadP(t1, FieldMemOperand(t2, kDetailsOffset));
LoadSmiLiteral(ip, Smi::FromInt(PropertyDetails::TypeField::kMask));
DCHECK_EQ(FIELD, 0);
DCHECK_EQ(DATA, 0);
and_(r0, t1, ip, SetRC);
bne(miss, cr0);

View File

@ -43,22 +43,22 @@ class TypeInfo;
// Type of properties.
// Order of kinds is significant.
// Must fit in the BitField PropertyDetails::KindField.
enum PropertyKind { DATA = 0, ACCESSOR = 1 };
enum PropertyKind { kData = 0, kAccessor = 1 };
// Order of modes is significant.
// Must fit in the BitField PropertyDetails::StoreModeField.
enum PropertyLocation { IN_OBJECT = 0, IN_DESCRIPTOR = 1 };
enum PropertyLocation { kField = 0, kDescriptor = 1 };
// Order of properties is significant.
// Must fit in the BitField PropertyDetails::TypeField.
// A copy of this is in mirror-debugger.js.
enum PropertyType {
FIELD = (IN_OBJECT << 1) | DATA,
CONSTANT = (IN_DESCRIPTOR << 1) | DATA,
ACCESSOR_FIELD = (IN_OBJECT << 1) | ACCESSOR,
CALLBACKS = (IN_DESCRIPTOR << 1) | ACCESSOR
DATA = (kField << 1) | kData,
DATA_CONSTANT = (kDescriptor << 1) | kData,
ACCESSOR = (kField << 1) | kAccessor,
ACCESSOR_CONSTANT = (kDescriptor << 1) | kAccessor
};

View File

@ -51,10 +51,10 @@ struct FastPropertyDetails {
// Outputs PropertyDetails as a dictionary details.
std::ostream& operator<<(std::ostream& os, const PropertyDetails& details) {
os << "(";
if (details.location() == IN_DESCRIPTOR) {
if (details.location() == kDescriptor) {
os << "immutable ";
}
os << (details.kind() == DATA ? "data" : "accessor");
os << (details.kind() == kData ? "data" : "accessor");
return os << ", dictionary_index: " << details.dictionary_index()
<< ", attrs: " << details.attributes() << ")";
}
@ -65,11 +65,11 @@ std::ostream& operator<<(std::ostream& os,
const FastPropertyDetails& details_fast) {
const PropertyDetails& details = details_fast.details;
os << "(";
if (details.location() == IN_DESCRIPTOR) {
if (details.location() == kDescriptor) {
os << "immutable ";
}
os << (details.kind() == DATA ? "data" : "accessor");
if (details.location() == IN_OBJECT) {
os << (details.kind() == kData ? "data" : "accessor");
if (details.location() == kField) {
os << ": " << details.representation().Mnemonic()
<< ", field_index: " << details.field_index();
}

View File

@ -73,40 +73,33 @@ class Descriptor BASE_EMBEDDED {
std::ostream& operator<<(std::ostream& os, const Descriptor& d);
class FieldDescriptor FINAL : public Descriptor {
class DataDescriptor FINAL : public Descriptor {
public:
FieldDescriptor(Handle<Name> key,
int field_index,
PropertyAttributes attributes,
Representation representation)
: Descriptor(key, HeapType::Any(key->GetIsolate()), attributes,
FIELD, representation, field_index) {}
FieldDescriptor(Handle<Name> key,
int field_index,
Handle<HeapType> field_type,
PropertyAttributes attributes,
Representation representation)
: Descriptor(key, field_type, attributes, FIELD,
representation, field_index) { }
DataDescriptor(Handle<Name> key, int field_index,
PropertyAttributes attributes, Representation representation)
: Descriptor(key, HeapType::Any(key->GetIsolate()), attributes, DATA,
representation, field_index) {}
DataDescriptor(Handle<Name> key, int field_index, Handle<HeapType> field_type,
PropertyAttributes attributes, Representation representation)
: Descriptor(key, field_type, attributes, DATA, representation,
field_index) {}
};
class ConstantDescriptor FINAL : public Descriptor {
class DataConstantDescriptor FINAL : public Descriptor {
public:
ConstantDescriptor(Handle<Name> key,
Handle<Object> value,
PropertyAttributes attributes)
: Descriptor(key, value, attributes, CONSTANT,
DataConstantDescriptor(Handle<Name> key, Handle<Object> value,
PropertyAttributes attributes)
: Descriptor(key, value, attributes, DATA_CONSTANT,
value->OptimalRepresentation()) {}
};
class CallbacksDescriptor FINAL : public Descriptor {
class AccessorConstantDescriptor FINAL : public Descriptor {
public:
CallbacksDescriptor(Handle<Name> key,
Handle<Object> foreign,
PropertyAttributes attributes)
: Descriptor(key, foreign, attributes, CALLBACKS,
AccessorConstantDescriptor(Handle<Name> key, Handle<Object> foreign,
PropertyAttributes attributes)
: Descriptor(key, foreign, attributes, ACCESSOR_CONSTANT,
Representation::Tagged()) {}
};
@ -119,7 +112,7 @@ class LookupResult FINAL BASE_EMBEDDED {
lookup_type_(NOT_FOUND),
holder_(NULL),
transition_(NULL),
details_(NONE, FIELD, Representation::None()) {
details_(NONE, DATA, Representation::None()) {
isolate->set_top_lookup_result(this);
}
@ -148,7 +141,7 @@ class LookupResult FINAL BASE_EMBEDDED {
void NotFound() {
lookup_type_ = NOT_FOUND;
details_ = PropertyDetails(NONE, FIELD, 0);
details_ = PropertyDetails(NONE, DATA, 0);
holder_ = NULL;
transition_ = NULL;
}
@ -159,8 +152,8 @@ class LookupResult FINAL BASE_EMBEDDED {
}
// Property callbacks does not include transitions to callbacks.
bool IsPropertyCallbacks() const {
return !IsTransition() && details_.type() == CALLBACKS;
bool IsAccessorConstant() const {
return !IsTransition() && details_.type() == ACCESSOR_CONSTANT;
}
bool IsReadOnly() const {
@ -168,12 +161,12 @@ class LookupResult FINAL BASE_EMBEDDED {
return details_.IsReadOnly();
}
bool IsField() const {
return lookup_type_ == DESCRIPTOR_TYPE && details_.type() == FIELD;
bool IsData() const {
return lookup_type_ == DESCRIPTOR_TYPE && details_.type() == DATA;
}
bool IsConstant() const {
return lookup_type_ == DESCRIPTOR_TYPE && details_.type() == CONSTANT;
bool IsDataConstant() const {
return lookup_type_ == DESCRIPTOR_TYPE && details_.type() == DATA_CONSTANT;
}
bool IsConfigurable() const { return details_.IsConfigurable(); }
@ -190,8 +183,8 @@ class LookupResult FINAL BASE_EMBEDDED {
return transition_;
}
bool IsTransitionToField() const {
return IsTransition() && details_.type() == FIELD;
bool IsTransitionToData() const {
return IsTransition() && details_.type() == DATA;
}
int GetLocalFieldIndexFromMap(Map* map) const {
@ -199,7 +192,7 @@ class LookupResult FINAL BASE_EMBEDDED {
}
Object* GetConstantFromMap(Map* map) const {
DCHECK(details_.type() == CONSTANT);
DCHECK(details_.type() == DATA_CONSTANT);
return GetValueFromMap(map);
}

View File

@ -136,7 +136,7 @@ RUNTIME_FUNCTION(Runtime_DebugGetPropertyDetails) {
isolate, element_or_char,
Runtime::GetElementOrCharAt(isolate, obj, index));
details->set(0, *element_or_char);
details->set(1, PropertyDetails(NONE, FIELD, 0).AsSmi());
details->set(1, PropertyDetails(NONE, DATA, 0).AsSmi());
return *isolate->factory()->NewJSArrayWithElements(details);
}
@ -158,7 +158,7 @@ RUNTIME_FUNCTION(Runtime_DebugGetPropertyDetails) {
details->set(0, *value);
// TODO(verwaest): Get rid of this random way of handling interceptors.
PropertyDetails d = it.state() == LookupIterator::INTERCEPTOR
? PropertyDetails(NONE, FIELD, 0)
? PropertyDetails(NONE, DATA, 0)
: it.property_details();
details->set(1, d.AsSmi());
details->set(

View File

@ -615,7 +615,7 @@ RUNTIME_FUNCTION(Runtime_KeyedGetProperty) {
// appropriate.
LookupIterator it(receiver, key, LookupIterator::OWN);
if (it.state() == LookupIterator::DATA &&
it.property_details().type() == FIELD) {
it.property_details().type() == DATA) {
FieldIndex field_index = it.GetFieldIndex();
// Do not track double fields in the keyed lookup cache. Reading
// double values requires boxing.
@ -632,7 +632,7 @@ RUNTIME_FUNCTION(Runtime_KeyedGetProperty) {
NameDictionary* dictionary = receiver->property_dictionary();
int entry = dictionary->FindEntry(key);
if ((entry != NameDictionary::kNotFound) &&
(dictionary->DetailsAt(entry).type() == FIELD)) {
(dictionary->DetailsAt(entry).type() == DATA)) {
Object* value = dictionary->ValueAt(entry);
if (!receiver->IsGlobalObject()) return value;
value = PropertyCell::cast(value)->value();

View File

@ -65,10 +65,11 @@ static Object* DeclareGlobals(Isolate* isolate, Handle<GlobalObject> global,
// Check whether we can reconfigure the existing property into a
// function.
PropertyDetails old_details = it.property_details();
// TODO(verwaest): CALLBACKS invalidly includes ExecutableAccessInfo,
// TODO(verwaest): ACCESSOR_CONSTANT invalidly includes
// ExecutableAccessInfo,
// which are actually data properties, not accessor properties.
if (old_details.IsReadOnly() || old_details.IsDontEnum() ||
old_details.type() == CALLBACKS) {
old_details.type() == ACCESSOR_CONSTANT) {
return ThrowRedeclarationError(isolate, name);
}
// If the existing property is not configurable, keep its attributes. Do

View File

@ -80,7 +80,7 @@ void Runtime::InitializeIntrinsicFunctionNames(Isolate* isolate,
if (name == NULL) continue;
Handle<NameDictionary> new_dict = NameDictionary::Add(
dict, isolate->factory()->InternalizeUtf8String(name),
Handle<Smi>(Smi::FromInt(i), isolate), PropertyDetails(NONE, FIELD, 0));
Handle<Smi>(Smi::FromInt(i), isolate), PropertyDetails(NONE, DATA, 0));
// The dictionary does not need to grow.
CHECK(new_dict.is_identical_to(dict));
}

View File

@ -335,7 +335,7 @@ void StringStream::PrintUsingMap(JSObject* js_object) {
DescriptorArray* descs = map->instance_descriptors();
for (int i = 0; i < real_size; i++) {
PropertyDetails details = descs->GetDetails(i);
if (details.type() == FIELD) {
if (details.type() == DATA) {
Object* key = descs->GetKey(i);
if (key->IsString() || key->IsNumber()) {
int len = 3;

View File

@ -97,7 +97,7 @@ Handle<TransitionArray> TransitionArray::Insert(Handle<Map> map,
bool is_special_transition = flag == SPECIAL_TRANSITION;
DCHECK_EQ(is_special_transition, IsSpecialTransition(*name));
PropertyDetails details = is_special_transition
? PropertyDetails(NONE, FIELD, 0)
? PropertyDetails(NONE, DATA, 0)
: GetTargetDetails(*name, *target);
int insertion_index = kNotFound;

View File

@ -4391,7 +4391,7 @@ void MacroAssembler::LoadFromNumberDictionary(Label* miss,
// Check that the value is a field property.
const int kDetailsOffset =
SeededNumberDictionary::kElementsStartOffset + 2 * kPointerSize;
DCHECK_EQ(FIELD, 0);
DCHECK_EQ(DATA, 0);
Test(FieldOperand(elements, r2, times_pointer_size, kDetailsOffset),
Smi::FromInt(PropertyDetails::TypeField::kMask));
j(not_zero, miss);

View File

@ -1324,7 +1324,7 @@ void MacroAssembler::LoadFromNumberDictionary(Label* miss,
// Check that the value is a field property.
const int kDetailsOffset =
SeededNumberDictionary::kElementsStartOffset + 2 * kPointerSize;
DCHECK_EQ(FIELD, 0);
DCHECK_EQ(DATA, 0);
test(FieldOperand(elements, r2, times_pointer_size, kDetailsOffset),
Immediate(PropertyDetails::TypeField::kMask << kSmiTagSize));
j(not_zero, miss);

View File

@ -152,8 +152,8 @@ TEST(StressJS) {
Handle<AccessorInfo> foreign = TestAccessorInfo(isolate, attrs);
Map::EnsureDescriptorSlack(map, 1);
CallbacksDescriptor d(Handle<Name>(Name::cast(foreign->name())),
foreign, attrs);
AccessorConstantDescriptor d(Handle<Name>(Name::cast(foreign->name())),
foreign, attrs);
map->AppendDescriptor(&d);
// Add the Foo constructor the global object.

View File

@ -41,10 +41,11 @@ static void CheckPropertyDetailsFieldsConsistency(PropertyType type,
TEST(PropertyDetailsFieldsConsistency) {
CheckPropertyDetailsFieldsConsistency(FIELD, DATA, IN_OBJECT);
CheckPropertyDetailsFieldsConsistency(CONSTANT, DATA, IN_DESCRIPTOR);
CheckPropertyDetailsFieldsConsistency(ACCESSOR_FIELD, ACCESSOR, IN_OBJECT);
CheckPropertyDetailsFieldsConsistency(CALLBACKS, ACCESSOR, IN_DESCRIPTOR);
CheckPropertyDetailsFieldsConsistency(DATA, kData, kField);
CheckPropertyDetailsFieldsConsistency(DATA_CONSTANT, kData, kDescriptor);
CheckPropertyDetailsFieldsConsistency(ACCESSOR, kAccessor, kField);
CheckPropertyDetailsFieldsConsistency(ACCESSOR_CONSTANT, kAccessor,
kDescriptor);
}
@ -77,7 +78,7 @@ TEST(TransitionArray_SimpleFieldTransitions) {
transitions->Insert(map0, name1, map1, SIMPLE_PROPERTY_TRANSITION);
ConnectTransition(map0, transitions, map1);
CHECK(transitions->IsSimpleTransition());
transition = transitions->Search(DATA, *name1, attributes);
transition = transitions->Search(kData, *name1, attributes);
CHECK_EQ(TransitionArray::kSimpleTransitionIndex, transition);
CHECK_EQ(*name1, transitions->GetKey(transition));
CHECK_EQ(*map1, transitions->GetTarget(transition));
@ -87,11 +88,11 @@ TEST(TransitionArray_SimpleFieldTransitions) {
ConnectTransition(map0, transitions, map2);
CHECK(transitions->IsFullTransitionArray());
transition = transitions->Search(DATA, *name1, attributes);
transition = transitions->Search(kData, *name1, attributes);
CHECK_EQ(*name1, transitions->GetKey(transition));
CHECK_EQ(*map1, transitions->GetTarget(transition));
transition = transitions->Search(DATA, *name2, attributes);
transition = transitions->Search(kData, *name2, attributes);
CHECK_EQ(*name2, transitions->GetKey(transition));
CHECK_EQ(*map2, transitions->GetTarget(transition));
@ -127,7 +128,7 @@ TEST(TransitionArray_FullFieldTransitions) {
transitions = transitions->Insert(map0, name1, map1, PROPERTY_TRANSITION);
ConnectTransition(map0, transitions, map1);
CHECK(transitions->IsFullTransitionArray());
transition = transitions->Search(DATA, *name1, attributes);
transition = transitions->Search(kData, *name1, attributes);
CHECK_EQ(*name1, transitions->GetKey(transition));
CHECK_EQ(*map1, transitions->GetTarget(transition));
@ -135,11 +136,11 @@ TEST(TransitionArray_FullFieldTransitions) {
ConnectTransition(map0, transitions, map2);
CHECK(transitions->IsFullTransitionArray());
transition = transitions->Search(DATA, *name1, attributes);
transition = transitions->Search(kData, *name1, attributes);
CHECK_EQ(*name1, transitions->GetKey(transition));
CHECK_EQ(*map1, transitions->GetTarget(transition));
transition = transitions->Search(DATA, *name2, attributes);
transition = transitions->Search(kData, *name2, attributes);
CHECK_EQ(*name2, transitions->GetKey(transition));
CHECK_EQ(*map2, transitions->GetTarget(transition));
@ -179,7 +180,7 @@ TEST(TransitionArray_DifferentFieldNames) {
}
for (int i = 0; i < PROPS_COUNT; i++) {
int transition = transitions->Search(DATA, *names[i], attributes);
int transition = transitions->Search(kData, *names[i], attributes);
CHECK_EQ(*names[i], transitions->GetKey(transition));
CHECK_EQ(*maps[i], transitions->GetTarget(transition));
}
@ -222,7 +223,7 @@ TEST(TransitionArray_SameFieldNamesDifferentAttributesSimple) {
for (int i = 0; i < ATTRS_COUNT; i++) {
PropertyAttributes attributes = static_cast<PropertyAttributes>(i);
int transition = transitions->Search(DATA, *name, attributes);
int transition = transitions->Search(kData, *name, attributes);
CHECK_EQ(*name, transitions->GetKey(transition));
CHECK_EQ(*attr_maps[i], transitions->GetTarget(transition));
}
@ -285,14 +286,14 @@ TEST(TransitionArray_SameFieldNamesDifferentAttributes) {
for (int i = 0; i < ATTRS_COUNT; i++) {
PropertyAttributes attributes = static_cast<PropertyAttributes>(i);
int transition = transitions->Search(DATA, *name, attributes);
int transition = transitions->Search(kData, *name, attributes);
CHECK_EQ(*name, transitions->GetKey(transition));
CHECK_EQ(*attr_maps[i], transitions->GetTarget(transition));
}
// Ensure that info about the other fields still valid.
for (int i = 0; i < PROPS_COUNT; i++) {
int transition = transitions->Search(DATA, *names[i], NONE);
int transition = transitions->Search(kData, *names[i], NONE);
CHECK_EQ(*names[i], transitions->GetKey(transition));
CHECK_EQ(*maps[i], transitions->GetTarget(transition));
}

View File

@ -67,11 +67,11 @@ static Handle<DescriptorArray> CreateDescriptorArray(Isolate* isolate,
TestPropertyKind kind = props[i];
if (kind == PROP_CONSTANT) {
ConstantDescriptor d(name, func, NONE);
DataConstantDescriptor d(name, func, NONE);
descriptors->Append(&d);
} else {
FieldDescriptor f(name, next_field_offset, NONE, representations[kind]);
DataDescriptor f(name, next_field_offset, NONE, representations[kind]);
next_field_offset += f.GetDetails().field_width_in_words();
descriptors->Append(&f);
}
@ -541,7 +541,7 @@ TEST(LayoutDescriptorCreateNewSlow) {
CHECK_NE(LayoutDescriptor::FastPointerLayout(), *layout_descriptor);
CHECK(layout_descriptor->IsSlowLayout());
for (int i = 0; i < inobject_properties; i++) {
// PROP_DOUBLE has index 1 among FIELD properties.
// PROP_DOUBLE has index 1 among DATA properties.
const bool tagged = (i % (PROP_KIND_NUMBER - 1)) != 1;
CHECK_EQ(tagged, layout_descriptor->IsTagged(i));
}
@ -600,12 +600,12 @@ static Handle<LayoutDescriptor> TestLayoutDescriptorAppend(
Handle<LayoutDescriptor> layout_descriptor;
TestPropertyKind kind = props[i];
if (kind == PROP_CONSTANT) {
ConstantDescriptor d(name, func, NONE);
DataConstantDescriptor d(name, func, NONE);
layout_descriptor = LayoutDescriptor::Append(map, d.GetDetails());
descriptors->Append(&d);
} else {
FieldDescriptor f(name, next_field_offset, NONE, representations[kind]);
DataDescriptor f(name, next_field_offset, NONE, representations[kind]);
int field_width_in_words = f.GetDetails().field_width_in_words();
next_field_offset += field_width_in_words;
layout_descriptor = LayoutDescriptor::Append(map, f.GetDetails());
@ -736,7 +736,7 @@ static Handle<LayoutDescriptor> TestLayoutDescriptorAppendIfFastOrUseFull(
CHECK_EQ(*full_layout_descriptor, layout_desc);
} else {
CHECK(!switched_to_slow_mode);
if (details.type() == FIELD) {
if (details.type() == DATA) {
nof++;
int field_index = details.field_index();
int field_width_in_words = details.field_width_in_words();
@ -971,7 +971,7 @@ static void TestLayoutDescriptorHelper(Isolate* isolate,
int first_non_tagged_field_offset = end_offset;
for (int i = 0; i < number_of_descriptors; i++) {
PropertyDetails details = descriptors->GetDetails(i);
if (details.type() != FIELD) continue;
if (details.type() != DATA) continue;
FieldIndex index = FieldIndex::ForDescriptor(*map, i);
if (!index.is_inobject()) continue;
all_fields_tagged &= !details.representation().IsDouble();

View File

@ -209,14 +209,14 @@ mirror = debug.MakeMirror(o);
// a has getter but no setter.
assertTrue(mirror.property('a').hasGetter());
assertFalse(mirror.property('a').hasSetter());
assertEquals(debug.PropertyType.Callbacks, mirror.property('a').propertyType());
assertEquals(debug.PropertyType.AccessorConstant, mirror.property('a').propertyType());
assertEquals('function', mirror.property('a').getter().type());
assertEquals('undefined', mirror.property('a').setter().type());
assertEquals('function (){return \'a\';}', mirror.property('a').getter().source());
// b has setter but no getter.
assertFalse(mirror.property('b').hasGetter());
assertTrue(mirror.property('b').hasSetter());
assertEquals(debug.PropertyType.Callbacks, mirror.property('b').propertyType());
assertEquals(debug.PropertyType.AccessorConstant, mirror.property('b').propertyType());
assertEquals('undefined', mirror.property('b').getter().type());
assertEquals('function', mirror.property('b').setter().type());
assertEquals('function (){}', mirror.property('b').setter().source());
@ -224,7 +224,7 @@ assertFalse(mirror.property('b').isException());
// c has both getter and setter. The getter throws an exception.
assertTrue(mirror.property('c').hasGetter());
assertTrue(mirror.property('c').hasSetter());
assertEquals(debug.PropertyType.Callbacks, mirror.property('c').propertyType());
assertEquals(debug.PropertyType.AccessorConstant, mirror.property('c').propertyType());
assertEquals('function', mirror.property('c').getter().type());
assertEquals('function', mirror.property('c').setter().type());
assertEquals('function (){throw \'c\';}', mirror.property('c').getter().source());

View File

@ -77,7 +77,7 @@ var SuperCar = ((function (Super) {
}
});
// Convert self.copy from CONSTANT to FIELD.
// Convert self.copy from DATA_CONSTANT to DATA.
self.copy = function () { };
return self;