V8. ASM-2-WASM. Fixes import handling logic.
The asm typer would CHECK fail for imports like var bogus = stdlib.<HeapViewType> This CL changes this behavior so the typer reports a validation error instead. BUG= https://bugs.chromium.org/p/v8/issues/detail?id=4203 TEST=cctest/asmjs/test-asm-typer.cc LOG=N Review-Url: https://codereview.chromium.org/2152763002 Cr-Commit-Position: refs/heads/master@{#37777}
This commit is contained in:
parent
43d3187e7a
commit
ca25c845e2
@ -647,13 +647,15 @@ AsmType* AsmTyper::ValidateGlobalDeclaration(Assignment* assign) {
|
||||
FAIL(assign, "Invalid import.");
|
||||
}
|
||||
CHECK(target_info->mutability() == VariableInfo::kImmutableGlobal);
|
||||
if (!target_info->IsFFI()) {
|
||||
target_info = target_info->Clone(zone_);
|
||||
} else {
|
||||
if (target_info->IsFFI()) {
|
||||
// create a new target info that represents a foreign variable.
|
||||
DCHECK(target_info->type()->AsFFIType() != nullptr);
|
||||
target_info = new (zone_) VariableInfo(target_info->type());
|
||||
target_info->set_mutability(VariableInfo::kImmutableGlobal);
|
||||
} else if (target_info->type()->IsA(AsmType::Heap())) {
|
||||
FAIL(assign, "Heap view types can not be aliased.");
|
||||
} else {
|
||||
target_info = target_info->Clone(zone_);
|
||||
}
|
||||
} else if (value->IsBinaryOperation()) {
|
||||
// This should either be:
|
||||
|
@ -561,6 +561,7 @@ TEST(ErrorsInGlobalVariableDefinition) {
|
||||
{"var a = 0; var a = 0;", "Redefined global variable"},
|
||||
{"var a = 0, b = 0; var a = 0;", "Redefined global variable"},
|
||||
{"var a = 0, b = 0; var b = 0, a = 0.0;", "Redefined global variable"},
|
||||
{"var a = stdlib.Int8Array", "Heap view types can not be aliased"},
|
||||
};
|
||||
|
||||
for (size_t ii = 0; ii < arraysize(kTests); ++ii) {
|
||||
|
Loading…
Reference in New Issue
Block a user