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

Side by Side Diff: src/code-stubs-hydrogen.cc

Issue 965723002: Ensure we can reliably check the cell for validity of global property (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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 | « src/code-stubs.h ('k') | src/deoptimizer.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/bailout-reason.h" 7 #include "src/bailout-reason.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/field-index.h" 9 #include "src/field-index.h"
10 #include "src/hydrogen.h" 10 #include "src/hydrogen.h"
(...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 StoreGlobalStub* stub = casted_stub(); 1331 StoreGlobalStub* stub = casted_stub();
1332 HParameter* value = GetParameter(StoreDescriptor::kValueIndex); 1332 HParameter* value = GetParameter(StoreDescriptor::kValueIndex);
1333 if (stub->check_global()) { 1333 if (stub->check_global()) {
1334 // Check that the map of the global has not changed: use a placeholder map 1334 // Check that the map of the global has not changed: use a placeholder map
1335 // that will be replaced later with the global object's map. 1335 // that will be replaced later with the global object's map.
1336 HParameter* proxy = GetParameter(StoreDescriptor::kReceiverIndex); 1336 HParameter* proxy = GetParameter(StoreDescriptor::kReceiverIndex);
1337 HValue* proxy_map = 1337 HValue* proxy_map =
1338 Add<HLoadNamedField>(proxy, nullptr, HObjectAccess::ForMap()); 1338 Add<HLoadNamedField>(proxy, nullptr, HObjectAccess::ForMap());
1339 HValue* global = 1339 HValue* global =
1340 Add<HLoadNamedField>(proxy_map, nullptr, HObjectAccess::ForPrototype()); 1340 Add<HLoadNamedField>(proxy_map, nullptr, HObjectAccess::ForPrototype());
1341 Handle<Map> placeholder_map = isolate()->factory()->meta_map(); 1341 HValue* current_global = Add<HLoadNamedField>(
1342 HValue* cell = Add<HConstant>(Map::WeakCellForMap(placeholder_map)); 1342 context(), nullptr,
1343 HValue* expected_map = 1343 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
1344 Add<HLoadNamedField>(cell, nullptr, HObjectAccess::ForWeakCellValue()); 1344 IfBuilder global_check(this);
1345 HValue* map = 1345 global_check.IfNot<HCompareObjectEqAndBranch>(global, current_global);
1346 Add<HLoadNamedField>(global, nullptr, HObjectAccess::ForMap()); 1346 global_check.ThenDeopt(Deoptimizer::kCrossContextGlobalStore);
1347 IfBuilder map_check(this); 1347 global_check.End();
1348 map_check.IfNot<HCompareObjectEqAndBranch>(expected_map, map);
1349 map_check.ThenDeopt(Deoptimizer::kUnknownMap);
1350 map_check.End();
1351 } 1348 }
1352 1349
1353 HValue* weak_cell = Add<HConstant>(isolate()->factory()->NewWeakCell( 1350 HValue* weak_cell = Add<HConstant>(isolate()->factory()->NewWeakCell(
1354 StoreGlobalStub::property_cell_placeholder(isolate()))); 1351 StoreGlobalStub::property_cell_placeholder(isolate())));
1355 HValue* cell = Add<HLoadNamedField>(weak_cell, nullptr, 1352 HValue* cell = Add<HLoadNamedField>(weak_cell, nullptr,
1356 HObjectAccess::ForWeakCellValue()); 1353 HObjectAccess::ForWeakCellValue());
1354 Add<HCheckHeapObject>(cell);
1357 HObjectAccess access(HObjectAccess::ForCellPayload(isolate())); 1355 HObjectAccess access(HObjectAccess::ForCellPayload(isolate()));
1358 HValue* cell_contents = Add<HLoadNamedField>(cell, nullptr, access); 1356 HValue* cell_contents = Add<HLoadNamedField>(cell, nullptr, access);
1359 1357
1360 if (stub->is_constant()) { 1358 if (stub->is_constant()) {
1361 IfBuilder builder(this); 1359 IfBuilder builder(this);
1362 builder.If<HCompareObjectEqAndBranch>(cell_contents, value); 1360 builder.If<HCompareObjectEqAndBranch>(cell_contents, value);
1363 builder.Then(); 1361 builder.Then();
1364 builder.ElseDeopt( 1362 builder.ElseDeopt(
1365 Deoptimizer::kUnexpectedCellContentsInConstantGlobalStore); 1363 Deoptimizer::kUnexpectedCellContentsInConstantGlobalStore);
1366 builder.End(); 1364 builder.End();
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after
2248 // megamorphic case is handled as part of the default stub. 2246 // megamorphic case is handled as part of the default stub.
2249 DCHECK(!FLAG_vector_ics); 2247 DCHECK(!FLAG_vector_ics);
2250 2248
2251 // Probe the stub cache. 2249 // Probe the stub cache.
2252 Add<HTailCallThroughMegamorphicCache>(receiver, name); 2250 Add<HTailCallThroughMegamorphicCache>(receiver, name);
2253 2251
2254 // We never continue. 2252 // We never continue.
2255 return graph()->GetConstant0(); 2253 return graph()->GetConstant0();
2256 } 2254 }
2257 } } // namespace v8::internal 2255 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/deoptimizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698