Commit 124fbe55 authored by cbruni's avatar cbruni Committed by Commit bot

[debugging] Add %Verify() helper and check verify a HeapObject has a Map.

R=jkummerow@chromium.org

Review-Url: https://codereview.chromium.org/2625053006
Cr-Commit-Position: refs/heads/master@{#42322}
parent ff7063c7
......@@ -44,6 +44,8 @@ void Smi::SmiVerify() {
void HeapObject::HeapObjectVerify() {
VerifyHeapPointer(map());
CHECK(map()->IsMap());
InstanceType instance_type = map()->instance_type();
if (instance_type < FIRST_NONSTRING_TYPE) {
......
......@@ -828,5 +828,22 @@ RUNTIME_FUNCTION(Runtime_ValidateWasmOrphanedInstance) {
return isolate->heap()->ToBoolean(true);
}
RUNTIME_FUNCTION(Runtime_Verify) {
HandleScope shs(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
#ifdef VERIFY_HEAP
object->ObjectVerify();
#else
CHECK(object->IsObject());
if (object->IsHeapObject()) {
CHECK(HeapObject::cast(*object)->map()->IsMap());
} else {
CHECK(object->IsSmi());
}
#endif
return isolate->heap()->ToBoolean(true);
}
} // namespace internal
} // namespace v8
......@@ -910,7 +910,8 @@ namespace internal {
F(IsWasmCode, 1, 1) \
F(ValidateWasmInstancesChain, 2, 1) \
F(ValidateWasmModuleState, 1, 1) \
F(ValidateWasmOrphanedInstance, 1, 1)
F(ValidateWasmOrphanedInstance, 1, 1) \
F(Verify, 1, 1)
#define FOR_EACH_INTRINSIC_TYPEDARRAY(F) \
F(ArrayBufferGetByteLength, 1, 1) \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment