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

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

Issue 1692713006: Allow looser heap accesses historically emitted by Emscripten. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 4 years, 10 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 | src/wasm/asm-wasm-builder.cc » ('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 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 // bin->set_bounds(Bounds(cache_.kAsmSigned)); 758 // bin->set_bounds(Bounds(cache_.kAsmSigned));
759 RECURSE(VisitWithExpectation(expr->key(), cache_.kAsmSigned, 759 RECURSE(VisitWithExpectation(expr->key(), cache_.kAsmSigned,
760 "must be integer")); 760 "must be integer"));
761 IntersectResult(expr, type); 761 IntersectResult(expr, type);
762 } else { 762 } else {
763 Literal* literal = expr->key()->AsLiteral(); 763 Literal* literal = expr->key()->AsLiteral();
764 if (literal) { 764 if (literal) {
765 RECURSE(VisitWithExpectation(literal, cache_.kAsmSigned, 765 RECURSE(VisitWithExpectation(literal, cache_.kAsmSigned,
766 "array index expected to be integer")); 766 "array index expected to be integer"));
767 } else { 767 } else {
768 BinaryOperation* bin = expr->key()->AsBinaryOperation(); 768 int expected_shift = ElementShiftSize(type);
769 if (bin == NULL || bin->op() != Token::SAR) { 769 if (expected_shift == 0) {
770 FAIL(expr->key(), "expected >> in heap access"); 770 RECURSE(Visit(expr->key()));
771 } else {
772 BinaryOperation* bin = expr->key()->AsBinaryOperation();
773 if (bin == NULL || bin->op() != Token::SAR) {
774 FAIL(expr->key(), "expected >> in heap access");
775 }
776 RECURSE(VisitWithExpectation(bin->left(), cache_.kAsmSigned,
777 "array index expected to be integer"));
778 Literal* right = bin->right()->AsLiteral();
779 if (right == NULL || right->raw_value()->ContainsDot()) {
780 FAIL(right, "heap access shift must be integer");
781 }
782 RECURSE(VisitWithExpectation(bin->right(), cache_.kAsmSigned,
783 "array shift expected to be integer"));
784 int n = static_cast<int>(right->raw_value()->AsNumber());
785 if (expected_shift < 0 || n != expected_shift) {
786 FAIL(right, "heap access shift must match element size");
787 }
771 } 788 }
772 RECURSE(VisitWithExpectation(bin->left(), cache_.kAsmSigned, 789 expr->key()->set_bounds(Bounds(cache_.kAsmSigned));
773 "array index expected to be integer"));
774 Literal* right = bin->right()->AsLiteral();
775 if (right == NULL || right->raw_value()->ContainsDot()) {
776 FAIL(right, "heap access shift must be integer");
777 }
778 RECURSE(VisitWithExpectation(bin->right(), cache_.kAsmSigned,
779 "array shift expected to be integer"));
780 int n = static_cast<int>(right->raw_value()->AsNumber());
781 int expected_shift = ElementShiftSize(type);
782 if (expected_shift < 0 || n != expected_shift) {
783 FAIL(right, "heap access shift must match element size");
784 }
785 bin->set_bounds(Bounds(cache_.kAsmSigned));
786 } 790 }
787 Type* result_type; 791 Type* result_type;
788 if (type->Is(cache_.kAsmIntArrayElement)) { 792 if (type->Is(cache_.kAsmIntArrayElement)) {
789 result_type = cache_.kAsmIntQ; 793 result_type = cache_.kAsmIntQ;
790 intish_ = kMaxUncombinedAdditiveSteps; 794 intish_ = kMaxUncombinedAdditiveSteps;
791 } else if (type->Is(cache_.kAsmFloat)) { 795 } else if (type->Is(cache_.kAsmFloat)) {
792 if (assigning) { 796 if (assigning) {
793 result_type = cache_.kAsmFloatDoubleQ; 797 result_type = cache_.kAsmFloatDoubleQ;
794 } else { 798 } else {
795 result_type = cache_.kAsmFloatQ; 799 result_type = cache_.kAsmFloatQ;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 #undef V 897 #undef V
894 if (IsStdlibObject(expr->obj())) { 898 if (IsStdlibObject(expr->obj())) {
895 VisitLibraryAccess(&stdlib_types_, expr); 899 VisitLibraryAccess(&stdlib_types_, expr);
896 return; 900 return;
897 } 901 }
898 902
899 property_info_ = NULL; 903 property_info_ = NULL;
900 904
901 // Only recurse at this point so that we avoid needing 905 // Only recurse at this point so that we avoid needing
902 // stdlib.Math to have a real type. 906 // stdlib.Math to have a real type.
903 RECURSE(VisitWithExpectation(expr->obj(), Type::Any(), "bad propety object")); 907 RECURSE(
908 VisitWithExpectation(expr->obj(), Type::Any(), "bad property object"));
904 909
905 // For heap view or function table access. 910 // For heap view or function table access.
906 if (computed_type_->IsArray()) { 911 if (computed_type_->IsArray()) {
907 VisitHeapAccess(expr, false, NULL); 912 VisitHeapAccess(expr, false, NULL);
908 return; 913 return;
909 } 914 }
910 915
911 VariableProxy* proxy = expr->obj()->AsVariableProxy(); 916 VariableProxy* proxy = expr->obj()->AsVariableProxy();
912 if (proxy != NULL) { 917 if (proxy != NULL) {
913 Variable* var = proxy->var(); 918 Variable* var = proxy->var();
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
1547 1552
1548 1553
1549 void AsmTyper::VisitRewritableAssignmentExpression( 1554 void AsmTyper::VisitRewritableAssignmentExpression(
1550 RewritableAssignmentExpression* expr) { 1555 RewritableAssignmentExpression* expr) {
1551 RECURSE(Visit(expr->expression())); 1556 RECURSE(Visit(expr->expression()));
1552 } 1557 }
1553 1558
1554 1559
1555 } // namespace internal 1560 } // namespace internal
1556 } // namespace v8 1561 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/wasm/asm-wasm-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698