Commit cddaf24c authored by Mircea Trofin's avatar Mircea Trofin Committed by Commit Bot

[wasm] Fix for code immovability validators.

Bug: 
Change-Id: Ic31aa23078cd0af04b25af9e3d06e89f45e85d88
Reviewed-on: https://chromium-review.googlesource.com/706144Reviewed-by: 's avatarBrad Nelson <bradnelson@chromium.org>
Commit-Queue: Mircea Trofin <mtrofin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48555}
parent 2caaf7a5
......@@ -844,7 +844,7 @@ void PipelineWasmCompilationJob::ValidateImmovableEmbeddedObjects() const {
case RelocInfo::CODE_TARGET:
// this would be either one of the stubs or builtins, because
// we didn't link yet.
target = reinterpret_cast<Object*>(it.rinfo()->target_address());
target = Code::GetCodeFromTargetAddress(it.rinfo()->target_address());
break;
case RelocInfo::EMBEDDED_OBJECT:
target = it.rinfo()->target_object();
......@@ -855,7 +855,17 @@ void PipelineWasmCompilationJob::ValidateImmovableEmbeddedObjects() const {
CHECK_NOT_NULL(target);
bool is_immovable =
target->IsSmi() || Heap::IsImmovable(HeapObject::cast(target));
CHECK(is_immovable);
bool is_wasm = target->IsCode() &&
(Code::cast(target)->kind() == Code::WASM_FUNCTION ||
Code::cast(target)->kind() == Code::WASM_TO_JS_FUNCTION);
bool is_allowed_stub = false;
if (target->IsCode()) {
Code* code = Code::cast(target);
is_allowed_stub =
code->kind() == Code::STUB &&
CodeStub::MajorKeyFromKey(code->stub_key()) == CodeStub::DoubleToI;
}
CHECK(is_immovable || is_wasm || is_allowed_stub);
}
}
......
......@@ -4242,7 +4242,7 @@ void ValidateImportWrapperReferencesImmovables(Handle<Code> wrapper) {
case RelocInfo::CODE_TARGET:
// this would be either one of the stubs or builtins, because
// we didn't link yet.
target = reinterpret_cast<Object*>(it.rinfo()->target_address());
target = Code::GetCodeFromTargetAddress(it.rinfo()->target_address());
break;
case RelocInfo::EMBEDDED_OBJECT:
target = it.rinfo()->target_object();
......@@ -4253,7 +4253,14 @@ void ValidateImportWrapperReferencesImmovables(Handle<Code> wrapper) {
CHECK_NOT_NULL(target);
bool is_immovable =
target->IsSmi() || Heap::IsImmovable(HeapObject::cast(target));
CHECK(is_immovable);
bool is_allowed_stub = false;
if (target->IsCode()) {
Code* code = Code::cast(target);
is_allowed_stub =
code->kind() == Code::STUB &&
CodeStub::MajorKeyFromKey(code->stub_key()) == CodeStub::DoubleToI;
}
CHECK(is_immovable || is_allowed_stub);
}
}
......
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