Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Side by Side Diff: src/typing-asm.cc

Issue 1569423002: Reject lack of "use asm" marker in asm typer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/cctest/test-asm-validator.cc » ('j') | test/cctest/test-asm-validator.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-asm-validator.cc » ('j') | test/cctest/test-asm-validator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698