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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 << typer_->error_message() << "'\n"; | 269 << typer_->error_message() << "'\n"; |
270 return false; | 270 return false; |
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 ast_value_factory_.Internalize(isolate_); |
279 return var_name.mode_ == DYNAMIC_GLOBAL | 280 return var_name.mode_ == DYNAMIC_GLOBAL |
280 ? outer_scope_->DeclareDynamicGlobal(name_ast_string, | 281 ? outer_scope_->DeclareDynamicGlobal(name_ast_string, |
281 Variable::NORMAL) | 282 Variable::NORMAL) |
282 : module_->scope()->DeclareLocal(name_ast_string, VAR, | 283 : module_->scope()->DeclareLocal(name_ast_string, VAR, |
283 kCreatedInitialized, | 284 kCreatedInitialized, |
284 Variable::NORMAL); | 285 Variable::NORMAL); |
285 } | 286 } |
286 | 287 |
287 bool ValidateAllStatements(FunctionDeclaration* fun_decl) { | 288 bool ValidateAllStatements(FunctionDeclaration* fun_decl) { |
288 AsmTyper::FlattenedStatements iter(zone_, fun_decl->fun()->body()); | 289 AsmTyper::FlattenedStatements iter(zone_, fun_decl->fun()->body()); |
(...skipping 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1994 for (size_t ii = 0; ii < arraysize(kTests); ++ii) { | 1995 for (size_t ii = 0; ii < arraysize(kTests); ++ii) { |
1995 if (!ValidationOf(Module(kTests[ii])) | 1996 if (!ValidationOf(Module(kTests[ii])) |
1996 ->FailsWithMessage("Can't assign to immutable symbol")) { | 1997 ->FailsWithMessage("Can't assign to immutable symbol")) { |
1997 std::cerr << "Test:\n" << kTests[ii]; | 1998 std::cerr << "Test:\n" << kTests[ii]; |
1998 CHECK(false); | 1999 CHECK(false); |
1999 } | 2000 } |
2000 } | 2001 } |
2001 } | 2002 } |
2002 | 2003 |
2003 } // namespace | 2004 } // namespace |
OLD | NEW |