OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <cstring> | 5 #include <cstring> |
6 #include <functional> | 6 #include <functional> |
7 #include <iostream> | 7 #include <iostream> |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "src/asmjs/asm-typer.h" | 10 #include "src/asmjs/asm-typer.h" |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 } | 271 } |
272 | 272 |
273 return true; | 273 return true; |
274 } | 274 } |
275 | 275 |
276 private: | 276 private: |
277 Variable* DeclareVariable(VariableName var_name) { | 277 Variable* DeclareVariable(VariableName var_name) { |
278 auto* name_ast_string = ast_value_factory_.GetOneByteString(var_name.name_); | 278 auto* name_ast_string = ast_value_factory_.GetOneByteString(var_name.name_); |
279 return var_name.mode_ == DYNAMIC_GLOBAL | 279 return var_name.mode_ == DYNAMIC_GLOBAL |
280 ? outer_scope_->DeclareDynamicGlobal(name_ast_string, | 280 ? outer_scope_->DeclareDynamicGlobal(name_ast_string, |
281 Variable::NORMAL) | 281 NORMAL_VARIABLE) |
282 : module_->scope()->DeclareLocal(name_ast_string, VAR, | 282 : module_->scope()->DeclareLocal(name_ast_string, VAR, |
283 kCreatedInitialized, | 283 kCreatedInitialized, |
284 Variable::NORMAL); | 284 NORMAL_VARIABLE); |
285 } | 285 } |
286 | 286 |
287 bool ValidateAllStatements(FunctionDeclaration* fun_decl) { | 287 bool ValidateAllStatements(FunctionDeclaration* fun_decl) { |
288 AsmTyper::FlattenedStatements iter(zone_, fun_decl->fun()->body()); | 288 AsmTyper::FlattenedStatements iter(zone_, fun_decl->fun()->body()); |
289 while (auto* curr = iter.Next()) { | 289 while (auto* curr = iter.Next()) { |
290 if (typer_->ValidateStatement(curr) == AsmType::None()) { | 290 if (typer_->ValidateStatement(curr) == AsmType::None()) { |
291 return false; | 291 return false; |
292 } | 292 } |
293 } | 293 } |
294 return true; | 294 return true; |
(...skipping 1699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1994 for (size_t ii = 0; ii < arraysize(kTests); ++ii) { | 1994 for (size_t ii = 0; ii < arraysize(kTests); ++ii) { |
1995 if (!ValidationOf(Module(kTests[ii])) | 1995 if (!ValidationOf(Module(kTests[ii])) |
1996 ->FailsWithMessage("Can't assign to immutable symbol")) { | 1996 ->FailsWithMessage("Can't assign to immutable symbol")) { |
1997 std::cerr << "Test:\n" << kTests[ii]; | 1997 std::cerr << "Test:\n" << kTests[ii]; |
1998 CHECK(false); | 1998 CHECK(false); |
1999 } | 1999 } |
2000 } | 2000 } |
2001 } | 2001 } |
2002 | 2002 |
2003 } // namespace | 2003 } // namespace |
OLD | NEW |