Index: src/code-stubs-hydrogen.cc |
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc |
index c679d4c3f56bca0efde13b763756b81216526777..826c1dd730031deef5332b8cbfeb2083d60e939f 100644 |
--- a/src/code-stubs-hydrogen.cc |
+++ b/src/code-stubs-hydrogen.cc |
@@ -1313,16 +1313,25 @@ HValue* CodeStubGraphBuilder<StoreGlobalStub>::BuildCodeInitializedStub() { |
Handle<Object> placeholer_value(Smi::FromInt(0), isolate()); |
Handle<PropertyCell> placeholder_cell = |
isolate()->factory()->NewPropertyCell(placeholer_value); |
- |
HParameter* value = GetParameter(StoreDescriptor::kValueIndex); |
- |
if (stub->check_global()) { |
// Check that the map of the global has not changed: use a placeholder map |
// that will be replaced later with the global object's map. |
+ HParameter* proxy = GetParameter(StoreDescriptor::kReceiverIndex); |
+ HValue* proxy_map = |
+ Add<HLoadNamedField>(proxy, nullptr, HObjectAccess::ForMap()); |
+ HValue* global = |
+ Add<HLoadNamedField>(proxy_map, nullptr, HObjectAccess::ForPrototype()); |
Handle<Map> placeholder_map = isolate()->factory()->meta_map(); |
- HValue* global = Add<HConstant>( |
- StoreGlobalStub::global_placeholder(isolate())); |
- Add<HCheckMaps>(global, placeholder_map); |
+ HValue* cell = Add<HConstant>(Map::WeakCellForMap(placeholder_map)); |
+ HValue* expected_map = |
+ Add<HLoadNamedField>(cell, nullptr, HObjectAccess::ForWeakCellValue()); |
+ HValue* map = |
+ Add<HLoadNamedField>(global, nullptr, HObjectAccess::ForMap()); |
+ IfBuilder map_check(this); |
+ map_check.IfNot<HCompareObjectEqAndBranch>(expected_map, map); |
+ map_check.ThenDeopt("Unknown map"); |
+ map_check.End(); |
} |
HValue* cell = Add<HConstant>(placeholder_cell); |