2022-01-06 02:26:19 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2022-06-16 09:27:35 +00:00
|
|
|
#include "ecmascript/compiler/bytecode_circuit_builder.h"
|
|
|
|
|
2022-04-24 07:14:09 +00:00
|
|
|
#include "ecmascript/base/number_helper.h"
|
2022-06-10 07:22:21 +00:00
|
|
|
#include "ecmascript/compiler/gate_accessor.h"
|
2022-07-21 17:37:55 +00:00
|
|
|
#include "ecmascript/ts_types/ts_manager.h"
|
2022-08-26 01:06:59 +00:00
|
|
|
|
2022-01-19 01:11:02 +00:00
|
|
|
namespace panda::ecmascript::kungfu {
|
2022-03-07 02:58:13 +00:00
|
|
|
void BytecodeCircuitBuilder::BytecodeToCircuit()
|
2022-01-06 02:26:19 +00:00
|
|
|
{
|
2022-08-02 08:38:18 +00:00
|
|
|
std::map<std::pair<uint8_t *, uint8_t *>, std::vector<uint8_t *>> exceptionInfo;
|
2022-01-06 02:26:19 +00:00
|
|
|
|
|
|
|
// collect try catch block info
|
2022-08-02 08:38:18 +00:00
|
|
|
CollectTryCatchBlockInfo(exceptionInfo);
|
2022-01-06 02:26:19 +00:00
|
|
|
|
2022-03-07 02:58:13 +00:00
|
|
|
// Complete bytecode block Information
|
2022-08-02 08:38:18 +00:00
|
|
|
CompleteBytecodeBlockInfo();
|
2022-01-06 02:26:19 +00:00
|
|
|
|
|
|
|
// Building the basic block diagram of bytecode
|
2022-08-02 08:38:18 +00:00
|
|
|
BuildBasicBlocks(exceptionInfo);
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
|
2022-01-22 11:09:02 +00:00
|
|
|
void BytecodeCircuitBuilder::CollectBytecodeBlockInfo(uint8_t *pc, std::vector<CfgInfo> &bytecodeBlockInfos)
|
2022-01-06 02:26:19 +00:00
|
|
|
{
|
2022-08-26 01:06:59 +00:00
|
|
|
auto opcode = static_cast<EcmaBytecode>(*pc);
|
2022-01-06 02:26:19 +00:00
|
|
|
switch (opcode) {
|
2022-08-26 01:06:59 +00:00
|
|
|
case EcmaBytecode::JMP_IMM8: {
|
2022-04-15 06:42:30 +00:00
|
|
|
int8_t offset = static_cast<int8_t>(READ_INST_8_0());
|
2022-01-06 02:26:19 +00:00
|
|
|
std::vector<uint8_t *> temp;
|
|
|
|
temp.emplace_back(pc + offset);
|
|
|
|
// current basic block end
|
2022-01-19 01:11:02 +00:00
|
|
|
bytecodeBlockInfos.emplace_back(pc, SplitKind::END, temp);
|
2022-09-06 05:27:19 +00:00
|
|
|
bytecodeBlockInfos.emplace_back(pc + BytecodeOffset::TWO, SplitKind::START,
|
|
|
|
std::vector<uint8_t *>(1, pc + BytecodeOffset::TWO));
|
2022-01-06 02:26:19 +00:00
|
|
|
// jump basic block start
|
2022-01-22 11:09:02 +00:00
|
|
|
bytecodeBlockInfos.emplace_back(pc + offset, SplitKind::START, std::vector<uint8_t *>(1, pc + offset));
|
2022-08-16 15:48:09 +00:00
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
break;
|
2022-08-26 01:06:59 +00:00
|
|
|
case EcmaBytecode::JMP_IMM16: {
|
2022-04-15 06:42:30 +00:00
|
|
|
int16_t offset = static_cast<int16_t>(READ_INST_16_0());
|
2022-01-06 02:26:19 +00:00
|
|
|
std::vector<uint8_t *> temp;
|
|
|
|
temp.emplace_back(pc + offset);
|
2022-01-19 01:11:02 +00:00
|
|
|
bytecodeBlockInfos.emplace_back(pc, SplitKind::END, temp);
|
2022-09-06 05:27:19 +00:00
|
|
|
bytecodeBlockInfos.emplace_back(pc + BytecodeOffset::THREE, SplitKind::START,
|
|
|
|
std::vector<uint8_t *>(1, pc + BytecodeOffset::THREE));
|
2022-01-19 01:11:02 +00:00
|
|
|
bytecodeBlockInfos.emplace_back(pc + offset, SplitKind::START,
|
2022-01-22 11:09:02 +00:00
|
|
|
std::vector<uint8_t *>(1, pc + offset));
|
2022-08-16 15:48:09 +00:00
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
break;
|
2022-08-26 01:06:59 +00:00
|
|
|
case EcmaBytecode::JMP_IMM32: {
|
2022-04-15 06:42:30 +00:00
|
|
|
int32_t offset = static_cast<int32_t>(READ_INST_32_0());
|
2022-01-06 02:26:19 +00:00
|
|
|
std::vector<uint8_t *> temp;
|
|
|
|
temp.emplace_back(pc + offset);
|
2022-01-19 01:11:02 +00:00
|
|
|
bytecodeBlockInfos.emplace_back(pc, SplitKind::END, temp);
|
2022-09-06 05:27:19 +00:00
|
|
|
bytecodeBlockInfos.emplace_back(pc + BytecodeOffset::FIVE, SplitKind::START,
|
|
|
|
std::vector<uint8_t *>(1, pc + BytecodeOffset::FIVE));
|
2022-01-22 11:09:02 +00:00
|
|
|
bytecodeBlockInfos.emplace_back(pc + offset, SplitKind::START, std::vector<uint8_t *>(1, pc + offset));
|
2022-08-16 15:48:09 +00:00
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
break;
|
2022-08-26 01:06:59 +00:00
|
|
|
case EcmaBytecode::JEQZ_IMM8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
std::vector<uint8_t *> temp;
|
2022-09-06 05:27:19 +00:00
|
|
|
temp.emplace_back(pc + BytecodeOffset::TWO); // first successor
|
2022-04-15 06:42:30 +00:00
|
|
|
int8_t offset = static_cast<int8_t>(READ_INST_8_0());
|
2022-01-06 02:26:19 +00:00
|
|
|
temp.emplace_back(pc + offset); // second successor
|
|
|
|
// condition branch current basic block end
|
2022-01-19 01:11:02 +00:00
|
|
|
bytecodeBlockInfos.emplace_back(pc, SplitKind::END, temp);
|
2022-01-06 02:26:19 +00:00
|
|
|
// first branch basic block start
|
2022-09-06 05:27:19 +00:00
|
|
|
bytecodeBlockInfos.emplace_back(pc + BytecodeOffset::TWO, SplitKind::START,
|
|
|
|
std::vector<uint8_t *>(1, pc + BytecodeOffset::TWO));
|
2022-01-06 02:26:19 +00:00
|
|
|
// second branch basic block start
|
2022-01-19 01:11:02 +00:00
|
|
|
bytecodeBlockInfos.emplace_back(pc + offset, SplitKind::START, std::vector<uint8_t *>(1, pc + offset));
|
2022-08-16 15:48:09 +00:00
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
break;
|
2022-08-26 01:06:59 +00:00
|
|
|
case EcmaBytecode::JEQZ_IMM16: {
|
2022-01-06 02:26:19 +00:00
|
|
|
std::vector<uint8_t *> temp;
|
2022-09-06 05:27:19 +00:00
|
|
|
temp.emplace_back(pc + BytecodeOffset::THREE); // first successor
|
2022-04-15 06:42:30 +00:00
|
|
|
int16_t offset = static_cast<int16_t>(READ_INST_16_0());
|
2022-01-06 02:26:19 +00:00
|
|
|
temp.emplace_back(pc + offset); // second successor
|
2022-01-19 01:11:02 +00:00
|
|
|
bytecodeBlockInfos.emplace_back(pc, SplitKind::END, temp); // end
|
2022-09-06 05:27:19 +00:00
|
|
|
bytecodeBlockInfos.emplace_back(pc + BytecodeOffset::THREE, SplitKind::START,
|
|
|
|
std::vector<uint8_t *>(1, pc + BytecodeOffset::THREE));
|
2022-01-19 01:11:02 +00:00
|
|
|
bytecodeBlockInfos.emplace_back(pc + offset, SplitKind::START, std::vector<uint8_t *>(1, pc + offset));
|
2022-08-16 15:48:09 +00:00
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
break;
|
2022-08-26 01:06:59 +00:00
|
|
|
case EcmaBytecode::JNEZ_IMM8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
std::vector<uint8_t *> temp;
|
2022-09-06 05:27:19 +00:00
|
|
|
temp.emplace_back(pc + BytecodeOffset::TWO); // first successor
|
2022-04-15 06:42:30 +00:00
|
|
|
int8_t offset = static_cast<int8_t>(READ_INST_8_0());
|
2022-01-19 01:11:02 +00:00
|
|
|
temp.emplace_back(pc + offset); // second successor
|
|
|
|
bytecodeBlockInfos.emplace_back(pc, SplitKind::END, temp);
|
2022-09-06 05:27:19 +00:00
|
|
|
bytecodeBlockInfos.emplace_back(pc + BytecodeOffset::TWO, SplitKind::START,
|
|
|
|
std::vector<uint8_t *>(1, pc + BytecodeOffset::TWO));
|
2022-01-19 01:11:02 +00:00
|
|
|
bytecodeBlockInfos.emplace_back(pc + offset, SplitKind::START, std::vector<uint8_t *>(1, pc + offset));
|
2022-08-16 15:48:09 +00:00
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
break;
|
2022-08-26 01:06:59 +00:00
|
|
|
case EcmaBytecode::JNEZ_IMM16: {
|
2022-01-06 02:26:19 +00:00
|
|
|
std::vector<uint8_t *> temp;
|
2022-09-06 05:27:19 +00:00
|
|
|
temp.emplace_back(pc + BytecodeOffset::THREE); // first successor
|
2022-06-06 09:41:17 +00:00
|
|
|
int16_t offset = static_cast<int16_t>(READ_INST_16_0());
|
2022-01-19 01:11:02 +00:00
|
|
|
temp.emplace_back(pc + offset); // second successor
|
|
|
|
bytecodeBlockInfos.emplace_back(pc, SplitKind::END, temp);
|
2022-09-06 05:27:19 +00:00
|
|
|
bytecodeBlockInfos.emplace_back(pc + BytecodeOffset::THREE, SplitKind::START,
|
|
|
|
std::vector<uint8_t *>(1, pc + BytecodeOffset::THREE));
|
2022-01-19 01:11:02 +00:00
|
|
|
bytecodeBlockInfos.emplace_back(pc + offset, SplitKind::START, std::vector<uint8_t *>(1, pc + offset));
|
2022-08-16 15:48:09 +00:00
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
break;
|
|
|
|
case EcmaBytecode::RETURN_DYN:
|
|
|
|
case EcmaBytecode::RETURNUNDEFINED_PREF:
|
|
|
|
case EcmaBytecode::THROWDYN_PREF:
|
|
|
|
case EcmaBytecode::THROWCONSTASSIGNMENT_PREF_V8:
|
|
|
|
case EcmaBytecode::THROWTHROWNOTEXISTS_PREF:
|
|
|
|
case EcmaBytecode::THROWPATTERNNONCOERCIBLE_PREF:
|
|
|
|
case EcmaBytecode::THROWDELETESUPERPROPERTY_PREF: {
|
2022-01-19 01:11:02 +00:00
|
|
|
bytecodeBlockInfos.emplace_back(pc, SplitKind::END, std::vector<uint8_t *>(1, pc));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
2022-04-01 06:33:39 +00:00
|
|
|
}
|
2022-01-06 02:26:19 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-02 08:38:18 +00:00
|
|
|
void BytecodeCircuitBuilder::CollectTryCatchBlockInfo(std::map<std::pair<uint8_t *, uint8_t *>,
|
|
|
|
std::vector<uint8_t *>> &byteCodeException)
|
2022-01-06 02:26:19 +00:00
|
|
|
{
|
|
|
|
// try contains many catch
|
2022-06-07 04:12:06 +00:00
|
|
|
panda_file::MethodDataAccessor mda(*pf_, method_->GetMethodId());
|
|
|
|
panda_file::CodeDataAccessor cda(*pf_, mda.GetCodeId().value());
|
2022-08-02 08:38:18 +00:00
|
|
|
|
|
|
|
cda.EnumerateTryBlocks([this, &byteCodeException](
|
2022-01-18 04:02:20 +00:00
|
|
|
panda_file::CodeDataAccessor::TryBlock &try_block) {
|
2022-01-19 01:11:02 +00:00
|
|
|
auto tryStartOffset = try_block.GetStartPc();
|
|
|
|
auto tryEndOffset = try_block.GetStartPc() + try_block.GetLength();
|
2022-03-07 02:58:13 +00:00
|
|
|
auto tryStartPc = const_cast<uint8_t *>(method_->GetBytecodeArray() + tryStartOffset);
|
|
|
|
auto tryEndPc = const_cast<uint8_t *>(method_->GetBytecodeArray() + tryEndOffset);
|
2022-08-23 02:33:21 +00:00
|
|
|
// skip try blocks with same pc in start and end label
|
|
|
|
if (tryStartPc == tryEndPc) {
|
|
|
|
return true;
|
|
|
|
}
|
2022-01-06 02:26:19 +00:00
|
|
|
byteCodeException[std::make_pair(tryStartPc, tryEndPc)] = {};
|
|
|
|
uint32_t pcOffset = panda_file::INVALID_OFFSET;
|
|
|
|
try_block.EnumerateCatchBlocks([&](panda_file::CodeDataAccessor::CatchBlock &catch_block) {
|
|
|
|
pcOffset = catch_block.GetHandlerPc();
|
2022-03-07 02:58:13 +00:00
|
|
|
auto catchBlockPc = const_cast<uint8_t *>(method_->GetBytecodeArray() + pcOffset);
|
2022-01-06 02:26:19 +00:00
|
|
|
// try block associate catch block
|
|
|
|
byteCodeException[std::make_pair(tryStartPc, tryEndPc)].emplace_back(catchBlockPc);
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
// Check whether the previous block of the try block exists.
|
|
|
|
// If yes, add the current block; otherwise, create a new block.
|
|
|
|
bool flag = false;
|
2022-08-02 08:38:18 +00:00
|
|
|
for (size_t i = 0; i < bytecodeBlockInfos_.size(); i++) {
|
|
|
|
if (bytecodeBlockInfos_[i].splitKind == SplitKind::START) {
|
2022-01-06 02:26:19 +00:00
|
|
|
continue;
|
|
|
|
}
|
2022-08-02 08:38:18 +00:00
|
|
|
if (bytecodeBlockInfos_[i].pc == byteCodeCurPrePc_.at(tryStartPc)) {
|
2022-01-06 02:26:19 +00:00
|
|
|
flag = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!flag) {
|
|
|
|
// pre block
|
2022-08-02 08:38:18 +00:00
|
|
|
bytecodeBlockInfos_.emplace_back(byteCodeCurPrePc_.at(tryStartPc), SplitKind::END,
|
|
|
|
std::vector<uint8_t *>(1, tryStartPc));
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-01-19 01:11:02 +00:00
|
|
|
// try block
|
2022-08-02 08:38:18 +00:00
|
|
|
bytecodeBlockInfos_.emplace_back(tryStartPc, SplitKind::START, std::vector<uint8_t *>(1, tryStartPc));
|
2022-01-06 02:26:19 +00:00
|
|
|
flag = false;
|
2022-08-02 08:38:18 +00:00
|
|
|
for (size_t i = 0; i < bytecodeBlockInfos_.size(); i++) {
|
|
|
|
if (bytecodeBlockInfos_[i].splitKind == SplitKind::START) {
|
2022-01-06 02:26:19 +00:00
|
|
|
continue;
|
|
|
|
}
|
2022-08-02 08:38:18 +00:00
|
|
|
if (bytecodeBlockInfos_[i].pc == byteCodeCurPrePc_.at(tryEndPc)) {
|
|
|
|
auto &succs = bytecodeBlockInfos_[i].succs;
|
|
|
|
auto iter = std::find(succs.cbegin(), succs.cend(), bytecodeBlockInfos_[i].pc);
|
2022-04-24 17:17:29 +00:00
|
|
|
if (iter == succs.cend()) {
|
2022-08-26 01:06:59 +00:00
|
|
|
auto opcode = static_cast<EcmaBytecode>(*(bytecodeBlockInfos_[i].pc));
|
2022-01-06 02:26:19 +00:00
|
|
|
switch (opcode) {
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::JMP_IMM8:
|
|
|
|
case EcmaBytecode::JMP_IMM16:
|
|
|
|
case EcmaBytecode::JMP_IMM32:
|
|
|
|
case EcmaBytecode::JEQZ_IMM8:
|
|
|
|
case EcmaBytecode::JEQZ_IMM16:
|
|
|
|
case EcmaBytecode::JNEZ_IMM8:
|
|
|
|
case EcmaBytecode::JNEZ_IMM16:
|
|
|
|
case EcmaBytecode::RETURN_DYN:
|
|
|
|
case EcmaBytecode::RETURNUNDEFINED_PREF:
|
|
|
|
case EcmaBytecode::THROWDYN_PREF: {
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
succs.emplace_back(tryEndPc);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
flag = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!flag) {
|
2022-08-02 08:38:18 +00:00
|
|
|
bytecodeBlockInfos_.emplace_back(byteCodeCurPrePc_.at(tryEndPc), SplitKind::END,
|
|
|
|
std::vector<uint8_t *>(1, tryEndPc));
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-08-02 08:38:18 +00:00
|
|
|
bytecodeBlockInfos_.emplace_back(tryEndPc, SplitKind::START, std::vector<uint8_t *>(1, tryEndPc)); // next block
|
2022-01-06 02:26:19 +00:00
|
|
|
return true;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-08-02 08:38:18 +00:00
|
|
|
void BytecodeCircuitBuilder::CompleteBytecodeBlockInfo()
|
2022-01-06 02:26:19 +00:00
|
|
|
{
|
2022-08-02 08:38:18 +00:00
|
|
|
std::sort(bytecodeBlockInfos_.begin(), bytecodeBlockInfos_.end());
|
2022-01-06 02:26:19 +00:00
|
|
|
|
2022-04-14 08:14:34 +00:00
|
|
|
if (IsLogEnabled()) {
|
2022-08-02 08:38:18 +00:00
|
|
|
PrintCollectBlockInfo(bytecodeBlockInfos_);
|
2022-04-14 08:14:34 +00:00
|
|
|
}
|
2022-01-06 02:26:19 +00:00
|
|
|
|
|
|
|
// Deduplicate
|
2022-08-02 08:38:18 +00:00
|
|
|
auto deduplicateIndex = std::unique(bytecodeBlockInfos_.begin(), bytecodeBlockInfos_.end());
|
|
|
|
bytecodeBlockInfos_.erase(deduplicateIndex, bytecodeBlockInfos_.end());
|
2022-01-06 02:26:19 +00:00
|
|
|
|
|
|
|
// Supplementary block information
|
|
|
|
std::vector<uint8_t *> endBlockPc;
|
|
|
|
std::vector<uint8_t *> startBlockPc;
|
2022-08-02 08:38:18 +00:00
|
|
|
for (size_t i = 0; i < bytecodeBlockInfos_.size() - 1; i++) {
|
|
|
|
if (bytecodeBlockInfos_[i].splitKind == bytecodeBlockInfos_[i + 1].splitKind &&
|
|
|
|
bytecodeBlockInfos_[i].splitKind == SplitKind::START) {
|
|
|
|
auto prePc = byteCodeCurPrePc_.at(bytecodeBlockInfos_[i + 1].pc);
|
2022-01-06 02:26:19 +00:00
|
|
|
endBlockPc.emplace_back(prePc); // Previous instruction of current instruction
|
2022-08-02 08:38:18 +00:00
|
|
|
endBlockPc.emplace_back(bytecodeBlockInfos_[i + 1].pc); // current instruction
|
2022-01-06 02:26:19 +00:00
|
|
|
continue;
|
|
|
|
}
|
2022-08-02 08:38:18 +00:00
|
|
|
if (bytecodeBlockInfos_[i].splitKind == bytecodeBlockInfos_[i + 1].splitKind &&
|
|
|
|
bytecodeBlockInfos_[i].splitKind == SplitKind::END) {
|
|
|
|
auto tempPc = bytecodeBlockInfos_[i].pc;
|
|
|
|
auto findItem = std::find_if(byteCodeCurPrePc_.cbegin(), byteCodeCurPrePc_.cend(),
|
2022-01-18 04:02:20 +00:00
|
|
|
[tempPc](const std::map<uint8_t *, uint8_t *>::value_type item) {
|
|
|
|
return item.second == tempPc;
|
|
|
|
});
|
2022-08-02 08:38:18 +00:00
|
|
|
if (findItem != byteCodeCurPrePc_.cend()) {
|
2022-01-06 02:26:19 +00:00
|
|
|
startBlockPc.emplace_back((*findItem).first);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Supplementary end block info
|
2022-04-24 17:17:29 +00:00
|
|
|
for (auto iter = endBlockPc.cbegin(); iter != endBlockPc.cend(); iter += 2) { // 2: index
|
2022-08-02 08:38:18 +00:00
|
|
|
bytecodeBlockInfos_.emplace_back(*iter, SplitKind::END,
|
2022-09-06 11:50:09 +00:00
|
|
|
std::vector<uint8_t *>(1, *(iter + 1)));
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
// Supplementary start block info
|
2022-04-24 17:17:29 +00:00
|
|
|
for (auto iter = startBlockPc.cbegin(); iter != startBlockPc.cend(); iter++) {
|
2022-08-02 08:38:18 +00:00
|
|
|
bytecodeBlockInfos_.emplace_back(*iter, SplitKind::START, std::vector<uint8_t *>(1, *iter));
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Deduplicate successor
|
2022-08-02 08:38:18 +00:00
|
|
|
for (size_t i = 0; i < bytecodeBlockInfos_.size(); i++) {
|
|
|
|
if (bytecodeBlockInfos_[i].splitKind == SplitKind::END) {
|
|
|
|
std::set<uint8_t *> tempSet(bytecodeBlockInfos_[i].succs.cbegin(),
|
|
|
|
bytecodeBlockInfos_[i].succs.cend());
|
|
|
|
bytecodeBlockInfos_[i].succs.assign(tempSet.cbegin(), tempSet.cend());
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-02 08:38:18 +00:00
|
|
|
std::sort(bytecodeBlockInfos_.begin(), bytecodeBlockInfos_.end());
|
2022-01-06 02:26:19 +00:00
|
|
|
|
|
|
|
// handling jumps to an empty block
|
2022-08-02 08:38:18 +00:00
|
|
|
auto endPc = bytecodeBlockInfos_[bytecodeBlockInfos_.size() - 1].pc;
|
|
|
|
auto iter = --byteCodeCurPrePc_.cend();
|
2022-01-06 02:26:19 +00:00
|
|
|
if (endPc == iter->first) {
|
2022-08-02 08:38:18 +00:00
|
|
|
bytecodeBlockInfos_.emplace_back(endPc, SplitKind::END, std::vector<uint8_t *>(1, endPc));
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
// Deduplicate
|
2022-08-02 08:38:18 +00:00
|
|
|
deduplicateIndex = std::unique(bytecodeBlockInfos_.begin(), bytecodeBlockInfos_.end());
|
|
|
|
bytecodeBlockInfos_.erase(deduplicateIndex, bytecodeBlockInfos_.end());
|
2022-01-06 02:26:19 +00:00
|
|
|
|
2022-04-14 08:14:34 +00:00
|
|
|
if (IsLogEnabled()) {
|
2022-08-02 08:38:18 +00:00
|
|
|
PrintCollectBlockInfo(bytecodeBlockInfos_);
|
2022-04-14 08:14:34 +00:00
|
|
|
}
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
|
2022-03-07 02:58:13 +00:00
|
|
|
void BytecodeCircuitBuilder::BuildBasicBlocks(std::map<std::pair<uint8_t *, uint8_t *>,
|
2022-08-02 08:38:18 +00:00
|
|
|
std::vector<uint8_t *>> &exception)
|
2022-01-06 02:26:19 +00:00
|
|
|
{
|
2022-01-22 11:09:02 +00:00
|
|
|
std::map<uint8_t *, BytecodeRegion *> startPcToBB; // [start, bb]
|
|
|
|
std::map<uint8_t *, BytecodeRegion *> endPcToBB; // [end, bb]
|
2022-08-02 08:38:18 +00:00
|
|
|
graph_.resize(bytecodeBlockInfos_.size() / 2); // 2 : half size
|
2022-01-06 02:26:19 +00:00
|
|
|
// build basic block
|
|
|
|
int blockId = 0;
|
|
|
|
int index = 0;
|
2022-08-02 08:38:18 +00:00
|
|
|
for (size_t i = 0; i < bytecodeBlockInfos_.size() - 1; i += 2) { // 2:index
|
|
|
|
auto startPc = bytecodeBlockInfos_[i].pc;
|
|
|
|
auto endPc = bytecodeBlockInfos_[i + 1].pc;
|
2022-04-24 17:17:29 +00:00
|
|
|
auto block = &graph_[index++];
|
2022-01-06 02:26:19 +00:00
|
|
|
block->id = blockId++;
|
|
|
|
block->start = startPc;
|
|
|
|
block->end = endPc;
|
|
|
|
block->preds = {};
|
|
|
|
block->succs = {};
|
2022-01-19 01:11:02 +00:00
|
|
|
startPcToBB[startPc] = block;
|
|
|
|
endPcToBB[endPc] = block;
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// add block associate
|
2022-08-02 08:38:18 +00:00
|
|
|
for (size_t i = 0; i < bytecodeBlockInfos_.size(); i++) {
|
|
|
|
if (bytecodeBlockInfos_[i].splitKind == SplitKind::START) {
|
2022-01-06 02:26:19 +00:00
|
|
|
continue;
|
|
|
|
}
|
2022-08-02 08:38:18 +00:00
|
|
|
auto curPc = bytecodeBlockInfos_[i].pc;
|
|
|
|
auto &successors = bytecodeBlockInfos_[i].succs;
|
2022-01-06 02:26:19 +00:00
|
|
|
for (size_t j = 0; j < successors.size(); j++) {
|
|
|
|
if (successors[j] == curPc) {
|
|
|
|
continue;
|
|
|
|
}
|
2022-01-19 01:11:02 +00:00
|
|
|
auto curBlock = endPcToBB[curPc];
|
|
|
|
auto succsBlock = startPcToBB[successors[j]];
|
2022-01-06 02:26:19 +00:00
|
|
|
curBlock->succs.emplace_back(succsBlock);
|
|
|
|
succsBlock->preds.emplace_back(curBlock);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// try catch block associate
|
2022-04-24 17:17:29 +00:00
|
|
|
for (size_t i = 0; i < graph_.size(); i++) {
|
|
|
|
const auto pc = graph_[i].start;
|
|
|
|
auto it = exception.cbegin();
|
|
|
|
for (; it != exception.cend(); it++) {
|
2022-01-06 02:26:19 +00:00
|
|
|
if (pc < it->first.first || pc >= it->first.second) { // try block interval
|
2022-01-18 04:02:20 +00:00
|
|
|
continue;
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
auto catchs = exception[it->first]; // catchs start pc
|
2022-04-24 17:17:29 +00:00
|
|
|
for (size_t j = i + 1; j < graph_.size(); j++) {
|
|
|
|
if (std::find(catchs.cbegin(), catchs.cend(), graph_[j].start) != catchs.cend()) {
|
|
|
|
graph_[i].catchs.insert(graph_[i].catchs.cbegin(), &graph_[j]);
|
|
|
|
graph_[i].succs.emplace_back(&graph_[j]);
|
|
|
|
graph_[j].preds.emplace_back(&graph_[i]);
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-07-21 02:14:57 +00:00
|
|
|
|
|
|
|
// When there are multiple catch blocks in the current block, the set of catch blocks
|
|
|
|
// needs to be sorted to satisfy the order of execution of catch blocks.
|
|
|
|
BytecodeRegion& bb = graph_[i];
|
2022-07-15 02:35:25 +00:00
|
|
|
bb.SortCatches();
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
|
2022-04-14 08:14:34 +00:00
|
|
|
if (IsLogEnabled()) {
|
2022-04-24 17:17:29 +00:00
|
|
|
PrintGraph();
|
2022-04-14 08:14:34 +00:00
|
|
|
}
|
2022-04-24 17:17:29 +00:00
|
|
|
ComputeDominatorTree();
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
|
2022-04-24 17:17:29 +00:00
|
|
|
void BytecodeCircuitBuilder::ComputeDominatorTree()
|
2022-01-06 02:26:19 +00:00
|
|
|
{
|
|
|
|
// Construct graph backward order
|
2022-01-19 01:11:02 +00:00
|
|
|
std::map<size_t, size_t> bbIdToDfsTimestamp; // (basicblock id, dfs order)
|
2022-08-01 09:13:57 +00:00
|
|
|
std::unordered_map<size_t, size_t> dfsFatherIdx;
|
|
|
|
std::unordered_map<size_t, size_t> bbDfsTimestampToIdx;
|
|
|
|
std::vector<size_t> basicBlockList;
|
2022-01-06 02:26:19 +00:00
|
|
|
size_t timestamp = 0;
|
|
|
|
std::deque<size_t> pendingList;
|
2022-04-24 17:17:29 +00:00
|
|
|
std::vector<size_t> visited(graph_.size(), 0);
|
|
|
|
auto basicBlockId = graph_[0].id;
|
2022-08-01 09:13:57 +00:00
|
|
|
visited[graph_[0].id] = 1;
|
2022-01-06 02:26:19 +00:00
|
|
|
pendingList.push_back(basicBlockId);
|
|
|
|
while (!pendingList.empty()) {
|
2022-08-01 09:13:57 +00:00
|
|
|
size_t curBlockId = pendingList.back();
|
2022-01-06 02:26:19 +00:00
|
|
|
pendingList.pop_back();
|
2022-08-01 09:13:57 +00:00
|
|
|
basicBlockList.push_back(curBlockId);
|
2022-01-19 01:11:02 +00:00
|
|
|
bbIdToDfsTimestamp[curBlockId] = timestamp++;
|
2022-08-01 09:13:57 +00:00
|
|
|
for (const auto &succBlock: graph_[curBlockId].succs) {
|
2022-01-06 02:26:19 +00:00
|
|
|
if (visited[succBlock->id] == 0) {
|
|
|
|
visited[succBlock->id] = 1;
|
|
|
|
pendingList.push_back(succBlock->id);
|
2022-08-01 09:13:57 +00:00
|
|
|
dfsFatherIdx[succBlock->id] = bbIdToDfsTimestamp[curBlockId];
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-08-26 01:06:59 +00:00
|
|
|
|
2022-08-01 09:13:57 +00:00
|
|
|
for (size_t idx = 0; idx < basicBlockList.size(); idx++) {
|
|
|
|
bbDfsTimestampToIdx[basicBlockList[idx]] = idx;
|
|
|
|
}
|
2022-01-06 02:26:19 +00:00
|
|
|
|
2022-04-24 17:17:29 +00:00
|
|
|
RemoveDeadRegions(bbIdToDfsTimestamp);
|
2022-01-06 02:26:19 +00:00
|
|
|
|
2022-04-14 08:14:34 +00:00
|
|
|
if (IsLogEnabled()) {
|
|
|
|
// print cfg order
|
|
|
|
for (auto iter : bbIdToDfsTimestamp) {
|
2022-07-06 06:12:54 +00:00
|
|
|
LOG_COMPILER(INFO) << "BB_" << iter.first << " dfs timestamp is : " << iter.second;
|
2022-04-14 08:14:34 +00:00
|
|
|
}
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-04-14 08:14:34 +00:00
|
|
|
|
2022-08-01 09:13:57 +00:00
|
|
|
std::vector<size_t> immDom(basicBlockList.size()); // immediate dominator with dfs order index
|
|
|
|
std::vector<size_t> semiDom(basicBlockList.size());
|
|
|
|
std::vector<size_t> realImmDom(graph_.size()); // immediate dominator with real index
|
|
|
|
std::vector<std::vector<size_t> > semiDomTree(basicBlockList.size());
|
|
|
|
{
|
|
|
|
std::vector<size_t> parent(basicBlockList.size());
|
|
|
|
std::iota(parent.begin(), parent.end(), 0);
|
|
|
|
std::vector<size_t> minIdx(basicBlockList.size());
|
|
|
|
std::function<size_t(size_t)> unionFind = [&] (size_t idx) -> size_t {
|
|
|
|
if (parent[idx] == idx) return idx;
|
|
|
|
size_t unionFindSetRoot = unionFind(parent[idx]);
|
|
|
|
if (semiDom[minIdx[idx]] > semiDom[minIdx[parent[idx]]]) {
|
|
|
|
minIdx[idx] = minIdx[parent[idx]];
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-08-01 09:13:57 +00:00
|
|
|
return parent[idx] = unionFindSetRoot;
|
|
|
|
};
|
|
|
|
auto merge = [&] (size_t fatherIdx, size_t sonIdx) -> void {
|
|
|
|
size_t parentFatherIdx = unionFind(fatherIdx);
|
|
|
|
size_t parentSonIdx = unionFind(sonIdx);
|
|
|
|
parent[parentSonIdx] = parentFatherIdx;
|
|
|
|
};
|
|
|
|
std::iota(semiDom.begin(), semiDom.end(), 0);
|
|
|
|
semiDom[0] = semiDom.size();
|
2022-08-05 09:00:14 +00:00
|
|
|
for (size_t idx = basicBlockList.size() - 1; idx >= 1; idx--) {
|
2022-08-01 09:13:57 +00:00
|
|
|
for (const auto &preBlock : graph_[basicBlockList[idx]].preds) {
|
|
|
|
if (bbDfsTimestampToIdx[preBlock->id] < idx) {
|
|
|
|
semiDom[idx] = std::min(semiDom[idx], bbDfsTimestampToIdx[preBlock->id]);
|
|
|
|
} else {
|
|
|
|
unionFind(bbDfsTimestampToIdx[preBlock->id]);
|
|
|
|
semiDom[idx] = std::min(semiDom[idx], semiDom[minIdx[bbDfsTimestampToIdx[preBlock->id]]]);
|
|
|
|
}
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-08-01 09:13:57 +00:00
|
|
|
for (const auto & succDomIdx : semiDomTree[idx]) {
|
|
|
|
unionFind(succDomIdx);
|
|
|
|
if (idx == semiDom[minIdx[succDomIdx]]) {
|
|
|
|
immDom[succDomIdx] = idx;
|
|
|
|
} else {
|
|
|
|
immDom[succDomIdx] = minIdx[succDomIdx];
|
|
|
|
}
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-08-01 09:13:57 +00:00
|
|
|
minIdx[idx] = idx;
|
|
|
|
merge(dfsFatherIdx[basicBlockList[idx]], idx);
|
|
|
|
semiDomTree[semiDom[idx]].push_back(idx);
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-08-01 09:13:57 +00:00
|
|
|
for (size_t idx = 1; idx < basicBlockList.size(); idx++) {
|
|
|
|
if (immDom[idx] != semiDom[idx]) {
|
|
|
|
immDom[idx] = immDom[immDom[idx]];
|
2022-04-14 08:14:34 +00:00
|
|
|
}
|
2022-08-01 09:13:57 +00:00
|
|
|
realImmDom[basicBlockList[idx]] = basicBlockList[immDom[idx]];
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-08-01 09:13:57 +00:00
|
|
|
semiDom[0] = 0;
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
|
2022-04-14 08:14:34 +00:00
|
|
|
if (IsLogEnabled()) {
|
|
|
|
// print immediate dominator
|
2022-08-01 09:13:57 +00:00
|
|
|
for (size_t i = 0; i < realImmDom.size(); i++) {
|
|
|
|
LOG_COMPILER(INFO) << i << " immediate dominator: " << realImmDom[i];
|
2022-04-14 08:14:34 +00:00
|
|
|
}
|
2022-04-24 17:17:29 +00:00
|
|
|
PrintGraph();
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-04-14 08:14:34 +00:00
|
|
|
|
2022-08-01 09:13:57 +00:00
|
|
|
BuildImmediateDominator(realImmDom);
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-04-24 17:17:29 +00:00
|
|
|
void BytecodeCircuitBuilder::BuildImmediateDominator(const std::vector<size_t> &immDom)
|
2022-01-06 02:26:19 +00:00
|
|
|
{
|
2022-04-24 17:17:29 +00:00
|
|
|
graph_[0].iDominator = &graph_[0];
|
2022-01-18 04:02:20 +00:00
|
|
|
for (size_t i = 1; i < immDom.size(); i++) {
|
2022-04-24 17:17:29 +00:00
|
|
|
auto dominatedBlock = &graph_[i];
|
2022-01-06 02:26:19 +00:00
|
|
|
if (dominatedBlock->isDead) {
|
|
|
|
continue;
|
|
|
|
}
|
2022-04-24 17:17:29 +00:00
|
|
|
auto immDomBlock = &graph_[immDom[i]];
|
2022-01-06 02:26:19 +00:00
|
|
|
dominatedBlock->iDominator = immDomBlock;
|
|
|
|
}
|
|
|
|
|
2022-04-14 08:14:34 +00:00
|
|
|
if (IsLogEnabled()) {
|
2022-04-24 17:17:29 +00:00
|
|
|
for (auto block : graph_) {
|
2022-04-14 08:14:34 +00:00
|
|
|
if (block.isDead) {
|
|
|
|
continue;
|
|
|
|
}
|
2022-07-06 06:12:54 +00:00
|
|
|
LOG_COMPILER(INFO) << "current block " << block.id
|
2022-04-14 08:14:34 +00:00
|
|
|
<< " immediate dominator block id: " << block.iDominator->id;
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-24 17:17:29 +00:00
|
|
|
for (auto &block : graph_) {
|
2022-01-06 02:26:19 +00:00
|
|
|
if (block.isDead) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (block.iDominator->id != block.id) {
|
|
|
|
block.iDominator->immDomBlocks.emplace_back(&block);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-14 08:14:34 +00:00
|
|
|
if (IsLogEnabled()) {
|
2022-04-24 17:17:29 +00:00
|
|
|
for (auto &block : graph_) {
|
2022-04-14 08:14:34 +00:00
|
|
|
if (block.isDead) {
|
|
|
|
continue;
|
|
|
|
}
|
2022-08-05 09:00:14 +00:00
|
|
|
std::string log("block " + std::to_string(block.id) + " dominate block has: ");
|
2022-04-14 08:14:34 +00:00
|
|
|
for (size_t i = 0; i < block.immDomBlocks.size(); i++) {
|
|
|
|
log += std::to_string(block.immDomBlocks[i]->id) + ",";
|
|
|
|
}
|
2022-07-06 06:12:54 +00:00
|
|
|
LOG_COMPILER(INFO) << log;
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
}
|
2022-04-14 08:14:34 +00:00
|
|
|
|
2022-04-24 17:17:29 +00:00
|
|
|
ComputeDomFrontiers(immDom);
|
|
|
|
InsertPhi();
|
|
|
|
UpdateCFG();
|
|
|
|
BuildCircuit();
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
|
2022-04-24 17:17:29 +00:00
|
|
|
void BytecodeCircuitBuilder::ComputeDomFrontiers(const std::vector<size_t> &immDom)
|
2022-01-06 02:26:19 +00:00
|
|
|
{
|
2022-01-22 11:09:02 +00:00
|
|
|
std::vector<std::set<BytecodeRegion *>> domFrontiers(immDom.size());
|
2022-04-24 17:17:29 +00:00
|
|
|
for (auto &bb : graph_) {
|
2022-01-06 02:26:19 +00:00
|
|
|
if (bb.isDead) {
|
|
|
|
continue;
|
|
|
|
}
|
2022-01-22 11:09:02 +00:00
|
|
|
if (bb.preds.size() < 2) { // 2: pred num
|
2022-01-06 02:26:19 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
for (size_t i = 0; i < bb.preds.size(); i++) {
|
|
|
|
auto runner = bb.preds[i];
|
2022-01-18 04:02:20 +00:00
|
|
|
while (runner->id != immDom[bb.id]) {
|
2022-01-06 02:26:19 +00:00
|
|
|
domFrontiers[runner->id].insert(&bb);
|
2022-04-24 17:17:29 +00:00
|
|
|
runner = &graph_[immDom[runner->id]];
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (size_t i = 0; i < domFrontiers.size(); i++) {
|
2022-04-24 17:17:29 +00:00
|
|
|
for (auto iter = domFrontiers[i].cbegin(); iter != domFrontiers[i].cend(); iter++) {
|
|
|
|
graph_[i].domFrontiers.emplace_back(*iter);
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-14 08:14:34 +00:00
|
|
|
if (IsLogEnabled()) {
|
|
|
|
for (size_t i = 0; i < domFrontiers.size(); i++) {
|
|
|
|
std::string log("basic block " + std::to_string(i) + " dominate Frontiers is: ");
|
2022-04-24 17:17:29 +00:00
|
|
|
for (auto iter = domFrontiers[i].cbegin(); iter != domFrontiers[i].cend(); iter++) {
|
2022-04-14 08:14:34 +00:00
|
|
|
log += std::to_string((*iter)->id) + ", ";
|
|
|
|
}
|
2022-07-06 06:12:54 +00:00
|
|
|
LOG_COMPILER(INFO) << log;
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-24 17:17:29 +00:00
|
|
|
void BytecodeCircuitBuilder::RemoveDeadRegions(const std::map<size_t, size_t> &bbIdToDfsTimestamp)
|
2022-01-06 02:26:19 +00:00
|
|
|
{
|
2022-04-24 17:17:29 +00:00
|
|
|
for (auto &block: graph_) {
|
2022-01-22 11:09:02 +00:00
|
|
|
std::vector<BytecodeRegion *> newPreds;
|
2022-01-19 01:11:02 +00:00
|
|
|
for (auto &bb : block.preds) {
|
|
|
|
if (bbIdToDfsTimestamp.count(bb->id)) {
|
2022-01-06 02:26:19 +00:00
|
|
|
newPreds.emplace_back(bb);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
block.preds = newPreds;
|
|
|
|
}
|
|
|
|
|
2022-04-24 17:17:29 +00:00
|
|
|
for (auto &block : graph_) {
|
2022-01-19 01:11:02 +00:00
|
|
|
block.isDead = !bbIdToDfsTimestamp.count(block.id);
|
2022-01-06 02:26:19 +00:00
|
|
|
if (block.isDead) {
|
|
|
|
block.succs.clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-24 17:17:29 +00:00
|
|
|
BytecodeInfo BytecodeCircuitBuilder::GetBytecodeInfo(const uint8_t *pc)
|
2022-01-06 02:26:19 +00:00
|
|
|
{
|
2022-01-22 11:09:02 +00:00
|
|
|
BytecodeInfo info;
|
2022-09-06 05:27:19 +00:00
|
|
|
auto opcode = static_cast<EcmaBytecode>(*pc);
|
|
|
|
info.opcode = opcode;
|
2022-01-06 02:26:19 +00:00
|
|
|
switch (opcode) {
|
2022-08-26 01:06:59 +00:00
|
|
|
case EcmaBytecode::MOV_V4_V4: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t vdst = READ_INST_4_0();
|
|
|
|
uint16_t vsrc = READ_INST_4_1();
|
|
|
|
info.vregOut.emplace_back(vdst);
|
2022-09-06 05:27:19 +00:00
|
|
|
info.offset = BytecodeOffset::TWO;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(vsrc));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::MOV_DYN_V8_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t vdst = READ_INST_8_0();
|
|
|
|
uint16_t vsrc = READ_INST_8_1();
|
|
|
|
info.vregOut.emplace_back(vdst);
|
2022-09-06 05:27:19 +00:00
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(vsrc));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::MOV_DYN_V16_V16: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t vdst = READ_INST_16_0();
|
|
|
|
uint16_t vsrc = READ_INST_16_2();
|
|
|
|
info.vregOut.emplace_back(vdst);
|
2022-09-06 05:27:19 +00:00
|
|
|
info.offset = BytecodeOffset::FIVE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(vsrc));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDA_STR_ID32: {
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::FIVE;
|
|
|
|
uint64_t imm = READ_INST_32_0();
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(StringId(imm));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-08-26 01:06:59 +00:00
|
|
|
case EcmaBytecode::JMP_IMM8: {
|
2022-09-06 05:27:19 +00:00
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-08-26 01:06:59 +00:00
|
|
|
case EcmaBytecode::JMP_IMM16: {
|
2022-09-06 05:27:19 +00:00
|
|
|
info.offset = BytecodeOffset::THREE;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-08-26 01:06:59 +00:00
|
|
|
case EcmaBytecode::JMP_IMM32: {
|
2022-09-06 05:27:19 +00:00
|
|
|
info.offset = BytecodeOffset::FIVE;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-08-26 01:06:59 +00:00
|
|
|
case EcmaBytecode::JEQZ_IMM8: {
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-08-26 01:06:59 +00:00
|
|
|
case EcmaBytecode::JEQZ_IMM16: {
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-08-26 01:06:59 +00:00
|
|
|
case EcmaBytecode::JNEZ_IMM8: {
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-08-26 01:06:59 +00:00
|
|
|
case EcmaBytecode::JNEZ_IMM16: {
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDA_DYN_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t vsrc = READ_INST_8_0();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(vsrc));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::STA_DYN_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t vdst = READ_INST_8_0();
|
|
|
|
info.vregOut.emplace_back(vdst);
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDAI_DYN_IMM32: {
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::FIVE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(Immediate(READ_INST_32_0()));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::FLDAI_DYN_IMM64: {
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::NINE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(Immediate(READ_INST_64_0()));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::CALLARG0DYN_PREF_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint32_t funcReg = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(funcReg));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::CALLARG1DYN_PREF_V8_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint32_t funcReg = READ_INST_8_1();
|
|
|
|
uint32_t reg = READ_INST_8_2();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::FOUR;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(funcReg));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(reg));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::CALLARGS2DYN_PREF_V8_V8_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint32_t funcReg = READ_INST_8_1();
|
2022-03-16 06:14:38 +00:00
|
|
|
uint32_t reg0 = READ_INST_8_2();
|
|
|
|
uint32_t reg1 = READ_INST_8_3();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::FIVE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(funcReg));
|
2022-03-16 06:14:38 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(reg0));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(reg1));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::CALLARGS3DYN_PREF_V8_V8_V8_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint32_t funcReg = READ_INST_8_1();
|
2022-03-16 06:14:38 +00:00
|
|
|
uint32_t reg0 = READ_INST_8_2();
|
|
|
|
uint32_t reg1 = READ_INST_8_3();
|
|
|
|
uint32_t reg2 = READ_INST_8_4();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::SIX;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(funcReg));
|
2022-03-16 06:14:38 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(reg0));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(reg1));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(reg2));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::CALLITHISRANGEDYN_PREF_IMM16_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint32_t funcReg = READ_INST_8_3();
|
2022-03-16 06:14:38 +00:00
|
|
|
uint32_t actualNumArgs = READ_INST_16_1();
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(funcReg));
|
2022-03-16 06:14:38 +00:00
|
|
|
for (size_t i = 1; i <= actualNumArgs; i++) {
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(funcReg + i));
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::FIVE;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::CALLSPREADDYN_PREF_V8_V8_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
|
|
|
uint16_t v1 = READ_INST_8_2();
|
|
|
|
uint16_t v2 = READ_INST_8_3();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::FIVE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v1));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v2));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::CALLIRANGEDYN_PREF_IMM16_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint32_t funcReg = READ_INST_8_3();
|
|
|
|
uint32_t actualNumArgs = READ_INST_16_1();
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(funcReg));
|
2022-03-16 06:14:38 +00:00
|
|
|
for (size_t i = 1; i <= actualNumArgs; i++) {
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(funcReg + i));
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::FIVE;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::RETURN_DYN: {
|
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::ONE;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::RETURNUNDEFINED_PREF: {
|
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDNAN_PREF: {
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDINFINITY_PREF: {
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDGLOBALTHIS_PREF: {
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDUNDEFINED_PREF: {
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDNULL_PREF: {
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDSYMBOL_PREF: {
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDGLOBAL_PREF: {
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDTRUE_PREF: {
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDFALSE_PREF: {
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDLEXENVDYN_PREF: {
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::GETUNMAPPEDARGS_PREF: {
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::ASYNCFUNCTIONENTER_PREF: {
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::TONUMBER_PREF_V8: {
|
|
|
|
uint16_t v0 = READ_INST_8_1();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::NEGDYN_PREF_V8: {
|
|
|
|
uint16_t v0 = READ_INST_8_1();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::NOTDYN_PREF_V8: {
|
|
|
|
uint16_t v0 = READ_INST_8_1();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EcmaBytecode::INCDYN_PREF_V8: {
|
|
|
|
uint16_t v0 = READ_INST_8_1();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::DECDYN_PREF_V8: {
|
|
|
|
uint16_t v0 = READ_INST_8_1();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::THROWDYN_PREF: {
|
|
|
|
info.accIn = true;
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::TYPEOFDYN_PREF: {
|
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::GETPROPITERATOR_PREF: {
|
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::RESUMEGENERATOR_PREF_V8: {
|
|
|
|
uint16_t vs = READ_INST_8_1();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
|
|
|
info.inputs.emplace_back(VirtualRegister(vs));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::GETRESUMEMODE_PREF_V8: {
|
|
|
|
uint16_t vs = READ_INST_8_1();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
|
|
|
info.inputs.emplace_back(VirtualRegister(vs));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::GETITERATOR_PREF: {
|
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::THROWCONSTASSIGNMENT_PREF_V8: {
|
|
|
|
uint16_t v0 = READ_INST_8_1();
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::THROWTHROWNOTEXISTS_PREF: {
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::THROWPATTERNNONCOERCIBLE_PREF: {
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::THROWIFNOTOBJECT_PREF_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::ITERNEXT_PREF_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::CLOSEITERATOR_PREF_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::ADD2DYN_PREF_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::SUB2DYN_PREF_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::MUL2DYN_PREF_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::DIV2DYN_PREF_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::MOD2DYN_PREF_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::EQDYN_PREF_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::NOTEQDYN_PREF_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LESSDYN_PREF_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LESSEQDYN_PREF_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::GREATERDYN_PREF_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::GREATEREQDYN_PREF_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t vs = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(vs));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::SHL2DYN_PREF_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::SHR2DYN_PREF_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::ASHR2DYN_PREF_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::AND2DYN_PREF_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::OR2DYN_PREF_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::XOR2DYN_PREF_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::DELOBJPROP_PREF_V8_V8: {
|
|
|
|
uint16_t v0 = READ_INST_8_1();
|
|
|
|
uint16_t v1 = READ_INST_8_2();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::FOUR;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-09-06 05:27:19 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v1));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::DEFINEFUNCDYN_PREF_ID16_IMM16_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_5();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::SEVEN;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(MethodId(READ_INST_16_1()));
|
|
|
|
info.inputs.emplace_back(Immediate(READ_INST_16_3()));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::DEFINEMETHOD_PREF_ID16_IMM16_V8: {
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
uint16_t methodId = READ_INST_16_1();
|
|
|
|
uint16_t length = READ_INST_16_3();
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_5();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::SEVEN;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(MethodId(methodId));
|
|
|
|
info.inputs.emplace_back(Immediate(length));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::NEWOBJDYNRANGE_PREF_IMM16_V8: {
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::FIVE;
|
2022-05-17 07:07:10 +00:00
|
|
|
uint16_t range = READ_INST_16_1();
|
|
|
|
uint16_t firstArgRegIdx = READ_INST_8_3();
|
|
|
|
for (uint16_t i = 0; i < range; ++i) {
|
|
|
|
info.inputs.emplace_back(VirtualRegister(firstArgRegIdx + i));
|
|
|
|
}
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::EXPDYN_PREF_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::ISINDYN_PREF_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::INSTANCEOFDYN_PREF_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::STRICTNOTEQDYN_PREF_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::STRICTEQDYN_PREF_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDLEXVARDYN_PREF_IMM16_IMM16: {
|
|
|
|
uint16_t level = READ_INST_16_1();
|
|
|
|
uint16_t slot = READ_INST_16_3();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::SIX;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(Immediate(level));
|
|
|
|
info.inputs.emplace_back(Immediate(slot));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDLEXVARDYN_PREF_IMM8_IMM8: {
|
|
|
|
uint16_t level = READ_INST_8_1();
|
|
|
|
uint16_t slot = READ_INST_8_2();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::FOUR;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(Immediate(level));
|
|
|
|
info.inputs.emplace_back(Immediate(slot));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDLEXVARDYN_PREF_IMM4_IMM4: {
|
|
|
|
uint16_t level = READ_INST_4_2();
|
|
|
|
uint16_t slot = READ_INST_4_3();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(Immediate(level));
|
|
|
|
info.inputs.emplace_back(Immediate(slot));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::STLEXVARDYN_PREF_IMM16_IMM16_V8: {
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
uint16_t level = READ_INST_16_1();
|
|
|
|
uint16_t slot = READ_INST_16_3();
|
2022-09-06 05:27:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_5();
|
|
|
|
info.offset = BytecodeOffset::SEVEN;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(Immediate(level));
|
|
|
|
info.inputs.emplace_back(Immediate(slot));
|
2022-09-06 05:27:19 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::STLEXVARDYN_PREF_IMM8_IMM8_V8: {
|
|
|
|
uint16_t level = READ_INST_8_1();
|
|
|
|
uint16_t slot = READ_INST_8_2();
|
|
|
|
uint16_t v0 = READ_INST_8_3();
|
|
|
|
info.offset = BytecodeOffset::FIVE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(Immediate(level));
|
|
|
|
info.inputs.emplace_back(Immediate(slot));
|
2022-09-06 05:27:19 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::STLEXVARDYN_PREF_IMM4_IMM4_V8: {
|
|
|
|
uint16_t level = READ_INST_4_2();
|
|
|
|
uint16_t slot = READ_INST_4_3();
|
|
|
|
uint16_t v0 = READ_INST_8_2();
|
|
|
|
info.offset = BytecodeOffset::FOUR;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(Immediate(level));
|
|
|
|
info.inputs.emplace_back(Immediate(slot));
|
2022-09-06 05:27:19 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::NEWLEXENVDYN_PREF_IMM16: {
|
2022-04-09 10:00:34 +00:00
|
|
|
uint16_t numVars = READ_INST_16_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::FOUR;
|
2022-08-16 15:48:09 +00:00
|
|
|
info.inputs.emplace_back(Immediate(numVars));
|
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::NEWLEXENVWITHNAMEDYN_PREF_IMM16_IMM16: {
|
|
|
|
uint16_t numVars = READ_INST_16_1();
|
|
|
|
uint16_t scopeId = READ_INST_16_3();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::SIX;
|
2022-04-09 10:00:34 +00:00
|
|
|
info.inputs.emplace_back(Immediate(numVars));
|
|
|
|
info.inputs.emplace_back(Immediate(scopeId));
|
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::POPLEXENVDYN_PREF: {
|
|
|
|
info.accOut = false;
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::CREATEITERRESULTOBJ_PREF_V8_V8: {
|
|
|
|
uint16_t v0 = READ_INST_8_1();
|
|
|
|
uint16_t v1 = READ_INST_8_2();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::FOUR;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v1));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::SUSPENDGENERATOR_PREF_V8_V8: {
|
|
|
|
uint16_t v0 = READ_INST_8_1();
|
|
|
|
uint16_t v1 = READ_INST_8_2();
|
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::FOUR;
|
2022-06-06 09:41:17 +00:00
|
|
|
uint32_t offset = pc - method_->GetBytecodeArray();
|
|
|
|
info.inputs.emplace_back(Immediate(offset)); // Save the pc offset when suspend
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v1));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::ASYNCFUNCTIONAWAITUNCAUGHT_PREF_V8_V8: {
|
|
|
|
uint16_t v0 = READ_INST_8_1();
|
|
|
|
uint16_t v1 = READ_INST_8_2();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::FOUR;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-09-06 05:27:19 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v1));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::ASYNCFUNCTIONRESOLVE_PREF_V8_V8_V8: {
|
|
|
|
uint16_t v0 = READ_INST_8_1();
|
|
|
|
uint16_t v2 = READ_INST_8_3();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::FIVE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-09-06 05:27:19 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v2));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::ASYNCFUNCTIONREJECT_PREF_V8_V8_V8: {
|
|
|
|
uint16_t v0 = READ_INST_8_1();
|
|
|
|
uint16_t v2 = READ_INST_8_3();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::FIVE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-09-06 05:27:19 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v2));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 11:50:09 +00:00
|
|
|
case EcmaBytecode::NEWOBJAPPLY_PREF_V8_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::FOUR;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::THROWUNDEFINEDIFHOLE_PREF_V8_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
|
|
|
uint16_t v1 = READ_INST_8_2();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.offset = BytecodeOffset::FOUR;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v1));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::STOWNBYNAME_PREF_ID32_V8: {
|
|
|
|
uint32_t stringId = READ_INST_32_1();
|
|
|
|
uint32_t v0 = READ_INST_8_5();
|
|
|
|
info.accIn = true;
|
|
|
|
info.offset = BytecodeOffset::SEVEN;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(StringId(stringId));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::CREATEEMPTYARRAY_PREF: {
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::CREATEEMPTYOBJECT_PREF: {
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::CREATEOBJECTWITHBUFFER_PREF_IMM16: {
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
uint16_t imm = READ_INST_16_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::FOUR;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(Immediate(imm));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::SETOBJECTWITHPROTO_PREF_V8_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
uint16_t v1 = READ_INST_8_2();
|
|
|
|
info.offset = BytecodeOffset::FOUR;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-09-06 05:27:19 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v1));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::CREATEARRAYWITHBUFFER_PREF_IMM16: {
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
uint16_t imm = READ_INST_16_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::FOUR;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(Immediate(imm));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::GETMODULENAMESPACE_PREF_ID32: {
|
|
|
|
uint32_t stringId = READ_INST_32_1();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::SIX;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(StringId(stringId));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::STMODULEVAR_PREF_ID32: {
|
|
|
|
uint32_t stringId = READ_INST_32_1();
|
|
|
|
info.accIn = true;
|
|
|
|
info.offset = BytecodeOffset::SIX;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(StringId(stringId));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::COPYMODULE_PREF_V8: {
|
|
|
|
uint16_t v0 = READ_INST_8_1();
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EcmaBytecode::LDMODULEVAR_PREF_ID32_IMM8: {
|
|
|
|
uint32_t stringId = READ_INST_32_1();
|
|
|
|
uint8_t innerFlag = READ_INST_8_5();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::SEVEN;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(StringId(stringId));
|
|
|
|
info.inputs.emplace_back(Immediate(innerFlag));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::CREATEREGEXPWITHLITERAL_PREF_ID32_IMM8: {
|
|
|
|
uint32_t stringId = READ_INST_32_1();
|
|
|
|
uint8_t flags = READ_INST_8_5();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::SEVEN;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(StringId(stringId));
|
|
|
|
info.inputs.emplace_back(Immediate(flags));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::GETTEMPLATEOBJECT_PREF_V8: {
|
|
|
|
uint16_t v0 = READ_INST_8_1();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::GETNEXTPROPNAME_PREF_V8: {
|
|
|
|
uint16_t v0 = READ_INST_8_1();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::COPYDATAPROPERTIES_PREF_V8_V8: {
|
|
|
|
uint16_t v0 = READ_INST_8_1();
|
|
|
|
uint16_t v1 = READ_INST_8_2();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::FOUR;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-09-06 05:27:19 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v1));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::STOWNBYINDEX_PREF_V8_IMM32: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint32_t v0 = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
uint32_t index = READ_INST_32_2();
|
|
|
|
info.accIn = true;
|
|
|
|
info.offset = BytecodeOffset::SEVEN;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
|
|
|
info.inputs.emplace_back(Immediate(index));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::STOWNBYVALUE_PREF_V8_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint32_t v0 = READ_INST_8_1();
|
|
|
|
uint32_t v1 = READ_INST_8_2();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.offset = BytecodeOffset::FOUR;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v1));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::CREATEOBJECTWITHEXCLUDEDKEYS_PREF_IMM16_V8_V8: {
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
uint16_t numKeys = READ_INST_16_1();
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_3();
|
2022-03-31 12:11:37 +00:00
|
|
|
uint16_t firstArgRegIdx = READ_INST_8_4();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::SIX;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(Immediate(numKeys));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-03-31 12:11:37 +00:00
|
|
|
info.inputs.emplace_back(Immediate(firstArgRegIdx));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDHOLE_PREF: {
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-08-16 15:48:09 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::COPYRESTARGS_PREF_IMM16: {
|
|
|
|
uint16_t restIdx = READ_INST_16_1();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::FOUR;
|
|
|
|
info.inputs.emplace_back(Immediate(restIdx));
|
2022-08-16 15:48:09 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::DEFINEGETTERSETTERBYVALUE_PREF_V8_V8_V8_V8: {
|
|
|
|
uint16_t v0 = READ_INST_8_1();
|
|
|
|
uint16_t v1 = READ_INST_8_2();
|
|
|
|
uint16_t v2 = READ_INST_8_3();
|
|
|
|
uint16_t v3 = READ_INST_8_4();
|
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::SIX;
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v1));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v2));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v3));
|
2022-08-16 15:48:09 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDOBJBYINDEX_PREF_V8_IMM32: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
uint32_t idx = READ_INST_32_2();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::SEVEN;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
|
|
|
info.inputs.emplace_back(Immediate(idx));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::STOBJBYINDEX_PREF_V8_IMM32: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
uint32_t index = READ_INST_32_2();
|
|
|
|
info.accIn = true;
|
|
|
|
info.offset = BytecodeOffset::SEVEN;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
|
|
|
info.inputs.emplace_back(Immediate(index));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDOBJBYVALUE_PREF_V8_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint32_t v0 = READ_INST_8_1();
|
|
|
|
uint32_t v1 = READ_INST_8_2();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::FOUR;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v1));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::STOBJBYVALUE_PREF_V8_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint32_t v0 = READ_INST_8_1();
|
|
|
|
uint32_t v1 = READ_INST_8_2();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.offset = BytecodeOffset::FOUR;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v1));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDSUPERBYVALUE_PREF_V8_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint32_t v0 = READ_INST_8_1();
|
|
|
|
uint32_t v1 = READ_INST_8_2();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::FOUR;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v1));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::STSUPERBYVALUE_PREF_V8_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint32_t v0 = READ_INST_8_1();
|
|
|
|
uint32_t v1 = READ_INST_8_2();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.offset = BytecodeOffset::FOUR;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v1));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::TRYLDGLOBALBYNAME_PREF_ID32: {
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::SIX;
|
|
|
|
info.inputs.emplace_back(StringId(READ_INST_32_1()));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::TRYSTGLOBALBYNAME_PREF_ID32: {
|
|
|
|
info.accIn = true;
|
|
|
|
info.offset = BytecodeOffset::SIX;
|
|
|
|
info.inputs.emplace_back(StringId(READ_INST_32_1()));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::STCONSTTOGLOBALRECORD_PREF_ID32: {
|
|
|
|
info.accIn = true;
|
|
|
|
info.offset = BytecodeOffset::SIX;
|
|
|
|
info.inputs.emplace_back(StringId(READ_INST_32_1()));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::STLETTOGLOBALRECORD_PREF_ID32: {
|
|
|
|
info.accIn = true;
|
|
|
|
info.offset = BytecodeOffset::SIX;
|
|
|
|
info.inputs.emplace_back(StringId(READ_INST_32_1()));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::STCLASSTOGLOBALRECORD_PREF_ID32: {
|
|
|
|
info.accIn = true;
|
|
|
|
info.offset = BytecodeOffset::SIX;
|
|
|
|
info.inputs.emplace_back(StringId(READ_INST_32_1()));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::STOWNBYVALUEWITHNAMESET_PREF_V8_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint32_t v0 = READ_INST_8_1();
|
|
|
|
uint32_t v1 = READ_INST_8_2();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.offset = BytecodeOffset::FOUR;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v1));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::STOWNBYNAMEWITHNAMESET_PREF_ID32_V8: {
|
|
|
|
uint32_t stringId = READ_INST_32_1();
|
|
|
|
uint32_t v0 = READ_INST_8_5();
|
|
|
|
info.accIn = true;
|
|
|
|
info.offset = BytecodeOffset::SEVEN;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(StringId(stringId));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDGLOBALVAR_PREF_ID32: {
|
|
|
|
uint32_t stringId = READ_INST_32_1();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::SIX;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(StringId(stringId));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDOBJBYNAME_PREF_ID32_V8: {
|
|
|
|
uint32_t stringId = READ_INST_32_1();
|
|
|
|
uint32_t v0 = READ_INST_8_5();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::SEVEN;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(StringId(stringId));
|
2022-09-06 05:27:19 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::STOBJBYNAME_PREF_ID32_V8: {
|
|
|
|
uint32_t stringId = READ_INST_32_1();
|
|
|
|
uint32_t v0 = READ_INST_8_5();
|
|
|
|
info.accIn = true;
|
|
|
|
info.offset = BytecodeOffset::SEVEN;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(StringId(stringId));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDSUPERBYNAME_PREF_ID32_V8: {
|
|
|
|
uint32_t stringId = READ_INST_32_1();
|
|
|
|
uint32_t v0 = READ_INST_8_5();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::SEVEN;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(StringId(stringId));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::STSUPERBYNAME_PREF_ID32_V8: {
|
|
|
|
uint32_t stringId = READ_INST_32_1();
|
|
|
|
uint32_t v0 = READ_INST_8_5();
|
|
|
|
info.accIn = true;
|
|
|
|
info.offset = BytecodeOffset::SEVEN;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(StringId(stringId));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::STGLOBALVAR_PREF_ID32: {
|
|
|
|
uint32_t stringId = READ_INST_32_1();
|
|
|
|
info.accIn = true;
|
|
|
|
info.offset = BytecodeOffset::SIX;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(StringId(stringId));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::CREATEGENERATOROBJ_PREF_V8: {
|
|
|
|
uint16_t v0 = READ_INST_8_1();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::CREATEASYNCGENERATOROBJ_PREF_V8: {
|
|
|
|
uint16_t v0 = READ_INST_8_1();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
2022-07-29 03:13:50 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::ASYNCGENERATORRESOLVE_PREF_V8_V8_V8: {
|
|
|
|
uint16_t v0 = READ_INST_8_1();
|
|
|
|
uint16_t v1 = READ_INST_8_2();
|
|
|
|
uint16_t v2 = READ_INST_8_3();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::FIVE;
|
2022-07-29 03:13:50 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v1));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v2));
|
|
|
|
break;
|
|
|
|
}
|
2022-09-07 02:53:47 +00:00
|
|
|
case EcmaBytecode::ASYNCGENERATORREJECT_PREF_V8_V8: {
|
2022-08-11 02:28:22 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
|
|
|
uint16_t v1 = READ_INST_8_2();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::FOUR;
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v1));
|
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::STARRAYSPREAD_PREF_V8_V8: {
|
|
|
|
uint16_t v0 = READ_INST_8_1();
|
|
|
|
uint16_t v1 = READ_INST_8_2();
|
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::FOUR;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v1));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::GETITERATORNEXT_PREF_V8_V8: {
|
|
|
|
uint16_t v0 = READ_INST_8_1();
|
|
|
|
uint16_t v1 = READ_INST_8_2();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::FOUR;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v1));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::DEFINECLASSWITHBUFFER_PREF_ID16_IMM16_IMM16_V8_V8: {
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
uint16_t methodId = READ_INST_16_1();
|
|
|
|
uint16_t imm = READ_INST_16_3();
|
|
|
|
uint16_t length = READ_INST_16_5();
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_7();
|
|
|
|
uint16_t v1 = READ_INST_8_8();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::TEN;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(MethodId(methodId));
|
|
|
|
info.inputs.emplace_back(Immediate(imm));
|
|
|
|
info.inputs.emplace_back(Immediate(length));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v1));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDFUNCTION_PREF: {
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDBIGINT_PREF_ID32: {
|
|
|
|
uint32_t stringId = READ_INST_32_1();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::SIX;
|
2022-05-06 09:24:11 +00:00
|
|
|
info.inputs.emplace_back(StringId(stringId));
|
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::TONUMERIC_PREF_V8: {
|
|
|
|
uint16_t v0 = READ_INST_8_1();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-07-13 03:43:26 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::DYNAMICIMPORT_PREF_V8: {
|
|
|
|
uint16_t v0 = READ_INST_8_1();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-08-27 10:57:41 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::SUPERCALL_PREF_IMM16_V8: {
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
uint16_t range = READ_INST_16_1();
|
|
|
|
uint16_t v0 = READ_INST_8_3();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
2022-07-22 09:12:45 +00:00
|
|
|
for (size_t i = 0; i < range; i++) {
|
|
|
|
info.inputs.emplace_back(VirtualRegister(v0 + i));
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::FIVE;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::SUPERCALLSPREAD_PREF_V8: {
|
2022-01-06 02:26:19 +00:00
|
|
|
uint16_t v0 = READ_INST_8_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::THREE;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(VirtualRegister(v0));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::CREATEOBJECTHAVINGMETHOD_PREF_IMM16: {
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
uint16_t imm = READ_INST_16_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::FOUR;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(Immediate(imm));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::THROWIFSUPERNOTCORRECTCALL_PREF_IMM16: {
|
2022-08-16 15:48:09 +00:00
|
|
|
uint16_t imm = READ_INST_16_1();
|
2022-09-06 05:27:19 +00:00
|
|
|
info.accIn = true;
|
|
|
|
info.offset = BytecodeOffset::FOUR;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
info.inputs.emplace_back(Immediate(imm));
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDHOMEOBJECT_PREF: {
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::THROWDELETESUPERPROPERTY_PREF: {
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::DEBUGGER_PREF: {
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::ISTRUE_PREF: {
|
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-08-16 15:48:09 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::ISFALSE_PREF: {
|
|
|
|
info.accIn = true;
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::TWO;
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDPATCHVAR_PREF_IMM16: {
|
2022-09-03 08:08:40 +00:00
|
|
|
uint32_t index = READ_INST_16_1();
|
|
|
|
info.accOut = true;
|
|
|
|
info.offset = BytecodeOffset::FOUR;
|
|
|
|
info.inputs.emplace_back(Immediate(index));
|
|
|
|
break;
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::STPATCHVAR_PREF_IMM16: {
|
2022-09-03 08:08:40 +00:00
|
|
|
uint32_t index = READ_INST_16_1();
|
|
|
|
info.accIn = true;
|
|
|
|
info.offset = BytecodeOffset::FOUR;
|
|
|
|
info.inputs.emplace_back(Immediate(index));
|
|
|
|
break;
|
|
|
|
}
|
2022-01-06 02:26:19 +00:00
|
|
|
default: {
|
2022-07-06 06:12:54 +00:00
|
|
|
LOG_COMPILER(ERROR) << "Error bytecode: " << opcode << ", pls check bytecode offset.";
|
2022-04-12 08:49:37 +00:00
|
|
|
UNREACHABLE();
|
2022-01-06 02:26:19 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
2022-04-24 17:17:29 +00:00
|
|
|
void BytecodeCircuitBuilder::InsertPhi()
|
2022-01-06 02:26:19 +00:00
|
|
|
{
|
|
|
|
std::map<uint16_t, std::set<size_t>> defsitesInfo; // <vreg, bbs>
|
2022-04-24 17:17:29 +00:00
|
|
|
for (auto &bb : graph_) {
|
2022-01-06 02:26:19 +00:00
|
|
|
if (bb.isDead) {
|
|
|
|
continue;
|
|
|
|
}
|
2022-06-30 02:22:52 +00:00
|
|
|
EnumerateBlock(bb, [this, &defsitesInfo, &bb]
|
|
|
|
([[maybe_unused]]uint8_t * pc, BytecodeInfo &bytecodeInfo) -> bool {
|
2022-09-06 05:27:19 +00:00
|
|
|
if (bytecodeInfo.IsBc(EcmaBytecode::RESUMEGENERATOR_PREF_V8)) {
|
2022-08-16 13:05:02 +00:00
|
|
|
auto numVRegs = MethodLiteral::GetNumVregs(file_, method_) + method_->GetNumArgs();
|
2022-06-06 09:41:17 +00:00
|
|
|
for (size_t i = 0; i < numVRegs; i++) {
|
|
|
|
bytecodeInfo.vregOut.emplace_back(i);
|
|
|
|
}
|
|
|
|
}
|
2022-01-18 04:02:20 +00:00
|
|
|
for (const auto &vreg: bytecodeInfo.vregOut) {
|
2022-01-06 02:26:19 +00:00
|
|
|
defsitesInfo[vreg].insert(bb.id);
|
|
|
|
}
|
2022-06-30 02:22:52 +00:00
|
|
|
return true;
|
|
|
|
});
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
|
2022-07-15 02:35:25 +00:00
|
|
|
// handle phi generated from multiple control flow in the same source block
|
|
|
|
InsertExceptionPhi(defsitesInfo);
|
|
|
|
|
2022-04-14 08:14:34 +00:00
|
|
|
if (IsLogEnabled()) {
|
2022-07-15 02:35:25 +00:00
|
|
|
PrintDefsitesInfo(defsitesInfo);
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
|
2022-01-19 01:11:02 +00:00
|
|
|
for (const auto&[variable, defsites] : defsitesInfo) {
|
2022-01-06 02:26:19 +00:00
|
|
|
std::queue<uint16_t> workList;
|
2022-01-18 04:02:20 +00:00
|
|
|
for (auto blockId: defsites) {
|
2022-01-06 02:26:19 +00:00
|
|
|
workList.push(blockId);
|
|
|
|
}
|
|
|
|
while (!workList.empty()) {
|
|
|
|
auto currentId = workList.front();
|
|
|
|
workList.pop();
|
2022-04-24 17:17:29 +00:00
|
|
|
for (auto &block : graph_[currentId].domFrontiers) {
|
2022-01-06 02:26:19 +00:00
|
|
|
if (!block->phi.count(variable)) {
|
|
|
|
block->phi.insert(variable);
|
|
|
|
if (!defsitesInfo[variable].count(block->id)) {
|
|
|
|
workList.push(block->id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-04-14 08:14:34 +00:00
|
|
|
|
|
|
|
if (IsLogEnabled()) {
|
2022-04-24 17:17:29 +00:00
|
|
|
PrintGraph();
|
2022-04-14 08:14:34 +00:00
|
|
|
}
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
|
2022-07-15 02:35:25 +00:00
|
|
|
void BytecodeCircuitBuilder::InsertExceptionPhi(std::map<uint16_t, std::set<size_t>> &defsitesInfo)
|
|
|
|
{
|
|
|
|
// handle try catch defsite
|
|
|
|
for (auto &bb : graph_) {
|
|
|
|
if (bb.isDead) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (bb.catchs.size() == 0) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
std::set<size_t> vregs;
|
2022-08-05 09:00:14 +00:00
|
|
|
EnumerateBlock(bb, [this, &vregs]
|
2022-06-30 02:22:52 +00:00
|
|
|
([[maybe_unused]]uint8_t * pc, BytecodeInfo &bytecodeInfo) -> bool {
|
2022-09-06 05:27:19 +00:00
|
|
|
if (bytecodeInfo.IsBc(EcmaBytecode::RESUMEGENERATOR_PREF_V8)) {
|
2022-08-16 13:05:02 +00:00
|
|
|
auto numVRegs = MethodLiteral::GetNumVregs(file_, method_) + method_->GetNumArgs();
|
2022-08-05 09:00:14 +00:00
|
|
|
for (size_t i = 0; i < numVRegs; i++) {
|
|
|
|
vregs.insert(i);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2022-07-15 02:35:25 +00:00
|
|
|
for (const auto &vreg: bytecodeInfo.vregOut) {
|
|
|
|
vregs.insert(vreg);
|
|
|
|
}
|
2022-06-30 02:22:52 +00:00
|
|
|
return true;
|
|
|
|
});
|
2022-07-15 02:35:25 +00:00
|
|
|
|
|
|
|
for (auto &vreg : vregs) {
|
|
|
|
defsitesInfo[vreg].insert(bb.catchs.at(0)->id);
|
|
|
|
bb.catchs.at(0)->phi.insert(vreg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-19 01:11:02 +00:00
|
|
|
// Update CFG's predecessor, successor and try catch associations
|
2022-04-24 17:17:29 +00:00
|
|
|
void BytecodeCircuitBuilder::UpdateCFG()
|
2022-01-19 01:11:02 +00:00
|
|
|
{
|
2022-04-24 17:17:29 +00:00
|
|
|
for (auto &bb: graph_) {
|
2022-01-19 01:11:02 +00:00
|
|
|
if (bb.isDead) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
bb.preds.clear();
|
|
|
|
bb.trys.clear();
|
2022-01-22 11:09:02 +00:00
|
|
|
std::vector<BytecodeRegion *> newSuccs;
|
2022-01-19 01:11:02 +00:00
|
|
|
for (const auto &succ: bb.succs) {
|
2022-04-24 17:17:29 +00:00
|
|
|
if (std::count(bb.catchs.cbegin(), bb.catchs.cend(), succ)) {
|
2022-01-19 01:11:02 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
newSuccs.push_back(succ);
|
|
|
|
}
|
|
|
|
bb.succs = newSuccs;
|
|
|
|
}
|
2022-04-24 17:17:29 +00:00
|
|
|
for (auto &bb: graph_) {
|
2022-01-19 01:11:02 +00:00
|
|
|
if (bb.isDead) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
for (auto &succ: bb.succs) {
|
|
|
|
succ->preds.push_back(&bb);
|
|
|
|
}
|
|
|
|
for (auto &catchBlock: bb.catchs) {
|
|
|
|
catchBlock->trys.push_back(&bb);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-24 17:17:29 +00:00
|
|
|
// build circuit
|
|
|
|
void BytecodeCircuitBuilder::BuildCircuitArgs()
|
|
|
|
{
|
2022-06-16 09:27:35 +00:00
|
|
|
argAcc_.NewCommonArg(CommonArgIdx::GLUE, MachineType::I64, GateType::NJSValue());
|
|
|
|
argAcc_.NewCommonArg(CommonArgIdx::LEXENV, MachineType::I64, GateType::TaggedValue());
|
2022-09-07 09:46:52 +00:00
|
|
|
argAcc_.NewCommonArg(CommonArgIdx::ACTUAL_ARGC, MachineType::I64, GateType::NJSValue());
|
2022-06-16 09:27:35 +00:00
|
|
|
auto funcIdx = static_cast<size_t>(CommonArgIdx::FUNC);
|
|
|
|
const size_t actualNumArgs = argAcc_.GetActualNumArgs();
|
|
|
|
// new actual argument gates
|
|
|
|
for (size_t argIdx = funcIdx; argIdx < actualNumArgs; argIdx++) {
|
|
|
|
argAcc_.NewArg(argIdx);
|
2022-04-24 17:17:29 +00:00
|
|
|
}
|
2022-07-19 12:44:46 +00:00
|
|
|
argAcc_.CollectArgs();
|
2022-07-05 07:24:00 +00:00
|
|
|
if (hasTypes_) {
|
|
|
|
argAcc_.FillArgsGateType(&typeRecorder_);
|
|
|
|
}
|
2022-04-24 17:17:29 +00:00
|
|
|
}
|
|
|
|
|
2022-06-30 02:22:52 +00:00
|
|
|
bool BytecodeCircuitBuilder::ShouldBeDead(BytecodeRegion &curBlock)
|
|
|
|
{
|
|
|
|
auto isDead = false;
|
|
|
|
for (auto bbPred : curBlock.preds) {
|
|
|
|
if (!bbPred->isDead) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
isDead = true;
|
|
|
|
}
|
|
|
|
for (auto bbTry : curBlock.trys) {
|
|
|
|
if (!bbTry->isDead) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
isDead = true;
|
|
|
|
}
|
|
|
|
return isDead;
|
|
|
|
}
|
|
|
|
|
2022-04-24 17:17:29 +00:00
|
|
|
void BytecodeCircuitBuilder::CollectPredsInfo()
|
|
|
|
{
|
|
|
|
for (auto &bb: graph_) {
|
|
|
|
if (bb.isDead) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
bb.numOfStatePreds = 0;
|
|
|
|
}
|
|
|
|
// get number of expanded state predicates of each block
|
|
|
|
// one block-level try catch edge may correspond to multiple bytecode-level edges
|
|
|
|
for (auto &bb: graph_) {
|
|
|
|
if (bb.isDead) {
|
|
|
|
continue;
|
|
|
|
}
|
2022-06-30 02:22:52 +00:00
|
|
|
if (ShouldBeDead(bb)) {
|
2022-07-22 09:12:45 +00:00
|
|
|
bb.UpdateTryCatchInfoForDeadBlock();
|
2022-06-30 02:22:52 +00:00
|
|
|
bb.isDead = true;
|
|
|
|
continue;
|
|
|
|
}
|
2022-07-22 09:12:45 +00:00
|
|
|
bool noThrow = true;
|
|
|
|
EnumerateBlock(bb, [&noThrow, &bb]
|
2022-06-30 02:22:52 +00:00
|
|
|
([[maybe_unused]]uint8_t * pc, BytecodeInfo &bytecodeInfo) -> bool {
|
2022-02-17 03:48:40 +00:00
|
|
|
if (bytecodeInfo.IsGeneral()) {
|
2022-07-22 09:12:45 +00:00
|
|
|
noThrow = false;
|
2022-04-24 17:17:29 +00:00
|
|
|
if (!bb.catchs.empty()) {
|
|
|
|
bb.catchs.at(0)->numOfStatePreds++;
|
|
|
|
}
|
|
|
|
}
|
2022-06-30 02:22:52 +00:00
|
|
|
if (bytecodeInfo.IsCondJump() && bb.succs.size() == 1) {
|
|
|
|
ASSERT(bb.succs[0]->id == bb.id + 1);
|
|
|
|
bb.succs[0]->numOfStatePreds++;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
});
|
2022-07-22 09:12:45 +00:00
|
|
|
bb.UpdateRedundantTryCatchInfo(noThrow);
|
|
|
|
bb.UpdateTryCatchInfoIfNoThrow(noThrow);
|
2022-04-24 17:17:29 +00:00
|
|
|
for (auto &succ: bb.succs) {
|
|
|
|
succ->numOfStatePreds++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// collect loopback edges
|
|
|
|
std::vector<VisitState> visitState(graph_.size(), VisitState::UNVISITED);
|
|
|
|
std::function<void(size_t)> dfs = [&](size_t bbId) -> void {
|
|
|
|
visitState[bbId] = VisitState::PENDING;
|
2022-06-30 02:22:52 +00:00
|
|
|
std::vector<BytecodeRegion *> merge;
|
2022-09-07 09:46:52 +00:00
|
|
|
merge.insert(merge.end(), graph_[bbId].succs.begin(), graph_[bbId].succs.end());
|
|
|
|
merge.insert(merge.end(), graph_[bbId].catchs.begin(), graph_[bbId].catchs.end());
|
2022-06-30 02:22:52 +00:00
|
|
|
auto it = merge.crbegin();
|
|
|
|
while (it != merge.crend()) {
|
2022-04-24 17:17:29 +00:00
|
|
|
auto succBlock = *it;
|
|
|
|
it++;
|
|
|
|
if (visitState[succBlock->id] == VisitState::UNVISITED) {
|
|
|
|
dfs(succBlock->id);
|
|
|
|
} else {
|
|
|
|
if (visitState[succBlock->id] == VisitState::PENDING) {
|
2022-09-07 09:46:52 +00:00
|
|
|
graph_[succBlock->id].loopbackBlocks.insert(bbId);
|
2022-04-24 17:17:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
visitState[bbId] = VisitState::VISITED;
|
|
|
|
};
|
|
|
|
dfs(graph_[0].id);
|
|
|
|
for (auto &bb: graph_) {
|
|
|
|
if (bb.isDead) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
bb.phiAcc = (bb.numOfStatePreds > 1) || (!bb.trys.empty());
|
|
|
|
bb.numOfLoopBacks = bb.loopbackBlocks.size();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BytecodeCircuitBuilder::NewMerge(GateRef &state, GateRef &depend, size_t numOfIns)
|
|
|
|
{
|
|
|
|
state = circuit_.NewGate(OpCode(OpCode::MERGE), numOfIns,
|
|
|
|
std::vector<GateRef>(numOfIns, Circuit::NullGate()),
|
2022-06-08 11:50:21 +00:00
|
|
|
GateType::Empty());
|
2022-04-24 17:17:29 +00:00
|
|
|
depend = circuit_.NewGate(OpCode(OpCode::DEPEND_SELECTOR), numOfIns,
|
|
|
|
std::vector<GateRef>(numOfIns + 1, Circuit::NullGate()),
|
2022-06-08 11:50:21 +00:00
|
|
|
GateType::Empty());
|
2022-07-19 12:44:46 +00:00
|
|
|
gateAcc_.NewIn(depend, 0, state);
|
2022-04-24 17:17:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void BytecodeCircuitBuilder::NewLoopBegin(BytecodeRegion &bb)
|
|
|
|
{
|
|
|
|
NewMerge(bb.mergeForwardEdges, bb.depForward, bb.numOfStatePreds - bb.numOfLoopBacks);
|
|
|
|
NewMerge(bb.mergeLoopBackEdges, bb.depLoopBack, bb.numOfLoopBacks);
|
|
|
|
auto loopBack = circuit_.NewGate(OpCode(OpCode::LOOP_BACK), 0,
|
2022-06-08 11:50:21 +00:00
|
|
|
{bb.mergeLoopBackEdges}, GateType::Empty());
|
2022-04-24 17:17:29 +00:00
|
|
|
bb.stateStart = circuit_.NewGate(OpCode(OpCode::LOOP_BEGIN), 0,
|
2022-06-08 11:50:21 +00:00
|
|
|
{bb.mergeForwardEdges, loopBack}, GateType::Empty());
|
2022-04-24 17:17:29 +00:00
|
|
|
// 2: the number of depend inputs and it is in accord with LOOP_BEGIN
|
|
|
|
bb.dependStart = circuit_.NewGate(OpCode(OpCode::DEPEND_SELECTOR), 2,
|
|
|
|
{bb.stateStart, bb.depForward, bb.depLoopBack},
|
2022-06-08 11:50:21 +00:00
|
|
|
GateType::Empty());
|
2022-04-24 17:17:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void BytecodeCircuitBuilder::BuildBlockCircuitHead()
|
|
|
|
{
|
|
|
|
for (auto &bb: graph_) {
|
|
|
|
if (bb.isDead) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (bb.numOfStatePreds == 0) {
|
|
|
|
bb.stateStart = Circuit::GetCircuitRoot(OpCode(OpCode::STATE_ENTRY));
|
|
|
|
bb.dependStart = Circuit::GetCircuitRoot(OpCode(OpCode::DEPEND_ENTRY));
|
|
|
|
} else if (bb.numOfLoopBacks > 0) {
|
|
|
|
NewLoopBegin(bb);
|
|
|
|
} else {
|
|
|
|
NewMerge(bb.stateStart, bb.dependStart, bb.numOfStatePreds);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<GateRef> BytecodeCircuitBuilder::CreateGateInList(const BytecodeInfo &info)
|
|
|
|
{
|
2022-06-10 07:22:21 +00:00
|
|
|
size_t numValueInputs = info.ComputeValueInputCount();
|
2022-04-24 17:17:29 +00:00
|
|
|
const size_t length = 2; // 2: state and depend on input
|
2022-06-10 07:22:21 +00:00
|
|
|
const size_t numBCOffsetInput = info.ComputeBCOffsetInputCount();
|
|
|
|
std::vector<GateRef> inList(length + numValueInputs + numBCOffsetInput, Circuit::NullGate());
|
2022-04-24 17:17:29 +00:00
|
|
|
for (size_t i = 0; i < info.inputs.size(); i++) {
|
|
|
|
const auto &input = info.inputs[i];
|
|
|
|
if (std::holds_alternative<MethodId>(input)) {
|
|
|
|
inList[i + length] = circuit_.NewGate(OpCode(OpCode::CONSTANT), MachineType::I16,
|
|
|
|
std::get<MethodId>(input).GetId(),
|
|
|
|
{Circuit::GetCircuitRoot(OpCode(OpCode::CONSTANT_LIST))},
|
2022-06-08 11:50:21 +00:00
|
|
|
GateType::NJSValue());
|
2022-04-24 17:17:29 +00:00
|
|
|
} else if (std::holds_alternative<StringId>(input)) {
|
2022-08-27 16:23:14 +00:00
|
|
|
inList[i + length] = circuit_.NewGate(OpCode(OpCode::CONSTANT), MachineType::I32,
|
|
|
|
std::get<StringId>(input).GetId(),
|
2022-04-24 17:17:29 +00:00
|
|
|
{Circuit::GetCircuitRoot(OpCode(OpCode::CONSTANT_LIST))},
|
2022-06-08 11:50:21 +00:00
|
|
|
GateType::NJSValue());
|
2022-04-24 17:17:29 +00:00
|
|
|
} else if (std::holds_alternative<Immediate>(input)) {
|
|
|
|
inList[i + length] = circuit_.NewGate(OpCode(OpCode::CONSTANT), MachineType::I64,
|
|
|
|
std::get<Immediate>(input).GetValue(),
|
|
|
|
{Circuit::GetCircuitRoot(OpCode(OpCode::CONSTANT_LIST))},
|
2022-06-08 11:50:21 +00:00
|
|
|
GateType::NJSValue());
|
2022-04-24 17:17:29 +00:00
|
|
|
} else {
|
|
|
|
ASSERT(std::holds_alternative<VirtualRegister>(input));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return inList;
|
|
|
|
}
|
|
|
|
|
|
|
|
void BytecodeCircuitBuilder::SetBlockPred(BytecodeRegion &bbNext, const GateRef &state,
|
|
|
|
const GateRef &depend, bool isLoopBack)
|
|
|
|
{
|
|
|
|
if (bbNext.numOfLoopBacks == 0) {
|
2022-07-19 12:44:46 +00:00
|
|
|
gateAcc_.NewIn(bbNext.stateStart, bbNext.statePredIndex, state);
|
|
|
|
gateAcc_.NewIn(bbNext.dependStart, bbNext.statePredIndex + 1, depend);
|
2022-04-24 17:17:29 +00:00
|
|
|
} else {
|
|
|
|
if (isLoopBack) {
|
2022-07-19 12:44:46 +00:00
|
|
|
gateAcc_.NewIn(bbNext.mergeLoopBackEdges, bbNext.loopBackIndex, state);
|
|
|
|
gateAcc_.NewIn(bbNext.depLoopBack, bbNext.loopBackIndex + 1, depend);
|
2022-04-24 17:17:29 +00:00
|
|
|
bbNext.loopBackIndex++;
|
|
|
|
ASSERT(bbNext.loopBackIndex <= bbNext.numOfLoopBacks);
|
|
|
|
} else {
|
2022-07-19 12:44:46 +00:00
|
|
|
gateAcc_.NewIn(bbNext.mergeForwardEdges, bbNext.forwardIndex, state);
|
|
|
|
gateAcc_.NewIn(bbNext.depForward, bbNext.forwardIndex + 1, depend);
|
2022-04-24 17:17:29 +00:00
|
|
|
bbNext.forwardIndex++;
|
|
|
|
ASSERT(bbNext.forwardIndex <= bbNext.numOfStatePreds - bbNext.numOfLoopBacks);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bbNext.statePredIndex++;
|
|
|
|
ASSERT(bbNext.statePredIndex <= bbNext.numOfStatePreds);
|
|
|
|
}
|
|
|
|
|
|
|
|
GateRef BytecodeCircuitBuilder::NewConst(const BytecodeInfo &info)
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
{
|
2022-08-26 01:06:59 +00:00
|
|
|
auto opcode = static_cast<EcmaBytecode>(info.opcode);
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
GateRef gate = 0;
|
|
|
|
switch (opcode) {
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDNAN_PREF:
|
2022-06-30 02:22:52 +00:00
|
|
|
gate = circuit_.NewGate(OpCode(OpCode::CONSTANT), MachineType::I64,
|
2022-04-24 07:14:09 +00:00
|
|
|
base::NumberHelper::GetNaN(),
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
{Circuit::GetCircuitRoot(OpCode(OpCode::CONSTANT_LIST))},
|
2022-06-08 11:50:21 +00:00
|
|
|
GateType::TaggedValue());
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
break;
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDINFINITY_PREF:
|
2022-06-30 02:22:52 +00:00
|
|
|
gate = circuit_.NewGate(OpCode(OpCode::CONSTANT), MachineType::I64,
|
2022-04-24 07:14:09 +00:00
|
|
|
base::NumberHelper::GetPositiveInfinity(),
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
{Circuit::GetCircuitRoot(OpCode(OpCode::CONSTANT_LIST))},
|
2022-06-08 11:50:21 +00:00
|
|
|
GateType::TaggedValue());
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
break;
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDUNDEFINED_PREF:
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
gate = circuit_.NewGate(OpCode(OpCode::CONSTANT), MachineType::I64, JSTaggedValue::VALUE_UNDEFINED,
|
|
|
|
{Circuit::GetCircuitRoot(OpCode(OpCode::CONSTANT_LIST))},
|
2022-06-08 11:50:21 +00:00
|
|
|
GateType::TaggedValue());
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
break;
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDNULL_PREF:
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
gate = circuit_.NewGate(OpCode(OpCode::CONSTANT), MachineType::I64, JSTaggedValue::VALUE_NULL,
|
|
|
|
{Circuit::GetCircuitRoot(OpCode(OpCode::CONSTANT_LIST))},
|
2022-06-08 11:50:21 +00:00
|
|
|
GateType::TaggedValue());
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
break;
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDTRUE_PREF:
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
gate = circuit_.NewGate(OpCode(OpCode::CONSTANT), MachineType::I64, JSTaggedValue::VALUE_TRUE,
|
|
|
|
{Circuit::GetCircuitRoot(OpCode(OpCode::CONSTANT_LIST))},
|
2022-06-08 11:50:21 +00:00
|
|
|
GateType::TaggedValue());
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
break;
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDFALSE_PREF:
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
gate = circuit_.NewGate(OpCode(OpCode::CONSTANT), MachineType::I64, JSTaggedValue::VALUE_FALSE,
|
|
|
|
{Circuit::GetCircuitRoot(OpCode(OpCode::CONSTANT_LIST))},
|
2022-06-08 11:50:21 +00:00
|
|
|
GateType::TaggedValue());
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
break;
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDHOLE_PREF:
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
gate = circuit_.NewGate(OpCode(OpCode::CONSTANT), MachineType::I64, JSTaggedValue::VALUE_HOLE,
|
|
|
|
{Circuit::GetCircuitRoot(OpCode(OpCode::CONSTANT_LIST))},
|
2022-06-08 11:50:21 +00:00
|
|
|
GateType::TaggedNPointer());
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
break;
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDAI_DYN_IMM32:
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
gate = circuit_.NewGate(OpCode(OpCode::CONSTANT), MachineType::I64,
|
2022-04-24 07:14:09 +00:00
|
|
|
std::get<Immediate>(info.inputs[0]).ToJSTaggedValueInt(),
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
{Circuit::GetCircuitRoot(OpCode(OpCode::CONSTANT_LIST))},
|
2022-06-08 11:50:21 +00:00
|
|
|
GateType::TaggedValue());
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
break;
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::FLDAI_DYN_IMM64:
|
2022-04-24 17:17:29 +00:00
|
|
|
gate = circuit_.NewGate(OpCode(OpCode::CONSTANT), MachineType::I64,
|
2022-04-24 07:14:09 +00:00
|
|
|
std::get<Immediate>(info.inputs.at(0)).ToJSTaggedValueDouble(),
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
{Circuit::GetCircuitRoot(OpCode(OpCode::CONSTANT_LIST))},
|
2022-06-08 11:50:21 +00:00
|
|
|
GateType::TaggedValue());
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
break;
|
2022-09-06 05:27:19 +00:00
|
|
|
case EcmaBytecode::LDFUNCTION_PREF:
|
2022-06-16 09:27:35 +00:00
|
|
|
gate = argAcc_.GetCommonArgGate(CommonArgIdx::FUNC);
|
2022-04-06 07:17:04 +00:00
|
|
|
break;
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
default:
|
2022-04-11 02:41:49 +00:00
|
|
|
UNREACHABLE();
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
}
|
|
|
|
return gate;
|
|
|
|
}
|
|
|
|
|
2022-04-24 17:17:29 +00:00
|
|
|
void BytecodeCircuitBuilder::NewJSGate(BytecodeRegion &bb, const uint8_t *pc, GateRef &state, GateRef &depend)
|
2022-01-18 04:02:20 +00:00
|
|
|
{
|
2022-04-24 17:17:29 +00:00
|
|
|
auto bytecodeInfo = GetBytecodeInfo(pc);
|
2022-06-10 07:22:21 +00:00
|
|
|
size_t numValueInputs = bytecodeInfo.ComputeTotalValueCount();
|
2022-04-24 17:17:29 +00:00
|
|
|
GateRef gate = 0;
|
|
|
|
std::vector<GateRef> inList = CreateGateInList(bytecodeInfo);
|
|
|
|
if (!bytecodeInfo.vregOut.empty() || bytecodeInfo.accOut) {
|
|
|
|
gate = circuit_.NewGate(OpCode(OpCode::JS_BYTECODE), MachineType::I64, numValueInputs,
|
2022-06-08 11:50:21 +00:00
|
|
|
inList, GateType::AnyType());
|
2022-04-24 17:17:29 +00:00
|
|
|
} else {
|
|
|
|
gate = circuit_.NewGate(OpCode(OpCode::JS_BYTECODE), MachineType::NOVALUE, numValueInputs,
|
2022-06-08 11:50:21 +00:00
|
|
|
inList, GateType::Empty());
|
2022-04-14 08:14:34 +00:00
|
|
|
}
|
2022-06-10 07:22:21 +00:00
|
|
|
// 1: store bcoffset in the end.
|
|
|
|
AddBytecodeOffsetInfo(gate, bytecodeInfo, numValueInputs + 1, const_cast<uint8_t *>(pc));
|
2022-07-19 12:44:46 +00:00
|
|
|
gateAcc_.NewIn(gate, 0, state);
|
|
|
|
gateAcc_.NewIn(gate, 1, depend);
|
2022-06-08 11:50:21 +00:00
|
|
|
auto ifSuccess = circuit_.NewGate(OpCode(OpCode::IF_SUCCESS), 0, {gate}, GateType::Empty());
|
|
|
|
auto ifException = circuit_.NewGate(OpCode(OpCode::IF_EXCEPTION), 0, {gate}, GateType::Empty());
|
2022-04-24 17:17:29 +00:00
|
|
|
if (!bb.catchs.empty()) {
|
|
|
|
auto &bbNext = bb.catchs.at(0);
|
|
|
|
auto isLoopBack = bbNext->loopbackBlocks.count(bb.id);
|
|
|
|
SetBlockPred(*bbNext, ifException, gate, isLoopBack);
|
|
|
|
bbNext->expandedPreds.push_back(
|
|
|
|
{bb.id, pc, true}
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
auto constant = circuit_.NewGate(OpCode(OpCode::CONSTANT), MachineType::I64,
|
|
|
|
JSTaggedValue::VALUE_EXCEPTION,
|
|
|
|
{Circuit::GetCircuitRoot(OpCode(OpCode::CONSTANT_LIST))},
|
2022-06-08 11:50:21 +00:00
|
|
|
GateType::AnyType());
|
2022-04-24 17:17:29 +00:00
|
|
|
circuit_.NewGate(OpCode(OpCode::RETURN), 0,
|
|
|
|
{ifException, gate, constant,
|
|
|
|
Circuit::GetCircuitRoot(OpCode(OpCode::RETURN_LIST))},
|
2022-06-08 11:50:21 +00:00
|
|
|
GateType::AnyType());
|
2022-02-12 08:15:41 +00:00
|
|
|
}
|
2022-04-24 17:17:29 +00:00
|
|
|
jsgateToBytecode_[gate] = {bb.id, pc};
|
2022-06-06 09:41:17 +00:00
|
|
|
if (bytecodeInfo.IsGeneratorRelative()) {
|
|
|
|
suspendAndResumeGates_.emplace_back(gate);
|
|
|
|
}
|
2022-02-17 03:48:40 +00:00
|
|
|
if (bytecodeInfo.IsThrow()) {
|
2022-04-24 17:17:29 +00:00
|
|
|
auto constant = circuit_.NewGate(OpCode(OpCode::CONSTANT), MachineType::I64,
|
|
|
|
JSTaggedValue::VALUE_HOLE,
|
|
|
|
{Circuit::GetCircuitRoot(OpCode(OpCode::CONSTANT_LIST))},
|
2022-06-08 11:50:21 +00:00
|
|
|
GateType::AnyType());
|
2022-04-24 17:17:29 +00:00
|
|
|
circuit_.NewGate(OpCode(OpCode::RETURN), 0,
|
|
|
|
{ifSuccess, gate, constant,
|
|
|
|
Circuit::GetCircuitRoot(OpCode(OpCode::RETURN_LIST))},
|
2022-06-08 11:50:21 +00:00
|
|
|
GateType::AnyType());
|
2022-04-24 17:17:29 +00:00
|
|
|
return;
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-04-24 17:17:29 +00:00
|
|
|
state = ifSuccess;
|
|
|
|
depend = gate;
|
|
|
|
if (pc == bb.end) {
|
|
|
|
auto &bbNext = graph_[bb.id + 1];
|
|
|
|
auto isLoopBack = bbNext.loopbackBlocks.count(bb.id);
|
|
|
|
SetBlockPred(bbNext, state, depend, isLoopBack);
|
|
|
|
bbNext.expandedPreds.push_back(
|
|
|
|
{bb.id, pc, false}
|
|
|
|
);
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-04-24 17:17:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void BytecodeCircuitBuilder::NewJump(BytecodeRegion &bb, const uint8_t *pc, GateRef &state, GateRef &depend)
|
|
|
|
{
|
|
|
|
auto bytecodeInfo = GetBytecodeInfo(pc);
|
2022-06-10 07:22:21 +00:00
|
|
|
size_t numValueInputs = bytecodeInfo.ComputeValueInputCount();
|
2022-02-17 03:48:40 +00:00
|
|
|
if (bytecodeInfo.IsCondJump()) {
|
2022-04-24 17:17:29 +00:00
|
|
|
GateRef gate = 0;
|
|
|
|
gate = circuit_.NewGate(OpCode(OpCode::JS_BYTECODE), MachineType::NOVALUE, numValueInputs,
|
|
|
|
std::vector<GateRef>(2 + numValueInputs, // 2: state and depend input
|
|
|
|
Circuit::NullGate()),
|
2022-06-08 11:50:21 +00:00
|
|
|
GateType::Empty());
|
2022-07-19 12:44:46 +00:00
|
|
|
gateAcc_.NewIn(gate, 0, state);
|
|
|
|
gateAcc_.NewIn(gate, 1, depend);
|
2022-06-08 11:50:21 +00:00
|
|
|
auto ifTrue = circuit_.NewGate(OpCode(OpCode::IF_TRUE), 0, {gate}, GateType::Empty());
|
|
|
|
auto ifFalse = circuit_.NewGate(OpCode(OpCode::IF_FALSE), 0, {gate}, GateType::Empty());
|
2022-06-30 02:22:52 +00:00
|
|
|
if (bb.succs.size() == 1) {
|
|
|
|
auto &bbNext = bb.succs[0];
|
|
|
|
ASSERT(bbNext->id == bb.id + 1);
|
|
|
|
auto isLoopBack = bbNext->loopbackBlocks.count(bb.id);
|
|
|
|
SetBlockPred(*bbNext, ifFalse, gate, isLoopBack);
|
|
|
|
SetBlockPred(*bbNext, ifTrue, gate, isLoopBack);
|
|
|
|
bbNext->expandedPreds.push_back(
|
|
|
|
{bb.id, pc, false}
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
ASSERT(bb.succs.size() == 2); // 2 : 2 num of successors
|
2022-08-04 07:37:10 +00:00
|
|
|
[[maybe_unused]] uint32_t bitSet = 0;
|
2022-06-30 02:22:52 +00:00
|
|
|
for (auto &bbNext: bb.succs) {
|
|
|
|
if (bbNext->id == bb.id + 1) {
|
|
|
|
auto isLoopBack = bbNext->loopbackBlocks.count(bb.id);
|
|
|
|
SetBlockPred(*bbNext, ifFalse, gate, isLoopBack);
|
|
|
|
bbNext->expandedPreds.push_back(
|
|
|
|
{bb.id, pc, false}
|
|
|
|
);
|
|
|
|
bitSet |= 1;
|
|
|
|
} else {
|
|
|
|
auto isLoopBack = bbNext->loopbackBlocks.count(bb.id);
|
|
|
|
SetBlockPred(*bbNext, ifTrue, gate, isLoopBack);
|
|
|
|
bbNext->expandedPreds.push_back(
|
|
|
|
{bb.id, pc, false}
|
|
|
|
);
|
|
|
|
bitSet |= 2; // 2:verify
|
|
|
|
}
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-06-30 02:22:52 +00:00
|
|
|
ASSERT(bitSet == 3); // 3:Verify the number of successor blocks
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-04-24 17:17:29 +00:00
|
|
|
jsgateToBytecode_[gate] = {bb.id, pc};
|
|
|
|
} else {
|
|
|
|
ASSERT(bb.succs.size() == 1);
|
|
|
|
auto &bbNext = bb.succs.at(0);
|
|
|
|
auto isLoopBack = bbNext->loopbackBlocks.count(bb.id);
|
|
|
|
SetBlockPred(*bbNext, state, depend, isLoopBack);
|
|
|
|
bbNext->expandedPreds.push_back(
|
|
|
|
{bb.id, pc, false}
|
|
|
|
);
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-04-24 17:17:29 +00:00
|
|
|
}
|
2022-01-19 01:11:02 +00:00
|
|
|
|
2022-04-24 17:17:29 +00:00
|
|
|
void BytecodeCircuitBuilder::NewReturn(BytecodeRegion &bb, const uint8_t *pc, GateRef &state, GateRef &depend)
|
|
|
|
{
|
|
|
|
ASSERT(bb.succs.empty());
|
|
|
|
auto bytecodeInfo = GetBytecodeInfo(pc);
|
2022-09-06 05:27:19 +00:00
|
|
|
if (static_cast<EcmaBytecode>(bytecodeInfo.opcode) == EcmaBytecode::RETURN_DYN) {
|
|
|
|
// handle return.dyn bytecode
|
2022-04-24 17:17:29 +00:00
|
|
|
auto gate = circuit_.NewGate(OpCode(OpCode::RETURN), 0,
|
|
|
|
{ state, depend, Circuit::NullGate(),
|
|
|
|
Circuit::GetCircuitRoot(OpCode(OpCode::RETURN_LIST)) },
|
2022-06-07 17:02:53 +00:00
|
|
|
GateType::AnyType());
|
2022-04-24 17:17:29 +00:00
|
|
|
jsgateToBytecode_[gate] = {bb.id, pc};
|
2022-09-06 05:27:19 +00:00
|
|
|
} else if (static_cast<EcmaBytecode>(bytecodeInfo.opcode) == EcmaBytecode::RETURNUNDEFINED_PREF) {
|
2022-04-24 17:17:29 +00:00
|
|
|
// handle returnundefined bytecode
|
|
|
|
auto constant = circuit_.NewGate(OpCode(OpCode::CONSTANT), MachineType::I64,
|
2022-05-20 09:32:34 +00:00
|
|
|
JSTaggedValue::VALUE_UNDEFINED,
|
2022-04-24 17:17:29 +00:00
|
|
|
{ Circuit::GetCircuitRoot(OpCode(OpCode::CONSTANT_LIST)) },
|
2022-06-08 11:50:21 +00:00
|
|
|
GateType::AnyType());
|
2022-04-24 17:17:29 +00:00
|
|
|
auto gate = circuit_.NewGate(OpCode(OpCode::RETURN), 0,
|
|
|
|
{ state, depend, constant,
|
|
|
|
Circuit::GetCircuitRoot(OpCode(OpCode::RETURN_LIST)) },
|
2022-06-07 17:02:53 +00:00
|
|
|
GateType::AnyType());
|
2022-04-24 17:17:29 +00:00
|
|
|
jsgateToBytecode_[gate] = {bb.id, pc};
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-04-24 17:17:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void BytecodeCircuitBuilder::NewByteCode(BytecodeRegion &bb, const uint8_t *pc, GateRef &state, GateRef &depend)
|
|
|
|
{
|
|
|
|
ASSERT(pc != nullptr);
|
|
|
|
auto bytecodeInfo = GetBytecodeInfo(pc);
|
2022-02-17 03:48:40 +00:00
|
|
|
if (bytecodeInfo.IsSetConstant()) {
|
2022-04-24 17:17:29 +00:00
|
|
|
// handle bytecode command to get constants
|
|
|
|
GateRef gate = NewConst(bytecodeInfo);
|
|
|
|
jsgateToBytecode_[gate] = {bb.id, pc};
|
2022-06-30 02:22:52 +00:00
|
|
|
if (pc == bb.end) {
|
|
|
|
auto &bbNext = graph_[bb.id + 1];
|
|
|
|
auto isLoopBack = bbNext.loopbackBlocks.count(bb.id);
|
|
|
|
SetBlockPred(bbNext, state, depend, isLoopBack);
|
|
|
|
bbNext.expandedPreds.push_back(
|
|
|
|
{bb.id, pc, false}
|
|
|
|
);
|
|
|
|
}
|
2022-02-17 03:48:40 +00:00
|
|
|
} else if (bytecodeInfo.IsGeneral()) {
|
2022-04-24 17:17:29 +00:00
|
|
|
// handle general ecma.* bytecodes
|
|
|
|
NewJSGate(bb, pc, state, depend);
|
2022-02-17 03:48:40 +00:00
|
|
|
} else if (bytecodeInfo.IsJump()) {
|
2022-04-24 17:17:29 +00:00
|
|
|
// handle conditional jump and unconditional jump bytecodes
|
|
|
|
NewJump(bb, pc, state, depend);
|
2022-02-17 03:48:40 +00:00
|
|
|
} else if (bytecodeInfo.IsReturn()) {
|
2022-09-06 05:27:19 +00:00
|
|
|
// handle return.dyn and returnundefined bytecodes
|
2022-04-24 17:17:29 +00:00
|
|
|
NewReturn(bb, pc, state, depend);
|
2022-02-17 03:48:40 +00:00
|
|
|
} else if (bytecodeInfo.IsMov()) {
|
2022-09-06 05:27:19 +00:00
|
|
|
// handle mov.dyn lda.dyn sta.dyn bytecodes
|
2022-04-24 17:17:29 +00:00
|
|
|
if (pc == bb.end) {
|
|
|
|
auto &bbNext = graph_[bb.id + 1];
|
|
|
|
auto isLoopBack = bbNext.loopbackBlocks.count(bb.id);
|
|
|
|
SetBlockPred(bbNext, state, depend, isLoopBack);
|
|
|
|
bbNext.expandedPreds.push_back(
|
|
|
|
{bb.id, pc, false}
|
|
|
|
);
|
|
|
|
}
|
2022-02-17 03:48:40 +00:00
|
|
|
} else if (bytecodeInfo.IsDiscarded()) {
|
2022-04-24 17:17:29 +00:00
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
UNREACHABLE();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BytecodeCircuitBuilder::BuildSubCircuit()
|
|
|
|
{
|
|
|
|
for (auto &bb: graph_) {
|
2022-01-06 02:26:19 +00:00
|
|
|
if (bb.isDead) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
auto stateCur = bb.stateStart;
|
|
|
|
auto dependCur = bb.dependStart;
|
2022-01-19 01:11:02 +00:00
|
|
|
ASSERT(stateCur != Circuit::NullGate());
|
|
|
|
ASSERT(dependCur != Circuit::NullGate());
|
2022-02-10 02:03:48 +00:00
|
|
|
if (!bb.trys.empty()) {
|
2022-06-08 11:50:21 +00:00
|
|
|
dependCur = circuit_.NewGate(OpCode(OpCode::GET_EXCEPTION), 0, {dependCur}, GateType::Empty());
|
2022-02-10 02:03:48 +00:00
|
|
|
}
|
2022-06-30 02:22:52 +00:00
|
|
|
EnumerateBlock(bb, [this, &stateCur, &dependCur, &bb]
|
|
|
|
(uint8_t * pc, BytecodeInfo &bytecodeInfo) -> bool {
|
|
|
|
NewByteCode(bb, pc, stateCur, dependCur);
|
2022-02-17 03:48:40 +00:00
|
|
|
if (bytecodeInfo.IsJump() || bytecodeInfo.IsThrow()) {
|
2022-06-30 02:22:52 +00:00
|
|
|
return false;
|
2022-04-24 17:17:29 +00:00
|
|
|
}
|
2022-06-30 02:22:52 +00:00
|
|
|
return true;
|
|
|
|
});
|
2022-04-24 17:17:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-11 19:13:23 +00:00
|
|
|
void BytecodeCircuitBuilder::NewPhi(BytecodeRegion &bb, uint16_t reg, bool acc, GateRef ¤tPhi)
|
2022-04-24 17:17:29 +00:00
|
|
|
{
|
|
|
|
if (bb.numOfLoopBacks == 0) {
|
2022-06-11 19:13:23 +00:00
|
|
|
currentPhi =
|
|
|
|
circuit_.NewGate(OpCode(OpCode::VALUE_SELECTOR), MachineType::I64, bb.numOfStatePreds,
|
|
|
|
std::vector<GateRef>(1 + bb.numOfStatePreds, Circuit::NullGate()), GateType::AnyType());
|
2022-07-19 12:44:46 +00:00
|
|
|
gateAcc_.NewIn(currentPhi, 0, bb.stateStart);
|
2022-04-24 17:17:29 +00:00
|
|
|
for (size_t i = 0; i < bb.numOfStatePreds; ++i) {
|
|
|
|
auto &[predId, predPc, isException] = bb.expandedPreds.at(i);
|
2022-07-19 12:44:46 +00:00
|
|
|
gateAcc_.NewIn(currentPhi, i + 1, RenameVariable(predId, predPc, reg, acc));
|
2022-04-24 17:17:29 +00:00
|
|
|
}
|
|
|
|
} else {
|
2022-06-11 19:13:23 +00:00
|
|
|
// 2: the number of value inputs and it is in accord with LOOP_BEGIN
|
|
|
|
currentPhi = circuit_.NewGate(OpCode(OpCode::VALUE_SELECTOR), MachineType::I64, 2,
|
|
|
|
{bb.stateStart, Circuit::NullGate(), Circuit::NullGate()}, GateType::AnyType());
|
|
|
|
auto loopBackValue =
|
|
|
|
circuit_.NewGate(OpCode(OpCode::VALUE_SELECTOR), MachineType::I64, bb.numOfLoopBacks,
|
|
|
|
std::vector<GateRef>(1 + bb.numOfLoopBacks, Circuit::NullGate()), GateType::AnyType());
|
2022-07-19 12:44:46 +00:00
|
|
|
gateAcc_.NewIn(loopBackValue, 0, bb.mergeLoopBackEdges);
|
2022-08-11 11:46:55 +00:00
|
|
|
size_t loopBackIndex = 1; // 1: start index of value inputs
|
2022-04-24 17:17:29 +00:00
|
|
|
for (size_t i = 0; i < bb.numOfStatePreds; ++i) {
|
|
|
|
auto &[predId, predPc, isException] = bb.expandedPreds.at(i);
|
|
|
|
if (bb.loopbackBlocks.count(predId)) {
|
2022-08-11 11:46:55 +00:00
|
|
|
gateAcc_.NewIn(loopBackValue, loopBackIndex++, RenameVariable(predId, predPc, reg, acc));
|
2022-04-24 17:17:29 +00:00
|
|
|
}
|
|
|
|
}
|
2022-06-11 19:13:23 +00:00
|
|
|
auto forwardValue = circuit_.NewGate(
|
|
|
|
OpCode(OpCode::VALUE_SELECTOR), MachineType::I64, bb.numOfStatePreds - bb.numOfLoopBacks,
|
|
|
|
std::vector<GateRef>(1 + bb.numOfStatePreds - bb.numOfLoopBacks, Circuit::NullGate()), GateType::AnyType());
|
2022-07-19 12:44:46 +00:00
|
|
|
gateAcc_.NewIn(forwardValue, 0, bb.mergeForwardEdges);
|
2022-08-11 11:46:55 +00:00
|
|
|
size_t forwardIndex = 1; // 1: start index of value inputs
|
2022-04-24 17:17:29 +00:00
|
|
|
for (size_t i = 0; i < bb.numOfStatePreds; ++i) {
|
|
|
|
auto &[predId, predPc, isException] = bb.expandedPreds.at(i);
|
|
|
|
if (!bb.loopbackBlocks.count(predId)) {
|
2022-08-11 11:46:55 +00:00
|
|
|
gateAcc_.NewIn(forwardValue, forwardIndex++, RenameVariable(predId, predPc, reg, acc));
|
2022-04-24 17:17:29 +00:00
|
|
|
}
|
|
|
|
}
|
2022-07-19 12:44:46 +00:00
|
|
|
gateAcc_.NewIn(currentPhi, 1, forwardValue); // 1: index of forward value input
|
|
|
|
gateAcc_.NewIn(currentPhi, 2, loopBackValue); // 2: index of loop-back value input
|
2022-04-24 17:17:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// recursive variables renaming algorithm
|
2022-07-05 07:24:00 +00:00
|
|
|
GateRef BytecodeCircuitBuilder::RenameVariable(const size_t bbId, const uint8_t *end,
|
|
|
|
const uint16_t reg, const bool acc)
|
2022-04-24 17:17:29 +00:00
|
|
|
{
|
|
|
|
ASSERT(end != nullptr);
|
2022-02-17 03:48:40 +00:00
|
|
|
auto tmpReg = reg;
|
2022-04-24 17:17:29 +00:00
|
|
|
// find def-site in bytecodes of basic block
|
|
|
|
auto ans = Circuit::NullGate();
|
|
|
|
auto &bb = graph_.at(bbId);
|
|
|
|
std::vector<uint8_t *> instList;
|
|
|
|
{
|
|
|
|
auto pcIter = bb.start;
|
|
|
|
while (pcIter <= end) {
|
|
|
|
instList.push_back(pcIter);
|
|
|
|
auto curInfo = GetBytecodeInfo(pcIter);
|
|
|
|
pcIter += curInfo.offset;
|
|
|
|
}
|
|
|
|
}
|
2022-07-05 07:24:00 +00:00
|
|
|
GateType type = GateType::AnyType();
|
2022-02-17 03:48:40 +00:00
|
|
|
auto tmpAcc = acc;
|
2022-09-13 03:00:53 +00:00
|
|
|
for (auto pcIter = instList.rbegin(); pcIter != instList.rend(); pcIter++) { // upper bound
|
2022-06-06 09:41:17 +00:00
|
|
|
auto curInfo = GetBytecodeInfo(*pcIter);
|
2022-05-26 04:54:21 +00:00
|
|
|
// original bc use acc as input && current bc use acc as output
|
|
|
|
bool isTransByAcc = tmpAcc && curInfo.accOut;
|
|
|
|
// 0 : the index in vreg-out list
|
|
|
|
bool isTransByVreg = (!tmpAcc && curInfo.IsOut(tmpReg, 0));
|
|
|
|
if (isTransByAcc || isTransByVreg) {
|
2022-02-17 03:48:40 +00:00
|
|
|
if (curInfo.IsMov()) {
|
|
|
|
tmpAcc = curInfo.accIn;
|
|
|
|
if (!curInfo.inputs.empty()) {
|
|
|
|
ASSERT(!tmpAcc);
|
|
|
|
ASSERT(curInfo.inputs.size() == 1);
|
|
|
|
tmpReg = std::get<VirtualRegister>(curInfo.inputs.at(0)).GetId();
|
2022-07-05 07:24:00 +00:00
|
|
|
}
|
|
|
|
if (hasTypes_) {
|
|
|
|
type = typeRecorder_.UpdateType(pcToBCOffset_.at(*pcIter) - 1, type);
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-02-17 03:48:40 +00:00
|
|
|
} else {
|
2022-06-06 09:41:17 +00:00
|
|
|
ans = byteCodeToJSGate_.at(*pcIter);
|
2022-07-05 07:24:00 +00:00
|
|
|
if (hasTypes_ && !type.IsAnyType()) {
|
|
|
|
gateAcc_.SetGateType(ans, type);
|
|
|
|
}
|
2022-02-17 03:48:40 +00:00
|
|
|
break;
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
}
|
2022-09-06 05:27:19 +00:00
|
|
|
if (static_cast<EcmaBytecode>(curInfo.opcode) != EcmaBytecode::RESUMEGENERATOR_PREF_V8) {
|
2022-06-06 09:41:17 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
// New RESTORE_REGISTER HIR, used to restore the register content when processing resume instruction.
|
|
|
|
// New SAVE_REGISTER HIR, used to save register content when processing suspend instruction.
|
|
|
|
auto resumeGate = byteCodeToJSGate_.at(*pcIter);
|
2022-09-19 13:08:34 +00:00
|
|
|
ans = GetExistingRestore(resumeGate, tmpReg);
|
|
|
|
if (ans != Circuit::NullGate()) {
|
|
|
|
break;
|
|
|
|
}
|
2022-07-19 12:44:46 +00:00
|
|
|
GateRef resumeDependGate = gateAcc_.GetDep(resumeGate);
|
2022-06-06 09:41:17 +00:00
|
|
|
ans = circuit_.NewGate(OpCode(OpCode::RESTORE_REGISTER), MachineType::I64, tmpReg,
|
2022-07-05 07:24:00 +00:00
|
|
|
{resumeDependGate}, GateType::AnyType());
|
2022-09-19 13:08:34 +00:00
|
|
|
SetExistingRestore(resumeGate, tmpReg, ans);
|
2022-07-19 12:44:46 +00:00
|
|
|
gateAcc_.SetDep(resumeGate, ans);
|
2022-07-05 07:24:00 +00:00
|
|
|
auto saveRegGate = RenameVariable(bbId, *pcIter - 1, tmpReg, tmpAcc);
|
2022-06-06 09:41:17 +00:00
|
|
|
auto nextPcIter = pcIter;
|
|
|
|
nextPcIter++;
|
2022-09-06 05:27:19 +00:00
|
|
|
ASSERT(GetBytecodeInfo(*nextPcIter).opcode == EcmaBytecode::SUSPENDGENERATOR_PREF_V8_V8);
|
2022-06-06 09:41:17 +00:00
|
|
|
GateRef suspendGate = byteCodeToJSGate_.at(*nextPcIter);
|
2022-07-19 12:44:46 +00:00
|
|
|
auto dependGate = gateAcc_.GetDep(suspendGate);
|
2022-06-06 09:41:17 +00:00
|
|
|
auto newDependGate = circuit_.NewGate(OpCode(OpCode::SAVE_REGISTER), tmpReg, {dependGate, saveRegGate},
|
|
|
|
GateType::Empty());
|
2022-07-19 12:44:46 +00:00
|
|
|
gateAcc_.SetDep(suspendGate, newDependGate);
|
2022-06-06 09:41:17 +00:00
|
|
|
break;
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-04-24 17:17:29 +00:00
|
|
|
// find GET_EXCEPTION gate if this is a catch block
|
2022-02-17 03:48:40 +00:00
|
|
|
if (ans == Circuit::NullGate() && tmpAcc) {
|
2022-04-24 17:17:29 +00:00
|
|
|
if (!bb.trys.empty()) {
|
2022-07-19 12:44:46 +00:00
|
|
|
std::vector<GateRef> outList;
|
|
|
|
gateAcc_.GetOutVector(bb.dependStart, outList);
|
2022-04-24 17:17:29 +00:00
|
|
|
ASSERT(outList.size() == 1);
|
|
|
|
const auto &getExceptionGate = outList.at(0);
|
2022-07-19 12:44:46 +00:00
|
|
|
ASSERT(gateAcc_.GetOpCode(getExceptionGate) == OpCode::GET_EXCEPTION);
|
2022-04-24 17:17:29 +00:00
|
|
|
ans = getExceptionGate;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// find def-site in value selectors of vregs
|
2022-02-17 03:48:40 +00:00
|
|
|
if (ans == Circuit::NullGate() && !tmpAcc && bb.phi.count(tmpReg)) {
|
|
|
|
if (!bb.vregToValSelectorGate.count(tmpReg)) {
|
2022-06-11 19:13:23 +00:00
|
|
|
NewPhi(bb, tmpReg, tmpAcc, bb.vregToValSelectorGate[tmpReg]);
|
2022-04-24 17:17:29 +00:00
|
|
|
}
|
2022-02-17 03:48:40 +00:00
|
|
|
ans = bb.vregToValSelectorGate.at(tmpReg);
|
2022-04-24 17:17:29 +00:00
|
|
|
}
|
|
|
|
// find def-site in value selectors of acc
|
2022-02-17 03:48:40 +00:00
|
|
|
if (ans == Circuit::NullGate() && tmpAcc && bb.phiAcc) {
|
2022-04-24 17:17:29 +00:00
|
|
|
if (bb.valueSelectorAccGate == Circuit::NullGate()) {
|
2022-06-11 19:13:23 +00:00
|
|
|
NewPhi(bb, tmpReg, tmpAcc, bb.valueSelectorAccGate);
|
2022-04-24 17:17:29 +00:00
|
|
|
}
|
|
|
|
ans = bb.valueSelectorAccGate;
|
|
|
|
}
|
2022-06-16 09:27:35 +00:00
|
|
|
if (ans == Circuit::NullGate() && IsEntryBlock(bbId)) { // entry block
|
2022-04-24 17:17:29 +00:00
|
|
|
// find def-site in function args
|
2022-06-16 09:27:35 +00:00
|
|
|
ASSERT(!tmpAcc);
|
|
|
|
ans = argAcc_.GetArgGate(tmpReg);
|
2022-05-26 04:54:21 +00:00
|
|
|
return ans;
|
2022-04-24 17:17:29 +00:00
|
|
|
}
|
|
|
|
if (ans == Circuit::NullGate()) {
|
|
|
|
// recursively find def-site in dominator block
|
2022-07-05 07:24:00 +00:00
|
|
|
return RenameVariable(bb.iDominator->id, bb.iDominator->end, tmpReg, tmpAcc);
|
2022-04-24 17:17:29 +00:00
|
|
|
} else {
|
|
|
|
// def-site already found
|
|
|
|
return ans;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BytecodeCircuitBuilder::BuildCircuit()
|
|
|
|
{
|
|
|
|
if (IsLogEnabled()) {
|
|
|
|
PrintBBInfo();
|
|
|
|
}
|
|
|
|
|
|
|
|
// create arg gates array
|
|
|
|
BuildCircuitArgs();
|
|
|
|
CollectPredsInfo();
|
|
|
|
BuildBlockCircuitHead();
|
|
|
|
// build states sub-circuit of each block
|
|
|
|
BuildSubCircuit();
|
2022-01-19 01:11:02 +00:00
|
|
|
// verification of soundness of CFG
|
2022-04-24 17:17:29 +00:00
|
|
|
for (auto &bb: graph_) {
|
2022-01-06 02:26:19 +00:00
|
|
|
if (bb.isDead) {
|
|
|
|
continue;
|
|
|
|
}
|
2022-01-19 01:11:02 +00:00
|
|
|
ASSERT(bb.statePredIndex == bb.numOfStatePreds);
|
2022-04-24 17:17:29 +00:00
|
|
|
ASSERT(bb.loopBackIndex == bb.numOfLoopBacks);
|
|
|
|
if (bb.numOfLoopBacks) {
|
|
|
|
ASSERT(bb.forwardIndex == bb.numOfStatePreds - bb.numOfLoopBacks);
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
}
|
2022-04-14 08:14:34 +00:00
|
|
|
|
|
|
|
if (IsLogEnabled()) {
|
2022-04-24 17:17:29 +00:00
|
|
|
PrintBytecodeInfo();
|
2022-04-14 08:14:34 +00:00
|
|
|
}
|
|
|
|
|
2022-01-22 11:09:02 +00:00
|
|
|
for (const auto &[key, value]: jsgateToBytecode_) {
|
2022-01-19 01:11:02 +00:00
|
|
|
byteCodeToJSGate_[value.second] = key;
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-01-19 01:11:02 +00:00
|
|
|
// resolve def-site of virtual regs and set all value inputs
|
2022-07-19 12:44:46 +00:00
|
|
|
std::vector<GateRef> gates;
|
|
|
|
circuit_.GetAllGates(gates);
|
|
|
|
for (auto gate: gates) {
|
|
|
|
auto valueCount = gateAcc_.GetInValueCount(gate);
|
2022-01-22 11:09:02 +00:00
|
|
|
auto it = jsgateToBytecode_.find(gate);
|
2022-04-24 17:17:29 +00:00
|
|
|
if (it == jsgateToBytecode_.cend()) {
|
2022-01-06 02:26:19 +00:00
|
|
|
continue;
|
|
|
|
}
|
2022-07-19 12:44:46 +00:00
|
|
|
if (gateAcc_.GetOpCode(gate) == OpCode::CONSTANT) {
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
continue;
|
|
|
|
}
|
2022-01-06 02:26:19 +00:00
|
|
|
const auto &[id, pc] = it->second;
|
2022-07-05 07:24:00 +00:00
|
|
|
if (hasTypes_) {
|
|
|
|
auto type = typeRecorder_.GetType(pcToBCOffset_.at(pc) - 1);
|
|
|
|
if (!type.IsAnyType()) {
|
|
|
|
gateAcc_.SetGateType(gate, type);
|
|
|
|
}
|
|
|
|
}
|
2022-01-22 11:09:02 +00:00
|
|
|
auto bytecodeInfo = GetBytecodeInfo(pc);
|
2022-06-10 07:22:21 +00:00
|
|
|
[[maybe_unused]] size_t numValueInputs = bytecodeInfo.ComputeTotalValueCount();
|
|
|
|
[[maybe_unused]] size_t numValueOutputs = bytecodeInfo.ComputeOutCount() + bytecodeInfo.vregOut.size();
|
2022-03-02 08:06:19 +00:00
|
|
|
ASSERT(numValueInputs == valueCount);
|
2022-01-06 02:26:19 +00:00
|
|
|
ASSERT(numValueOutputs <= 1);
|
2022-07-19 12:44:46 +00:00
|
|
|
auto stateCount = gateAcc_.GetStateCount(gate);
|
|
|
|
auto dependCount = gateAcc_.GetDependCount(gate);
|
2022-03-02 08:06:19 +00:00
|
|
|
for (size_t valueIdx = 0; valueIdx < valueCount; valueIdx++) {
|
|
|
|
auto inIdx = valueIdx + stateCount + dependCount;
|
2022-07-19 12:44:46 +00:00
|
|
|
if (!gateAcc_.IsInGateNull(gate, inIdx)) {
|
2022-01-14 09:48:52 +00:00
|
|
|
continue;
|
|
|
|
}
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
if (valueIdx < bytecodeInfo.inputs.size()) {
|
2022-07-19 12:44:46 +00:00
|
|
|
gateAcc_.NewIn(gate, inIdx,
|
2022-04-24 17:17:29 +00:00
|
|
|
RenameVariable(id, pc - 1,
|
|
|
|
std::get<VirtualRegister>(bytecodeInfo.inputs.at(valueIdx)).GetId(),
|
|
|
|
false));
|
2022-01-06 02:26:19 +00:00
|
|
|
} else {
|
2022-07-19 12:44:46 +00:00
|
|
|
gateAcc_.NewIn(gate, inIdx, RenameVariable(id, pc - 1, 0, true));
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-04-14 08:14:34 +00:00
|
|
|
|
|
|
|
if (IsLogEnabled()) {
|
|
|
|
circuit_.PrintAllGates(*this);
|
|
|
|
}
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
|
2022-06-10 07:22:21 +00:00
|
|
|
void BytecodeCircuitBuilder::AddBytecodeOffsetInfo(GateRef &gate, const BytecodeInfo &info, size_t bcOffsetIndex,
|
|
|
|
uint8_t *pc)
|
|
|
|
{
|
|
|
|
if (info.IsCall()) {
|
|
|
|
auto bcOffset = circuit_.NewGate(OpCode(OpCode::CONSTANT), MachineType::I64,
|
2022-08-02 08:38:18 +00:00
|
|
|
pcToBCOffset_.at(pc),
|
2022-06-10 07:22:21 +00:00
|
|
|
{Circuit::GetCircuitRoot(OpCode(OpCode::CONSTANT_LIST))},
|
|
|
|
GateType::NJSValue());
|
2022-07-19 12:44:46 +00:00
|
|
|
gateAcc_.NewIn(gate, bcOffsetIndex, bcOffset);
|
2022-06-10 07:22:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-19 13:08:34 +00:00
|
|
|
GateRef BytecodeCircuitBuilder::GetExistingRestore(GateRef resumeGate, uint16_t tmpReg) const {
|
|
|
|
auto pr = std::make_pair(resumeGate, tmpReg);
|
|
|
|
if (resumeRegToRestore_.count(pr)) {
|
|
|
|
return resumeRegToRestore_.at(pr);
|
|
|
|
}
|
|
|
|
return Circuit::NullGate();
|
|
|
|
}
|
|
|
|
|
|
|
|
void BytecodeCircuitBuilder::SetExistingRestore(GateRef resumeGate, uint16_t tmpReg, GateRef restoreGate) {
|
|
|
|
auto pr = std::make_pair(resumeGate, tmpReg);
|
|
|
|
resumeRegToRestore_[pr] = restoreGate;
|
|
|
|
}
|
|
|
|
|
2022-01-22 11:09:02 +00:00
|
|
|
void BytecodeCircuitBuilder::PrintCollectBlockInfo(std::vector<CfgInfo> &bytecodeBlockInfos)
|
2022-01-06 02:26:19 +00:00
|
|
|
{
|
2022-04-24 17:17:29 +00:00
|
|
|
for (auto iter = bytecodeBlockInfos.cbegin(); iter != bytecodeBlockInfos.cend(); iter++) {
|
2022-04-14 08:14:34 +00:00
|
|
|
std::string log("offset: " + std::to_string(reinterpret_cast<uintptr_t>(iter->pc)) + " splitKind: " +
|
|
|
|
std::to_string(static_cast<int32_t>(iter->splitKind)) + " successor are: ");
|
2022-01-19 01:11:02 +00:00
|
|
|
auto &vec = iter->succs;
|
2022-01-18 04:02:20 +00:00
|
|
|
for (size_t i = 0; i < vec.size(); i++) {
|
2022-04-14 08:14:34 +00:00
|
|
|
log += std::to_string(reinterpret_cast<uintptr_t>(vec[i])) + " , ";
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-07-06 06:12:54 +00:00
|
|
|
LOG_COMPILER(INFO) << log;
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-07-06 06:12:54 +00:00
|
|
|
LOG_COMPILER(INFO) << "-----------------------------------------------------------------------";
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
|
2022-04-24 17:17:29 +00:00
|
|
|
void BytecodeCircuitBuilder::PrintGraph()
|
2022-01-06 02:26:19 +00:00
|
|
|
{
|
2022-04-24 17:17:29 +00:00
|
|
|
for (size_t i = 0; i < graph_.size(); i++) {
|
|
|
|
if (graph_[i].isDead) {
|
2022-07-06 06:12:54 +00:00
|
|
|
LOG_COMPILER(INFO) << "BB_" << graph_[i].id << ": ;predsId= invalid BB";
|
|
|
|
LOG_COMPILER(INFO) << "curStartPc: " << reinterpret_cast<uintptr_t>(graph_[i].start) <<
|
2022-04-24 17:17:29 +00:00
|
|
|
" curEndPc: " << reinterpret_cast<uintptr_t>(graph_[i].end);
|
2022-01-06 02:26:19 +00:00
|
|
|
continue;
|
|
|
|
}
|
2022-04-24 17:17:29 +00:00
|
|
|
std::string log("BB_" + std::to_string(graph_[i].id) + ": ;predsId= ");
|
|
|
|
for (size_t k = 0; k < graph_[i].preds.size(); ++k) {
|
|
|
|
log += std::to_string(graph_[i].preds[k]->id) + ", ";
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-07-06 06:12:54 +00:00
|
|
|
LOG_COMPILER(INFO) << log;
|
|
|
|
LOG_COMPILER(INFO) << "curStartPc: " << reinterpret_cast<uintptr_t>(graph_[i].start) <<
|
2022-04-24 17:17:29 +00:00
|
|
|
" curEndPc: " << reinterpret_cast<uintptr_t>(graph_[i].end);
|
2022-01-06 02:26:19 +00:00
|
|
|
|
2022-04-24 17:17:29 +00:00
|
|
|
for (size_t j = 0; j < graph_[i].preds.size(); j++) {
|
2022-07-06 06:12:54 +00:00
|
|
|
LOG_COMPILER(INFO) << "predsStartPc: " << reinterpret_cast<uintptr_t>(graph_[i].preds[j]->start) <<
|
2022-04-24 17:17:29 +00:00
|
|
|
" predsEndPc: " << reinterpret_cast<uintptr_t>(graph_[i].preds[j]->end);
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
|
2022-04-24 17:17:29 +00:00
|
|
|
for (size_t j = 0; j < graph_[i].succs.size(); j++) {
|
2022-07-06 06:12:54 +00:00
|
|
|
LOG_COMPILER(INFO) << "succesStartPc: " << reinterpret_cast<uintptr_t>(graph_[i].succs[j]->start) <<
|
2022-04-24 17:17:29 +00:00
|
|
|
" succesEndPc: " << reinterpret_cast<uintptr_t>(graph_[i].succs[j]->end);
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
|
2022-04-14 08:14:34 +00:00
|
|
|
std::string log1("succesId: ");
|
2022-04-24 17:17:29 +00:00
|
|
|
for (size_t j = 0; j < graph_[i].succs.size(); j++) {
|
|
|
|
log1 += std::to_string(graph_[i].succs[j]->id) + ", ";
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-07-06 06:12:54 +00:00
|
|
|
LOG_COMPILER(INFO) << log1;
|
2022-01-06 02:26:19 +00:00
|
|
|
|
2022-04-24 17:17:29 +00:00
|
|
|
for (size_t j = 0; j < graph_[i].catchs.size(); j++) {
|
2022-07-06 06:12:54 +00:00
|
|
|
LOG_COMPILER(INFO) << "catchStartPc: " << reinterpret_cast<uintptr_t>(graph_[i].catchs[j]->start) <<
|
2022-04-24 17:17:29 +00:00
|
|
|
" catchEndPc: " << reinterpret_cast<uintptr_t>(graph_[i].catchs[j]->end);
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
|
2022-04-24 17:17:29 +00:00
|
|
|
for (size_t j = 0; j < graph_[i].immDomBlocks.size(); j++) {
|
2022-07-06 06:12:54 +00:00
|
|
|
LOG_COMPILER(INFO) << "dominate block id: " << graph_[i].immDomBlocks[j]->id << " startPc: " <<
|
2022-04-24 17:17:29 +00:00
|
|
|
reinterpret_cast<uintptr_t>(graph_[i].immDomBlocks[j]->start) << " endPc: " <<
|
|
|
|
reinterpret_cast<uintptr_t>(graph_[i].immDomBlocks[j]->end);
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
|
2022-04-24 17:17:29 +00:00
|
|
|
if (graph_[i].iDominator) {
|
2022-07-06 06:12:54 +00:00
|
|
|
LOG_COMPILER(INFO) << "current block " << graph_[i].id <<
|
2022-04-24 17:17:29 +00:00
|
|
|
" immediate dominator is " << graph_[i].iDominator->id;
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
|
2022-04-24 17:17:29 +00:00
|
|
|
std::string log2("current block " + std::to_string(graph_[i].id) + " dominance Frontiers: ");
|
|
|
|
for (const auto &frontier: graph_[i].domFrontiers) {
|
2022-04-14 08:14:34 +00:00
|
|
|
log2 += std::to_string(frontier->id) + " , ";
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-07-06 06:12:54 +00:00
|
|
|
LOG_COMPILER(INFO) << log2;
|
2022-01-06 02:26:19 +00:00
|
|
|
|
2022-04-24 17:17:29 +00:00
|
|
|
std::string log3("current block " + std::to_string(graph_[i].id) + " phi variable: ");
|
|
|
|
for (auto variable: graph_[i].phi) {
|
2022-04-14 08:14:34 +00:00
|
|
|
log3 += std::to_string(variable) + " , ";
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-07-06 06:12:54 +00:00
|
|
|
LOG_COMPILER(INFO) << log3;
|
|
|
|
LOG_COMPILER(INFO) << "-------------------------------------------------------";
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-24 17:17:29 +00:00
|
|
|
void BytecodeCircuitBuilder::PrintBytecodeInfo()
|
2022-01-06 02:26:19 +00:00
|
|
|
{
|
2022-04-24 17:17:29 +00:00
|
|
|
for (auto &bb: graph_) {
|
2022-01-06 02:26:19 +00:00
|
|
|
if (bb.isDead) {
|
|
|
|
continue;
|
|
|
|
}
|
2022-07-06 06:12:54 +00:00
|
|
|
LOG_COMPILER(INFO) << "BB_" << bb.id << ": ";
|
2022-06-30 02:22:52 +00:00
|
|
|
EnumerateBlock(bb, [](uint8_t * pc, BytecodeInfo &bytecodeInfo) -> bool {
|
2022-04-14 08:14:34 +00:00
|
|
|
std::string log;
|
2022-08-26 01:06:59 +00:00
|
|
|
log += "Inst_" + GetEcmaBytecodeStr(static_cast<EcmaBytecode>(*pc)) + ": " + "In=[";
|
2022-06-30 02:22:52 +00:00
|
|
|
if (bytecodeInfo.accIn) {
|
2022-04-14 08:14:34 +00:00
|
|
|
log += "acc,";
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-06-30 02:22:52 +00:00
|
|
|
for (const auto &in: bytecodeInfo.inputs) {
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
if (std::holds_alternative<VirtualRegister>(in)) {
|
2022-04-14 08:14:34 +00:00
|
|
|
log += std::to_string(std::get<VirtualRegister>(in).GetId()) + ",";
|
Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.
For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5
Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-04 07:52:07 +00:00
|
|
|
}
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-04-14 08:14:34 +00:00
|
|
|
log += "] Out=[";
|
2022-06-30 02:22:52 +00:00
|
|
|
if (bytecodeInfo.accOut) {
|
2022-04-14 08:14:34 +00:00
|
|
|
log += "acc,";
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-06-30 02:22:52 +00:00
|
|
|
for (const auto &out: bytecodeInfo.vregOut) {
|
2022-04-14 08:14:34 +00:00
|
|
|
log += std::to_string(out) + ",";
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-04-14 08:14:34 +00:00
|
|
|
log += "]";
|
2022-07-06 06:12:54 +00:00
|
|
|
LOG_COMPILER(INFO) << log;
|
2022-06-30 02:22:52 +00:00
|
|
|
return true;
|
|
|
|
});
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-24 17:17:29 +00:00
|
|
|
void BytecodeCircuitBuilder::PrintBBInfo()
|
2022-01-06 02:26:19 +00:00
|
|
|
{
|
2022-04-24 17:17:29 +00:00
|
|
|
for (auto &bb: graph_) {
|
2022-01-06 02:26:19 +00:00
|
|
|
if (bb.isDead) {
|
|
|
|
continue;
|
|
|
|
}
|
2022-07-06 06:12:54 +00:00
|
|
|
LOG_COMPILER(INFO) << "------------------------";
|
|
|
|
LOG_COMPILER(INFO) << "block: " << bb.id;
|
2022-04-14 08:14:34 +00:00
|
|
|
std::string log("preds: ");
|
2022-01-18 04:02:20 +00:00
|
|
|
for (auto pred: bb.preds) {
|
2022-04-14 08:14:34 +00:00
|
|
|
log += std::to_string(pred->id) + " , ";
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-07-06 06:12:54 +00:00
|
|
|
LOG_COMPILER(INFO) << log;
|
2022-04-14 08:14:34 +00:00
|
|
|
std::string log1("succs: ");
|
2022-01-18 04:02:20 +00:00
|
|
|
for (auto succ: bb.succs) {
|
2022-04-14 08:14:34 +00:00
|
|
|
log1 += std::to_string(succ->id) + " , ";
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-07-06 06:12:54 +00:00
|
|
|
LOG_COMPILER(INFO) << log1;
|
2022-04-14 08:14:34 +00:00
|
|
|
std::string log2("catchs: ");
|
2022-01-18 04:02:20 +00:00
|
|
|
for (auto catchBlock: bb.catchs) {
|
2022-04-14 08:14:34 +00:00
|
|
|
log2 += std::to_string(catchBlock->id) + " , ";
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-07-06 06:12:54 +00:00
|
|
|
LOG_COMPILER(INFO) << log2;
|
2022-04-14 08:14:34 +00:00
|
|
|
std::string log3("trys: ");
|
2022-01-18 04:02:20 +00:00
|
|
|
for (auto tryBlock: bb.trys) {
|
2022-04-14 08:14:34 +00:00
|
|
|
log3 += std::to_string(tryBlock->id) + " , ";
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
2022-07-06 06:12:54 +00:00
|
|
|
LOG_COMPILER(INFO) << log3;
|
2022-01-06 02:26:19 +00:00
|
|
|
}
|
|
|
|
}
|
2022-07-15 02:35:25 +00:00
|
|
|
|
|
|
|
void BytecodeCircuitBuilder::PrintDefsitesInfo(const std::map<uint16_t, std::set<size_t>> &defsitesInfo)
|
|
|
|
{
|
|
|
|
for (const auto&[variable, defsites] : defsitesInfo) {
|
|
|
|
std::string log("variable: " + std::to_string(variable) + " locate block have: ");
|
|
|
|
for (auto id : defsites) {
|
|
|
|
log += std::to_string(id) + " , ";
|
|
|
|
}
|
|
|
|
LOG_COMPILER(INFO) << log;
|
|
|
|
}
|
|
|
|
}
|
2022-04-22 03:03:38 +00:00
|
|
|
} // namespace panda::ecmascript::kungfu
|