From f3d1888fdbf7ec0262fd3ca60e6138163964b591 Mon Sep 17 00:00:00 2001 From: ishell Date: Wed, 19 Nov 2014 03:45:17 -0800 Subject: [PATCH] PropertyDetails cleanup: NORMAL property type merged with FIELD. First step towards replacing PropertyType with two enums: {DATA,ACCESSOR} x {CONST,WRITABLE}. Review URL: https://codereview.chromium.org/733253004 Cr-Commit-Position: refs/heads/master@{#25417} --- src/arm/macro-assembler-arm.cc | 3 ++- src/arm64/macro-assembler-arm64.cc | 3 ++- src/bootstrapper.cc | 4 --- src/heap-snapshot-generator.cc | 3 --- src/ia32/macro-assembler-ia32.cc | 4 +-- src/ic/handler-compiler.cc | 3 ++- src/lookup-inl.h | 1 - src/lookup.cc | 2 +- src/lookup.h | 4 +-- src/mips/macro-assembler-mips.cc | 3 ++- src/mips64/macro-assembler-mips64.cc | 3 ++- src/mirror-debugger.js | 14 ++++------- src/objects-printer.cc | 8 +----- src/objects.cc | 44 +++++++++++---------------------- src/ppc/macro-assembler-ppc.cc | 3 ++- src/property-details.h | 27 +++++++++----------- src/property.cc | 48 ++++++++++++++++++++++++++++++++---- src/property.h | 7 ++---- src/runtime/runtime-debug.cc | 7 +++--- src/runtime/runtime-object.cc | 2 +- src/runtime/runtime.cc | 3 +-- src/x64/macro-assembler-x64.cc | 4 +-- src/x87/macro-assembler-x87.cc | 4 +-- test/mjsunit/mirror-object.js | 7 +----- 24 files changed, 105 insertions(+), 106 deletions(-) diff --git a/src/arm/macro-assembler-arm.cc b/src/arm/macro-assembler-arm.cc index 9294a8c..729ce02 100644 --- a/src/arm/macro-assembler-arm.cc +++ b/src/arm/macro-assembler-arm.cc @@ -1699,11 +1699,12 @@ void MacroAssembler::LoadFromNumberDictionary(Label* miss, } bind(&done); - // Check that the value is a normal property. + // Check that the value is a field property. // t2: elements + (index * kPointerSize) const int kDetailsOffset = SeededNumberDictionary::kElementsStartOffset + 2 * kPointerSize; ldr(t1, FieldMemOperand(t2, kDetailsOffset)); + DCHECK_EQ(FIELD, 0); tst(t1, Operand(Smi::FromInt(PropertyDetails::TypeField::kMask))); b(ne, miss); diff --git a/src/arm64/macro-assembler-arm64.cc b/src/arm64/macro-assembler-arm64.cc index c7a61ea..82f7183 100644 --- a/src/arm64/macro-assembler-arm64.cc +++ b/src/arm64/macro-assembler-arm64.cc @@ -4213,10 +4213,11 @@ void MacroAssembler::LoadFromNumberDictionary(Label* miss, } Bind(&done); - // Check that the value is a normal property. + // Check that the value is a field property. const int kDetailsOffset = SeededNumberDictionary::kElementsStartOffset + 2 * kPointerSize; Ldrsw(scratch1, UntagSmiFieldMemOperand(scratch2, kDetailsOffset)); + DCHECK_EQ(FIELD, 0); TestAndBranchIfAnySet(scratch1, PropertyDetails::TypeField::kMask, miss); // Get the value at the masked, scaled index and return. diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc index 03dd569..505b784 100644 --- a/src/bootstrapper.cc +++ b/src/bootstrapper.cc @@ -2599,10 +2599,6 @@ void Genesis::TransferNamedProperties(Handle from, JSObject::SetNormalizedProperty(to, key, callbacks, d); break; } - // Do not occur since the from object has fast properties. - case NORMAL: - UNREACHABLE(); - break; } } } else { diff --git a/src/heap-snapshot-generator.cc b/src/heap-snapshot-generator.cc index 1406ed5..b7b290e 100644 --- a/src/heap-snapshot-generator.cc +++ b/src/heap-snapshot-generator.cc @@ -1671,9 +1671,6 @@ void V8HeapExplorer::ExtractPropertyReferences(JSObject* js_obj, int entry) { js_obj, entry, descs->GetKey(i), descs->GetValue(i)); break; - case NORMAL: // only in slow mode - UNREACHABLE(); - break; } } } else { diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc index 098415e..06b6f6a 100644 --- a/src/ia32/macro-assembler-ia32.cc +++ b/src/ia32/macro-assembler-ia32.cc @@ -1356,10 +1356,10 @@ void MacroAssembler::LoadFromNumberDictionary(Label* miss, } bind(&done); - // Check that the value is a normal propety. + // Check that the value is a field property. const int kDetailsOffset = SeededNumberDictionary::kElementsStartOffset + 2 * kPointerSize; - DCHECK_EQ(NORMAL, 0); + DCHECK_EQ(FIELD, 0); test(FieldOperand(elements, r2, times_pointer_size, kDetailsOffset), Immediate(PropertyDetails::TypeField::kMask << kSmiTagSize)); j(not_zero, miss); diff --git a/src/ic/handler-compiler.cc b/src/ic/handler-compiler.cc index 7f440c0..2213573 100644 --- a/src/ic/handler-compiler.cc +++ b/src/ic/handler-compiler.cc @@ -241,7 +241,8 @@ Handle NamedLoadHandlerCompiler::CompileLoadInterceptor( case LookupIterator::NOT_FOUND: break; case LookupIterator::DATA: - inline_followup = it->property_details().type() == FIELD; + inline_followup = + it->property_details().type() == FIELD && !it->is_dictionary_holder(); break; case LookupIterator::ACCESSOR: { Handle accessors = it->GetAccessors(); diff --git a/src/lookup-inl.h b/src/lookup-inl.h index d4777a0..1adf227 100644 --- a/src/lookup-inl.h +++ b/src/lookup-inl.h @@ -66,7 +66,6 @@ LookupIterator::State LookupIterator::LookupInHolder(Map* map, switch (property_details_.type()) { case v8::internal::CONSTANT: case v8::internal::FIELD: - case v8::internal::NORMAL: return DATA; case v8::internal::CALLBACKS: return ACCESSOR; diff --git a/src/lookup.cc b/src/lookup.cc index 84eb6d4..55e9d68 100644 --- a/src/lookup.cc +++ b/src/lookup.cc @@ -102,7 +102,7 @@ void LookupIterator::ReconfigureDataProperty(Handle value, DCHECK(HolderIsReceiverOrHiddenPrototype()); Handle holder = GetHolder(); if (holder_map_->is_dictionary_map()) { - PropertyDetails details(attributes, NORMAL, 0); + PropertyDetails details(attributes, FIELD, 0); JSObject::SetNormalizedProperty(holder, name(), value, details); } else { holder_map_ = Map::ReconfigureDataProperty(holder_map_, descriptor_number(), diff --git a/src/lookup.h b/src/lookup.h index 52231e5..a78bb5d 100644 --- a/src/lookup.h +++ b/src/lookup.h @@ -46,7 +46,7 @@ class LookupIterator FINAL BASE_EMBEDDED { Configuration configuration = PROTOTYPE_CHAIN) : configuration_(ComputeConfiguration(configuration, name)), state_(NOT_FOUND), - property_details_(NONE, NORMAL, Representation::None()), + property_details_(NONE, FIELD, 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, NORMAL, Representation::None()), + property_details_(NONE, FIELD, 0), isolate_(name->GetIsolate()), name_(name), holder_map_(holder->map(), isolate_), diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc index deb3ff6..5cc505d 100644 --- a/src/mips/macro-assembler-mips.cc +++ b/src/mips/macro-assembler-mips.cc @@ -591,11 +591,12 @@ void MacroAssembler::LoadFromNumberDictionary(Label* miss, } bind(&done); - // Check that the value is a normal property. + // Check that the value is a field property. // reg2: elements + (index * kPointerSize). const int kDetailsOffset = SeededNumberDictionary::kElementsStartOffset + 2 * kPointerSize; lw(reg1, FieldMemOperand(reg2, kDetailsOffset)); + DCHECK_EQ(FIELD, 0); And(at, reg1, Operand(Smi::FromInt(PropertyDetails::TypeField::kMask))); Branch(miss, ne, at, Operand(zero_reg)); diff --git a/src/mips64/macro-assembler-mips64.cc b/src/mips64/macro-assembler-mips64.cc index 466906a..45b190b 100644 --- a/src/mips64/macro-assembler-mips64.cc +++ b/src/mips64/macro-assembler-mips64.cc @@ -595,11 +595,12 @@ void MacroAssembler::LoadFromNumberDictionary(Label* miss, } bind(&done); - // Check that the value is a normal property. + // Check that the value is a field property. // reg2: elements + (index * kPointerSize). const int kDetailsOffset = SeededNumberDictionary::kElementsStartOffset + 2 * kPointerSize; ld(reg1, FieldMemOperand(reg2, kDetailsOffset)); + DCHECK_EQ(FIELD, 0); And(at, reg1, Operand(Smi::FromInt(PropertyDetails::TypeField::kMask))); Branch(miss, ne, at, Operand(zero_reg)); diff --git a/src/mirror-debugger.js b/src/mirror-debugger.js index 7306c1b..c7f2f2c 100644 --- a/src/mirror-debugger.js +++ b/src/mirror-debugger.js @@ -179,10 +179,9 @@ PropertyKind.Indexed = 2; // A copy of the PropertyType enum from property-details.h var PropertyType = {}; -PropertyType.Normal = 0; -PropertyType.Field = 1; -PropertyType.Constant = 2; -PropertyType.Callbacks = 3; +PropertyType.Field = 0; +PropertyType.Constant = 1; +PropertyType.Callbacks = 2; // Different attributes for a property. @@ -2902,10 +2901,9 @@ function serializeLocationFields (location, content) { * "ref":} * * If the attribute for the property is PropertyAttribute.None it is not added. - * If the propertyType for the property is PropertyType.Normal it is not added. * Here are a couple of examples. * - * {"name":"hello","ref":1} + * {"name":"hello","propertyType":0,"ref":1} * {"name":"length","attributes":7,"propertyType":3,"ref":2} * * @param {PropertyMirror} propertyMirror The property to serialize. @@ -2922,9 +2920,7 @@ JSONProtocolSerializer.prototype.serializeProperty_ = function(propertyMirror) { if (propertyMirror.attributes() != PropertyAttribute.None) { result.attributes = propertyMirror.attributes(); } - if (propertyMirror.propertyType() != PropertyType.Normal) { - result.propertyType = propertyMirror.propertyType(); - } + result.propertyType = propertyMirror.propertyType(); result.ref = propertyValue.handle(); } return result; diff --git a/src/objects-printer.cc b/src/objects-printer.cc index dff4dd2..db3d041 100644 --- a/src/objects-printer.cc +++ b/src/objects-printer.cc @@ -247,9 +247,6 @@ void JSObject::PrintProperties(std::ostream& os) { // NOLINT case CALLBACKS: os << Brief(descs->GetCallbacksObject(i)) << " (callback)\n"; break; - case NORMAL: // only in slow mode - UNREACHABLE(); - break; } } } else { @@ -1073,6 +1070,7 @@ void DescriptorArray::Print() { void DescriptorArray::PrintDescriptors(std::ostream& os) { // NOLINT + HandleScope scope(GetIsolate()); os << "Descriptor array " << number_of_descriptors() << "\n"; for (int i = 0; i < number_of_descriptors(); i++) { Descriptor desc; @@ -1157,10 +1155,6 @@ void TransitionArray::PrintTransitions(std::ostream& os, case CALLBACKS: os << " (transition to callback " << Brief(GetTargetValue(i)) << ")"; break; - // Values below are never in the target descriptor array. - case NORMAL: - UNREACHABLE(); - break; } os << ", attrs: " << details.attributes(); } diff --git a/src/objects.cc b/src/objects.cc index ec31b72..867deb9 100644 --- a/src/objects.cc +++ b/src/objects.cc @@ -1836,7 +1836,7 @@ void JSObject::AddSlowProperty(Handle object, // Assign an enumeration index to the property and update // SetNextEnumerationIndex. int index = dict->NextEnumerationIndex(); - PropertyDetails details = PropertyDetails(attributes, NORMAL, index); + PropertyDetails details(attributes, FIELD, index); dict->SetNextEnumerationIndex(index + 1); dict->SetEntry(entry, name, cell, details); return; @@ -1845,7 +1845,7 @@ void JSObject::AddSlowProperty(Handle object, PropertyCell::SetValueInferType(cell, value); value = cell; } - PropertyDetails details = PropertyDetails(attributes, NORMAL, 0); + PropertyDetails details(attributes, FIELD, 0); Handle result = NameDictionary::Add(dict, name, value, details); if (*dict != *result) object->set_properties(*result); @@ -2855,9 +2855,6 @@ MaybeHandle Map::TryUpdateInternal(Handle old_map) { return MaybeHandle(); } break; - - case NORMAL: - UNREACHABLE(); } } if (new_map->NumberOfOwnDescriptors() != old_nof) return MaybeHandle(); @@ -4347,8 +4344,7 @@ void JSObject::MigrateFastToSlow(Handle object, case CONSTANT: { Handle key(descs->GetKey(i)); Handle value(descs->GetConstant(i), isolate); - PropertyDetails d = PropertyDetails( - details.attributes(), NORMAL, i + 1); + PropertyDetails d(details.attributes(), FIELD, i + 1); dictionary = NameDictionary::Add(dictionary, key, value, d); break; } @@ -4367,22 +4363,17 @@ void JSObject::MigrateFastToSlow(Handle object, value = isolate->factory()->NewHeapNumber(old->value()); } } - PropertyDetails d = - PropertyDetails(details.attributes(), NORMAL, i + 1); + PropertyDetails d(details.attributes(), FIELD, i + 1); dictionary = NameDictionary::Add(dictionary, key, value, d); break; } case CALLBACKS: { Handle key(descs->GetKey(i)); Handle value(descs->GetCallbacksObject(i), isolate); - PropertyDetails d = PropertyDetails( - details.attributes(), CALLBACKS, i + 1); + PropertyDetails d(details.attributes(), CALLBACKS, i + 1); dictionary = NameDictionary::Add(dictionary, key, value, d); break; } - case NORMAL: - UNREACHABLE(); - break; } } @@ -4455,8 +4446,7 @@ void JSObject::MigrateSlowToFast(Handle object, Object* value = dictionary->ValueAt(index); PropertyType type = dictionary->DetailsAt(index).type(); - DCHECK(type != FIELD); - if (type == NORMAL && !value->IsJSFunction()) { + if (type == FIELD && !value->IsJSFunction()) { number_of_fields += 1; } } @@ -4527,7 +4517,7 @@ void JSObject::MigrateSlowToFast(Handle object, if (value->IsJSFunction()) { ConstantDescriptor d(key, handle(value, isolate), details.attributes()); descriptors->Set(enumeration_index - 1, &d); - } else if (type == NORMAL) { + } else if (type == FIELD) { if (current_offset < inobject_props) { object->InObjectPropertyAtPut(current_offset, value, UPDATE_WRITE_BARRIER); @@ -4603,7 +4593,7 @@ static Handle CopyFastElementsToDictionary( value = handle(Handle::cast(array)->get(i), isolate); } if (!value->IsTheHole()) { - PropertyDetails details = PropertyDetails(NONE, NORMAL, 0); + PropertyDetails details(NONE, FIELD, 0); dictionary = SeededNumberDictionary::AddNumberEntry(dictionary, i, value, details); } @@ -7005,10 +6995,6 @@ bool DescriptorArray::CanHoldValue(int descriptor, Object* value) { case CALLBACKS: return false; - - case NORMAL: - UNREACHABLE(); - break; } UNREACHABLE(); @@ -12408,8 +12394,8 @@ MaybeHandle 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, NORMAL, details.dictionary_index()); + details = + PropertyDetails(attributes, FIELD, details.dictionary_index()); dictionary->DetailsAtPut(entry, details); } else if (details.IsReadOnly() && !element->IsTheHole()) { if (strict_mode == SLOPPY) { @@ -12460,7 +12446,7 @@ MaybeHandle JSObject::SetDictionaryElement( } } - PropertyDetails details = PropertyDetails(attributes, NORMAL, 0); + PropertyDetails details(attributes, FIELD, 0); Handle new_dictionary = SeededNumberDictionary::AddNumberEntry(dictionary, index, value, details); @@ -14592,7 +14578,7 @@ Handle JSObject::PrepareSlowElementsForSort( } uint32_t result = pos; - PropertyDetails no_details = PropertyDetails(NONE, NORMAL, 0); + PropertyDetails no_details(NONE, FIELD, 0); while (undefs > 0) { if (pos > static_cast(Smi::kMaxValue)) { // Adding an entry with the key beyond smi-range requires @@ -14978,7 +14964,7 @@ Handle JSGlobalObject::EnsurePropertyCell( Isolate* isolate = global->GetIsolate(); Handle cell = isolate->factory()->NewPropertyCell( isolate->factory()->the_hole_value()); - PropertyDetails details(NONE, NORMAL, 0); + PropertyDetails details(NONE, FIELD, 0); details = details.AsDeleted(); Handle dictionary = NameDictionary::Add( handle(global->property_dictionary()), name, cell, details); @@ -15458,7 +15444,7 @@ Handle Dictionary::AtPut( #ifdef DEBUG USE(Shape::AsHandle(dictionary->GetIsolate(), key)); #endif - PropertyDetails details = PropertyDetails(NONE, NORMAL, 0); + PropertyDetails details(NONE, FIELD, 0); AddEntry(dictionary, key, value, details, dictionary->Hash(key)); return dictionary; @@ -15546,7 +15532,7 @@ Handle UnseededNumberDictionary::AddNumberEntry( uint32_t key, Handle value) { SLOW_DCHECK(dictionary->FindEntry(key) == kNotFound); - return Add(dictionary, key, value, PropertyDetails(NONE, NORMAL, 0)); + return Add(dictionary, key, value, PropertyDetails(NONE, FIELD, 0)); } diff --git a/src/ppc/macro-assembler-ppc.cc b/src/ppc/macro-assembler-ppc.cc index 9dc6e42..0b3d729 100644 --- a/src/ppc/macro-assembler-ppc.cc +++ b/src/ppc/macro-assembler-ppc.cc @@ -1509,12 +1509,13 @@ void MacroAssembler::LoadFromNumberDictionary(Label* miss, Register elements, } bind(&done); - // Check that the value is a normal property. + // Check that the value is a field property. // t2: elements + (index * kPointerSize) const int kDetailsOffset = SeededNumberDictionary::kElementsStartOffset + 2 * kPointerSize; LoadP(t1, FieldMemOperand(t2, kDetailsOffset)); LoadSmiLiteral(ip, Smi::FromInt(PropertyDetails::TypeField::kMask)); + DCHECK_EQ(FIELD, 0); and_(r0, t1, ip, SetRC); bne(miss, cr0); diff --git a/src/property-details.h b/src/property-details.h index 39f633a..4a3152d 100644 --- a/src/property-details.h +++ b/src/property-details.h @@ -44,14 +44,7 @@ class TypeInfo; // Order of properties is significant. // Must fit in the BitField PropertyDetails::TypeField. // A copy of this is in mirror-debugger.js. -enum PropertyType { - // Only in slow mode. - NORMAL = 0, - // Only in fast mode. - FIELD = 1, - CONSTANT = 2, - CALLBACKS = 3 -}; +enum PropertyType { FIELD = 0, CONSTANT = 1, CALLBACKS = 2 }; class Representation { @@ -240,13 +233,10 @@ class PropertyDetails BASE_EMBEDDED { } Representation representation() const { - DCHECK(type() != NORMAL); return DecodeRepresentation(RepresentationField::decode(value_)); } - int field_index() const { - return FieldIndexField::decode(value_); - } + int field_index() const { return FieldIndexField::decode(value_); } inline int field_width_in_words() const; @@ -259,7 +249,7 @@ class PropertyDetails BASE_EMBEDDED { bool IsReadOnly() const { return (attributes() & READ_ONLY) != 0; } bool IsConfigurable() const { return (attributes() & DONT_DELETE) == 0; } bool IsDontEnum() const { return (attributes() & DONT_ENUM) != 0; } - bool IsDeleted() const { return DeletedField::decode(value_) != 0;} + bool IsDeleted() const { return DeletedField::decode(value_) != 0; } // Bit fields in value_ (type, shift, size). Must be public so the // constants can be embedded in generated code. @@ -277,11 +267,18 @@ class PropertyDetails BASE_EMBEDDED { class FieldIndexField : public BitField {}; // NOLINT - // All bits for fast objects must fix in a smi. - STATIC_ASSERT(9 + kDescriptorIndexBitCount + kDescriptorIndexBitCount <= 31); + + // All bits for both fast and slow objects must fit in a smi. + STATIC_ASSERT(DictionaryStorageField::kNext <= 31); + STATIC_ASSERT(FieldIndexField::kNext <= 31); static const int kInitialIndex = 1; +#ifdef OBJECT_PRINT + // For our gdb macros, we should perhaps change these in the future. + void Print(bool dictionary_mode); +#endif + private: PropertyDetails(int value, int pointer) { value_ = DescriptorPointer::update(value, pointer); diff --git a/src/property.cc b/src/property.cc index e9e4b64..fcc718d 100644 --- a/src/property.cc +++ b/src/property.cc @@ -42,13 +42,38 @@ std::ostream& operator<<(std::ostream& os, } +struct FastPropertyDetails { + explicit FastPropertyDetails(const PropertyDetails& v) : details(v) {} + const PropertyDetails details; +}; + + +// Outputs PropertyDetails as a dictionary details. std::ostream& operator<<(std::ostream& os, const PropertyDetails& details) { os << "("; switch (details.type()) { - case NORMAL: - os << "normal: dictionary_index: " << details.dictionary_index(); + case FIELD: + os << "normal: "; break; case CONSTANT: + os << "constant: "; + break; + case CALLBACKS: + UNREACHABLE(); + break; + } + return os << " dictionary_index: " << details.dictionary_index() + << ", attrs: " << details.attributes() << ")"; +} + + +// Outputs PropertyDetails as a descriptor array details. +std::ostream& operator<<(std::ostream& os, + const FastPropertyDetails& details_fast) { + const PropertyDetails& details = details_fast.details; + os << "("; + switch (details.type()) { + case CONSTANT: os << "constant: p: " << details.pointer(); break; case FIELD: @@ -60,14 +85,27 @@ std::ostream& operator<<(std::ostream& os, const PropertyDetails& details) { os << "callbacks: p: " << details.pointer(); break; } - os << ", attrs: " << details.attributes() << ")"; - return os; + return os << ", attrs: " << details.attributes() << ")"; +} + + +#ifdef OBJECT_PRINT +void PropertyDetails::Print(bool dictionary_mode) { + OFStream os(stdout); + if (dictionary_mode) { + os << *this; + } else { + os << FastPropertyDetails(*this); + } + os << "\n" << std::flush; } +#endif std::ostream& operator<<(std::ostream& os, const Descriptor& d) { return os << "Descriptor " << Brief(*d.GetKey()) << " @ " - << Brief(*d.GetValue()) << " " << d.GetDetails(); + << Brief(*d.GetValue()) << " " + << FastPropertyDetails(d.GetDetails()); } } } // namespace v8::internal diff --git a/src/property.h b/src/property.h index 48b7501..a9d8b09 100644 --- a/src/property.h +++ b/src/property.h @@ -119,7 +119,7 @@ class LookupResult FINAL BASE_EMBEDDED { lookup_type_(NOT_FOUND), holder_(NULL), transition_(NULL), - details_(NONE, NORMAL, Representation::None()) { + details_(NONE, FIELD, Representation::None()) { isolate->set_top_lookup_result(this); } @@ -148,7 +148,7 @@ class LookupResult FINAL BASE_EMBEDDED { void NotFound() { lookup_type_ = NOT_FOUND; - details_ = PropertyDetails(NONE, NORMAL, Representation::None()); + details_ = PropertyDetails(NONE, FIELD, 0); holder_ = NULL; transition_ = NULL; } @@ -160,7 +160,6 @@ class LookupResult FINAL BASE_EMBEDDED { // Property callbacks does not include transitions to callbacks. bool IsPropertyCallbacks() const { - DCHECK(!(details_.type() == CALLBACKS && !IsFound())); return !IsTransition() && details_.type() == CALLBACKS; } @@ -170,12 +169,10 @@ class LookupResult FINAL BASE_EMBEDDED { } bool IsField() const { - DCHECK(!(details_.type() == FIELD && !IsFound())); return lookup_type_ == DESCRIPTOR_TYPE && details_.type() == FIELD; } bool IsConstant() const { - DCHECK(!(details_.type() == CONSTANT && !IsFound())); return lookup_type_ == DESCRIPTOR_TYPE && details_.type() == CONSTANT; } diff --git a/src/runtime/runtime-debug.cc b/src/runtime/runtime-debug.cc index 68d2f9e..4a14a0f 100644 --- a/src/runtime/runtime-debug.cc +++ b/src/runtime/runtime-debug.cc @@ -136,8 +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, NORMAL, Representation::None()).AsSmi()); + details->set(1, PropertyDetails(NONE, FIELD, 0).AsSmi()); return *isolate->factory()->NewJSArrayWithElements(details); } @@ -159,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, NORMAL, 0) + ? PropertyDetails(NONE, FIELD, 0) : it.property_details(); details->set(1, d.AsSmi()); details->set( @@ -214,7 +213,7 @@ RUNTIME_FUNCTION(Runtime_DebugPropertyIndexFromDetails) { SealHandleScope shs(isolate); DCHECK(args.length() == 1); CONVERT_PROPERTY_DETAILS_CHECKED(details, 0); - // TODO(verwaest): Depends on the type of details. + // TODO(verwaest): Works only for dictionary mode holders. return Smi::FromInt(details.dictionary_index()); } diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc index 3b302d1..de4e812 100644 --- a/src/runtime/runtime-object.cc +++ b/src/runtime/runtime-object.cc @@ -617,7 +617,7 @@ RUNTIME_FUNCTION(Runtime_KeyedGetProperty) { NameDictionary* dictionary = receiver->property_dictionary(); int entry = dictionary->FindEntry(key); if ((entry != NameDictionary::kNotFound) && - (dictionary->DetailsAt(entry).type() == NORMAL)) { + (dictionary->DetailsAt(entry).type() == FIELD)) { Object* value = dictionary->ValueAt(entry); if (!receiver->IsGlobalObject()) return value; value = PropertyCell::cast(value)->value(); diff --git a/src/runtime/runtime.cc b/src/runtime/runtime.cc index cd6f36c..459ca50 100644 --- a/src/runtime/runtime.cc +++ b/src/runtime/runtime.cc @@ -80,8 +80,7 @@ void Runtime::InitializeIntrinsicFunctionNames(Isolate* isolate, if (name == NULL) continue; Handle new_dict = NameDictionary::Add( dict, isolate->factory()->InternalizeUtf8String(name), - Handle(Smi::FromInt(i), isolate), - PropertyDetails(NONE, NORMAL, Representation::None())); + Handle(Smi::FromInt(i), isolate), PropertyDetails(NONE, FIELD, 0)); // The dictionary does not need to grow. CHECK(new_dict.is_identical_to(dict)); } diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc index 21b0f9b..d8878a8 100644 --- a/src/x64/macro-assembler-x64.cc +++ b/src/x64/macro-assembler-x64.cc @@ -4367,10 +4367,10 @@ void MacroAssembler::LoadFromNumberDictionary(Label* miss, } bind(&done); - // Check that the value is a normal propety. + // Check that the value is a field property. const int kDetailsOffset = SeededNumberDictionary::kElementsStartOffset + 2 * kPointerSize; - DCHECK_EQ(NORMAL, 0); + DCHECK_EQ(FIELD, 0); Test(FieldOperand(elements, r2, times_pointer_size, kDetailsOffset), Smi::FromInt(PropertyDetails::TypeField::kMask)); j(not_zero, miss); diff --git a/src/x87/macro-assembler-x87.cc b/src/x87/macro-assembler-x87.cc index 3f522fc..d6d2453 100644 --- a/src/x87/macro-assembler-x87.cc +++ b/src/x87/macro-assembler-x87.cc @@ -1321,10 +1321,10 @@ void MacroAssembler::LoadFromNumberDictionary(Label* miss, } bind(&done); - // Check that the value is a normal propety. + // Check that the value is a field property. const int kDetailsOffset = SeededNumberDictionary::kElementsStartOffset + 2 * kPointerSize; - DCHECK_EQ(NORMAL, 0); + DCHECK_EQ(FIELD, 0); test(FieldOperand(elements, r2, times_pointer_size, kDetailsOffset), Immediate(PropertyDetails::TypeField::kMask << kSmiTagSize)); j(not_zero, miss); diff --git a/test/mjsunit/mirror-object.js b/test/mjsunit/mirror-object.js index 7020338..91d0f82 100644 --- a/test/mjsunit/mirror-object.js +++ b/test/mjsunit/mirror-object.js @@ -125,12 +125,7 @@ function testObjectMirror(obj, cls_name, ctor_name, hasSpecialProperties) { // Check that serialized name is correct. assertEquals(properties[i].name(), fromJSON.properties[i].name, 'Unexpected serialized name'); - // If property type is normal property type is not serialized. - if (properties[i].propertyType() != debug.PropertyType.Normal) { - assertEquals(properties[i].propertyType(), fromJSON.properties[i].propertyType, 'Unexpected serialized property type'); - } else { - assertTrue(typeof(fromJSON.properties[i].propertyType) === 'undefined', 'Unexpected serialized property type'); - } + assertEquals(properties[i].propertyType(), fromJSON.properties[i].propertyType, 'Unexpected serialized property type'); // If there are no attributes attributes are not serialized. if (properties[i].attributes() != debug.PropertyAttribute.None) { -- 2.7.4