| 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 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 auto* use_asm_directive = iter.Next(); | 598 auto* use_asm_directive = iter.Next(); |
| 599 if (use_asm_directive == nullptr) { | 599 if (use_asm_directive == nullptr) { |
| 600 FAIL(fun, "Missing \"use asm\"."); | 600 FAIL(fun, "Missing \"use asm\"."); |
| 601 } | 601 } |
| 602 // Check for extra assignment inserted by the parser when in this form: | 602 // Check for extra assignment inserted by the parser when in this form: |
| 603 // (function Module(a, b, c) {... }) | 603 // (function Module(a, b, c) {... }) |
| 604 ExpressionStatement* estatement = use_asm_directive->AsExpressionStatement(); | 604 ExpressionStatement* estatement = use_asm_directive->AsExpressionStatement(); |
| 605 if (estatement != nullptr) { | 605 if (estatement != nullptr) { |
| 606 Assignment* assignment = estatement->expression()->AsAssignment(); | 606 Assignment* assignment = estatement->expression()->AsAssignment(); |
| 607 if (assignment != nullptr && assignment->target()->IsVariableProxy() && | 607 if (assignment != nullptr && assignment->target()->IsVariableProxy() && |
| 608 assignment->target()->AsVariableProxy()->var()->mode() == | 608 assignment->target() |
| 609 CONST_LEGACY) { | 609 ->AsVariableProxy() |
| 610 ->var() |
| 611 ->is_sloppy_function_name()) { |
| 610 use_asm_directive = iter.Next(); | 612 use_asm_directive = iter.Next(); |
| 611 } | 613 } |
| 612 } | 614 } |
| 613 if (!IsUseAsmDirective(use_asm_directive)) { | 615 if (!IsUseAsmDirective(use_asm_directive)) { |
| 614 FAIL(fun, "Missing \"use asm\"."); | 616 FAIL(fun, "Missing \"use asm\"."); |
| 615 } | 617 } |
| 616 source_layout.AddUseAsm(*use_asm_directive); | 618 source_layout.AddUseAsm(*use_asm_directive); |
| 617 ReturnStatement* module_return = nullptr; | 619 ReturnStatement* module_return = nullptr; |
| 618 | 620 |
| 619 // *VIOLATION* The spec states that globals should be followed by function | 621 // *VIOLATION* The spec states that globals should be followed by function |
| (...skipping 2143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2763 return true; | 2765 return true; |
| 2764 } | 2766 } |
| 2765 | 2767 |
| 2766 *error_message = typer.error_message(); | 2768 *error_message = typer.error_message(); |
| 2767 return false; | 2769 return false; |
| 2768 } | 2770 } |
| 2769 | 2771 |
| 2770 } // namespace wasm | 2772 } // namespace wasm |
| 2771 } // namespace internal | 2773 } // namespace internal |
| 2772 } // namespace v8 | 2774 } // namespace v8 |
| OLD | NEW |