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 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 Section tables_; | 551 Section tables_; |
552 Section exports_; | 552 Section exports_; |
553 | 553 |
554 DISALLOW_COPY_AND_ASSIGN(SourceLayoutTracker); | 554 DISALLOW_COPY_AND_ASSIGN(SourceLayoutTracker); |
555 }; | 555 }; |
556 } // namespace | 556 } // namespace |
557 | 557 |
558 AsmType* AsmTyper::ValidateModule(FunctionLiteral* fun) { | 558 AsmType* AsmTyper::ValidateModule(FunctionLiteral* fun) { |
559 SourceLayoutTracker source_layout; | 559 SourceLayoutTracker source_layout; |
560 | 560 |
561 Scope* scope = fun->scope(); | 561 DeclarationScope* scope = fun->scope(); |
562 if (!scope->is_function_scope()) FAIL(fun, "Not at function scope."); | 562 if (!scope->is_function_scope()) FAIL(fun, "Not at function scope."); |
563 if (!ValidAsmIdentifier(fun->name())) | 563 if (!ValidAsmIdentifier(fun->name())) |
564 FAIL(fun, "Invalid asm.js identifier in module name."); | 564 FAIL(fun, "Invalid asm.js identifier in module name."); |
565 module_name_ = fun->name(); | 565 module_name_ = fun->name(); |
566 | 566 |
567 // Allowed parameters: Stdlib, FFI, Mem | 567 // Allowed parameters: Stdlib, FFI, Mem |
568 static const uint32_t MaxModuleParameters = 3; | 568 static const uint32_t MaxModuleParameters = 3; |
569 if (scope->num_parameters() > MaxModuleParameters) { | 569 if (scope->num_parameters() > MaxModuleParameters) { |
570 FAIL(fun, "asm.js modules may not have more than three parameters."); | 570 FAIL(fun, "asm.js modules may not have more than three parameters."); |
571 } | 571 } |
(...skipping 2172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2744 return true; | 2744 return true; |
2745 } | 2745 } |
2746 | 2746 |
2747 *error_message = typer.error_message(); | 2747 *error_message = typer.error_message(); |
2748 return false; | 2748 return false; |
2749 } | 2749 } |
2750 | 2750 |
2751 } // namespace wasm | 2751 } // namespace wasm |
2752 } // namespace internal | 2752 } // namespace internal |
2753 } // namespace v8 | 2753 } // namespace v8 |
OLD | NEW |