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

Unified Diff: src/code-stubs-hydrogen.cc

Issue 2322373002: [stubs] Port StoreGlobalStub to TurboFan. (Closed)
Patch Set: Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/code-stubs.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs-hydrogen.cc
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc
index a7e33da54fccab0d3b3f007c110c35159ab6cd8a..57402362e861ff152d74dd0dd931b80ea7ab4d12 100644
--- a/src/code-stubs-hydrogen.cc
+++ b/src/code-stubs-hydrogen.cc
@@ -1520,99 +1520,6 @@ HValue* CodeStubGraphBuilder<ToBooleanICStub>::BuildCodeInitializedStub() {
Handle<Code> ToBooleanICStub::GenerateCode() { return DoGenerateCode(this); }
template <>
-HValue* CodeStubGraphBuilder<StoreGlobalStub>::BuildCodeInitializedStub() {
- StoreGlobalStub* stub = casted_stub();
- HParameter* value = GetParameter(Descriptor::kValue);
- 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(Descriptor::kReceiver);
- HValue* proxy_map =
- Add<HLoadNamedField>(proxy, nullptr, HObjectAccess::ForMap());
- HValue* global =
- Add<HLoadNamedField>(proxy_map, nullptr, HObjectAccess::ForPrototype());
- HValue* map_cell = Add<HConstant>(isolate()->factory()->NewWeakCell(
- StoreGlobalStub::global_map_placeholder(isolate())));
- HValue* expected_map = Add<HLoadNamedField>(
- map_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(DeoptimizeReason::kUnknownMap);
- map_check.End();
- }
-
- HValue* weak_cell = Add<HConstant>(isolate()->factory()->NewWeakCell(
- StoreGlobalStub::property_cell_placeholder(isolate())));
- HValue* cell = Add<HLoadNamedField>(weak_cell, nullptr,
- HObjectAccess::ForWeakCellValue());
- Add<HCheckHeapObject>(cell);
- HObjectAccess access = HObjectAccess::ForPropertyCellValue();
- // Load the payload of the global parameter cell. A hole indicates that the
- // cell has been invalidated and that the store must be handled by the
- // runtime.
- HValue* cell_contents = Add<HLoadNamedField>(cell, nullptr, access);
-
- auto cell_type = stub->cell_type();
- if (cell_type == PropertyCellType::kConstant ||
- cell_type == PropertyCellType::kUndefined) {
- // This is always valid for all states a cell can be in.
- IfBuilder builder(this);
- builder.If<HCompareObjectEqAndBranch>(cell_contents, value);
- builder.Then();
- builder.ElseDeopt(
- DeoptimizeReason::kUnexpectedCellContentsInConstantGlobalStore);
- builder.End();
- } else {
- IfBuilder builder(this);
- HValue* hole_value = graph()->GetConstantHole();
- builder.If<HCompareObjectEqAndBranch>(cell_contents, hole_value);
- builder.Then();
- builder.Deopt(DeoptimizeReason::kUnexpectedCellContentsInGlobalStore);
- builder.Else();
- // When dealing with constant types, the type may be allowed to change, as
- // long as optimized code remains valid.
- if (cell_type == PropertyCellType::kConstantType) {
- switch (stub->constant_type()) {
- case PropertyCellConstantType::kSmi:
- access = access.WithRepresentation(Representation::Smi());
- break;
- case PropertyCellConstantType::kStableMap: {
- // It is sufficient here to check that the value and cell contents
- // have identical maps, no matter if they are stable or not or if they
- // are the maps that were originally in the cell or not. If optimized
- // code will deopt when a cell has a unstable map and if it has a
- // dependency on a stable map, it will deopt if the map destabilizes.
- Add<HCheckHeapObject>(value);
- Add<HCheckHeapObject>(cell_contents);
- HValue* expected_map = Add<HLoadNamedField>(cell_contents, nullptr,
- HObjectAccess::ForMap());
- HValue* map =
- Add<HLoadNamedField>(value, nullptr, HObjectAccess::ForMap());
- IfBuilder map_check(this);
- map_check.IfNot<HCompareObjectEqAndBranch>(expected_map, map);
- map_check.ThenDeopt(DeoptimizeReason::kUnknownMap);
- map_check.End();
- access = access.WithRepresentation(Representation::HeapObject());
- break;
- }
- }
- }
- Add<HStoreNamedField>(cell, access, value);
- builder.End();
- }
-
- return value;
-}
-
-
-Handle<Code> StoreGlobalStub::GenerateCode() {
- return DoGenerateCode(this);
-}
-
-
-template <>
HValue* CodeStubGraphBuilder<ElementsTransitionAndStoreStub>::BuildCodeStub() {
HValue* object = GetParameter(StoreTransitionHelper::ReceiverIndex());
HValue* key = GetParameter(StoreTransitionHelper::NameIndex());
« no previous file with comments | « src/code-stubs.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698