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

Unified Diff: src/code-stubs.cc

Issue 2544793002: [stubs] Cleanup storing of maps to objects. (Closed)
Patch Set: Created 4 years 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-stub-assembler.cc ('k') | src/compiler/code-assembler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs.cc
diff --git a/src/code-stubs.cc b/src/code-stubs.cc
index 46ad63b4a4bdc3803bea4faf9528274c2d667764..8600350d0f38d5d081c1c203a923a0dcc296bffc 100644
--- a/src/code-stubs.cc
+++ b/src/code-stubs.cc
@@ -478,7 +478,7 @@ void StoreMapStub::GenerateAssembly(compiler::CodeAssemblerState* state) const {
Node* map = assembler.Parameter(Descriptor::kMap);
Node* value = assembler.Parameter(Descriptor::kValue);
- assembler.StoreObjectField(receiver, JSObject::kMapOffset, map);
+ assembler.StoreMap(receiver, map);
assembler.Return(value);
}
@@ -521,7 +521,7 @@ void StoreTransitionStub::GenerateAssembly(
// And finally update the map.
assembler.Comment("Store map");
- assembler.StoreObjectField(receiver, JSObject::kMapOffset, map);
+ assembler.StoreMap(receiver, map);
assembler.Return(value);
// Only store to tagged field never bails out.
@@ -2233,9 +2233,8 @@ compiler::Node* FastCloneShallowObjectStub::GenerateFastPath(
if (FLAG_allocation_site_pretenuring) {
Node* memento = assembler->InnerAllocate(copy, object_size);
- assembler->StoreObjectFieldNoWriteBarrier(
- memento, HeapObject::kMapOffset,
- assembler->LoadRoot(Heap::kAllocationMementoMapRootIndex));
+ assembler->StoreMapNoWriteBarrier(memento,
+ Heap::kAllocationMementoMapRootIndex);
assembler->StoreObjectFieldNoWriteBarrier(
memento, AllocationMemento::kAllocationSiteOffset, allocation_site);
Node* memento_create_count = assembler->LoadObjectField(
@@ -2602,10 +2601,8 @@ compiler::Node* FastNewFunctionContextStub::Generate(
// Create a new closure from the given function info in new space
Node* function_context = assembler->Allocate(size);
- Isolate* isolate = assembler->isolate();
- assembler->StoreMapNoWriteBarrier(
- function_context,
- assembler->HeapConstant(isolate->factory()->function_context_map()));
+ assembler->StoreMapNoWriteBarrier(function_context,
+ Heap::kFunctionContextMapRootIndex);
assembler->StoreObjectFieldNoWriteBarrier(function_context,
Context::kLengthOffset,
assembler->SmiFromWord32(length));
@@ -2734,10 +2731,14 @@ compiler::Node* NonEmptyShallowClone(CodeStubAssembler* assembler,
kind, boilerplate_map, length, allocation_site, capacity, param_mode);
assembler->Comment("copy elements header");
- for (int offset = 0; offset < FixedArrayBase::kHeaderSize;
- offset += kPointerSize) {
- Node* value = assembler->LoadObjectField(boilerplate_elements, offset);
- assembler->StoreObjectField(elements, offset, value);
+ // Header consists of map and length.
+ STATIC_ASSERT(FixedArrayBase::kHeaderSize == 2 * kPointerSize);
+ assembler->StoreMap(elements, assembler->LoadMap(boilerplate_elements));
+ {
+ int offset = FixedArrayBase::kLengthOffset;
+ assembler->StoreObjectFieldNoWriteBarrier(
+ elements, offset,
+ assembler->LoadObjectField(boilerplate_elements, offset));
}
if (assembler->Is64()) {
« no previous file with comments | « src/code-stub-assembler.cc ('k') | src/compiler/code-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698