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

Side by Side Diff: src/compiler/js-global-object-specialization.cc

Issue 2456763002: Merged: [compiler] Properly validate stable map assumption for globals. (Closed)
Patch Set: Created 4 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
« no previous file with comments | « src/bailout-reason.h ('k') | src/crankshaft/hydrogen.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/compiler/js-global-object-specialization.h" 5 #include "src/compiler/js-global-object-specialization.h"
6 6
7 #include "src/compilation-dependencies.h" 7 #include "src/compilation-dependencies.h"
8 #include "src/compiler/access-builder.h" 8 #include "src/compiler/access-builder.h"
9 #include "src/compiler/common-operator.h" 9 #include "src/compiler/common-operator.h"
10 #include "src/compiler/js-graph.h" 10 #include "src/compiler/js-graph.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 effect = 174 effect =
175 graph()->NewNode(simplified()->CheckIf(), check, effect, control); 175 graph()->NewNode(simplified()->CheckIf(), check, effect, control);
176 break; 176 break;
177 } 177 }
178 case PropertyCellType::kConstantType: { 178 case PropertyCellType::kConstantType: {
179 // Record a code dependency on the cell, and just deoptimize if the new 179 // Record a code dependency on the cell, and just deoptimize if the new
180 // values' type doesn't match the type of the previous value in the cell. 180 // values' type doesn't match the type of the previous value in the cell.
181 dependencies()->AssumePropertyCell(property_cell); 181 dependencies()->AssumePropertyCell(property_cell);
182 Type* property_cell_value_type; 182 Type* property_cell_value_type;
183 if (property_cell_value->IsHeapObject()) { 183 if (property_cell_value->IsHeapObject()) {
184 // We cannot do anything if the {property_cell_value}s map is no
185 // longer stable.
186 Handle<Map> property_cell_value_map(
187 Handle<HeapObject>::cast(property_cell_value)->map(), isolate());
188 if (!property_cell_value_map->is_stable()) return NoChange();
189 dependencies()->AssumeMapStable(property_cell_value_map);
190
184 // Check that the {value} is a HeapObject. 191 // Check that the {value} is a HeapObject.
185 value = effect = graph()->NewNode(simplified()->CheckTaggedPointer(), 192 value = effect = graph()->NewNode(simplified()->CheckTaggedPointer(),
186 value, effect, control); 193 value, effect, control);
187 194
188 // Check {value} map agains the {property_cell} map. 195 // Check {value} map agains the {property_cell} map.
189 Handle<Map> property_cell_value_map(
190 Handle<HeapObject>::cast(property_cell_value)->map(), isolate());
191 effect = graph()->NewNode( 196 effect = graph()->NewNode(
192 simplified()->CheckMaps(1), value, 197 simplified()->CheckMaps(1), value,
193 jsgraph()->HeapConstant(property_cell_value_map), effect, control); 198 jsgraph()->HeapConstant(property_cell_value_map), effect, control);
194 property_cell_value_type = Type::TaggedPointer(); 199 property_cell_value_type = Type::TaggedPointer();
195 } else { 200 } else {
196 // Check that the {value} is a Smi. 201 // Check that the {value} is a Smi.
197 value = effect = graph()->NewNode(simplified()->CheckTaggedSigned(), 202 value = effect = graph()->NewNode(simplified()->CheckTaggedSigned(),
198 value, effect, control); 203 value, effect, control);
199 property_cell_value_type = Type::TaggedSigned(); 204 property_cell_value_type = Type::TaggedSigned();
200 } 205 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 } 277 }
273 278
274 279
275 SimplifiedOperatorBuilder* JSGlobalObjectSpecialization::simplified() const { 280 SimplifiedOperatorBuilder* JSGlobalObjectSpecialization::simplified() const {
276 return jsgraph()->simplified(); 281 return jsgraph()->simplified();
277 } 282 }
278 283
279 } // namespace compiler 284 } // namespace compiler
280 } // namespace internal 285 } // namespace internal
281 } // namespace v8 286 } // namespace v8
OLDNEW
« no previous file with comments | « src/bailout-reason.h ('k') | src/crankshaft/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698