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

Side by Side Diff: src/compiler/ast-graph-builder.cc

Issue 701853002: [turbofan] Fix deopt for assignments in non-effect context. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/compiler/ast-graph-builder.h" 5 #include "src/compiler/ast-graph-builder.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 #include "src/compiler/ast-loop-assignment-analyzer.h" 8 #include "src/compiler/ast-loop-assignment-analyzer.h"
9 #include "src/compiler/control-builders.h" 9 #include "src/compiler/control-builders.h"
10 #include "src/compiler/machine-operator.h" 10 #include "src/compiler/machine-operator.h"
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1166 environment()->Push(value); 1166 environment()->Push(value);
1167 } else { 1167 } else {
1168 VisitForValue(expr->value()); 1168 VisitForValue(expr->value());
1169 } 1169 }
1170 1170
1171 // Store the value. 1171 // Store the value.
1172 Node* value = environment()->Pop(); 1172 Node* value = environment()->Pop();
1173 switch (assign_type) { 1173 switch (assign_type) {
1174 case VARIABLE: { 1174 case VARIABLE: {
1175 Variable* variable = expr->target()->AsVariableProxy()->var(); 1175 Variable* variable = expr->target()->AsVariableProxy()->var();
1176 BuildVariableAssignment(variable, value, expr->op(), 1176 BuildVariableAssignment(variable, value, expr->op(), expr->AssignmentId(),
1177 expr->AssignmentId()); 1177 ast_context()->GetStateCombine());
1178 break; 1178 break;
1179 } 1179 }
1180 case NAMED_PROPERTY: { 1180 case NAMED_PROPERTY: {
1181 Node* object = environment()->Pop(); 1181 Node* object = environment()->Pop();
1182 Unique<Name> name = 1182 Unique<Name> name =
1183 MakeUnique(property->key()->AsLiteral()->AsPropertyName()); 1183 MakeUnique(property->key()->AsLiteral()->AsPropertyName());
1184 Node* store = 1184 Node* store =
1185 NewNode(javascript()->StoreNamed(strict_mode(), name), object, value); 1185 NewNode(javascript()->StoreNamed(strict_mode(), name), object, value);
1186 PrepareFrameState(store, expr->AssignmentId()); 1186 PrepareFrameState(store, expr->AssignmentId(),
1187 ast_context()->GetStateCombine());
1187 break; 1188 break;
1188 } 1189 }
1189 case KEYED_PROPERTY: { 1190 case KEYED_PROPERTY: {
1190 Node* key = environment()->Pop(); 1191 Node* key = environment()->Pop();
1191 Node* object = environment()->Pop(); 1192 Node* object = environment()->Pop();
1192 Node* store = NewNode(javascript()->StoreProperty(strict_mode()), object, 1193 Node* store = NewNode(javascript()->StoreProperty(strict_mode()), object,
1193 key, value); 1194 key, value);
1194 PrepareFrameState(store, expr->AssignmentId()); 1195 PrepareFrameState(store, expr->AssignmentId(),
1196 ast_context()->GetStateCombine());
1195 break; 1197 break;
1196 } 1198 }
1197 } 1199 }
1198 1200
1199 ast_context()->ProduceValue(value); 1201 ast_context()->ProduceValue(value);
1200 } 1202 }
1201 1203
1202 1204
1203 void AstGraphBuilder::VisitYield(Yield* expr) { 1205 void AstGraphBuilder::VisitYield(Yield* expr) {
1204 VisitForValue(expr->generator_object()); 1206 VisitForValue(expr->generator_object());
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
1950 Node* result = NewNode(op, current_context(), name); 1952 Node* result = NewNode(op, current_context(), name);
1951 PrepareFrameState(result, bailout_id, state_combine); 1953 PrepareFrameState(result, bailout_id, state_combine);
1952 return result; 1954 return result;
1953 } 1955 }
1954 } 1956 }
1955 UNREACHABLE(); 1957 UNREACHABLE();
1956 return NULL; 1958 return NULL;
1957 } 1959 }
1958 1960
1959 1961
1960 Node* AstGraphBuilder::BuildVariableAssignment(Variable* variable, Node* value, 1962 Node* AstGraphBuilder::BuildVariableAssignment(
1961 Token::Value op, 1963 Variable* variable, Node* value, Token::Value op, BailoutId bailout_id,
1962 BailoutId bailout_id) { 1964 OutputFrameStateCombine combine) {
1963 Node* the_hole = jsgraph()->TheHoleConstant(); 1965 Node* the_hole = jsgraph()->TheHoleConstant();
1964 VariableMode mode = variable->mode(); 1966 VariableMode mode = variable->mode();
1965 switch (variable->location()) { 1967 switch (variable->location()) {
1966 case Variable::UNALLOCATED: { 1968 case Variable::UNALLOCATED: {
1967 // Global var, const, or let variable. 1969 // Global var, const, or let variable.
1968 Node* global = BuildLoadGlobalObject(); 1970 Node* global = BuildLoadGlobalObject();
1969 Unique<Name> name = MakeUnique(variable->name()); 1971 Unique<Name> name = MakeUnique(variable->name());
1970 const Operator* op = javascript()->StoreNamed(strict_mode(), name); 1972 const Operator* op = javascript()->StoreNamed(strict_mode(), name);
1971 Node* store = NewNode(op, global, value); 1973 Node* store = NewNode(op, global, value);
1972 PrepareFrameState(store, bailout_id); 1974 PrepareFrameState(store, bailout_id, combine);
1973 return store; 1975 return store;
1974 } 1976 }
1975 case Variable::PARAMETER: 1977 case Variable::PARAMETER:
1976 case Variable::LOCAL: 1978 case Variable::LOCAL:
1977 // Local var, const, or let variable. 1979 // Local var, const, or let variable.
1978 if (mode == CONST_LEGACY && op == Token::INIT_CONST_LEGACY) { 1980 if (mode == CONST_LEGACY && op == Token::INIT_CONST_LEGACY) {
1979 // Perform an initialization check for legacy const variables. 1981 // Perform an initialization check for legacy const variables.
1980 Node* current = environment()->Lookup(variable); 1982 Node* current = environment()->Lookup(variable);
1981 if (current->op() != the_hole->op()) { 1983 if (current->op() != the_hole->op()) {
1982 value = BuildHoleCheckSilent(current, value, current); 1984 value = BuildHoleCheckSilent(current, value, current);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
2028 } 2030 }
2029 case Variable::LOOKUP: { 2031 case Variable::LOOKUP: {
2030 // Dynamic lookup of context variable (anywhere in the chain). 2032 // Dynamic lookup of context variable (anywhere in the chain).
2031 Node* name = jsgraph()->Constant(variable->name()); 2033 Node* name = jsgraph()->Constant(variable->name());
2032 Node* strict = jsgraph()->Constant(strict_mode()); 2034 Node* strict = jsgraph()->Constant(strict_mode());
2033 // TODO(mstarzinger): Use Runtime::kInitializeLegacyConstLookupSlot for 2035 // TODO(mstarzinger): Use Runtime::kInitializeLegacyConstLookupSlot for
2034 // initializations of const declarations. 2036 // initializations of const declarations.
2035 const Operator* op = 2037 const Operator* op =
2036 javascript()->CallRuntime(Runtime::kStoreLookupSlot, 4); 2038 javascript()->CallRuntime(Runtime::kStoreLookupSlot, 4);
2037 Node* store = NewNode(op, value, current_context(), name, strict); 2039 Node* store = NewNode(op, value, current_context(), name, strict);
2038 PrepareFrameState(store, bailout_id); 2040 PrepareFrameState(store, bailout_id, combine);
2039 return store; 2041 return store;
2040 } 2042 }
2041 } 2043 }
2042 UNREACHABLE(); 2044 UNREACHABLE();
2043 return NULL; 2045 return NULL;
2044 } 2046 }
2045 2047
2046 2048
2047 Node* AstGraphBuilder::BuildLoadObjectField(Node* object, int offset) { 2049 Node* AstGraphBuilder::BuildLoadObjectField(Node* object, int offset) {
2048 Node* field_load = NewNode(jsgraph()->machine()->Load(kMachAnyTagged), object, 2050 Node* field_load = NewNode(jsgraph()->machine()->Load(kMachAnyTagged), object,
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
2182 2184
2183 BitVector* AstGraphBuilder::GetVariablesAssignedInLoop( 2185 BitVector* AstGraphBuilder::GetVariablesAssignedInLoop(
2184 IterationStatement* stmt) { 2186 IterationStatement* stmt) {
2185 if (loop_assignment_analysis_ == NULL) return NULL; 2187 if (loop_assignment_analysis_ == NULL) return NULL;
2186 return loop_assignment_analysis_->GetVariablesAssignedInLoop(stmt); 2188 return loop_assignment_analysis_->GetVariablesAssignedInLoop(stmt);
2187 } 2189 }
2188 2190
2189 } // namespace compiler 2191 } // namespace compiler
2190 } // namespace internal 2192 } // namespace internal
2191 } // namespace v8 2193 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ast-graph-builder.h ('k') | test/mjsunit/regress/regress-assignment-in-test-context.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698