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 "src/asmjs/asm-typer.h" | 5 #include "src/asmjs/asm-typer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 } | 556 } |
557 return assign; | 557 return assign; |
558 } | 558 } |
559 | 559 |
560 } // namespace | 560 } // namespace |
561 | 561 |
562 // 6.1 ValidateModule | 562 // 6.1 ValidateModule |
563 AsmType* AsmTyper::ValidateModuleBeforeFunctionsPhase(FunctionLiteral* fun) { | 563 AsmType* AsmTyper::ValidateModuleBeforeFunctionsPhase(FunctionLiteral* fun) { |
564 DeclarationScope* scope = fun->scope(); | 564 DeclarationScope* scope = fun->scope(); |
565 if (!scope->is_function_scope()) FAIL(fun, "Not at function scope."); | 565 if (!scope->is_function_scope()) FAIL(fun, "Not at function scope."); |
| 566 if (scope->inner_scope_calls_eval()) { |
| 567 FAIL(fun, "Invalid asm.js module using eval."); |
| 568 } |
566 if (!ValidAsmIdentifier(fun->name())) | 569 if (!ValidAsmIdentifier(fun->name())) |
567 FAIL(fun, "Invalid asm.js identifier in module name."); | 570 FAIL(fun, "Invalid asm.js identifier in module name."); |
568 module_name_ = fun->name(); | 571 module_name_ = fun->name(); |
569 | 572 |
570 // Allowed parameters: Stdlib, FFI, Mem | 573 // Allowed parameters: Stdlib, FFI, Mem |
571 static const int MaxModuleParameters = 3; | 574 static const int MaxModuleParameters = 3; |
572 if (scope->num_parameters() > MaxModuleParameters) { | 575 if (scope->num_parameters() > MaxModuleParameters) { |
573 FAIL(fun, "asm.js modules may not have more than three parameters."); | 576 FAIL(fun, "asm.js modules may not have more than three parameters."); |
574 } | 577 } |
575 | 578 |
(...skipping 2303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2879 return true; | 2882 return true; |
2880 } | 2883 } |
2881 | 2884 |
2882 *error_message = typer.error_message(); | 2885 *error_message = typer.error_message(); |
2883 return false; | 2886 return false; |
2884 } | 2887 } |
2885 | 2888 |
2886 } // namespace wasm | 2889 } // namespace wasm |
2887 } // namespace internal | 2890 } // namespace internal |
2888 } // namespace v8 | 2891 } // namespace v8 |
OLD | NEW |