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

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

Issue 898723002: Use weak cell to embed property cell in StoreGlobal. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add comment about weak cells in FindAndReplace Created 5 years, 11 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.h ('k') | src/hydrogen-instructions.h » ('j') | 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 826c1dd730031deef5332b8cbfeb2083d60e939f..dd2f788b4bfa1283aa3fc420aa656b6c5631f5e9 100644
--- a/src/code-stubs-hydrogen.cc
+++ b/src/code-stubs-hydrogen.cc
@@ -1310,9 +1310,6 @@ Handle<Code> ToBooleanStub::GenerateCode() {
template <>
HValue* CodeStubGraphBuilder<StoreGlobalStub>::BuildCodeInitializedStub() {
StoreGlobalStub* stub = casted_stub();
- 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
@@ -1334,7 +1331,10 @@ HValue* CodeStubGraphBuilder<StoreGlobalStub>::BuildCodeInitializedStub() {
map_check.End();
}
- HValue* cell = Add<HConstant>(placeholder_cell);
+ HValue* weak_cell = Add<HConstant>(isolate()->factory()->NewWeakCell(
+ StoreGlobalStub::property_cell_placeholder(isolate())));
+ HValue* cell = Add<HLoadNamedField>(weak_cell, nullptr,
+ HObjectAccess::ForWeakCellValue());
HObjectAccess access(HObjectAccess::ForCellPayload(isolate()));
HValue* cell_contents = Add<HLoadNamedField>(cell, nullptr, access);
@@ -1354,7 +1354,8 @@ HValue* CodeStubGraphBuilder<StoreGlobalStub>::BuildCodeInitializedStub() {
builder.Then();
builder.Deopt("Unexpected cell contents in global store");
builder.Else();
- Add<HStoreNamedField>(cell, access, value);
+ HStoreNamedField* store = Add<HStoreNamedField>(cell, access, value);
+ store->MarkReceiverAsCell();
builder.End();
}
« no previous file with comments | « src/code-stubs.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698