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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 SmiTag(size_in_bytes)); | 344 SmiTag(size_in_bytes)); |
345 } | 345 } |
346 result.Bind(runtime_result); | 346 result.Bind(runtime_result); |
347 Goto(&merge_runtime); | 347 Goto(&merge_runtime); |
348 | 348 |
349 // When there is enough space, return `top' and bump it up. | 349 // When there is enough space, return `top' and bump it up. |
350 Bind(&no_runtime_call); | 350 Bind(&no_runtime_call); |
351 Node* no_runtime_result = top; | 351 Node* no_runtime_result = top; |
352 StoreNoWriteBarrier(MachineType::PointerRepresentation(), top_address, | 352 StoreNoWriteBarrier(MachineType::PointerRepresentation(), top_address, |
353 new_top); | 353 new_top); |
354 no_runtime_result = BitcastWordToTagged( | |
355 IntPtrAdd(no_runtime_result, IntPtrConstant(kHeapObjectTag))); | |
356 result.Bind(no_runtime_result); | 354 result.Bind(no_runtime_result); |
357 Goto(&merge_runtime); | 355 Goto(&merge_runtime); |
358 | 356 |
359 Bind(&merge_runtime); | 357 Bind(&merge_runtime); |
360 return result.value(); | 358 return result.value(); |
361 } | 359 } |
362 | 360 |
363 Node* CodeStubAssembler::AllocateRawAligned(Node* size_in_bytes, | 361 Node* CodeStubAssembler::AllocateRawAligned(Node* size_in_bytes, |
364 AllocationFlags flags, | 362 AllocationFlags flags, |
365 Node* top_address, | 363 Node* top_address, |
366 Node* limit_address) { | 364 Node* limit_address) { |
367 Node* top = Load(MachineType::Pointer(), top_address); | 365 Node* top = Load(MachineType::Pointer(), top_address); |
368 Node* limit = Load(MachineType::Pointer(), limit_address); | 366 Node* limit = Load(MachineType::Pointer(), limit_address); |
369 Variable adjusted_size(this, MachineType::PointerRepresentation()); | 367 Variable adjusted_size(this, MachineType::PointerRepresentation()); |
370 adjusted_size.Bind(size_in_bytes); | 368 adjusted_size.Bind(size_in_bytes); |
371 if (flags & kDoubleAlignment) { | 369 if (flags & kDoubleAlignment) { |
372 // TODO(epertoso): Simd128 alignment. | 370 // TODO(epertoso): Simd128 alignment. |
373 Label aligned(this), not_aligned(this), merge(this, &adjusted_size); | 371 Label aligned(this), not_aligned(this), merge(this, &adjusted_size); |
374 Branch(WordAnd(top, IntPtrConstant(kDoubleAlignmentMask)), ¬_aligned, | 372 Branch(WordAnd(top, IntPtrConstant(kDoubleAlignmentMask - kHeapObjectTag)), |
375 &aligned); | 373 ¬_aligned, &aligned); |
376 | 374 |
377 Bind(¬_aligned); | 375 Bind(¬_aligned); |
378 Node* not_aligned_size = | 376 Node* not_aligned_size = |
379 IntPtrAdd(size_in_bytes, IntPtrConstant(kPointerSize)); | 377 IntPtrAdd(size_in_bytes, IntPtrConstant(kPointerSize)); |
380 adjusted_size.Bind(not_aligned_size); | 378 adjusted_size.Bind(not_aligned_size); |
381 Goto(&merge); | 379 Goto(&merge); |
382 | 380 |
383 Bind(&aligned); | 381 Bind(&aligned); |
384 Goto(&merge); | 382 Goto(&merge); |
385 | 383 |
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1547 CallRuntime(Runtime::kOrdinaryHasInstance, context, callable, object)); | 1545 CallRuntime(Runtime::kOrdinaryHasInstance, context, callable, object)); |
1548 } | 1546 } |
1549 Goto(&return_result); | 1547 Goto(&return_result); |
1550 | 1548 |
1551 Bind(&return_result); | 1549 Bind(&return_result); |
1552 return var_result.value(); | 1550 return var_result.value(); |
1553 } | 1551 } |
1554 | 1552 |
1555 } // namespace internal | 1553 } // namespace internal |
1556 } // namespace v8 | 1554 } // namespace v8 |
OLD | NEW |