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