| 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/typing-asm.h" | 5 #include "src/typing-asm.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "src/v8.h" | 9 #include "src/v8.h" |
| 10 | 10 |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 } | 333 } |
| 334 | 334 |
| 335 | 335 |
| 336 void AsmTyper::VisitEmptyParentheses(EmptyParentheses* expr) { UNREACHABLE(); } | 336 void AsmTyper::VisitEmptyParentheses(EmptyParentheses* expr) { UNREACHABLE(); } |
| 337 | 337 |
| 338 | 338 |
| 339 void AsmTyper::VisitIfStatement(IfStatement* stmt) { | 339 void AsmTyper::VisitIfStatement(IfStatement* stmt) { |
| 340 if (!in_function_) { | 340 if (!in_function_) { |
| 341 FAIL(stmt, "if statement inside module body"); | 341 FAIL(stmt, "if statement inside module body"); |
| 342 } | 342 } |
| 343 RECURSE(VisitWithExpectation(stmt->condition(), cache_.kAsmSigned, | 343 RECURSE(VisitWithExpectation(stmt->condition(), cache_.kAsmInt, |
| 344 "if condition expected to be integer")); | 344 "if condition expected to be integer")); |
| 345 if (intish_ != 0) { |
| 346 FAIL(stmt, "if condition expected to be signed or unsigned"); |
| 347 } |
| 345 RECURSE(Visit(stmt->then_statement())); | 348 RECURSE(Visit(stmt->then_statement())); |
| 346 RECURSE(Visit(stmt->else_statement())); | 349 RECURSE(Visit(stmt->else_statement())); |
| 347 } | 350 } |
| 348 | 351 |
| 349 | 352 |
| 350 void AsmTyper::VisitContinueStatement(ContinueStatement* stmt) { | 353 void AsmTyper::VisitContinueStatement(ContinueStatement* stmt) { |
| 351 if (!in_function_) { | 354 if (!in_function_) { |
| 352 FAIL(stmt, "continue statement inside module body"); | 355 FAIL(stmt, "continue statement inside module body"); |
| 353 } | 356 } |
| 354 } | 357 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 | 430 |
| 428 | 431 |
| 429 void AsmTyper::VisitCaseClause(CaseClause* clause) { UNREACHABLE(); } | 432 void AsmTyper::VisitCaseClause(CaseClause* clause) { UNREACHABLE(); } |
| 430 | 433 |
| 431 | 434 |
| 432 void AsmTyper::VisitDoWhileStatement(DoWhileStatement* stmt) { | 435 void AsmTyper::VisitDoWhileStatement(DoWhileStatement* stmt) { |
| 433 if (!in_function_) { | 436 if (!in_function_) { |
| 434 FAIL(stmt, "do statement inside module body"); | 437 FAIL(stmt, "do statement inside module body"); |
| 435 } | 438 } |
| 436 RECURSE(Visit(stmt->body())); | 439 RECURSE(Visit(stmt->body())); |
| 437 RECURSE(VisitWithExpectation(stmt->cond(), cache_.kAsmSigned, | 440 RECURSE(VisitWithExpectation(stmt->cond(), cache_.kAsmInt, |
| 438 "do condition expected to be integer")); | 441 "do condition expected to be integer")); |
| 442 if (intish_ != 0) { |
| 443 FAIL(stmt, "do condition expected to be signed or unsigned"); |
| 444 } |
| 439 } | 445 } |
| 440 | 446 |
| 441 | 447 |
| 442 void AsmTyper::VisitWhileStatement(WhileStatement* stmt) { | 448 void AsmTyper::VisitWhileStatement(WhileStatement* stmt) { |
| 443 if (!in_function_) { | 449 if (!in_function_) { |
| 444 FAIL(stmt, "while statement inside module body"); | 450 FAIL(stmt, "while statement inside module body"); |
| 445 } | 451 } |
| 446 RECURSE(VisitWithExpectation(stmt->cond(), cache_.kAsmSigned, | 452 RECURSE(VisitWithExpectation(stmt->cond(), cache_.kAsmInt, |
| 447 "while condition expected to be integer")); | 453 "while condition expected to be integer")); |
| 454 if (intish_ != 0) { |
| 455 FAIL(stmt, "while condition expected to be signed or unsigned"); |
| 456 } |
| 448 RECURSE(Visit(stmt->body())); | 457 RECURSE(Visit(stmt->body())); |
| 449 } | 458 } |
| 450 | 459 |
| 451 | 460 |
| 452 void AsmTyper::VisitForStatement(ForStatement* stmt) { | 461 void AsmTyper::VisitForStatement(ForStatement* stmt) { |
| 453 if (!in_function_) { | 462 if (!in_function_) { |
| 454 FAIL(stmt, "for statement inside module body"); | 463 FAIL(stmt, "for statement inside module body"); |
| 455 } | 464 } |
| 456 if (stmt->init() != nullptr) { | 465 if (stmt->init() != nullptr) { |
| 457 RECURSE(Visit(stmt->init())); | 466 RECURSE(Visit(stmt->init())); |
| 458 } | 467 } |
| 459 if (stmt->cond() != nullptr) { | 468 if (stmt->cond() != nullptr) { |
| 460 RECURSE(VisitWithExpectation(stmt->cond(), cache_.kAsmSigned, | 469 RECURSE(VisitWithExpectation(stmt->cond(), cache_.kAsmInt, |
| 461 "for condition expected to be integer")); | 470 "for condition expected to be integer")); |
| 462 } | 471 } |
| 472 if (intish_ != 0) { |
| 473 FAIL(stmt, "for condition expected to be signed or unsigned"); |
| 474 } |
| 463 if (stmt->next() != nullptr) { | 475 if (stmt->next() != nullptr) { |
| 464 RECURSE(Visit(stmt->next())); | 476 RECURSE(Visit(stmt->next())); |
| 465 } | 477 } |
| 466 RECURSE(Visit(stmt->body())); | 478 RECURSE(Visit(stmt->body())); |
| 467 } | 479 } |
| 468 | 480 |
| 469 | 481 |
| 470 void AsmTyper::VisitForInStatement(ForInStatement* stmt) { | 482 void AsmTyper::VisitForInStatement(ForInStatement* stmt) { |
| 471 FAIL(stmt, "for-in statement encountered"); | 483 FAIL(stmt, "for-in statement encountered"); |
| 472 } | 484 } |
| (...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1642 } | 1654 } |
| 1643 | 1655 |
| 1644 | 1656 |
| 1645 void AsmTyper::VisitRewritableExpression(RewritableExpression* expr) { | 1657 void AsmTyper::VisitRewritableExpression(RewritableExpression* expr) { |
| 1646 RECURSE(Visit(expr->expression())); | 1658 RECURSE(Visit(expr->expression())); |
| 1647 } | 1659 } |
| 1648 | 1660 |
| 1649 | 1661 |
| 1650 } // namespace internal | 1662 } // namespace internal |
| 1651 } // namespace v8 | 1663 } // namespace v8 |
| OLD | NEW |