Commit 051bc1ec authored by bradnelson's avatar bradnelson Committed by Commit bot

[wasm][asm.js] Pass Script with Handle.

The asm-wasm-builder started allocating SharedFunctionInfos,
this makes it bad we'd passed Script by pointer (due to ignorance).
Switching to Handle<Script>.

R=clemensh@chromium.org,titzer@chromium.org
BUG=v8:5716

Review-Url: https://codereview.chromium.org/2552873003
Cr-Commit-Position: refs/heads/master@{#41529}
parent 400b01ff
......@@ -154,7 +154,7 @@ bool IsStdlibMemberValid(i::Isolate* isolate, Handle<JSReceiver> stdlib,
MaybeHandle<FixedArray> AsmJs::ConvertAsmToWasm(ParseInfo* info) {
ErrorThrower thrower(info->isolate(), "Asm.js -> WebAssembly conversion");
wasm::AsmWasmBuilder builder(info->isolate(), info->zone(),
info->ast_value_factory(), *info->script(),
info->ast_value_factory(), info->script(),
info->literal());
Handle<FixedArray> foreign_globals;
auto asm_wasm_result = builder.Run(&foreign_globals);
......
......@@ -173,7 +173,7 @@ void AsmTyper::VariableInfo::SetFirstForwardUse(int source_location) {
// ----------------------------------------------------------------------------
// Implementation of AsmTyper
AsmTyper::AsmTyper(Isolate* isolate, Zone* zone, Script* script,
AsmTyper::AsmTyper(Isolate* isolate, Zone* zone, Handle<Script> script,
FunctionLiteral* root)
: isolate_(isolate),
zone_(zone),
......@@ -2866,7 +2866,7 @@ AsmType* AsmTyper::NewHeapView(CallNew* new_heap_view) {
return heap_view_info->type();
}
bool IsValidAsm(Isolate* isolate, Zone* zone, Script* script,
bool IsValidAsm(Isolate* isolate, Zone* zone, Handle<Script> script,
FunctionLiteral* root, std::string* error_message) {
error_message->clear();
......
......@@ -68,7 +68,8 @@ class AsmTyper final {
};
~AsmTyper() = default;
AsmTyper(Isolate* isolate, Zone* zone, Script* script, FunctionLiteral* root);
AsmTyper(Isolate* isolate, Zone* zone, Handle<Script> script,
FunctionLiteral* root);
bool Validate();
// Do asm.js validation in phases (to interleave with conversion to wasm).
......@@ -369,7 +370,7 @@ class AsmTyper final {
Isolate* isolate_;
Zone* zone_;
Script* script_;
Handle<Script> script_;
FunctionLiteral* root_;
bool in_function_ = false;
......
......@@ -47,7 +47,7 @@ struct ForeignVariable {
class AsmWasmBuilderImpl final : public AstVisitor<AsmWasmBuilderImpl> {
public:
AsmWasmBuilderImpl(Isolate* isolate, Zone* zone,
AstValueFactory* ast_value_factory, Script* script,
AstValueFactory* ast_value_factory, Handle<Script> script,
FunctionLiteral* literal, AsmTyper* typer)
: local_variables_(ZoneHashMap::kDefaultHashMapCapacity,
ZoneAllocationPolicy(zone)),
......@@ -139,10 +139,10 @@ class AsmWasmBuilderImpl final : public AstVisitor<AsmWasmBuilderImpl> {
// SharedFunctionInfo to parse a single function,
// or squirrel away the SharedFunctionInfo to use later.
Handle<SharedFunctionInfo> shared =
isolate_->factory()->NewSharedFunctionInfoForLiteral(
decl->fun(), handle(script_, isolate_));
isolate_->factory()->NewSharedFunctionInfoForLiteral(decl->fun(),
script_);
shared->set_is_toplevel(false);
ParseInfo info(&zone, handle(script_, isolate_));
ParseInfo info(&zone, script_);
info.set_shared_info(shared);
info.set_toplevel(false);
info.set_language_mode(decl->fun()->scope()->language_mode());
......@@ -1921,7 +1921,7 @@ class AsmWasmBuilderImpl final : public AstVisitor<AsmWasmBuilderImpl> {
Isolate* isolate_;
Zone* zone_;
AstValueFactory* ast_value_factory_;
Script* script_;
Handle<Script> script_;
AsmTyper* typer_;
bool typer_failed_;
ZoneVector<std::pair<BreakableStatement*, bool>> breakable_blocks_;
......@@ -1940,7 +1940,7 @@ class AsmWasmBuilderImpl final : public AstVisitor<AsmWasmBuilderImpl> {
AsmWasmBuilder::AsmWasmBuilder(Isolate* isolate, Zone* zone,
AstValueFactory* ast_value_factory,
Script* script, FunctionLiteral* literal)
Handle<Script> script, FunctionLiteral* literal)
: isolate_(isolate),
zone_(zone),
ast_value_factory_(ast_value_factory),
......
......@@ -28,8 +28,8 @@ class AsmWasmBuilder {
};
explicit AsmWasmBuilder(Isolate* isolate, Zone* zone,
AstValueFactory* ast_value_factory, Script* script,
FunctionLiteral* root);
AstValueFactory* ast_value_factory,
Handle<Script> script, FunctionLiteral* root);
Result Run(Handle<FixedArray>* foreign_args);
static const char* foreign_init_name;
......@@ -41,7 +41,7 @@ class AsmWasmBuilder {
Isolate* isolate_;
Zone* zone_;
AstValueFactory* ast_value_factory_;
Script* script_;
Handle<Script> script_;
FunctionLiteral* literal_;
AsmTyper typer_;
};
......
......@@ -69,7 +69,7 @@ class AsmTyperHarnessBuilder {
->AtForTest(0)
->AsFunctionDeclaration()
->fun();
typer_.reset(new AsmTyper(isolate_, zone_, *script_, module_));
typer_.reset(new AsmTyper(isolate_, zone_, script_, module_));
if (validation_type_ == ValidateStatement ||
validation_type_ == ValidateExpression) {
......
......@@ -245,10 +245,6 @@
#BUG(v8:5683)
'wasm/import-memory': [SKIP],
#BUG(v8:5716)
'wasm/asm-wasm-switch': [SKIP],
'wasm/asm-wasm-expr': [SKIP],
}], # 'gc_stress == True'
##############################################################################
......
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