OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/typing-asm.h" | 7 #include "src/typing-asm.h" |
8 | 8 |
9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
10 #include "src/ast/scopes.h" | 10 #include "src/ast/scopes.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 bool AsmTyper::Validate() { | 69 bool AsmTyper::Validate() { |
70 VisitAsmModule(root_); | 70 VisitAsmModule(root_); |
71 return valid_ && !HasStackOverflow(); | 71 return valid_ && !HasStackOverflow(); |
72 } | 72 } |
73 | 73 |
74 | 74 |
75 void AsmTyper::VisitAsmModule(FunctionLiteral* fun) { | 75 void AsmTyper::VisitAsmModule(FunctionLiteral* fun) { |
76 Scope* scope = fun->scope(); | 76 Scope* scope = fun->scope(); |
77 if (!scope->is_function_scope()) FAIL(fun, "not at function scope"); | 77 if (!scope->is_function_scope()) FAIL(fun, "not at function scope"); |
78 | 78 |
| 79 ExpressionStatement* use_asm = fun->body()->first()->AsExpressionStatement(); |
| 80 if (use_asm == NULL) FAIL(fun, "missing \"use asm\""); |
| 81 Literal* use_asm_literal = use_asm->expression()->AsLiteral(); |
| 82 if (use_asm_literal == NULL) FAIL(fun, "missing \"use asm\""); |
| 83 if (!use_asm_literal->raw_value()->AsString()->IsOneByteEqualTo("use asm")) |
| 84 FAIL(fun, "missing \"use asm\""); |
| 85 |
79 // Module parameters. | 86 // Module parameters. |
80 for (int i = 0; i < scope->num_parameters(); ++i) { | 87 for (int i = 0; i < scope->num_parameters(); ++i) { |
81 Variable* param = scope->parameter(i); | 88 Variable* param = scope->parameter(i); |
82 DCHECK(GetType(param) == NULL); | 89 DCHECK(GetType(param) == NULL); |
83 SetType(param, Type::None(zone())); | 90 SetType(param, Type::None(zone())); |
84 } | 91 } |
85 | 92 |
86 ZoneList<Declaration*>* decls = scope->declarations(); | 93 ZoneList<Declaration*>* decls = scope->declarations(); |
87 | 94 |
88 // Set all globals to type Any. | 95 // Set all globals to type Any. |
(...skipping 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1452 | 1459 |
1453 | 1460 |
1454 void AsmTyper::VisitRewritableAssignmentExpression( | 1461 void AsmTyper::VisitRewritableAssignmentExpression( |
1455 RewritableAssignmentExpression* expr) { | 1462 RewritableAssignmentExpression* expr) { |
1456 RECURSE(Visit(expr->expression())); | 1463 RECURSE(Visit(expr->expression())); |
1457 } | 1464 } |
1458 | 1465 |
1459 | 1466 |
1460 } // namespace internal | 1467 } // namespace internal |
1461 } // namespace v8 | 1468 } // namespace v8 |
OLD | NEW |