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