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 | 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 | 7 |
8 namespace v8 { | 8 namespace v8 { |
9 namespace internal { | 9 namespace internal { |
10 | 10 |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 SmiTag(size_in_bytes)); | 360 SmiTag(size_in_bytes)); |
361 } | 361 } |
362 result.Bind(runtime_result); | 362 result.Bind(runtime_result); |
363 Goto(&merge_runtime); | 363 Goto(&merge_runtime); |
364 | 364 |
365 // When there is enough space, return `top' and bump it up. | 365 // When there is enough space, return `top' and bump it up. |
366 Bind(&no_runtime_call); | 366 Bind(&no_runtime_call); |
367 Node* no_runtime_result = top; | 367 Node* no_runtime_result = top; |
368 StoreNoWriteBarrier(MachineType::PointerRepresentation(), top_address, | 368 StoreNoWriteBarrier(MachineType::PointerRepresentation(), top_address, |
369 new_top); | 369 new_top); |
370 no_runtime_result = BitcastWordToTagged( | 370 result.Bind(BitcastWordToTagged(no_runtime_result)); |
371 IntPtrAdd(no_runtime_result, IntPtrConstant(kHeapObjectTag))); | |
372 result.Bind(no_runtime_result); | |
373 Goto(&merge_runtime); | 371 Goto(&merge_runtime); |
374 | 372 |
375 Bind(&merge_runtime); | 373 Bind(&merge_runtime); |
376 return result.value(); | 374 return result.value(); |
377 } | 375 } |
378 | 376 |
379 Node* CodeStubAssembler::AllocateRawAligned(Node* size_in_bytes, | 377 Node* CodeStubAssembler::AllocateRawAligned(Node* size_in_bytes, |
380 AllocationFlags flags, | 378 AllocationFlags flags, |
381 Node* top_address, | 379 Node* top_address, |
382 Node* limit_address) { | 380 Node* limit_address) { |
383 Node* top = Load(MachineType::Pointer(), top_address); | 381 Node* top = Load(MachineType::Pointer(), top_address); |
384 Node* limit = Load(MachineType::Pointer(), limit_address); | 382 Node* limit = Load(MachineType::Pointer(), limit_address); |
385 Variable adjusted_size(this, MachineType::PointerRepresentation()); | 383 Variable adjusted_size(this, MachineType::PointerRepresentation()); |
386 adjusted_size.Bind(size_in_bytes); | 384 adjusted_size.Bind(size_in_bytes); |
387 if (flags & kDoubleAlignment) { | 385 if (flags & kDoubleAlignment) { |
388 // TODO(epertoso): Simd128 alignment. | 386 // TODO(epertoso): Simd128 alignment. |
389 Label aligned(this), not_aligned(this), merge(this, &adjusted_size); | 387 Label aligned(this), not_aligned(this), merge(this, &adjusted_size); |
390 Branch(WordAnd(top, IntPtrConstant(kDoubleAlignmentMask)), ¬_aligned, | 388 Branch(WordAnd(IntPtrSub(top, IntPtrConstant(kHeapObjectTag)), |
391 &aligned); | 389 IntPtrConstant(kDoubleAlignmentMask)), |
| 390 ¬_aligned, &aligned); |
392 | 391 |
393 Bind(¬_aligned); | 392 Bind(¬_aligned); |
394 Node* not_aligned_size = | 393 Node* not_aligned_size = |
395 IntPtrAdd(size_in_bytes, IntPtrConstant(kPointerSize)); | 394 IntPtrAdd(size_in_bytes, IntPtrConstant(kPointerSize)); |
396 adjusted_size.Bind(not_aligned_size); | 395 adjusted_size.Bind(not_aligned_size); |
397 Goto(&merge); | 396 Goto(&merge); |
398 | 397 |
399 Bind(&aligned); | 398 Bind(&aligned); |
400 Goto(&merge); | 399 Goto(&merge); |
401 | 400 |
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1698 } | 1697 } |
1699 return IntPtrAdd( | 1698 return IntPtrAdd( |
1700 IntPtrConstant(base_size), | 1699 IntPtrConstant(base_size), |
1701 (element_size_shift >= 0) | 1700 (element_size_shift >= 0) |
1702 ? WordShl(index_node, IntPtrConstant(element_size_shift)) | 1701 ? WordShl(index_node, IntPtrConstant(element_size_shift)) |
1703 : WordShr(index_node, IntPtrConstant(-element_size_shift))); | 1702 : WordShr(index_node, IntPtrConstant(-element_size_shift))); |
1704 } | 1703 } |
1705 | 1704 |
1706 } // namespace internal | 1705 } // namespace internal |
1707 } // namespace v8 | 1706 } // namespace v8 |
OLD | NEW |