| OLD | NEW |
| 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 6264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } | 6282 } |
| 6283 | 6283 |
| 6284 void CodeStubAssembler::BuildFastFixedArrayForEach( | 6284 void CodeStubAssembler::BuildFastFixedArrayForEach( |
| 6285 Node* fixed_array, ElementsKind kind, Node* first_element_inclusive, | 6285 const CodeStubAssembler::VariableList& vars, Node* fixed_array, |
| 6286 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; |
| 6292 bool constent_last = ToInt32Constant(last_element_exclusive, last_val); | 6293 bool constent_last = ToInt32Constant(last_element_exclusive, last_val); |
| 6293 if (constant_first && constent_last) { | 6294 if (constant_first && constent_last) { |
| 6294 int delta = last_val - first_val; | 6295 int delta = last_val - first_val; |
| 6295 DCHECK(delta >= 0); | 6296 DCHECK(delta >= 0); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 6318 Node* start = | 6319 Node* start = |
| 6319 ElementOffsetFromIndex(first_element_inclusive, kind, mode, | 6320 ElementOffsetFromIndex(first_element_inclusive, kind, mode, |
| 6320 FixedArray::kHeaderSize - kHeapObjectTag); | 6321 FixedArray::kHeaderSize - kHeapObjectTag); |
| 6321 Node* limit = | 6322 Node* limit = |
| 6322 ElementOffsetFromIndex(last_element_exclusive, kind, mode, | 6323 ElementOffsetFromIndex(last_element_exclusive, kind, mode, |
| 6323 FixedArray::kHeaderSize - kHeapObjectTag); | 6324 FixedArray::kHeaderSize - kHeapObjectTag); |
| 6324 if (direction == ForEachDirection::kReverse) std::swap(start, limit); | 6325 if (direction == ForEachDirection::kReverse) std::swap(start, limit); |
| 6325 | 6326 |
| 6326 int increment = IsFastDoubleElementsKind(kind) ? kDoubleSize : kPointerSize; | 6327 int increment = IsFastDoubleElementsKind(kind) ? kDoubleSize : kPointerSize; |
| 6327 BuildFastLoop( | 6328 BuildFastLoop( |
| 6328 MachineType::PointerRepresentation(), start, limit, | 6329 vars, MachineType::PointerRepresentation(), start, limit, |
| 6329 [fixed_array, &body](Node* offset) { body(fixed_array, offset); }, | 6330 [fixed_array, &body](Node* offset) { body(fixed_array, offset); }, |
| 6330 direction == ForEachDirection::kReverse ? -increment : increment, | 6331 direction == ForEachDirection::kReverse ? -increment : increment, |
| 6331 direction == ForEachDirection::kReverse ? IndexAdvanceMode::kPre | 6332 direction == ForEachDirection::kReverse ? IndexAdvanceMode::kPre |
| 6332 : IndexAdvanceMode::kPost); | 6333 : IndexAdvanceMode::kPost); |
| 6333 } | 6334 } |
| 6334 | 6335 |
| 6335 void CodeStubAssembler::InitializeFieldsWithRoot( | 6336 void CodeStubAssembler::InitializeFieldsWithRoot( |
| 6336 Node* object, Node* start_offset, Node* end_offset, | 6337 Node* object, Node* start_offset, Node* end_offset, |
| 6337 Heap::RootListIndex root_index) { | 6338 Heap::RootListIndex root_index) { |
| 6338 start_offset = IntPtrAdd(start_offset, IntPtrConstant(-kHeapObjectTag)); | 6339 start_offset = IntPtrAdd(start_offset, IntPtrConstant(-kHeapObjectTag)); |
| (...skipping 2049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |