| 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 return false; | 268 return false; |
| 269 } | 269 } |
| 270 | 270 |
| 271 return true; | 271 return true; |
| 272 } | 272 } |
| 273 | 273 |
| 274 private: | 274 private: |
| 275 Variable* DeclareVariable(VariableName var_name) { | 275 Variable* DeclareVariable(VariableName var_name) { |
| 276 auto* name_ast_string = ast_value_factory_.GetOneByteString(var_name.name_); | 276 auto* name_ast_string = ast_value_factory_.GetOneByteString(var_name.name_); |
| 277 return var_name.mode_ == DYNAMIC_GLOBAL | 277 return var_name.mode_ == DYNAMIC_GLOBAL |
| 278 ? outer_scope_->DeclareDynamicGlobal(name_ast_string) | 278 ? outer_scope_->DeclareDynamicGlobal(name_ast_string, |
| 279 Variable::NORMAL) |
| 279 : module_->scope()->DeclareLocal(name_ast_string, VAR, | 280 : module_->scope()->DeclareLocal(name_ast_string, VAR, |
| 280 kCreatedInitialized, | 281 kCreatedInitialized, |
| 281 Variable::NORMAL); | 282 Variable::NORMAL); |
| 282 } | 283 } |
| 283 | 284 |
| 284 bool ValidateAllStatements(FunctionDeclaration* fun_decl) { | 285 bool ValidateAllStatements(FunctionDeclaration* fun_decl) { |
| 285 AsmTyper::FlattenedStatements iter(zone_, fun_decl->fun()->body()); | 286 AsmTyper::FlattenedStatements iter(zone_, fun_decl->fun()->body()); |
| 286 while (auto* curr = iter.Next()) { | 287 while (auto* curr = iter.Next()) { |
| 287 if (typer_->ValidateStatement(curr) == AsmType::None()) { | 288 if (typer_->ValidateStatement(curr) == AsmType::None()) { |
| 288 return false; | 289 return false; |
| (...skipping 1643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1932 for (size_t ii = 0; ii < arraysize(kTests); ++ii) { | 1933 for (size_t ii = 0; ii < arraysize(kTests); ++ii) { |
| 1933 if (!ValidationOf(Module(kTests[ii])) | 1934 if (!ValidationOf(Module(kTests[ii])) |
| 1934 ->FailsWithMessage("Invalid heap access index")) { | 1935 ->FailsWithMessage("Invalid heap access index")) { |
| 1935 std::cerr << "Test:\n" << kTests[ii]; | 1936 std::cerr << "Test:\n" << kTests[ii]; |
| 1936 CHECK(false); | 1937 CHECK(false); |
| 1937 } | 1938 } |
| 1938 } | 1939 } |
| 1939 } | 1940 } |
| 1940 | 1941 |
| 1941 } // namespace | 1942 } // namespace |
| OLD | NEW |