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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 Section tables_; | 544 Section tables_; |
545 Section exports_; | 545 Section exports_; |
546 | 546 |
547 DISALLOW_COPY_AND_ASSIGN(SourceLayoutTracker); | 547 DISALLOW_COPY_AND_ASSIGN(SourceLayoutTracker); |
548 }; | 548 }; |
549 } // namespace | 549 } // namespace |
550 | 550 |
551 AsmType* AsmTyper::ValidateModule(FunctionLiteral* fun) { | 551 AsmType* AsmTyper::ValidateModule(FunctionLiteral* fun) { |
552 SourceLayoutTracker source_layout; | 552 SourceLayoutTracker source_layout; |
553 | 553 |
554 Scope* scope = fun->scope(); | 554 DeclarationScope* scope = fun->scope(); |
555 if (!scope->is_function_scope()) FAIL(fun, "Not at function scope."); | 555 if (!scope->is_function_scope()) FAIL(fun, "Not at function scope."); |
556 if (!ValidAsmIdentifier(fun->name())) | 556 if (!ValidAsmIdentifier(fun->name())) |
557 FAIL(fun, "Invalid asm.js identifier in module name."); | 557 FAIL(fun, "Invalid asm.js identifier in module name."); |
558 module_name_ = fun->name(); | 558 module_name_ = fun->name(); |
559 | 559 |
560 // Allowed parameters: Stdlib, FFI, Mem | 560 // Allowed parameters: Stdlib, FFI, Mem |
561 static const uint32_t MaxModuleParameters = 3; | 561 static const uint32_t MaxModuleParameters = 3; |
562 if (scope->num_parameters() > MaxModuleParameters) { | 562 if (scope->num_parameters() > MaxModuleParameters) { |
563 FAIL(fun, "asm.js modules may not have more than three parameters."); | 563 FAIL(fun, "asm.js modules may not have more than three parameters."); |
564 } | 564 } |
(...skipping 2172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2737 return true; | 2737 return true; |
2738 } | 2738 } |
2739 | 2739 |
2740 *error_message = typer.error_message(); | 2740 *error_message = typer.error_message(); |
2741 return false; | 2741 return false; |
2742 } | 2742 } |
2743 | 2743 |
2744 } // namespace wasm | 2744 } // namespace wasm |
2745 } // namespace internal | 2745 } // namespace internal |
2746 } // namespace v8 | 2746 } // namespace v8 |
OLD | NEW |