Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/objects-debug.cc')
-rw-r--r--deps/v8/src/objects-debug.cc146
1 files changed, 97 insertions, 49 deletions
diff --git a/deps/v8/src/objects-debug.cc b/deps/v8/src/objects-debug.cc
index 8f149c8788c..3ce26f95c93 100644
--- a/deps/v8/src/objects-debug.cc
+++ b/deps/v8/src/objects-debug.cc
@@ -15,17 +15,24 @@
#include "src/objects-inl.h"
#include "src/objects/arguments-inl.h"
#include "src/objects/bigint.h"
+#ifdef V8_INTL_SUPPORT
+#include "src/objects/js-collator-inl.h"
+#endif // V8_INTL_SUPPORT
#include "src/objects/data-handler-inl.h"
#include "src/objects/debug-objects-inl.h"
#include "src/objects/hash-table-inl.h"
+#include "src/objects/js-array-inl.h"
#include "src/objects/js-collection-inl.h"
+#include "src/objects/js-generator-inl.h"
#include "src/objects/literal-objects-inl.h"
#ifdef V8_INTL_SUPPORT
+#include "src/objects/js-list-format-inl.h"
#include "src/objects/js-locale-inl.h"
#endif // V8_INTL_SUPPORT
#include "src/objects/js-regexp-inl.h"
#include "src/objects/js-regexp-string-iterator-inl.h"
#ifdef V8_INTL_SUPPORT
+#include "src/objects/js-plural-rules-inl.h"
#include "src/objects/js-relative-time-format-inl.h"
#endif // V8_INTL_SUPPORT
#include "src/objects/maybe-object.h"
@@ -196,7 +203,7 @@ void HeapObject::HeapObjectVerify(Isolate* isolate) {
FeedbackVector::cast(this)->FeedbackVectorVerify(isolate);
break;
-#define VERIFY_TYPED_ARRAY(Type, type, TYPE, ctype, size) \
+#define VERIFY_TYPED_ARRAY(Type, type, TYPE, ctype) \
case FIXED_##TYPE##_ARRAY_TYPE: \
Fixed##Type##Array::cast(this)->FixedTypedArrayVerify(isolate); \
break;
@@ -217,10 +224,12 @@ void HeapObject::HeapObjectVerify(Isolate* isolate) {
case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
case WASM_GLOBAL_TYPE:
case WASM_MEMORY_TYPE:
- case WASM_MODULE_TYPE:
case WASM_TABLE_TYPE:
JSObject::cast(this)->JSObjectVerify(isolate);
break;
+ case WASM_MODULE_TYPE:
+ WasmModuleObject::cast(this)->WasmModuleObjectVerify(isolate);
+ break;
case WASM_INSTANCE_TYPE:
WasmInstanceObject::cast(this)->WasmInstanceObjectVerify(isolate);
break;
@@ -257,9 +266,6 @@ void HeapObject::HeapObjectVerify(Isolate* isolate) {
case PROPERTY_CELL_TYPE:
PropertyCell::cast(this)->PropertyCellVerify(isolate);
break;
- case WEAK_CELL_TYPE:
- WeakCell::cast(this)->WeakCellVerify(isolate);
- break;
case JS_ARRAY_TYPE:
JSArray::cast(this)->JSArrayVerify(isolate);
break;
@@ -350,9 +356,18 @@ void HeapObject::HeapObjectVerify(Isolate* isolate) {
CodeDataContainer::cast(this)->CodeDataContainerVerify(isolate);
break;
#ifdef V8_INTL_SUPPORT
+ case JS_INTL_COLLATOR_TYPE:
+ JSCollator::cast(this)->JSCollatorVerify(isolate);
+ break;
+ case JS_INTL_LIST_FORMAT_TYPE:
+ JSListFormat::cast(this)->JSListFormatVerify(isolate);
+ break;
case JS_INTL_LOCALE_TYPE:
JSLocale::cast(this)->JSLocaleVerify(isolate);
break;
+ case JS_INTL_PLURAL_RULES_TYPE:
+ JSPluralRules::cast(this)->JSPluralRulesVerify(isolate);
+ break;
case JS_INTL_RELATIVE_TIME_FORMAT_TYPE:
JSRelativeTimeFormat::cast(this)->JSRelativeTimeFormatVerify(isolate);
break;
@@ -436,8 +451,7 @@ void FixedTypedArray<Traits>::FixedTypedArrayVerify(Isolate* isolate) {
}
}
-
-bool JSObject::ElementsAreSafeToExamine() {
+bool JSObject::ElementsAreSafeToExamine() const {
// If a GC was caused while constructing this object, the elements
// pointer may point to a one pointer filler map.
return reinterpret_cast<Map*>(elements()) !=
@@ -933,9 +947,21 @@ void JSFunction::JSFunctionVerify(Isolate* isolate) {
CHECK(feedback_cell()->IsFeedbackCell());
CHECK(code()->IsCode());
CHECK(map()->is_callable());
+ Handle<JSFunction> function(this, isolate);
+ LookupIterator it(isolate, function, isolate->factory()->prototype_string(),
+ LookupIterator::OWN_SKIP_INTERCEPTOR);
if (has_prototype_slot()) {
VerifyObjectField(isolate, kPrototypeOrInitialMapOffset);
}
+
+ if (has_prototype_property()) {
+ CHECK(it.IsFound());
+ CHECK_EQ(LookupIterator::ACCESSOR, it.state());
+ CHECK(it.GetAccessors()->IsAccessorInfo());
+ } else {
+ CHECK(!it.IsFound() || it.state() != LookupIterator::ACCESSOR ||
+ !it.GetAccessors()->IsAccessorInfo());
+ }
}
void SharedFunctionInfo::SharedFunctionInfoVerify(Isolate* isolate) {
@@ -943,9 +969,8 @@ void SharedFunctionInfo::SharedFunctionInfoVerify(Isolate* isolate) {
VerifyObjectField(isolate, kFunctionDataOffset);
VerifyObjectField(isolate, kOuterScopeInfoOrFeedbackMetadataOffset);
- VerifyObjectField(isolate, kFunctionIdentifierOrDebugInfoOffset);
+ VerifyObjectField(isolate, kScriptOrDebugInfoOffset);
VerifyObjectField(isolate, kNameOrScopeInfoOffset);
- VerifyObjectField(isolate, kScriptOffset);
Object* value = name_or_scope_info();
CHECK(value == kNoSharedNameSentinel || value->IsString() ||
@@ -960,8 +985,8 @@ void SharedFunctionInfo::SharedFunctionInfoVerify(Isolate* isolate) {
HasUncompiledDataWithPreParsedScope() ||
HasUncompiledDataWithoutPreParsedScope());
- CHECK(function_identifier_or_debug_info()->IsUndefined(isolate) ||
- HasBuiltinFunctionId() || HasInferredName() || HasDebugInfo());
+ CHECK(script_or_debug_info()->IsUndefined(isolate) ||
+ script_or_debug_info()->IsScript() || HasDebugInfo());
if (!is_compiled()) {
CHECK(!HasFeedbackMetadata());
@@ -1000,6 +1025,7 @@ void JSGlobalProxy::JSGlobalProxyVerify(Isolate* isolate) {
CHECK(IsJSGlobalProxy());
JSObjectVerify(isolate);
VerifyObjectField(isolate, JSGlobalProxy::kNativeContextOffset);
+ CHECK(map()->is_access_check_needed());
// Make sure that this object has no properties, elements.
CHECK_EQ(0, FixedArray::cast(elements())->length());
}
@@ -1070,11 +1096,6 @@ void PropertyCell::PropertyCellVerify(Isolate* isolate) {
VerifyObjectField(isolate, kValueOffset);
}
-void WeakCell::WeakCellVerify(Isolate* isolate) {
- CHECK(IsWeakCell());
- VerifyObjectField(isolate, kValueOffset);
-}
-
void CodeDataContainer::CodeDataContainerVerify(Isolate* isolate) {
CHECK(IsCodeDataContainer());
VerifyObjectField(isolate, kNextCodeLinkOffset);
@@ -1180,8 +1201,7 @@ void JSWeakMap::JSWeakMapVerify(Isolate* isolate) {
void JSArrayIterator::JSArrayIteratorVerify(Isolate* isolate) {
CHECK(IsJSArrayIterator());
JSObjectVerify(isolate);
- CHECK(iterated_object()->IsJSReceiver() ||
- iterated_object()->IsUndefined(isolate));
+ CHECK(iterated_object()->IsJSReceiver());
CHECK_GE(next_index()->Number(), 0);
CHECK_LE(next_index()->Number(), kMaxSafeInteger);
@@ -1409,6 +1429,7 @@ void JSRegExpStringIterator::JSRegExpStringIteratorVerify(Isolate* isolate) {
void JSProxy::JSProxyVerify(Isolate* isolate) {
CHECK(IsJSProxy());
+ CHECK(map()->GetConstructor()->IsJSFunction());
VerifyPointer(isolate, target());
VerifyPointer(isolate, handler());
if (!IsRevoked()) {
@@ -1534,7 +1555,8 @@ void Module::ModuleVerify(Isolate* isolate) {
void PrototypeInfo::PrototypeInfoVerify(Isolate* isolate) {
CHECK(IsPrototypeInfo());
- CHECK(weak_cell()->IsWeakCell() || weak_cell()->IsUndefined(isolate));
+ Object* module_ns = module_namespace();
+ CHECK(module_ns->IsJSModuleNamespace() || module_ns->IsUndefined(isolate));
if (prototype_users()->IsWeakArrayList()) {
PrototypeUsers::Verify(WeakArrayList::cast(prototype_users()));
} else {
@@ -1643,13 +1665,16 @@ void WasmExportedFunctionData::WasmExportedFunctionDataVerify(
CHECK(wrapper_code()->kind() == Code::JS_TO_WASM_FUNCTION ||
wrapper_code()->kind() == Code::C_WASM_ENTRY);
VerifyObjectField(isolate, kInstanceOffset);
+ VerifySmiField(kJumpTableOffsetOffset);
VerifySmiField(kFunctionIndexOffset);
}
void WasmModuleObject::WasmModuleObjectVerify(Isolate* isolate) {
CHECK(IsWasmModuleObject());
VerifyObjectField(isolate, kNativeModuleOffset);
+ CHECK(managed_native_module()->IsForeign());
VerifyObjectField(isolate, kExportWrappersOffset);
+ CHECK(export_wrappers()->IsFixedArray());
VerifyObjectField(isolate, kScriptOffset);
VerifyObjectField(isolate, kAsmJsOffsetTableOffset);
VerifyObjectField(isolate, kBreakPointInfosOffset);
@@ -1665,10 +1690,10 @@ void DataHandler::DataHandlerVerify(Isolate* isolate) {
VerifyMaybeObjectField(isolate, kData1Offset);
}
if (data_count >= 2) {
- VerifyObjectField(isolate, kData2Offset);
+ VerifyMaybeObjectField(isolate, kData2Offset);
}
if (data_count >= 3) {
- VerifyObjectField(isolate, kData3Offset);
+ VerifyMaybeObjectField(isolate, kData3Offset);
}
}
@@ -1783,16 +1808,17 @@ void Script::ScriptVerify(Isolate* isolate) {
}
void NormalizedMapCache::NormalizedMapCacheVerify(Isolate* isolate) {
- FixedArray::cast(this)->FixedArrayVerify(isolate);
+ WeakFixedArray::cast(this)->WeakFixedArrayVerify(isolate);
if (FLAG_enable_slow_asserts) {
for (int i = 0; i < length(); i++) {
- Object* e = FixedArray::get(i);
- if (e->IsWeakCell()) {
- if (!WeakCell::cast(e)->cleared()) {
- Map::cast(WeakCell::cast(e)->value())->DictionaryMapVerify(isolate);
- }
+ MaybeObject* e = WeakFixedArray::Get(i);
+ HeapObject* heap_object;
+ if (e->ToWeakHeapObject(&heap_object)) {
+ Map::cast(heap_object)->DictionaryMapVerify(isolate);
} else {
- CHECK(e->IsUndefined(isolate));
+ CHECK(e->IsClearedWeakHeapObject() ||
+ (e->ToStrongHeapObject(&heap_object) &&
+ heap_object->IsUndefined(isolate)));
}
}
}
@@ -1801,7 +1827,7 @@ void NormalizedMapCache::NormalizedMapCacheVerify(Isolate* isolate) {
void DebugInfo::DebugInfoVerify(Isolate* isolate) {
CHECK(IsDebugInfo());
VerifyPointer(isolate, shared());
- VerifyPointer(isolate, function_identifier());
+ VerifyPointer(isolate, script());
VerifyPointer(isolate, original_bytecode_array());
VerifyPointer(isolate, break_points());
}
@@ -1828,12 +1854,14 @@ void PreParsedScopeData::PreParsedScopeDataVerify(Isolate* isolate) {
void UncompiledDataWithPreParsedScope::UncompiledDataWithPreParsedScopeVerify(
Isolate* isolate) {
CHECK(IsUncompiledDataWithPreParsedScope());
+ VerifyPointer(isolate, inferred_name());
VerifyPointer(isolate, pre_parsed_scope_data());
}
void UncompiledDataWithoutPreParsedScope::
UncompiledDataWithoutPreParsedScopeVerify(Isolate* isolate) {
CHECK(IsUncompiledDataWithoutPreParsedScope());
+ VerifyPointer(isolate, inferred_name());
}
void InterpreterData::InterpreterDataVerify(Isolate* isolate) {
@@ -1843,7 +1871,23 @@ void InterpreterData::InterpreterDataVerify(Isolate* isolate) {
}
#ifdef V8_INTL_SUPPORT
+void JSCollator::JSCollatorVerify(Isolate* isolate) {
+ CHECK(IsJSCollator());
+ JSObjectVerify(isolate);
+ VerifyObjectField(isolate, kICUCollatorOffset);
+ VerifyObjectField(isolate, kFlagsOffset);
+ VerifyObjectField(isolate, kBoundCompareOffset);
+}
+
+void JSListFormat::JSListFormatVerify(Isolate* isolate) {
+ JSObjectVerify(isolate);
+ VerifyObjectField(isolate, kLocaleOffset);
+ VerifyObjectField(isolate, kFormatterOffset);
+ VerifyObjectField(isolate, kFlagsOffset);
+}
+
void JSLocale::JSLocaleVerify(Isolate* isolate) {
+ JSObjectVerify(isolate);
VerifyObjectField(isolate, kLanguageOffset);
VerifyObjectField(isolate, kScriptOffset);
VerifyObjectField(isolate, kRegionOffset);
@@ -1858,11 +1902,20 @@ void JSLocale::JSLocaleVerify(Isolate* isolate) {
VerifyObjectField(isolate, kNumberingSystemOffset);
}
+void JSPluralRules::JSPluralRulesVerify(Isolate* isolate) {
+ CHECK(IsJSPluralRules());
+ JSObjectVerify(isolate);
+ VerifyObjectField(isolate, kLocaleOffset);
+ VerifyObjectField(isolate, kTypeOffset);
+ VerifyObjectField(isolate, kICUPluralRulesOffset);
+ VerifyObjectField(isolate, kICUDecimalFormatOffset);
+}
+
void JSRelativeTimeFormat::JSRelativeTimeFormatVerify(Isolate* isolate) {
+ JSObjectVerify(isolate);
VerifyObjectField(isolate, kLocaleOffset);
- VerifyObjectField(isolate, kStyleOffset);
- VerifyObjectField(isolate, kNumericOffset);
VerifyObjectField(isolate, kFormatterOffset);
+ VerifyObjectField(isolate, kFlagsOffset);
}
#endif // V8_INTL_SUPPORT
@@ -1910,16 +1963,16 @@ void JSObject::IncrementSpillStatistics(Isolate* isolate,
break;
}
-#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
- case TYPE##_ELEMENTS:
+#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype) case TYPE##_ELEMENTS:
- TYPED_ARRAYS(TYPED_ARRAY_CASE)
+ TYPED_ARRAYS(TYPED_ARRAY_CASE)
#undef TYPED_ARRAY_CASE
- { info->number_of_objects_with_fast_elements_++;
- FixedArrayBase* e = FixedArrayBase::cast(elements());
- info->number_of_fast_used_elements_ += e->length();
- break;
- }
+ {
+ info->number_of_objects_with_fast_elements_++;
+ FixedArrayBase* e = FixedArrayBase::cast(elements());
+ info->number_of_fast_used_elements_ += e->length();
+ break;
+ }
case DICTIONARY_ELEMENTS:
case SLOW_STRING_WRAPPER_ELEMENTS: {
NumberDictionary* dict = element_dictionary();
@@ -2055,17 +2108,13 @@ bool TransitionsAccessor::IsConsistentWithBackPointers() {
// Estimates if there is a path from the object to a context.
// This function is not precise, and can return false even if
// there is a path to a context.
-bool CanLeak(Object* obj, Heap* heap, bool skip_weak_cell) {
+bool CanLeak(Object* obj, Heap* heap) {
if (!obj->IsHeapObject()) return false;
- if (obj->IsWeakCell()) {
- if (skip_weak_cell) return false;
- return CanLeak(WeakCell::cast(obj)->value(), heap, skip_weak_cell);
- }
if (obj->IsCell()) {
- return CanLeak(Cell::cast(obj)->value(), heap, skip_weak_cell);
+ return CanLeak(Cell::cast(obj)->value(), heap);
}
if (obj->IsPropertyCell()) {
- return CanLeak(PropertyCell::cast(obj)->value(), heap, skip_weak_cell);
+ return CanLeak(PropertyCell::cast(obj)->value(), heap);
}
if (obj->IsContext()) return true;
if (obj->IsMap()) {
@@ -2076,17 +2125,16 @@ bool CanLeak(Object* obj, Heap* heap, bool skip_weak_cell) {
}
return true;
}
- return CanLeak(HeapObject::cast(obj)->map(), heap, skip_weak_cell);
+ return CanLeak(HeapObject::cast(obj)->map(), heap);
}
void Code::VerifyEmbeddedObjects(Isolate* isolate, VerifyMode mode) {
if (kind() == OPTIMIZED_FUNCTION) return;
Heap* heap = isolate->heap();
int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT);
- bool skip_weak_cell = (mode == kNoContextSpecificPointers) ? false : true;
for (RelocIterator it(this, mask); !it.done(); it.next()) {
Object* target = it.rinfo()->target_object();
- DCHECK(!CanLeak(target, heap, skip_weak_cell));
+ DCHECK(!CanLeak(target, heap));
}
}