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

Side by Side Diff: src/code-stub-assembler.cc

Issue 2188993003: [stubs] Port CreateWeakCellStub to turbofan (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix stack overflow Created 4 years, 4 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
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/code-stub-assembler.h" 5 #include "src/code-stub-assembler.h"
6 #include "src/code-factory.h" 6 #include "src/code-factory.h"
7 #include "src/frames-inl.h" 7 #include "src/frames-inl.h"
8 #include "src/frames.h" 8 #include "src/frames.h"
9 #include "src/ic/stub-cache.h" 9 #include "src/ic/stub-cache.h"
10 10
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 return StoreNoWriteBarrier(rep, object, 884 return StoreNoWriteBarrier(rep, object,
885 IntPtrConstant(offset - kHeapObjectTag), value); 885 IntPtrConstant(offset - kHeapObjectTag), value);
886 } 886 }
887 887
888 Node* CodeStubAssembler::StoreMapNoWriteBarrier(Node* object, Node* map) { 888 Node* CodeStubAssembler::StoreMapNoWriteBarrier(Node* object, Node* map) {
889 return StoreNoWriteBarrier( 889 return StoreNoWriteBarrier(
890 MachineRepresentation::kTagged, object, 890 MachineRepresentation::kTagged, object,
891 IntPtrConstant(HeapNumber::kMapOffset - kHeapObjectTag), map); 891 IntPtrConstant(HeapNumber::kMapOffset - kHeapObjectTag), map);
892 } 892 }
893 893
894 Node* CodeStubAssembler::StoreObjectFieldRoot(Node* object, int offset,
895 Heap::RootListIndex root_index) {
896 if (Heap::RootIsImmortalImmovable(root_index)) {
897 return StoreObjectFieldNoWriteBarrier(object, offset, LoadRoot(root_index));
898 } else {
899 return StoreObjectField(object, offset, LoadRoot(root_index));
900 }
901 }
902
894 Node* CodeStubAssembler::StoreFixedArrayElement(Node* object, Node* index_node, 903 Node* CodeStubAssembler::StoreFixedArrayElement(Node* object, Node* index_node,
895 Node* value, 904 Node* value,
896 WriteBarrierMode barrier_mode, 905 WriteBarrierMode barrier_mode,
897 ParameterMode parameter_mode) { 906 ParameterMode parameter_mode) {
898 DCHECK(barrier_mode == SKIP_WRITE_BARRIER || 907 DCHECK(barrier_mode == SKIP_WRITE_BARRIER ||
899 barrier_mode == UPDATE_WRITE_BARRIER); 908 barrier_mode == UPDATE_WRITE_BARRIER);
900 Node* offset = 909 Node* offset =
901 ElementOffsetFromIndex(index_node, FAST_HOLEY_ELEMENTS, parameter_mode, 910 ElementOffsetFromIndex(index_node, FAST_HOLEY_ELEMENTS, parameter_mode,
902 FixedArray::kHeaderSize - kHeapObjectTag); 911 FixedArray::kHeaderSize - kHeapObjectTag);
903 MachineRepresentation rep = MachineRepresentation::kTagged; 912 MachineRepresentation rep = MachineRepresentation::kTagged;
(...skipping 2343 matching lines...) Expand 10 before | Expand all | Expand 10 after
3247 Bind(&next); 3256 Bind(&next);
3248 { 3257 {
3249 // For all objects but the receiver, check that the cache is empty. 3258 // For all objects but the receiver, check that the cache is empty.
3250 current_map.Bind(LoadMap(current_js_object.value())); 3259 current_map.Bind(LoadMap(current_js_object.value()));
3251 Node* enum_length = EnumLength(current_map.value()); 3260 Node* enum_length = EnumLength(current_map.value());
3252 Node* zero_constant = SmiConstant(Smi::FromInt(0)); 3261 Node* zero_constant = SmiConstant(Smi::FromInt(0));
3253 BranchIf(WordEqual(enum_length, zero_constant), &loop, use_runtime); 3262 BranchIf(WordEqual(enum_length, zero_constant), &loop, use_runtime);
3254 } 3263 }
3255 } 3264 }
3256 3265
3266 Node* CodeStubAssembler::CreateWeakCellInFeedbackVector(Node* feedback_vector,
3267 Node* slot,
3268 Node* value) {
3269 Node* size = IntPtrConstant(WeakCell::kSize);
3270 Node* cell = Allocate(size, compiler::CodeAssembler::kPretenured);
3271
3272 // Initialize the WeakCell.
3273 StoreObjectFieldRoot(cell, WeakCell::kMapOffset, Heap::kWeakCellMapRootIndex);
3274 StoreObjectField(cell, WeakCell::kValueOffset, value);
3275 StoreObjectFieldRoot(cell, WeakCell::kNextOffset,
3276 Heap::kTheHoleValueRootIndex);
3277
3278 // Store the WeakCell in the feedback vector.
3279 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER,
3280 CodeStubAssembler::SMI_PARAMETERS);
3281 return cell;
3282 }
3283
3257 } // namespace internal 3284 } // namespace internal
3258 } // namespace v8 3285 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698