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

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

Issue 1858263002: [asm.js] Fix typing bug for non-literals in heap access. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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/mjsunit/regress/regress-599825.js » ('j') | no next file with comments »
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/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 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 RECURSE(Visit(expr->key())); 774 RECURSE(Visit(expr->key()));
775 } else { 775 } else {
776 BinaryOperation* bin = expr->key()->AsBinaryOperation(); 776 BinaryOperation* bin = expr->key()->AsBinaryOperation();
777 if (bin == NULL || bin->op() != Token::SAR) { 777 if (bin == NULL || bin->op() != Token::SAR) {
778 FAIL(expr->key(), "expected >> in heap access"); 778 FAIL(expr->key(), "expected >> in heap access");
779 } 779 }
780 RECURSE(VisitWithExpectation(bin->left(), cache_.kAsmSigned, 780 RECURSE(VisitWithExpectation(bin->left(), cache_.kAsmSigned,
781 "array index expected to be integer")); 781 "array index expected to be integer"));
782 Literal* right = bin->right()->AsLiteral(); 782 Literal* right = bin->right()->AsLiteral();
783 if (right == NULL || right->raw_value()->ContainsDot()) { 783 if (right == NULL || right->raw_value()->ContainsDot()) {
784 FAIL(right, "heap access shift must be integer"); 784 FAIL(bin->right(), "heap access shift must be integer");
785 } 785 }
786 RECURSE(VisitWithExpectation(bin->right(), cache_.kAsmSigned, 786 RECURSE(VisitWithExpectation(bin->right(), cache_.kAsmSigned,
787 "array shift expected to be integer")); 787 "array shift expected to be integer"));
788 int n = static_cast<int>(right->raw_value()->AsNumber()); 788 int n = static_cast<int>(right->raw_value()->AsNumber());
789 if (expected_shift < 0 || n != expected_shift) { 789 if (expected_shift < 0 || n != expected_shift) {
790 FAIL(right, "heap access shift must match element size"); 790 FAIL(right, "heap access shift must match element size");
791 } 791 }
792 } 792 }
793 expr->key()->set_bounds(Bounds(cache_.kAsmSigned)); 793 expr->key()->set_bounds(Bounds(cache_.kAsmSigned));
794 } 794 }
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
1615 } 1615 }
1616 1616
1617 1617
1618 void AsmTyper::VisitRewritableExpression(RewritableExpression* expr) { 1618 void AsmTyper::VisitRewritableExpression(RewritableExpression* expr) {
1619 RECURSE(Visit(expr->expression())); 1619 RECURSE(Visit(expr->expression()));
1620 } 1620 }
1621 1621
1622 1622
1623 } // namespace internal 1623 } // namespace internal
1624 } // namespace v8 1624 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-599825.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698