fixed for code check warning

Signed-off-by: getingke <getingke@huawei.com>
Change-Id: Idb7cec9a4b7e4a483f27ca79345a79c98719bb75
This commit is contained in:
getingke 2021-09-26 15:37:07 +08:00
parent 05931e38fd
commit 38da911b3d
6 changed files with 16 additions and 12 deletions

View File

@ -97,7 +97,7 @@ AddrShift CircuitBuilder::ExceptionConstant()
auto constantList = Circuit::GetCircuitRoot(OpCode(OpCode::CONSTANT_LIST));
// NOTE: add bitfield value here
return circuit_->NewGate(OpCode(OpCode::JS_CONSTANT), panda::coretypes::TaggedValue::VALUE_EXCEPTION,
{constantList}, TypeCode::NOTYPE);
{constantList}, TypeCode::NOTYPE);
}
AddrShift CircuitBuilder::Branch(AddrShift state, AddrShift condition)

View File

@ -732,14 +732,14 @@ void FastGetPropertyByIndexStub::GenerateCircuit()
{
StubDescriptor *callAccessorGetter = GET_STUBDESCRIPTOR(AccessorGetter);
Return(CallRuntime(callAccessorGetter, thread,
GetWord64Constant(FAST_STUB_ID(AccessorGetter)),
{thread, *holder, value}));
GetWord64Constant(FAST_STUB_ID(AccessorGetter)),
{thread, *holder, value}));
}
Bind(&notInternal);
{
StubDescriptor *callGetter = GET_STUBDESCRIPTOR(CallGetter);
Return(CallRuntime(callGetter, thread, GetWord64Constant(FAST_STUB_ID(CallGetter)),
{thread, receiver, value}));
{thread, receiver, value}));
}
}
Bind(&notAccessor);
@ -839,8 +839,8 @@ void FastSetPropertyByIndexStub::GenerateCircuit()
{
StubDescriptor *addElementInternal = GET_STUBDESCRIPTOR(AddElementInternal);
AddrShift result = CallRuntime(addElementInternal, thread, GetWord64Constant(FAST_STUB_ID(AddElementInternal)),
{thread, receiver, index, value,
GetInteger32Constant(PropertyAttributes::GetDefaultAttributes())});
{thread, receiver, index, value,
GetInteger32Constant(PropertyAttributes::GetDefaultAttributes())});
Label success(env);
Label failed(env);
Branch(result, &success, &failed);

View File

@ -112,6 +112,7 @@ public:
class FastGetPropertyByIndexStub : public Stub {
public:
// 3 : 3 means argument counts
explicit FastGetPropertyByIndexStub(Circuit *circuit) : Stub("FastGetPropertyByIndex", 3, circuit) {}
~FastGetPropertyByIndexStub() = default;
NO_MOVE_SEMANTIC(FastGetPropertyByIndexStub);
@ -121,6 +122,7 @@ public:
class FastSetPropertyByIndexStub : public Stub {
public:
// 4 : 4 means argument counts
explicit FastSetPropertyByIndexStub(Circuit *circuit) : Stub("FastSetPropertyByIndex", 4, circuit) {}
~FastSetPropertyByIndexStub() = default;
NO_MOVE_SEMANTIC(FastSetPropertyByIndexStub);

View File

@ -708,9 +708,9 @@ void LLVMIRBuilder::VisitBlock(int gate, const OperandsVector &predecessors) //
LOG_ECMA(INFO) << " " << predecessor;
LLVMMoveBasicBlockBefore(llvmpre, llvmbb);
}
// if (gate == 0) { // insert prologue
// PrologueHandle(module_, builder_);
// }
if (gate == 0) { // insert prologue
PrologueHandle(module_, builder_);
}
}
void LLVMIRBuilder::VisitGoto(int block, int bbOut)

View File

@ -155,6 +155,7 @@ void LabelImpl::Bind()
{
ASSERT(!predecessors_.empty());
if (IsLoopHead()) {
// 2 means input number of depend selector gate
loopDepend_ = env_->GetCircuitBuilder().NewSelectorGate(OpCode(OpCode::DEPEND_SELECTOR), predeControl_, 2);
env_->GetCircuit()->NewIn(loopDepend_, 1, predecessors_[0]->GetDepend());
depend_ = loopDepend_;
@ -213,6 +214,7 @@ void LabelImpl::MergeAllDepend()
ASSERT(predecessors_.size() == 2); // 2 : Loop Head only support two predecessors_
// Add loop depend to in of depend_seclector
ASSERT(loopDepend_ != -1);
// 2 mean 3rd input gate for loopDepend_(depend_selector)
env_->GetCircuit()->NewIn(loopDepend_, 2, predecessors_[1]->GetDepend());
return;
}

View File

@ -1141,7 +1141,6 @@ HWTEST_F_L0(StubTest, FastGetPropertyByIndexStub)
int y = 10;
FastRuntimeStub::SetOwnElement(thread, obj.GetTaggedValue(), 1, JSTaggedValue(x));
FastRuntimeStub::SetOwnElement(thread, obj.GetTaggedValue(), 10250, JSTaggedValue(y));
assembler.Disassemble();
JSTaggedValue resVal = getpropertyByIndex(thread, obj.GetTaggedValue(), 1);
EXPECT_EQ(resVal.GetNumber(), x);
@ -1183,8 +1182,9 @@ HWTEST_F_L0(StubTest, FastSetPropertyByIndexStub)
auto taggedArray = array.GetTaggedValue();
setpropertyByIndex(thread, taggedArray, i, JSTaggedValue(i));
}
for(int i = 0; i < 20; i++) {
EXPECT_EQ(JSTaggedValue(i), JSArray::FastGetPropertyByValue(thread, JSHandle<JSTaggedValue>::Cast(array), i).GetTaggedValue());
for (int i = 0; i < 20; i++) {
EXPECT_EQ(JSTaggedValue(i),
JSArray::FastGetPropertyByValue(thread, JSHandle<JSTaggedValue>::Cast(array), i).GetTaggedValue());
}
}
} // namespace panda::test