diff options
Diffstat (limited to 'deps/v8/src/objects-debug.cc')
-rw-r--r-- | deps/v8/src/objects-debug.cc | 94 |
1 files changed, 76 insertions, 18 deletions
diff --git a/deps/v8/src/objects-debug.cc b/deps/v8/src/objects-debug.cc index be96592962..82a71a5ffa 100644 --- a/deps/v8/src/objects-debug.cc +++ b/deps/v8/src/objects-debug.cc @@ -30,6 +30,7 @@ #include "disassembler.h" #include "disasm.h" #include "jsregexp.h" +#include "macro-assembler.h" #include "objects-visiting.h" namespace v8 { @@ -79,6 +80,9 @@ void HeapObject::HeapObjectVerify() { } switch (instance_type) { + case SYMBOL_TYPE: + Symbol::cast(this)->SymbolVerify(); + break; case MAP_TYPE: Map::cast(this)->MapVerify(); break; @@ -212,6 +216,13 @@ void HeapObject::VerifyHeapPointer(Object* p) { } +void Symbol::SymbolVerify() { + CHECK(IsSymbol()); + CHECK(HasHashCode()); + CHECK_GT(Hash(), 0); +} + + void HeapNumber::HeapNumberVerify() { CHECK(IsHeapNumber()); } @@ -311,6 +322,9 @@ void Map::MapVerify() { SLOW_ASSERT(transitions()->IsSortedNoDuplicates()); SLOW_ASSERT(transitions()->IsConsistentWithBackPointers(this)); } + ASSERT(!is_observed() || instance_type() < FIRST_JS_OBJECT_TYPE || + instance_type() > LAST_JS_OBJECT_TYPE || + has_slow_elements_kind() || has_external_array_elements()); } @@ -325,6 +339,15 @@ void Map::SharedMapVerify() { } +void Map::VerifyOmittedPrototypeChecks() { + if (!FLAG_omit_prototype_checks_for_leaf_maps) return; + if (HasTransitionArray() || is_dictionary_map()) { + CHECK_EQ(0, dependent_code()->number_of_entries( + DependentCode::kPrototypeCheckGroup)); + } +} + + void CodeCache::CodeCacheVerify() { VerifyHeapPointer(default_cache()); VerifyHeapPointer(normal_type_cache()); @@ -456,24 +479,17 @@ void JSMessageObject::JSMessageObjectVerify() { void String::StringVerify() { CHECK(IsString()); CHECK(length() >= 0 && length() <= Smi::kMaxValue); - if (IsSymbol()) { + if (IsInternalizedString()) { CHECK(!HEAP->InNewSpace(this)); } if (IsConsString()) { ConsString::cast(this)->ConsStringVerify(); } else if (IsSlicedString()) { SlicedString::cast(this)->SlicedStringVerify(); - } else if (IsSeqAsciiString()) { - SeqAsciiString::cast(this)->SeqAsciiStringVerify(); } } -void SeqAsciiString::SeqAsciiStringVerify() { - CHECK(String::IsAscii(GetChars(), length())); -} - - void ConsString::ConsStringVerify() { CHECK(this->first()->IsString()); CHECK(this->second() == GetHeap()->empty_string() || @@ -499,7 +515,8 @@ void JSFunction::JSFunctionVerify() { VerifyObjectField(kPrototypeOrInitialMapOffset); VerifyObjectField(kNextFunctionLinkOffset); CHECK(code()->IsCode()); - CHECK(next_function_link()->IsUndefined() || + CHECK(next_function_link() == NULL || + next_function_link()->IsUndefined() || next_function_link()->IsJSFunction()); } @@ -589,6 +606,22 @@ void Code::CodeVerify() { } +void Code::VerifyEmbeddedMapsDependency() { + int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); + for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { + RelocInfo::Mode mode = it.rinfo()->rmode(); + if (mode == RelocInfo::EMBEDDED_OBJECT && + it.rinfo()->target_object()->IsMap()) { + Map* map = Map::cast(it.rinfo()->target_object()); + if (map->CanTransition()) { + CHECK(map->dependent_code()->Contains( + DependentCode::kWeaklyEmbeddedGroup, this)); + } + } + } +} + + void JSArray::JSArrayVerify() { JSObjectVerify(); CHECK(length()->IsNumber() || length()->IsUndefined()); @@ -685,16 +718,34 @@ void Foreign::ForeignVerify() { void AccessorInfo::AccessorInfoVerify() { - CHECK(IsAccessorInfo()); - VerifyPointer(getter()); - VerifyPointer(setter()); VerifyPointer(name()); - VerifyPointer(data()); VerifyPointer(flag()); VerifyPointer(expected_receiver_type()); } +void ExecutableAccessorInfo::ExecutableAccessorInfoVerify() { + CHECK(IsExecutableAccessorInfo()); + AccessorInfoVerify(); + VerifyPointer(getter()); + VerifyPointer(setter()); + VerifyPointer(data()); +} + + +void DeclaredAccessorDescriptor::DeclaredAccessorDescriptorVerify() { + CHECK(IsDeclaredAccessorDescriptor()); + VerifyPointer(serialized_data()); +} + + +void DeclaredAccessorInfo::DeclaredAccessorInfoVerify() { + CHECK(IsDeclaredAccessorInfo()); + AccessorInfoVerify(); + VerifyPointer(descriptor()); +} + + void AccessorPair::AccessorPairVerify() { CHECK(IsAccessorPair()); VerifyPointer(getter()); @@ -770,6 +821,13 @@ void TypeSwitchInfo::TypeSwitchInfoVerify() { } +void AllocationSiteInfo::AllocationSiteInfoVerify() { + CHECK(IsAllocationSiteInfo()); + VerifyHeapPointer(payload()); + CHECK(payload()->IsObject()); +} + + void Script::ScriptVerify() { CHECK(IsScript()); VerifyPointer(source()); @@ -855,7 +913,7 @@ void JSObject::IncrementSpillStatistics(SpillInformation* info) { info->number_of_fast_used_fields_ += map()->NextFreePropertyIndex(); info->number_of_fast_unused_fields_ += map()->unused_property_fields(); } else { - StringDictionary* dict = property_dictionary(); + NameDictionary* dict = property_dictionary(); info->number_of_slow_used_properties_ += dict->NumberOfElements(); info->number_of_slow_unused_properties_ += dict->Capacity() - dict->NumberOfElements(); @@ -946,10 +1004,10 @@ void JSObject::SpillInformation::Print() { bool DescriptorArray::IsSortedNoDuplicates(int valid_entries) { if (valid_entries == -1) valid_entries = number_of_descriptors(); - String* current_key = NULL; + Name* current_key = NULL; uint32_t current = 0; for (int i = 0; i < number_of_descriptors(); i++) { - String* key = GetSortedKey(i); + Name* key = GetSortedKey(i); if (key == current_key) { PrintDescriptors(); return false; @@ -968,10 +1026,10 @@ bool DescriptorArray::IsSortedNoDuplicates(int valid_entries) { bool TransitionArray::IsSortedNoDuplicates(int valid_entries) { ASSERT(valid_entries == -1); - String* current_key = NULL; + Name* current_key = NULL; uint32_t current = 0; for (int i = 0; i < number_of_transitions(); i++) { - String* key = GetSortedKey(i); + Name* key = GetSortedKey(i); if (key == current_key) { PrintTransitions(); return false; |