Commit 46907cbb authored by epertoso's avatar epertoso Committed by Commit bot

[stubs] Fix Allocate macro in the CodeStubAssembler.

The macro was Using SmiTag(Int32Constant()) was causing some unnecessary shifts to be emitted in the deferred code.

Also, when allocating in new space, the macro now uses Runtime::kAllocateInNewSpace.

Review-Url: https://codereview.chromium.org/1945263002
Cr-Commit-Position: refs/heads/master@{#36023}
parent ce38a8a9
......@@ -330,14 +330,19 @@ Node* CodeStubAssembler::AllocateRawUnaligned(Node* size_in_bytes,
Bind(&runtime_call);
// AllocateInTargetSpace does not use the context.
Node* context = IntPtrConstant(0);
Node* runtime_flags = SmiTag(Int32Constant(
AllocateDoubleAlignFlag::encode(false) |
AllocateTargetSpace::encode(flags & kPretenured
? AllocationSpace::OLD_SPACE
: AllocationSpace::NEW_SPACE)));
Node* runtime_result = CallRuntime(Runtime::kAllocateInTargetSpace, context,
SmiTag(size_in_bytes), runtime_flags);
Node* context = SmiConstant(Smi::FromInt(0));
Node* runtime_result;
if (flags & kPretenured) {
Node* runtime_flags = SmiConstant(
Smi::FromInt(AllocateDoubleAlignFlag::encode(false) |
AllocateTargetSpace::encode(AllocationSpace::OLD_SPACE)));
runtime_result = CallRuntime(Runtime::kAllocateInTargetSpace, context,
SmiTag(size_in_bytes), runtime_flags);
} else {
runtime_result = CallRuntime(Runtime::kAllocateInNewSpace, context,
SmiTag(size_in_bytes));
}
result.Bind(runtime_result);
Goto(&merge_runtime);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment