Commit a863620f authored by epertoso's avatar epertoso Committed by Commit bot

[stubs] Fix some CodeStubAssembler macros and adds a bitcast in the ToObjectStub.

This makes the MachineGraphVerifier happy with the stub.

R=jarin@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2394193002
Cr-Commit-Position: refs/heads/master@{#40154}
parent 8f43d748
......@@ -38,7 +38,7 @@ void CodeStubAssembler::Assert(Node* condition) {
#endif
}
Node* CodeStubAssembler::NoContextConstant() { return SmiConstant(Smi::kZero); }
Node* CodeStubAssembler::NoContextConstant() { return NumberConstant(0); }
#define HEAP_CONSTANT_ACCESSOR(rootName, name) \
Node* CodeStubAssembler::name##Constant() { \
......@@ -611,19 +611,17 @@ Node* CodeStubAssembler::AllocateRawUnaligned(Node* size_in_bytes,
&no_runtime_call);
Bind(&runtime_call);
// AllocateInTargetSpace does not use the context.
Node* context = SmiConstant(Smi::kZero);
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);
runtime_result =
CallRuntime(Runtime::kAllocateInTargetSpace, NoContextConstant(),
SmiTag(size_in_bytes), runtime_flags);
} else {
runtime_result = CallRuntime(Runtime::kAllocateInNewSpace, context,
SmiTag(size_in_bytes));
runtime_result = CallRuntime(Runtime::kAllocateInNewSpace,
NoContextConstant(), SmiTag(size_in_bytes));
}
result.Bind(runtime_result);
Goto(&merge_runtime);
......
......@@ -107,7 +107,7 @@ Node* CodeAssembler::NumberConstant(double value) {
}
Node* CodeAssembler::SmiConstant(Smi* value) {
return IntPtrConstant(bit_cast<intptr_t>(value));
return BitcastWordToTaggedSigned(IntPtrConstant(bit_cast<intptr_t>(value)));
}
Node* CodeAssembler::HeapConstant(Handle<HeapObject> object) {
......
......@@ -538,9 +538,9 @@ TARGET_TEST_F(InterpreterAssemblerTest, SmiTag) {
TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
InterpreterAssemblerForTest m(this, bytecode);
Node* value = m.Int32Constant(44);
EXPECT_THAT(m.SmiTag(value),
IsIntPtrConstant(static_cast<intptr_t>(44)
<< (kSmiShiftSize + kSmiTagSize)));
EXPECT_THAT(m.SmiTag(value), IsBitcastWordToTaggedSigned(IsIntPtrConstant(
static_cast<intptr_t>(44)
<< (kSmiShiftSize + kSmiTagSize))));
EXPECT_THAT(m.SmiUntag(value),
IsWordSar(IsBitcastTaggedToWord(value),
IsIntPtrConstant(kSmiShiftSize + kSmiTagSize)));
......
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