diff options
| author | Ben Murdoch <benm@google.com> | 2012-04-12 10:51:47 +0100 |
|---|---|---|
| committer | Ben Murdoch <benm@google.com> | 2012-04-16 16:41:38 +0100 |
| commit | 3ef787dbeca8a5fb1086949cda830dccee07bfbd (patch) | |
| tree | 0a22edd97aa148abffdd405c585b22213fccbc82 /src/objects-debug.cc | |
| parent | 85b71799222b55eb5dd74ea26efe0c64ab655c8c (diff) | |
| download | android_external_v8-3ef787dbeca8a5fb1086949cda830dccee07bfbd.tar.gz android_external_v8-3ef787dbeca8a5fb1086949cda830dccee07bfbd.tar.bz2 android_external_v8-3ef787dbeca8a5fb1086949cda830dccee07bfbd.zip | |
Merge V8 at 3.9.24.13
Bug: 5688872
Change-Id: Id0aa8d23375030494d3189c31774059c0f5398fc
Diffstat (limited to 'src/objects-debug.cc')
| -rw-r--r-- | src/objects-debug.cc | 125 |
1 files changed, 118 insertions, 7 deletions
diff --git a/src/objects-debug.cc b/src/objects-debug.cc index e9ca6c09..8eefb23d 100644 --- a/src/objects-debug.cc +++ b/src/objects-debug.cc @@ -1,4 +1,4 @@ -// Copyright 2011 the V8 project authors. All rights reserved. +// Copyright 2012 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: @@ -94,6 +94,9 @@ void HeapObject::HeapObjectVerify() { case BYTE_ARRAY_TYPE: ByteArray::cast(this)->ByteArrayVerify(); break; + case FREE_SPACE_TYPE: + FreeSpace::cast(this)->FreeSpaceVerify(); + break; case EXTERNAL_PIXEL_ARRAY_TYPE: ExternalPixelArray::cast(this)->ExternalPixelArrayVerify(); break; @@ -135,6 +138,9 @@ void HeapObject::HeapObjectVerify() { case JS_VALUE_TYPE: JSValue::cast(this)->JSValueVerify(); break; + case JS_DATE_TYPE: + JSDate::cast(this)->JSDateVerify(); + break; case JS_FUNCTION_TYPE: JSFunction::cast(this)->JSFunctionVerify(); break; @@ -153,6 +159,12 @@ void HeapObject::HeapObjectVerify() { case JS_ARRAY_TYPE: JSArray::cast(this)->JSArrayVerify(); break; + case JS_SET_TYPE: + JSSet::cast(this)->JSSetVerify(); + break; + case JS_MAP_TYPE: + JSMap::cast(this)->JSMapVerify(); + break; case JS_WEAK_MAP_TYPE: JSWeakMap::cast(this)->JSWeakMapVerify(); break; @@ -207,6 +219,11 @@ void ByteArray::ByteArrayVerify() { } +void FreeSpace::FreeSpaceVerify() { + ASSERT(IsFreeSpace()); +} + + void ExternalPixelArray::ExternalPixelArrayVerify() { ASSERT(IsExternalPixelArray()); } @@ -255,12 +272,20 @@ void ExternalDoubleArray::ExternalDoubleArrayVerify() { void JSObject::JSObjectVerify() { VerifyHeapPointer(properties()); VerifyHeapPointer(elements()); + + if (GetElementsKind() == NON_STRICT_ARGUMENTS_ELEMENTS) { + ASSERT(this->elements()->IsFixedArray()); + ASSERT(this->elements()->length() >= 2); + } + if (HasFastProperties()) { CHECK_EQ(map()->unused_property_fields(), (map()->inobject_properties() + properties()->length() - map()->NextFreePropertyIndex())); } - ASSERT_EQ(map()->has_fast_elements(), + ASSERT_EQ((map()->has_fast_elements() || + map()->has_fast_smi_only_elements() || + (elements() == GetHeap()->empty_fixed_array())), (elements()->map() == GetHeap()->fixed_array_map() || elements()->map() == GetHeap()->fixed_cow_array_map())); ASSERT(map()->has_fast_elements() == HasFastElements()); @@ -304,6 +329,18 @@ void PolymorphicCodeCache::PolymorphicCodeCacheVerify() { } +void TypeFeedbackInfo::TypeFeedbackInfoVerify() { + VerifyObjectField(kIcTotalCountOffset); + VerifyObjectField(kIcWithTypeinfoCountOffset); + VerifyHeapPointer(type_feedback_cells()); +} + + +void AliasedArgumentsEntry::AliasedArgumentsEntryVerify() { + VerifySmiField(kAliasedContextSlot); +} + + void FixedArray::FixedArrayVerify() { for (int i = 0; i < length(); i++) { Object* e = get(i); @@ -322,7 +359,8 @@ void FixedDoubleArray::FixedDoubleArrayVerify() { double value = get_scalar(i); ASSERT(!isnan(value) || (BitCast<uint64_t>(value) == - BitCast<uint64_t>(canonical_not_the_hole_nan_as_double()))); + BitCast<uint64_t>(canonical_not_the_hole_nan_as_double())) || + ((BitCast<uint64_t>(value) & Double::kSignMask) != 0)); } } } @@ -336,6 +374,53 @@ void JSValue::JSValueVerify() { } +void JSDate::JSDateVerify() { + if (value()->IsHeapObject()) { + VerifyHeapPointer(value()); + } + CHECK(value()->IsUndefined() || value()->IsSmi() || value()->IsHeapNumber()); + CHECK(year()->IsUndefined() || year()->IsSmi() || year()->IsNaN()); + CHECK(month()->IsUndefined() || month()->IsSmi() || month()->IsNaN()); + CHECK(day()->IsUndefined() || day()->IsSmi() || day()->IsNaN()); + CHECK(weekday()->IsUndefined() || weekday()->IsSmi() || weekday()->IsNaN()); + CHECK(hour()->IsUndefined() || hour()->IsSmi() || hour()->IsNaN()); + CHECK(min()->IsUndefined() || min()->IsSmi() || min()->IsNaN()); + CHECK(sec()->IsUndefined() || sec()->IsSmi() || sec()->IsNaN()); + CHECK(cache_stamp()->IsUndefined() || + cache_stamp()->IsSmi() || + cache_stamp()->IsNaN()); + + if (month()->IsSmi()) { + int month = Smi::cast(this->month())->value(); + CHECK(0 <= month && month <= 11); + } + if (day()->IsSmi()) { + int day = Smi::cast(this->day())->value(); + CHECK(1 <= day && day <= 31); + } + if (hour()->IsSmi()) { + int hour = Smi::cast(this->hour())->value(); + CHECK(0 <= hour && hour <= 23); + } + if (min()->IsSmi()) { + int min = Smi::cast(this->min())->value(); + CHECK(0 <= min && min <= 59); + } + if (sec()->IsSmi()) { + int sec = Smi::cast(this->sec())->value(); + CHECK(0 <= sec && sec <= 59); + } + if (weekday()->IsSmi()) { + int weekday = Smi::cast(this->weekday())->value(); + CHECK(0 <= weekday && weekday <= 6); + } + if (cache_stamp()->IsSmi()) { + CHECK(Smi::cast(cache_stamp())->value() <= + Smi::cast(Isolate::Current()->date_cache()->stamp())->value()); + } +} + + void JSMessageObject::JSMessageObjectVerify() { CHECK(IsJSMessageObject()); CHECK(type()->IsString()); @@ -367,7 +452,7 @@ void ConsString::ConsStringVerify() { CHECK(this->first()->IsString()); CHECK(this->second() == GetHeap()->empty_string() || this->second()->IsString()); - CHECK(this->length() >= String::kMinNonFlatLength); + CHECK(this->length() >= ConsString::kMinLength); if (this->IsFlat()) { // A flat cons can only be created by String::SlowTryFlatten. // Afterwards, the first part may be externalized. @@ -387,6 +472,7 @@ void JSFunction::JSFunctionVerify() { CHECK(IsJSFunction()); VerifyObjectField(kPrototypeOrInitialMapOffset); VerifyObjectField(kNextFunctionLinkOffset); + CHECK(code()->IsCode()); CHECK(next_function_link()->IsUndefined() || next_function_link()->IsJSFunction()); } @@ -463,6 +549,7 @@ void JSGlobalPropertyCell::JSGlobalPropertyCellVerify() { void Code::CodeVerify() { CHECK(IsAligned(reinterpret_cast<intptr_t>(instruction_start()), kCodeAlignment)); + relocation_info()->Verify(); Address last_gc_pc = NULL; for (RelocIterator it(this); !it.done(); it.next()) { it.rinfo()->Verify(); @@ -484,11 +571,27 @@ void JSArray::JSArrayVerify() { } +void JSSet::JSSetVerify() { + CHECK(IsJSSet()); + JSObjectVerify(); + VerifyHeapPointer(table()); + ASSERT(table()->IsHashTable() || table()->IsUndefined()); +} + + +void JSMap::JSMapVerify() { + CHECK(IsJSMap()); + JSObjectVerify(); + VerifyHeapPointer(table()); + ASSERT(table()->IsHashTable() || table()->IsUndefined()); +} + + void JSWeakMap::JSWeakMapVerify() { CHECK(IsJSWeakMap()); JSObjectVerify(); VerifyHeapPointer(table()); - ASSERT(table()->IsHashTable()); + ASSERT(table()->IsHashTable() || table()->IsUndefined()); } @@ -535,13 +638,14 @@ void JSRegExp::JSRegExpVerify() { void JSProxy::JSProxyVerify() { - ASSERT(IsJSProxy()); + CHECK(IsJSProxy()); VerifyPointer(handler()); + ASSERT(hash()->IsSmi() || hash()->IsUndefined()); } void JSFunctionProxy::JSFunctionProxyVerify() { - ASSERT(IsJSFunctionProxy()); + CHECK(IsJSFunctionProxy()); JSProxyVerify(); VerifyPointer(call_trap()); VerifyPointer(construct_trap()); @@ -563,6 +667,13 @@ void AccessorInfo::AccessorInfoVerify() { } +void AccessorPair::AccessorPairVerify() { + CHECK(IsAccessorPair()); + VerifyPointer(getter()); + VerifyPointer(setter()); +} + + void AccessCheckInfo::AccessCheckInfoVerify() { CHECK(IsAccessCheckInfo()); VerifyPointer(named_callback()); |
