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

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

Issue 2657293002: [csa] Return last value from BuildFastLoop to allow chaining sequential loops (Closed)
Patch Set: Created 3 years, 10 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/code-stub-assembler.h ('k') | no next file » | 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 #include "src/code-stub-assembler.h" 4 #include "src/code-stub-assembler.h"
5 #include "src/code-factory.h" 5 #include "src/code-factory.h"
6 #include "src/frames-inl.h" 6 #include "src/frames-inl.h"
7 #include "src/frames.h" 7 #include "src/frames.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 6232 matching lines...) Expand 10 before | Expand all | Expand 10 after
6243 StoreObjectField(cell, WeakCell::kValueOffset, value); 6243 StoreObjectField(cell, WeakCell::kValueOffset, value);
6244 StoreObjectFieldRoot(cell, WeakCell::kNextOffset, 6244 StoreObjectFieldRoot(cell, WeakCell::kNextOffset,
6245 Heap::kTheHoleValueRootIndex); 6245 Heap::kTheHoleValueRootIndex);
6246 6246
6247 // Store the WeakCell in the feedback vector. 6247 // Store the WeakCell in the feedback vector.
6248 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, 0, 6248 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, 0,
6249 CodeStubAssembler::SMI_PARAMETERS); 6249 CodeStubAssembler::SMI_PARAMETERS);
6250 return cell; 6250 return cell;
6251 } 6251 }
6252 6252
6253 void CodeStubAssembler::BuildFastLoop( 6253 Node* CodeStubAssembler::BuildFastLoop(
6254 const CodeStubAssembler::VariableList& vars, 6254 const CodeStubAssembler::VariableList& vars,
6255 MachineRepresentation index_rep, Node* start_index, Node* end_index, 6255 MachineRepresentation index_rep, Node* start_index, Node* end_index,
6256 const FastLoopBody& body, int increment, IndexAdvanceMode mode) { 6256 const FastLoopBody& body, int increment, IndexAdvanceMode mode) {
6257 Variable var(this, index_rep, start_index); 6257 Variable var(this, index_rep, start_index);
6258 VariableList vars_copy(vars, zone()); 6258 VariableList vars_copy(vars, zone());
6259 vars_copy.Add(&var, zone()); 6259 vars_copy.Add(&var, zone());
6260 Label loop(this, vars_copy); 6260 Label loop(this, vars_copy);
6261 Label after_loop(this); 6261 Label after_loop(this);
6262 // Introduce an explicit second check of the termination condition before the 6262 // Introduce an explicit second check of the termination condition before the
6263 // loop that helps turbofan generate better code. If there's only a single 6263 // loop that helps turbofan generate better code. If there's only a single
6264 // check, then the CodeStubAssembler forces it to be at the beginning of the 6264 // check, then the CodeStubAssembler forces it to be at the beginning of the
6265 // loop requiring a backwards branch at the end of the loop (it's not possible 6265 // loop requiring a backwards branch at the end of the loop (it's not possible
6266 // to force the loop header check at the end of the loop and branch forward to 6266 // to force the loop header check at the end of the loop and branch forward to
6267 // it from the pre-header). The extra branch is slower in the case that the 6267 // it from the pre-header). The extra branch is slower in the case that the
6268 // loop actually iterates. 6268 // loop actually iterates.
6269 Branch(WordEqual(var.value(), end_index), &after_loop, &loop); 6269 Branch(WordEqual(var.value(), end_index), &after_loop, &loop);
6270 Bind(&loop); 6270 Bind(&loop);
6271 { 6271 {
6272 if (mode == IndexAdvanceMode::kPre) { 6272 if (mode == IndexAdvanceMode::kPre) {
6273 Increment(var, increment); 6273 Increment(var, increment);
6274 } 6274 }
6275 body(var.value()); 6275 body(var.value());
6276 if (mode == IndexAdvanceMode::kPost) { 6276 if (mode == IndexAdvanceMode::kPost) {
6277 Increment(var, increment); 6277 Increment(var, increment);
6278 } 6278 }
6279 Branch(WordNotEqual(var.value(), end_index), &loop, &after_loop); 6279 Branch(WordNotEqual(var.value(), end_index), &loop, &after_loop);
6280 } 6280 }
6281 Bind(&after_loop); 6281 Bind(&after_loop);
6282 return var.value();
6282 } 6283 }
6283 6284
6284 void CodeStubAssembler::BuildFastFixedArrayForEach( 6285 void CodeStubAssembler::BuildFastFixedArrayForEach(
6285 Node* fixed_array, ElementsKind kind, Node* first_element_inclusive, 6286 Node* fixed_array, ElementsKind kind, Node* first_element_inclusive,
6286 Node* last_element_exclusive, const FastFixedArrayForEachBody& body, 6287 Node* last_element_exclusive, const FastFixedArrayForEachBody& body,
6287 ParameterMode mode, ForEachDirection direction) { 6288 ParameterMode mode, ForEachDirection direction) {
6288 STATIC_ASSERT(FixedArray::kHeaderSize == FixedDoubleArray::kHeaderSize); 6289 STATIC_ASSERT(FixedArray::kHeaderSize == FixedDoubleArray::kHeaderSize);
6289 int32_t first_val; 6290 int32_t first_val;
6290 bool constant_first = ToInt32Constant(first_element_inclusive, first_val); 6291 bool constant_first = ToInt32Constant(first_element_inclusive, first_val);
6291 int32_t last_val; 6292 int32_t last_val;
(...skipping 2096 matching lines...) Expand 10 before | Expand all | Expand 10 after
8388 formatted.c_str(), TENURED); 8389 formatted.c_str(), TENURED);
8389 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), 8390 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(),
8390 HeapConstant(string)); 8391 HeapConstant(string));
8391 } 8392 }
8392 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), tagged_value); 8393 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), tagged_value);
8393 #endif 8394 #endif
8394 } 8395 }
8395 8396
8396 } // namespace internal 8397 } // namespace internal
8397 } // namespace v8 8398 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stub-assembler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698