Chromium Code Reviews| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 337 Node* runtime_result = CallRuntime(Runtime::kAllocateInTargetSpace, context, | 337 Node* runtime_result = CallRuntime(Runtime::kAllocateInTargetSpace, context, |
| 338 SmiTag(size_in_bytes), runtime_flags); | 338 SmiTag(size_in_bytes), runtime_flags); |
| 339 result.Bind(runtime_result); | 339 result.Bind(runtime_result); |
| 340 Goto(&merge_runtime); | 340 Goto(&merge_runtime); |
| 341 | 341 |
| 342 // When there is enough space, return `top' and bump it up. | 342 // When there is enough space, return `top' and bump it up. |
| 343 Bind(&no_runtime_call); | 343 Bind(&no_runtime_call); |
| 344 Node* no_runtime_result = top; | 344 Node* no_runtime_result = top; |
| 345 StoreNoWriteBarrier(MachineType::PointerRepresentation(), top_address, | 345 StoreNoWriteBarrier(MachineType::PointerRepresentation(), top_address, |
| 346 new_top); | 346 new_top); |
| 347 no_runtime_result = BitcastWordToTagged( | |
| 348 IntPtrAdd(no_runtime_result, IntPtrConstant(kHeapObjectTag))); | |
| 349 result.Bind(no_runtime_result); | 347 result.Bind(no_runtime_result); |
| 350 Goto(&merge_runtime); | 348 Goto(&merge_runtime); |
| 351 | 349 |
| 352 Bind(&merge_runtime); | 350 Bind(&merge_runtime); |
| 353 return result.value(); | 351 return result.value(); |
| 354 } | 352 } |
| 355 | 353 |
| 356 Node* CodeStubAssembler::AllocateRawAligned(Node* size_in_bytes, | 354 Node* CodeStubAssembler::AllocateRawAligned(Node* size_in_bytes, |
| 357 AllocationFlags flags, | 355 AllocationFlags flags, |
| 358 Node* top_address, | 356 Node* top_address, |
| 359 Node* limit_address) { | 357 Node* limit_address) { |
| 360 Node* top = Load(MachineType::Pointer(), top_address); | 358 Node* top = Load(MachineType::Pointer(), top_address); |
| 361 Node* limit = Load(MachineType::Pointer(), limit_address); | 359 Node* limit = Load(MachineType::Pointer(), limit_address); |
| 362 Variable adjusted_size(this, MachineType::PointerRepresentation()); | 360 Variable adjusted_size(this, MachineType::PointerRepresentation()); |
| 363 adjusted_size.Bind(size_in_bytes); | 361 adjusted_size.Bind(size_in_bytes); |
| 364 if (flags & kDoubleAlignment) { | 362 if (flags & kDoubleAlignment) { |
| 365 // TODO(epertoso): Simd128 alignment. | 363 // TODO(epertoso): Simd128 alignment. |
| 366 Label aligned(this), not_aligned(this), merge(this, &adjusted_size); | 364 Label aligned(this), not_aligned(this), merge(this, &adjusted_size); |
| 367 Branch(WordAnd(top, IntPtrConstant(kDoubleAlignmentMask)), ¬_aligned, | 365 Branch(WordAnd(top, IntPtrConstant(kDoubleAlignmentMask - kHeapObjectTag)), |
| 368 &aligned); | 366 ¬_aligned, &aligned); |
| 369 | 367 |
| 370 Bind(¬_aligned); | 368 Bind(¬_aligned); |
| 371 Node* not_aligned_size = | 369 Node* not_aligned_size = |
| 372 IntPtrAdd(size_in_bytes, IntPtrConstant(kPointerSize)); | 370 IntPtrAdd(size_in_bytes, IntPtrConstant(kPointerSize)); |
| 373 adjusted_size.Bind(not_aligned_size); | 371 adjusted_size.Bind(not_aligned_size); |
| 374 Goto(&merge); | 372 Goto(&merge); |
|
Michael Lippautz
2016/04/28 16:58:08
I have the feeling that we should've written a tag
| |
| 375 | 373 |
| 376 Bind(&aligned); | 374 Bind(&aligned); |
| 377 Goto(&merge); | 375 Goto(&merge); |
| 378 | 376 |
| 379 Bind(&merge); | 377 Bind(&merge); |
| 380 } | 378 } |
| 381 | 379 |
| 382 Variable address(this, MachineRepresentation::kTagged); | 380 Variable address(this, MachineRepresentation::kTagged); |
| 383 address.Bind(AllocateRawUnaligned(adjusted_size.value(), kNone, top, limit)); | 381 address.Bind(AllocateRawUnaligned(adjusted_size.value(), kNone, top, limit)); |
| 384 | 382 |
| (...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1135 } | 1133 } |
| 1136 | 1134 |
| 1137 Node* CodeStubAssembler::BitFieldDecode(Node* word32, uint32_t shift, | 1135 Node* CodeStubAssembler::BitFieldDecode(Node* word32, uint32_t shift, |
| 1138 uint32_t mask) { | 1136 uint32_t mask) { |
| 1139 return Word32Shr(Word32And(word32, Int32Constant(mask)), | 1137 return Word32Shr(Word32And(word32, Int32Constant(mask)), |
| 1140 Int32Constant(shift)); | 1138 Int32Constant(shift)); |
| 1141 } | 1139 } |
| 1142 | 1140 |
| 1143 } // namespace internal | 1141 } // namespace internal |
| 1144 } // namespace v8 | 1142 } // namespace v8 |
| OLD | NEW |