| 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 #include "src/frames-inl.h" | 7 #include "src/frames-inl.h" |
| 8 #include "src/frames.h" | 8 #include "src/frames.h" |
| 9 #include "src/ic/stub-cache.h" | 9 #include "src/ic/stub-cache.h" |
| 10 | 10 |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 SmiTag(size_in_bytes)); | 371 SmiTag(size_in_bytes)); |
| 372 } | 372 } |
| 373 result.Bind(runtime_result); | 373 result.Bind(runtime_result); |
| 374 Goto(&merge_runtime); | 374 Goto(&merge_runtime); |
| 375 | 375 |
| 376 // When there is enough space, return `top' and bump it up. | 376 // When there is enough space, return `top' and bump it up. |
| 377 Bind(&no_runtime_call); | 377 Bind(&no_runtime_call); |
| 378 Node* no_runtime_result = top; | 378 Node* no_runtime_result = top; |
| 379 StoreNoWriteBarrier(MachineType::PointerRepresentation(), top_address, | 379 StoreNoWriteBarrier(MachineType::PointerRepresentation(), top_address, |
| 380 new_top); | 380 new_top); |
| 381 no_runtime_result = BitcastWordToTagged( | 381 result.Bind(BitcastWordToTagged(no_runtime_result)); |
| 382 IntPtrAdd(no_runtime_result, IntPtrConstant(kHeapObjectTag))); | |
| 383 result.Bind(no_runtime_result); | |
| 384 Goto(&merge_runtime); | 382 Goto(&merge_runtime); |
| 385 | 383 |
| 386 Bind(&merge_runtime); | 384 Bind(&merge_runtime); |
| 387 return result.value(); | 385 return result.value(); |
| 388 } | 386 } |
| 389 | 387 |
| 390 Node* CodeStubAssembler::AllocateRawAligned(Node* size_in_bytes, | 388 Node* CodeStubAssembler::AllocateRawAligned(Node* size_in_bytes, |
| 391 AllocationFlags flags, | 389 AllocationFlags flags, |
| 392 Node* top_address, | 390 Node* top_address, |
| 393 Node* limit_address) { | 391 Node* limit_address) { |
| 394 Node* top = Load(MachineType::Pointer(), top_address); | 392 Node* top = Load(MachineType::Pointer(), top_address); |
| 395 Node* limit = Load(MachineType::Pointer(), limit_address); | 393 Node* limit = Load(MachineType::Pointer(), limit_address); |
| 396 Variable adjusted_size(this, MachineType::PointerRepresentation()); | 394 Variable adjusted_size(this, MachineType::PointerRepresentation()); |
| 397 adjusted_size.Bind(size_in_bytes); | 395 adjusted_size.Bind(size_in_bytes); |
| 398 if (flags & kDoubleAlignment) { | 396 if (flags & kDoubleAlignment) { |
| 399 // TODO(epertoso): Simd128 alignment. | 397 // TODO(epertoso): Simd128 alignment. |
| 400 Label aligned(this), not_aligned(this), merge(this, &adjusted_size); | 398 Label aligned(this), not_aligned(this), merge(this, &adjusted_size); |
| 401 Branch(WordAnd(top, IntPtrConstant(kDoubleAlignmentMask)), ¬_aligned, | 399 Branch(WordAnd(IntPtrSub(top, IntPtrConstant(kHeapObjectTag)), |
| 402 &aligned); | 400 IntPtrConstant(kDoubleAlignmentMask)), |
| 401 ¬_aligned, &aligned); |
| 403 | 402 |
| 404 Bind(¬_aligned); | 403 Bind(¬_aligned); |
| 405 Node* not_aligned_size = | 404 Node* not_aligned_size = |
| 406 IntPtrAdd(size_in_bytes, IntPtrConstant(kPointerSize)); | 405 IntPtrAdd(size_in_bytes, IntPtrConstant(kPointerSize)); |
| 407 adjusted_size.Bind(not_aligned_size); | 406 adjusted_size.Bind(not_aligned_size); |
| 408 Goto(&merge); | 407 Goto(&merge); |
| 409 | 408 |
| 410 Bind(&aligned); | 409 Bind(&aligned); |
| 411 Goto(&merge); | 410 Goto(&merge); |
| 412 | 411 |
| 413 Bind(&merge); | 412 Bind(&merge); |
| 414 } | 413 } |
| 415 | 414 |
| 416 Variable address(this, MachineRepresentation::kTagged); | 415 Variable address(this, MachineRepresentation::kTagged); |
| 417 address.Bind(AllocateRawUnaligned(adjusted_size.value(), kNone, top, limit)); | 416 address.Bind(AllocateRawUnaligned(adjusted_size.value(), kNone, top, limit)); |
| 418 | 417 |
| 419 Label needs_filler(this), doesnt_need_filler(this), | 418 Label needs_filler(this), doesnt_need_filler(this), |
| 420 merge_address(this, &address); | 419 merge_address(this, &address); |
| 421 Branch(IntPtrEqual(adjusted_size.value(), size_in_bytes), &doesnt_need_filler, | 420 Branch(IntPtrEqual(adjusted_size.value(), size_in_bytes), &doesnt_need_filler, |
| 422 &needs_filler); | 421 &needs_filler); |
| 423 | 422 |
| 424 Bind(&needs_filler); | 423 Bind(&needs_filler); |
| 425 // Store a filler and increase the address by kPointerSize. | 424 // Store a filler and increase the address by kPointerSize. |
| 426 // TODO(epertoso): this code assumes that we only align to kDoubleSize. Change | 425 // TODO(epertoso): this code assumes that we only align to kDoubleSize. Change |
| 427 // it when Simd128 alignment is supported. | 426 // it when Simd128 alignment is supported. |
| 428 StoreNoWriteBarrier(MachineType::PointerRepresentation(), top, | 427 StoreNoWriteBarrier(MachineType::PointerRepresentation(), |
| 428 IntPtrSub(top, IntPtrConstant(1)), |
| 429 LoadRoot(Heap::kOnePointerFillerMapRootIndex)); | 429 LoadRoot(Heap::kOnePointerFillerMapRootIndex)); |
| 430 address.Bind(BitcastWordToTagged( | 430 address.Bind(BitcastWordToTagged( |
| 431 IntPtrAdd(address.value(), IntPtrConstant(kPointerSize)))); | 431 IntPtrAdd(address.value(), IntPtrConstant(kPointerSize)))); |
| 432 Goto(&merge_address); | 432 Goto(&merge_address); |
| 433 | 433 |
| 434 Bind(&doesnt_need_filler); | 434 Bind(&doesnt_need_filler); |
| 435 Goto(&merge_address); | 435 Goto(&merge_address); |
| 436 | 436 |
| 437 Bind(&merge_address); | 437 Bind(&merge_address); |
| 438 // Update the top. | 438 // Update the top. |
| (...skipping 1864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2303 Code::Flags code_flags = | 2303 Code::Flags code_flags = |
| 2304 Code::RemoveHolderFromFlags(Code::ComputeHandlerFlags(Code::LOAD_IC)); | 2304 Code::RemoveHolderFromFlags(Code::ComputeHandlerFlags(Code::LOAD_IC)); |
| 2305 | 2305 |
| 2306 TryProbeStubCache(isolate()->stub_cache(), code_flags, p->receiver, p->name, | 2306 TryProbeStubCache(isolate()->stub_cache(), code_flags, p->receiver, p->name, |
| 2307 &if_handler, &var_handler, if_miss); | 2307 &if_handler, &var_handler, if_miss); |
| 2308 } | 2308 } |
| 2309 } | 2309 } |
| 2310 | 2310 |
| 2311 } // namespace internal | 2311 } // namespace internal |
| 2312 } // namespace v8 | 2312 } // namespace v8 |
| OLD | NEW |