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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 Node* top_address, | 315 Node* top_address, |
316 Node* limit_address) { | 316 Node* limit_address) { |
317 Node* top = Load(MachineType::Pointer(), top_address); | 317 Node* top = Load(MachineType::Pointer(), top_address); |
318 Node* limit = Load(MachineType::Pointer(), limit_address); | 318 Node* limit = Load(MachineType::Pointer(), limit_address); |
319 | 319 |
320 // If there's not enough space, call the runtime. | 320 // If there's not enough space, call the runtime. |
321 Variable result(this, MachineRepresentation::kTagged); | 321 Variable result(this, MachineRepresentation::kTagged); |
322 Label runtime_call(this, Label::kDeferred), no_runtime_call(this); | 322 Label runtime_call(this, Label::kDeferred), no_runtime_call(this); |
323 Label merge_runtime(this, &result); | 323 Label merge_runtime(this, &result); |
324 | 324 |
325 Branch(IntPtrLessThan(IntPtrSub(limit, top), size_in_bytes), &runtime_call, | 325 Node* new_top = IntPtrAdd(top, size_in_bytes); |
| 326 Branch(UintPtrGreaterThanOrEqual(new_top, limit), &runtime_call, |
326 &no_runtime_call); | 327 &no_runtime_call); |
327 | 328 |
328 Bind(&runtime_call); | 329 Bind(&runtime_call); |
329 // AllocateInTargetSpace does not use the context. | 330 // AllocateInTargetSpace does not use the context. |
330 Node* context = IntPtrConstant(0); | 331 Node* context = IntPtrConstant(0); |
331 Node* runtime_flags = SmiTag(Int32Constant( | 332 Node* runtime_flags = SmiTag(Int32Constant( |
332 AllocateDoubleAlignFlag::encode(false) | | 333 AllocateDoubleAlignFlag::encode(false) | |
333 AllocateTargetSpace::encode(flags & kPretenured | 334 AllocateTargetSpace::encode(flags & kPretenured |
334 ? AllocationSpace::OLD_SPACE | 335 ? AllocationSpace::OLD_SPACE |
335 : AllocationSpace::NEW_SPACE))); | 336 : AllocationSpace::NEW_SPACE))); |
336 Node* runtime_result = CallRuntime(Runtime::kAllocateInTargetSpace, context, | 337 Node* runtime_result = CallRuntime(Runtime::kAllocateInTargetSpace, context, |
337 SmiTag(size_in_bytes), runtime_flags); | 338 SmiTag(size_in_bytes), runtime_flags); |
338 result.Bind(runtime_result); | 339 result.Bind(runtime_result); |
339 Goto(&merge_runtime); | 340 Goto(&merge_runtime); |
340 | 341 |
341 // When there is enough space, return `top' and bump it up. | 342 // When there is enough space, return `top' and bump it up. |
342 Bind(&no_runtime_call); | 343 Bind(&no_runtime_call); |
343 Node* no_runtime_result = top; | 344 Node* no_runtime_result = top; |
344 StoreNoWriteBarrier(MachineType::PointerRepresentation(), top_address, | 345 StoreNoWriteBarrier(MachineType::PointerRepresentation(), top_address, |
345 IntPtrAdd(top, size_in_bytes)); | 346 new_top); |
346 no_runtime_result = BitcastWordToTagged( | 347 no_runtime_result = BitcastWordToTagged( |
347 IntPtrAdd(no_runtime_result, IntPtrConstant(kHeapObjectTag))); | 348 IntPtrAdd(no_runtime_result, IntPtrConstant(kHeapObjectTag))); |
348 result.Bind(no_runtime_result); | 349 result.Bind(no_runtime_result); |
349 Goto(&merge_runtime); | 350 Goto(&merge_runtime); |
350 | 351 |
351 Bind(&merge_runtime); | 352 Bind(&merge_runtime); |
352 return result.value(); | 353 return result.value(); |
353 } | 354 } |
354 | 355 |
355 Node* CodeStubAssembler::AllocateRawAligned(Node* size_in_bytes, | 356 Node* CodeStubAssembler::AllocateRawAligned(Node* size_in_bytes, |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 } | 1135 } |
1135 | 1136 |
1136 Node* CodeStubAssembler::BitFieldDecode(Node* word32, uint32_t shift, | 1137 Node* CodeStubAssembler::BitFieldDecode(Node* word32, uint32_t shift, |
1137 uint32_t mask) { | 1138 uint32_t mask) { |
1138 return Word32Shr(Word32And(word32, Int32Constant(mask)), | 1139 return Word32Shr(Word32And(word32, Int32Constant(mask)), |
1139 Int32Constant(shift)); | 1140 Int32Constant(shift)); |
1140 } | 1141 } |
1141 | 1142 |
1142 } // namespace internal | 1143 } // namespace internal |
1143 } // namespace v8 | 1144 } // namespace v8 |
OLD | NEW |