Index: test/cctest/asmjs/test-asm-typer.cc |
diff --git a/test/cctest/asmjs/test-asm-typer.cc b/test/cctest/asmjs/test-asm-typer.cc |
index de3e9d42bf167cc167512f1171df3e228756f487..892c968d1d3e0ebb48fd036dec23c2aece3e87db 100644 |
--- a/test/cctest/asmjs/test-asm-typer.cc |
+++ b/test/cctest/asmjs/test-asm-typer.cc |
@@ -45,32 +45,33 @@ |
: source_(source), |
validation_type_(type), |
handles_(), |
+ zone_(handles_.main_zone()), |
isolate_(CcTest::i_isolate()), |
+ ast_value_factory_(zone_, isolate_->ast_string_constants(), |
+ isolate_->heap()->HashSeed()), |
factory_(isolate_->factory()), |
source_code_( |
factory_->NewStringFromUtf8(CStrVector(source)).ToHandleChecked()), |
- script_(factory_->NewScript(source_code_)), |
- info_(script_), |
- ast_value_factory_(info_.zone(), isolate_->ast_string_constants(), |
- isolate_->heap()->HashSeed()) { |
- info_.set_allow_lazy_parsing(false); |
- info_.set_toplevel(true); |
- info_.set_ast_value_factory(&ast_value_factory_); |
- info_.set_ast_value_factory_owned(false); |
- Parser parser(&info_); |
- |
- if (!Compiler::ParseAndAnalyze(&info_)) { |
+ script_(factory_->NewScript(source_code_)) { |
+ ParseInfo info(zone_, script_); |
+ info.set_allow_lazy_parsing(false); |
+ info.set_toplevel(true); |
+ info.set_ast_value_factory(&ast_value_factory_); |
+ info.set_ast_value_factory_owned(false); |
+ Parser parser(&info); |
+ |
+ if (!Compiler::ParseAndAnalyze(&info)) { |
std::cerr << "Failed to parse:\n" << source_ << "\n"; |
CHECK(false); |
} |
- outer_scope_ = info_.script_scope(); |
- module_ = info_.scope() |
+ outer_scope_ = info.script_scope(); |
+ module_ = info.scope() |
->declarations() |
->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) { |
@@ -103,7 +104,7 @@ |
if (var->IsUnallocated()) { |
var->AllocateTo(VariableLocation::LOCAL, -1); |
} |
- auto* var_info = new (zone()) AsmTyper::VariableInfo(type); |
+ auto* var_info = new (zone_) AsmTyper::VariableInfo(type); |
var_info->set_mutability(AsmTyper::VariableInfo::kLocal); |
CHECK(typer_->AddLocal(var, var_info)); |
return this; |
@@ -115,7 +116,7 @@ |
var->AllocateTo(VariableLocation::MODULE, -1); |
} |
if (type != nullptr) { |
- auto* var_info = new (zone()) AsmTyper::VariableInfo(type); |
+ auto* var_info = new (zone_) AsmTyper::VariableInfo(type); |
var_info->set_mutability(AsmTyper::VariableInfo::kMutableGlobal); |
CHECK(typer_->AddGlobal(var, var_info)); |
} |
@@ -124,12 +125,12 @@ |
AsmTyperHarnessBuilder* WithGlobal( |
VariableName var_name, std::function<AsmType*(Zone*)> type_creator) { |
- return WithGlobal(var_name, type_creator(zone())); |
+ return WithGlobal(var_name, type_creator(zone_)); |
} |
AsmTyperHarnessBuilder* WithUndefinedGlobal( |
VariableName var_name, std::function<AsmType*(Zone*)> type_creator) { |
- auto* type = type_creator(zone()); |
+ auto* type = type_creator(zone_); |
CHECK(type->AsFunctionType() != nullptr || |
type->AsFunctionTableType() != nullptr); |
WithGlobal(var_name, type); |
@@ -156,8 +157,7 @@ |
CHECK(false); |
case AsmTyper::kFFI: |
stdlib_map = nullptr; |
- var_info = |
- new (zone()) AsmTyper::VariableInfo(AsmType::FFIType(zone())); |
+ var_info = new (zone_) AsmTyper::VariableInfo(AsmType::FFIType(zone_)); |
var_info->set_mutability(AsmTyper::VariableInfo::kImmutableGlobal); |
break; |
case AsmTyper::kInfinity: |
@@ -176,7 +176,7 @@ |
} |
CHECK(var_info != nullptr); |
- var_info = var_info->Clone(zone()); |
+ var_info = var_info->Clone(zone_); |
} |
CHECK(typer_->AddGlobal(var, var_info)); |
@@ -193,7 +193,7 @@ |
AsmTyperHarnessBuilder* WithStdlib(VariableName var_name) { |
auto* var = DeclareVariable(var_name); |
auto* var_info = |
- AsmTyper::VariableInfo::ForSpecialSymbol(zone(), AsmTyper::kStdlib); |
+ AsmTyper::VariableInfo::ForSpecialSymbol(zone_, AsmTyper::kStdlib); |
CHECK(typer_->AddGlobal(var, var_info)); |
return this; |
} |
@@ -201,7 +201,7 @@ |
AsmTyperHarnessBuilder* WithHeap(VariableName var_name) { |
auto* var = DeclareVariable(var_name); |
auto* var_info = |
- AsmTyper::VariableInfo::ForSpecialSymbol(zone(), AsmTyper::kHeap); |
+ AsmTyper::VariableInfo::ForSpecialSymbol(zone_, AsmTyper::kHeap); |
CHECK(typer_->AddGlobal(var, var_info)); |
return this; |
} |
@@ -209,7 +209,7 @@ |
AsmTyperHarnessBuilder* WithFFI(VariableName var_name) { |
auto* var = DeclareVariable(var_name); |
auto* var_info = |
- AsmTyper::VariableInfo::ForSpecialSymbol(zone(), AsmTyper::kFFI); |
+ AsmTyper::VariableInfo::ForSpecialSymbol(zone_, AsmTyper::kFFI); |
CHECK(typer_->AddGlobal(var, var_info)); |
return this; |
} |
@@ -305,7 +305,7 @@ |
} |
bool ValidateAllStatements(FunctionDeclaration* fun_decl) { |
- AsmTyper::FlattenedStatements iter(zone(), fun_decl->fun()->body()); |
+ AsmTyper::FlattenedStatements iter(zone_, fun_decl->fun()->body()); |
while (auto* curr = iter.Next()) { |
if (typer_->ValidateStatement(curr) == AsmType::None()) { |
return false; |
@@ -315,7 +315,7 @@ |
} |
AsmType* ValidateExpressionStatment(FunctionDeclaration* fun_decl) { |
- AsmTyper::FlattenedStatements iter(zone(), fun_decl->fun()->body()); |
+ AsmTyper::FlattenedStatements iter(zone_, fun_decl->fun()->body()); |
AsmType* ret = AsmType::None(); |
bool last_was_expression_statement = false; |
while (auto* curr = iter.Next()) { |
@@ -337,17 +337,15 @@ |
return ret; |
} |
- Zone* zone() { return info_.zone(); } |
- |
std::string source_; |
ValidationType validation_type_; |
HandleAndZoneScope handles_; |
+ Zone* zone_; |
Isolate* isolate_; |
+ AstValueFactory ast_value_factory_; |
Factory* factory_; |
Handle<String> source_code_; |
Handle<Script> script_; |
- ParseInfo info_; |
- AstValueFactory ast_value_factory_; |
DeclarationScope* outer_scope_; |
FunctionLiteral* module_; |