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

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

Issue 2041843002: [asmjs] Validator should reject assignments to heap variables in functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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-617529.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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 RECURSE(VisitWithExpectation( 675 RECURSE(VisitWithExpectation(
676 expr->value(), type, "assignment value expected to match surrounding")); 676 expr->value(), type, "assignment value expected to match surrounding"));
677 Type* target_type = StorageType(computed_type_); 677 Type* target_type = StorageType(computed_type_);
678 678
679 if (expr->target()->IsVariableProxy()) { 679 if (expr->target()->IsVariableProxy()) {
680 // Assignment to a local or context variable. 680 // Assignment to a local or context variable.
681 VariableProxy* proxy = expr->target()->AsVariableProxy(); 681 VariableProxy* proxy = expr->target()->AsVariableProxy();
682 if (intish_ != 0) { 682 if (intish_ != 0) {
683 FAIL(expr, "intish or floatish assignment"); 683 FAIL(expr, "intish or floatish assignment");
684 } 684 }
685 if (in_function_ && target_type->IsArray()) {
686 FAIL(expr, "assignment to array variable");
687 }
685 expected_type_ = target_type; 688 expected_type_ = target_type;
686 Variable* var = proxy->var(); 689 Variable* var = proxy->var();
687 VariableInfo* info = GetVariableInfo(var); 690 VariableInfo* info = GetVariableInfo(var);
688 if (info == nullptr || info->type == nullptr) { 691 if (info == nullptr || info->type == nullptr) {
689 if (var->mode() == TEMPORARY) { 692 if (var->mode() == TEMPORARY) {
690 SetType(var, Type::Any()); 693 SetType(var, Type::Any());
691 info = GetVariableInfo(var); 694 info = GetVariableInfo(var);
692 } else { 695 } else {
693 FAIL(proxy, "unbound variable"); 696 FAIL(proxy, "unbound variable");
694 } 697 }
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after
1630 } 1633 }
1631 1634
1632 1635
1633 void AsmTyper::VisitRewritableExpression(RewritableExpression* expr) { 1636 void AsmTyper::VisitRewritableExpression(RewritableExpression* expr) {
1634 RECURSE(Visit(expr->expression())); 1637 RECURSE(Visit(expr->expression()));
1635 } 1638 }
1636 1639
1637 1640
1638 } // namespace internal 1641 } // namespace internal
1639 } // namespace v8 1642 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-617529.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698