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

Side by Side Diff: src/builtins/builtins-internal.cc

Issue 2227493002: [turbofan] Add initial support for growing stores. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add comments. 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
« no previous file with comments | « src/builtins/builtins.h ('k') | src/code-factory.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/builtins/builtins.h" 5 #include "src/builtins/builtins.h"
6 #include "src/builtins/builtins-utils.h" 6 #include "src/builtins/builtins-utils.h"
7 #include "src/interface-descriptors.h" 7 #include "src/interface-descriptors.h"
8 #include "src/macro-assembler.h" 8 #include "src/macro-assembler.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 void Builtins::Generate_InterruptCheck(MacroAssembler* masm) { 45 void Builtins::Generate_InterruptCheck(MacroAssembler* masm) {
46 masm->TailCallRuntime(Runtime::kInterrupt); 46 masm->TailCallRuntime(Runtime::kInterrupt);
47 } 47 }
48 48
49 void Builtins::Generate_StackCheck(MacroAssembler* masm) { 49 void Builtins::Generate_StackCheck(MacroAssembler* masm) {
50 masm->TailCallRuntime(Runtime::kStackGuard); 50 masm->TailCallRuntime(Runtime::kStackGuard);
51 } 51 }
52 52
53 // ----------------------------------------------------------------------------- 53 // -----------------------------------------------------------------------------
54 // FixedArray helpers. 54 // TurboFan support builtins.
55 55
56 void Builtins::Generate_CopyFixedArray(CodeStubAssembler* assembler) { 56 void Builtins::Generate_CopyFastSmiOrObjectElements(
57 CodeStubAssembler* assembler) {
57 typedef CodeStubAssembler::Label Label; 58 typedef CodeStubAssembler::Label Label;
58 typedef compiler::Node Node; 59 typedef compiler::Node Node;
59 typedef CodeStubAssembler::Variable Variable; 60 typedef CodeStubAssembler::Variable Variable;
60 typedef CopyFixedArrayDescriptor Descriptor; 61 typedef CopyFastSmiOrObjectElementsDescriptor Descriptor;
61 62
62 Node* source = assembler->Parameter(Descriptor::kSource); 63 Node* object = assembler->Parameter(Descriptor::kObject);
64
65 // Load the {object}s elements.
66 Node* source = assembler->LoadObjectField(object, JSObject::kElementsOffset);
63 67
64 // Load the {source} length. 68 // Load the {source} length.
65 Node* source_length_tagged = 69 Node* source_length_tagged =
66 assembler->LoadObjectField(source, FixedArray::kLengthOffset); 70 assembler->LoadObjectField(source, FixedArray::kLengthOffset);
67 Node* source_length = assembler->SmiToWord(source_length_tagged); 71 Node* source_length = assembler->SmiToWord(source_length_tagged);
68 72
69 // Compute the size of {source} in bytes. 73 // Compute the size of {source} in bytes.
70 Node* source_size = assembler->IntPtrAdd( 74 Node* source_size = assembler->IntPtrAdd(
71 assembler->WordShl(source_length, 75 assembler->WordShl(source_length,
72 assembler->IntPtrConstant(kPointerSizeLog2)), 76 assembler->IntPtrConstant(kPointerSizeLog2)),
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 assembler->StoreNoWriteBarrier(MachineRepresentation::kTagged, target, 119 assembler->StoreNoWriteBarrier(MachineRepresentation::kTagged, target,
116 offset, value); 120 offset, value);
117 121
118 // Increment {offset} and continue. 122 // Increment {offset} and continue.
119 var_offset.Bind(assembler->IntPtrAdd( 123 var_offset.Bind(assembler->IntPtrAdd(
120 offset, assembler->IntPtrConstant(kPointerSize))); 124 offset, assembler->IntPtrConstant(kPointerSize)));
121 assembler->Goto(&loop); 125 assembler->Goto(&loop);
122 } 126 }
123 127
124 assembler->Bind(&done_loop); 128 assembler->Bind(&done_loop);
125 assembler->Return(target); 129 {
130 // Update the {object}s element to {target}.
131 assembler->StoreObjectField(object, JSObject::kElementsOffset, target);
132 assembler->Return(target);
133 }
126 } 134 }
127 135
128 assembler->Bind(&if_oldspace); 136 assembler->Bind(&if_oldspace);
129 { 137 {
130 // Allocate the targeting FixedArray in old space 138 // Allocate the targeting FixedArray in old space
131 // (maybe even in large object space). 139 // (maybe even in large object space).
132 Node* flags = assembler->SmiConstant( 140 Node* flags = assembler->SmiConstant(
133 Smi::FromInt(AllocateDoubleAlignFlag::encode(false) | 141 Smi::FromInt(AllocateDoubleAlignFlag::encode(false) |
134 AllocateTargetSpace::encode(AllocationSpace::OLD_SPACE))); 142 AllocateTargetSpace::encode(AllocationSpace::OLD_SPACE)));
135 Node* source_size_tagged = assembler->SmiFromWord(source_size); 143 Node* source_size_tagged = assembler->SmiFromWord(source_size);
(...skipping 30 matching lines...) Expand all
166 // Store the {value} to the {target} with a proper write barrier. 174 // Store the {value} to the {target} with a proper write barrier.
167 assembler->Store(MachineRepresentation::kTagged, target, offset, value); 175 assembler->Store(MachineRepresentation::kTagged, target, offset, value);
168 176
169 // Increment {offset} and continue. 177 // Increment {offset} and continue.
170 var_offset.Bind(assembler->IntPtrAdd( 178 var_offset.Bind(assembler->IntPtrAdd(
171 offset, assembler->IntPtrConstant(kPointerSize))); 179 offset, assembler->IntPtrConstant(kPointerSize)));
172 assembler->Goto(&loop); 180 assembler->Goto(&loop);
173 } 181 }
174 182
175 assembler->Bind(&done_loop); 183 assembler->Bind(&done_loop);
176 assembler->Return(target); 184 {
185 // Update the {object}s element to {target}.
186 assembler->StoreObjectField(object, JSObject::kElementsOffset, target);
187 assembler->Return(target);
188 }
177 } 189 }
178 } 190 }
179 191
192 void Builtins::Generate_GrowFastDoubleElements(CodeStubAssembler* assembler) {
193 typedef CodeStubAssembler::Label Label;
194 typedef compiler::Node Node;
195 typedef GrowArrayElementsDescriptor Descriptor;
196
197 Node* object = assembler->Parameter(Descriptor::kObject);
198 Node* key = assembler->Parameter(Descriptor::kKey);
199 Node* context = assembler->Parameter(Descriptor::kContext);
200
201 Label runtime(assembler, CodeStubAssembler::Label::kDeferred);
202 Node* elements = assembler->LoadElements(object);
203 elements = assembler->CheckAndGrowElementsCapacity(
204 context, elements, FAST_DOUBLE_ELEMENTS, key, &runtime);
205 assembler->StoreObjectField(object, JSObject::kElementsOffset, elements);
206 assembler->Return(elements);
207
208 assembler->Bind(&runtime);
209 assembler->TailCallRuntime(Runtime::kGrowArrayElements, context, object, key);
210 }
211
212 void Builtins::Generate_GrowFastSmiOrObjectElements(
213 CodeStubAssembler* assembler) {
214 typedef CodeStubAssembler::Label Label;
215 typedef compiler::Node Node;
216 typedef GrowArrayElementsDescriptor Descriptor;
217
218 Node* object = assembler->Parameter(Descriptor::kObject);
219 Node* key = assembler->Parameter(Descriptor::kKey);
220 Node* context = assembler->Parameter(Descriptor::kContext);
221
222 Label runtime(assembler, CodeStubAssembler::Label::kDeferred);
223 Node* elements = assembler->LoadElements(object);
224 elements = assembler->CheckAndGrowElementsCapacity(
225 context, elements, FAST_ELEMENTS, key, &runtime);
226 assembler->StoreObjectField(object, JSObject::kElementsOffset, elements);
227 assembler->Return(elements);
228
229 assembler->Bind(&runtime);
230 assembler->TailCallRuntime(Runtime::kGrowArrayElements, context, object, key);
231 }
232
180 } // namespace internal 233 } // namespace internal
181 } // namespace v8 234 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins/builtins.h ('k') | src/code-factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698