| 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 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 return cache_.kAsmInt; | 714 return cache_.kAsmInt; |
| 715 } else { | 715 } else { |
| 716 return type; | 716 return type; |
| 717 } | 717 } |
| 718 } | 718 } |
| 719 | 719 |
| 720 | 720 |
| 721 void AsmTyper::VisitHeapAccess(Property* expr, bool assigning, | 721 void AsmTyper::VisitHeapAccess(Property* expr, bool assigning, |
| 722 Type* assignment_type) { | 722 Type* assignment_type) { |
| 723 Type::ArrayType* array_type = computed_type_->AsArray(); | 723 Type::ArrayType* array_type = computed_type_->AsArray(); |
| 724 size_t size = array_size_; | 724 // size_t size = array_size_; |
| 725 Type* type = array_type->AsArray()->Element(); | 725 Type* type = array_type->AsArray()->Element(); |
| 726 if (type->IsFunction()) { | 726 if (type->IsFunction()) { |
| 727 if (assigning) { | 727 if (assigning) { |
| 728 FAIL(expr, "assigning to function table is illegal"); | 728 FAIL(expr, "assigning to function table is illegal"); |
| 729 } | 729 } |
| 730 BinaryOperation* bin = expr->key()->AsBinaryOperation(); | 730 // TODO(bradnelson): Fix the parser and then un-comment this part |
| 731 if (bin == NULL || bin->op() != Token::BIT_AND) { | 731 // BinaryOperation* bin = expr->key()->AsBinaryOperation(); |
| 732 FAIL(expr->key(), "expected & in call"); | 732 // if (bin == NULL || bin->op() != Token::BIT_AND) { |
| 733 } | 733 // FAIL(expr->key(), "expected & in call"); |
| 734 RECURSE(VisitWithExpectation(bin->left(), cache_.kAsmSigned, | 734 // } |
| 735 "array index expected to be integer")); | 735 // RECURSE(VisitWithExpectation(bin->left(), cache_.kAsmSigned, |
| 736 Literal* right = bin->right()->AsLiteral(); | 736 // "array index expected to be integer")); |
| 737 if (right == NULL || right->raw_value()->ContainsDot()) { | 737 // Literal* right = bin->right()->AsLiteral(); |
| 738 FAIL(right, "call mask must be integer"); | 738 // if (right == NULL || right->raw_value()->ContainsDot()) { |
| 739 } | 739 // FAIL(right, "call mask must be integer"); |
| 740 RECURSE(VisitWithExpectation(bin->right(), cache_.kAsmSigned, | 740 // } |
| 741 "call mask expected to be integer")); | 741 // RECURSE(VisitWithExpectation(bin->right(), cache_.kAsmSigned, |
| 742 if (static_cast<size_t>(right->raw_value()->AsNumber()) != size - 1) { | 742 // "call mask expected to be integer")); |
| 743 FAIL(right, "call mask must match function table"); | 743 // if (static_cast<size_t>(right->raw_value()->AsNumber()) != size - 1) { |
| 744 } | 744 // FAIL(right, "call mask must match function table"); |
| 745 bin->set_bounds(Bounds(cache_.kAsmSigned)); | 745 // } |
| 746 // bin->set_bounds(Bounds(cache_.kAsmSigned)); |
| 747 RECURSE(VisitWithExpectation(expr->key(), cache_.kAsmSigned, |
| 748 "must be integer")); |
| 746 IntersectResult(expr, type); | 749 IntersectResult(expr, type); |
| 747 } else { | 750 } else { |
| 748 Literal* literal = expr->key()->AsLiteral(); | 751 Literal* literal = expr->key()->AsLiteral(); |
| 749 if (literal) { | 752 if (literal) { |
| 750 RECURSE(VisitWithExpectation(literal, cache_.kAsmSigned, | 753 RECURSE(VisitWithExpectation(literal, cache_.kAsmSigned, |
| 751 "array index expected to be integer")); | 754 "array index expected to be integer")); |
| 752 } else { | 755 } else { |
| 753 BinaryOperation* bin = expr->key()->AsBinaryOperation(); | 756 BinaryOperation* bin = expr->key()->AsBinaryOperation(); |
| 754 if (bin == NULL || bin->op() != Token::SAR) { | 757 if (bin == NULL || bin->op() != Token::SAR) { |
| 755 FAIL(expr->key(), "expected >> in heap access"); | 758 FAIL(expr->key(), "expected >> in heap access"); |
| (...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1483 | 1486 |
| 1484 | 1487 |
| 1485 void AsmTyper::VisitRewritableAssignmentExpression( | 1488 void AsmTyper::VisitRewritableAssignmentExpression( |
| 1486 RewritableAssignmentExpression* expr) { | 1489 RewritableAssignmentExpression* expr) { |
| 1487 RECURSE(Visit(expr->expression())); | 1490 RECURSE(Visit(expr->expression())); |
| 1488 } | 1491 } |
| 1489 | 1492 |
| 1490 | 1493 |
| 1491 } // namespace internal | 1494 } // namespace internal |
| 1492 } // namespace v8 | 1495 } // namespace v8 |
| OLD | NEW |