mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-27 12:10:47 +00:00
Refactor ID definition and callSignature initialization mechanism of stubs
Refactor ID definition and callSignature initialization mechanism of runtime stub, optimizer stub and bytecode handler stub, reduce amount and complexity of macro used in calling those stubs. Add stubDes struct to classify stubs both in AOT file generation phase and AOT file loading phase. Fix some circular dependency problems in including header files. Fix certain inline function declaration and definition format problems, which could lead to compiling errors. Issue: https://gitee.com/openharmony/ark_js_runtime/issues/I4VMLD?from=project-issue Test: stubTest(unit test), richards with asm interpreter enabled Signed-off-by: luochuhao <luochuhao@huawei.com> Change-Id: Ibd5fcd963347b97f8dec227f3245d2064463b0b0
This commit is contained in:
parent
ac73e853a0
commit
905d0496dc
2
BUILD.gn
2
BUILD.gn
@ -444,7 +444,7 @@ ecma_source = [
|
||||
"ecmascript/template_string.cpp",
|
||||
"ecmascript/weak_vector.cpp",
|
||||
"ecmascript/compiler/llvm/llvm_stackmap_parser.cpp",
|
||||
"ecmascript/trampoline/runtime_trampolines.cpp",
|
||||
"ecmascript/stubs/runtime_stubs.cpp",
|
||||
"ecmascript/ts_types/ts_type.cpp",
|
||||
"ecmascript/ts_types/ts_type_table.cpp",
|
||||
"ecmascript/ts_types/ts_loader.cpp",
|
||||
|
@ -20,6 +20,8 @@
|
||||
#include "ecmascript/js_hclass.h"
|
||||
#include "ecmascript/js_native_pointer.h"
|
||||
#include "ecmascript/js_tagged_value.h"
|
||||
#include "ecmascript/mem/object_xray.h"
|
||||
#include "ecmascript/mem/slots.h"
|
||||
#include "ecmascript/record.h"
|
||||
|
||||
namespace panda::ecmascript {
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "ecmascript/global_env.h"
|
||||
#include "ecmascript/js_collator.h"
|
||||
#include "ecmascript/js_intl.h"
|
||||
#include "ecmascript/mem/barriers-inl.h"
|
||||
|
||||
namespace panda::ecmascript::builtins {
|
||||
constexpr uint32_t FUNCTION_LENGTH_TWO = 2;
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "ecmascript/js_date.h"
|
||||
#include "ecmascript/js_date_time_format.h"
|
||||
#include "ecmascript/js_intl.h"
|
||||
#include "ecmascript/mem/barriers-inl.h"
|
||||
|
||||
namespace panda::ecmascript::builtins {
|
||||
// 13.2.1 Intl.DateTimeFormat ( [ locales [ , options ] ] )
|
||||
|
@ -41,6 +41,7 @@ config("ark_jsruntime_compiler_config") {
|
||||
source_set("libark_jsoptimizer_static") {
|
||||
sources = [
|
||||
"bytecode_circuit_builder.cpp",
|
||||
"call_signature.cpp",
|
||||
"circuit.cpp",
|
||||
"circuit_builder.cpp",
|
||||
"fast_stub.cpp",
|
||||
@ -49,9 +50,9 @@ source_set("libark_jsoptimizer_static") {
|
||||
"interpreter_stub.cpp",
|
||||
"llvm_codegen.cpp",
|
||||
"llvm_ir_builder.cpp",
|
||||
"rt_call_signature.cpp",
|
||||
"scheduler.cpp",
|
||||
"stub.cpp",
|
||||
"stub_descriptor.cpp",
|
||||
"type.cpp",
|
||||
"verifier.cpp",
|
||||
]
|
||||
@ -185,7 +186,7 @@ ark_gen_file("stub_aot_options_gen_h") {
|
||||
}
|
||||
|
||||
ohos_executable("ark_stub_opt") {
|
||||
sources = [ "stub_aot_compiler.cpp" ]
|
||||
sources = [ "stub_compiler.cpp" ]
|
||||
include_dirs = [ "$target_gen_dir" ]
|
||||
|
||||
configs = [
|
||||
|
@ -13,143 +13,138 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ecmascript/compiler/stub_descriptor.h"
|
||||
#include "ecmascript/compiler/call_signature.h"
|
||||
|
||||
#include "llvm-c/Core.h"
|
||||
#include "llvm/Support/Host.h"
|
||||
|
||||
namespace panda::ecmascript::kungfu {
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
||||
#define CALL_STUB_INIT_DESCRIPTOR(name) \
|
||||
class Stub##name##InterfaceDescriptor final { \
|
||||
public: \
|
||||
static void Initialize(StubDescriptor *descriptor); \
|
||||
}; \
|
||||
void Stub##name##InterfaceDescriptor::Initialize(StubDescriptor *descriptor)
|
||||
#define DEF_CALL_SIGNATURE(name) \
|
||||
void name##CallSignature::Initialize(CallSignature *callSign)
|
||||
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(FastAdd)
|
||||
DEF_CALL_SIGNATURE(FastAdd)
|
||||
{
|
||||
// 3 : 3 input parameters
|
||||
StubDescriptor fastAdd("FastAdd", 0, 3, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY()); // number or hole
|
||||
*descriptor = fastAdd;
|
||||
CallSignature fastAdd("FastAdd", 0, 3, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY()); // number or hole
|
||||
*callSign = fastAdd;
|
||||
// 3 : 3 input parameters
|
||||
std::array<VariableType, 3> params = {
|
||||
VariableType::POINTER(),
|
||||
VariableType::JS_ANY(),
|
||||
VariableType::JS_ANY(),
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
callSign->SetParameters(params.data());
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(FastSub)
|
||||
DEF_CALL_SIGNATURE(FastSub)
|
||||
{
|
||||
// 3 : 3 input parameters
|
||||
StubDescriptor fastSub("FastSub", 0, 3, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY()); // number or hole
|
||||
*descriptor = fastSub;
|
||||
CallSignature fastSub("FastSub", 0, 3, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY()); // number or hole
|
||||
*callSign = fastSub;
|
||||
// 3 : 3 input parameters
|
||||
std::array<VariableType, 3> params = {
|
||||
VariableType::POINTER(),
|
||||
VariableType::JS_ANY(),
|
||||
VariableType::JS_ANY(),
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
callSign->SetParameters(params.data());
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(FastMul)
|
||||
DEF_CALL_SIGNATURE(FastMul)
|
||||
{
|
||||
// 3 : 3 input parameters
|
||||
StubDescriptor fastMul("FastMul", 0, 3, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY()); // number or hole
|
||||
*descriptor = fastMul;
|
||||
CallSignature fastMul("FastMul", 0, 3, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY()); // number or hole
|
||||
*callSign = fastMul;
|
||||
// 3 : 3 input parameters
|
||||
std::array<VariableType, 3> params = {
|
||||
VariableType::POINTER(),
|
||||
VariableType::JS_ANY(),
|
||||
VariableType::JS_ANY(),
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
callSign->SetParameters(params.data());
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
CALL_STUB_INIT_DESCRIPTOR(FastMulGCTest)
|
||||
DEF_CALL_SIGNATURE(FastMulGCTest)
|
||||
{
|
||||
// 3 : 3 input parameters
|
||||
StubDescriptor fastMulGC("FastMulGCTest", 0, 3, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
|
||||
*descriptor = fastMulGC;
|
||||
CallSignature fastMulGC("FastMulGCTest", 0, 3, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
|
||||
*callSign = fastMulGC;
|
||||
// 3 : 3 input parameters
|
||||
std::array<VariableType, 3> params = {
|
||||
VariableType::POINTER(),
|
||||
VariableType::INT64(),
|
||||
VariableType::INT64(),
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
callSign->SetParameters(params.data());
|
||||
}
|
||||
#else
|
||||
CALL_STUB_INIT_DESCRIPTOR(FastMulGCTest) {}
|
||||
DEF_CALL_SIGNATURE(FastMulGCTest) {}
|
||||
#endif
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(FastDiv)
|
||||
DEF_CALL_SIGNATURE(FastDiv)
|
||||
{
|
||||
// 3 : 3 input parameters
|
||||
StubDescriptor fastDiv("FastDiv", 0, 3, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY()); // float or hole
|
||||
*descriptor = fastDiv;
|
||||
CallSignature fastDiv("FastDiv", 0, 3, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY()); // float or hole
|
||||
*callSign = fastDiv;
|
||||
// 3 : 3 input parameters
|
||||
std::array<VariableType, 3> params = {
|
||||
VariableType::POINTER(),
|
||||
VariableType::JS_ANY(),
|
||||
VariableType::JS_ANY(),
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
callSign->SetParameters(params.data());
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(FastMod)
|
||||
DEF_CALL_SIGNATURE(FastMod)
|
||||
{
|
||||
// 3 : 3 input parameters
|
||||
StubDescriptor fastMod("FastMod", 0, 3,
|
||||
CallSignature fastMod("FastMod", 0, 3,
|
||||
ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY()); // int,float or hole
|
||||
*descriptor = fastMod;
|
||||
*callSign = fastMod;
|
||||
// 3 : 3 input parameters
|
||||
std::array<VariableType, 3> params = {
|
||||
VariableType::POINTER(),
|
||||
VariableType::JS_ANY(),
|
||||
VariableType::JS_ANY(),
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
callSign->SetParameters(params.data());
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(FastTypeOf)
|
||||
DEF_CALL_SIGNATURE(FastTypeOf)
|
||||
{
|
||||
// 2 input parameters
|
||||
StubDescriptor fastTypeOf("FastTypeOf", 0, 2, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_POINTER());
|
||||
*descriptor = fastTypeOf;
|
||||
CallSignature fastTypeOf("FastTypeOf", 0, 2, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_POINTER());
|
||||
*callSign = fastTypeOf;
|
||||
// 2 input parameters
|
||||
std::array<VariableType, 2> params = {
|
||||
VariableType::POINTER(), // glue
|
||||
VariableType::JS_ANY(), // ACC
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
callSign->SetParameters(params.data());
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(FastEqual)
|
||||
DEF_CALL_SIGNATURE(FastEqual)
|
||||
{
|
||||
// 3 input parameters, return may be true/false/hole
|
||||
StubDescriptor fastEqual("FastEqual", 0, 3, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
|
||||
*descriptor = fastEqual;
|
||||
CallSignature fastEqual("FastEqual", 0, 3, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
|
||||
*callSign = fastEqual;
|
||||
// 3 input parameters
|
||||
std::array<VariableType, 3> params = {
|
||||
VariableType::POINTER(),
|
||||
VariableType::JS_ANY(),
|
||||
VariableType::JS_ANY(),
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
callSign->SetParameters(params.data());
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(SetPropertyByName)
|
||||
DEF_CALL_SIGNATURE(SetPropertyByName)
|
||||
{
|
||||
// 4 : 4 input parameters
|
||||
StubDescriptor setPropertyByName("SetPropertyByName", 0, 4, ArgumentsOrder::DEFAULT_ORDER,
|
||||
CallSignature setPropertyByName("SetPropertyByName", 0, 4, ArgumentsOrder::DEFAULT_ORDER,
|
||||
VariableType::INT64());
|
||||
*descriptor = setPropertyByName;
|
||||
*callSign = setPropertyByName;
|
||||
|
||||
std::array<VariableType, 4> params = { // 4 : 4 input parameters
|
||||
VariableType::POINTER(),
|
||||
@ -157,15 +152,15 @@ CALL_STUB_INIT_DESCRIPTOR(SetPropertyByName)
|
||||
VariableType::JS_POINTER(),
|
||||
VariableType::JS_ANY()
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
callSign->SetParameters(params.data());
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(SetPropertyByNameWithOwn)
|
||||
DEF_CALL_SIGNATURE(SetPropertyByNameWithOwn)
|
||||
{
|
||||
// 4 : 4 input parameters
|
||||
StubDescriptor setPropertyByNameWithOwn("SetPropertyByNameWithOwn", 0, 4, ArgumentsOrder::DEFAULT_ORDER,
|
||||
CallSignature setPropertyByNameWithOwn("SetPropertyByNameWithOwn", 0, 4, ArgumentsOrder::DEFAULT_ORDER,
|
||||
VariableType::INT64());
|
||||
*descriptor = setPropertyByNameWithOwn;
|
||||
*callSign = setPropertyByNameWithOwn;
|
||||
|
||||
std::array<VariableType, 4> params = { // 4 : 4 input parameters
|
||||
VariableType::POINTER(),
|
||||
@ -173,15 +168,15 @@ CALL_STUB_INIT_DESCRIPTOR(SetPropertyByNameWithOwn)
|
||||
VariableType::JS_POINTER(),
|
||||
VariableType::JS_ANY()
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
callSign->SetParameters(params.data());
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(SetPropertyByValue)
|
||||
DEF_CALL_SIGNATURE(SetPropertyByValue)
|
||||
{
|
||||
// 4 : 4 input parameters
|
||||
StubDescriptor setPropertyByName("SetPropertyByValue", 0, 4, ArgumentsOrder::DEFAULT_ORDER,
|
||||
CallSignature setPropertyByName("SetPropertyByValue", 0, 4, ArgumentsOrder::DEFAULT_ORDER,
|
||||
VariableType::INT64());
|
||||
*descriptor = setPropertyByName;
|
||||
*callSign = setPropertyByName;
|
||||
|
||||
std::array<VariableType, 4> params = { // 4 : 4 input parameters
|
||||
VariableType::POINTER(),
|
||||
@ -189,44 +184,44 @@ CALL_STUB_INIT_DESCRIPTOR(SetPropertyByValue)
|
||||
VariableType::JS_ANY(),
|
||||
VariableType::JS_ANY()
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
callSign->SetParameters(params.data());
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(GetPropertyByName)
|
||||
DEF_CALL_SIGNATURE(GetPropertyByName)
|
||||
{
|
||||
// 3 : 3 input parameters
|
||||
StubDescriptor getPropertyByName("GetPropertyByName", 0, 3, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
|
||||
*descriptor = getPropertyByName;
|
||||
CallSignature getPropertyByName("GetPropertyByName", 0, 3, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
|
||||
*callSign = getPropertyByName;
|
||||
// 3 : 3 input parameters
|
||||
std::array<VariableType, 3> params = {
|
||||
VariableType::POINTER(), // glue
|
||||
VariableType::JS_ANY(), // receiver
|
||||
VariableType::JS_POINTER(), // key
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
callSign->SetParameters(params.data());
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(GetPropertyByIndex)
|
||||
DEF_CALL_SIGNATURE(GetPropertyByIndex)
|
||||
{
|
||||
// 3 : 3 input parameters
|
||||
StubDescriptor getPropertyByIndex("GetPropertyByIndex", 0, 3, ArgumentsOrder::DEFAULT_ORDER,
|
||||
CallSignature getPropertyByIndex("GetPropertyByIndex", 0, 3, ArgumentsOrder::DEFAULT_ORDER,
|
||||
VariableType::JS_ANY());
|
||||
*descriptor = getPropertyByIndex;
|
||||
*callSign = getPropertyByIndex;
|
||||
// 3 : 3 input parameters
|
||||
std::array<VariableType, 3> params = {
|
||||
VariableType::POINTER(), // glue
|
||||
VariableType::JS_ANY(), // receiver
|
||||
VariableType::INT32(), // index
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
callSign->SetParameters(params.data());
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(SetPropertyByIndex)
|
||||
DEF_CALL_SIGNATURE(SetPropertyByIndex)
|
||||
{
|
||||
// 4 : 4 input parameters
|
||||
StubDescriptor setPropertyByIndex("SetPropertyByIndex", 0, 4, ArgumentsOrder::DEFAULT_ORDER,
|
||||
CallSignature setPropertyByIndex("SetPropertyByIndex", 0, 4, ArgumentsOrder::DEFAULT_ORDER,
|
||||
VariableType::INT64()); // hole or undefined
|
||||
*descriptor = setPropertyByIndex;
|
||||
*callSign = setPropertyByIndex;
|
||||
// 4 : 4 input parameters
|
||||
std::array<VariableType, 4> params = {
|
||||
VariableType::POINTER(),
|
||||
@ -234,30 +229,30 @@ CALL_STUB_INIT_DESCRIPTOR(SetPropertyByIndex)
|
||||
VariableType::INT32(),
|
||||
VariableType::JS_ANY(),
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
callSign->SetParameters(params.data());
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(GetPropertyByValue)
|
||||
DEF_CALL_SIGNATURE(GetPropertyByValue)
|
||||
{
|
||||
// 3 : 3 input parameters
|
||||
StubDescriptor getPropertyByValue("GetPropertyByValue", 0, 3, ArgumentsOrder::DEFAULT_ORDER,
|
||||
CallSignature getPropertyByValue("GetPropertyByValue", 0, 3, ArgumentsOrder::DEFAULT_ORDER,
|
||||
VariableType::JS_ANY());
|
||||
*descriptor = getPropertyByValue;
|
||||
*callSign = getPropertyByValue;
|
||||
// 3 : 3 input parameters
|
||||
std::array<VariableType, 3> params = {
|
||||
VariableType::POINTER(),
|
||||
VariableType::JS_POINTER(),
|
||||
VariableType::JS_ANY(),
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
callSign->SetParameters(params.data());
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(TryLoadICByName)
|
||||
DEF_CALL_SIGNATURE(TryLoadICByName)
|
||||
{
|
||||
// 4 : 4 input parameters
|
||||
StubDescriptor tryLoadICByName("TryLoadICByName", 0, 4,
|
||||
CallSignature tryLoadICByName("TryLoadICByName", 0, 4,
|
||||
ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
|
||||
*descriptor = tryLoadICByName;
|
||||
*callSign = tryLoadICByName;
|
||||
// 4 : 4 input parameters
|
||||
std::array<VariableType, 4> params = {
|
||||
VariableType::POINTER(),
|
||||
@ -265,15 +260,15 @@ CALL_STUB_INIT_DESCRIPTOR(TryLoadICByName)
|
||||
VariableType::JS_ANY(),
|
||||
VariableType::JS_ANY(),
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
callSign->SetParameters(params.data());
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(TryLoadICByValue)
|
||||
DEF_CALL_SIGNATURE(TryLoadICByValue)
|
||||
{
|
||||
// 5 : 5 input parameters
|
||||
StubDescriptor tryLoadICByValue("TryLoadICByValue", 0, 5,
|
||||
CallSignature tryLoadICByValue("TryLoadICByValue", 0, 5,
|
||||
ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
|
||||
*descriptor = tryLoadICByValue;
|
||||
*callSign = tryLoadICByValue;
|
||||
// 5 : 5 input parameters
|
||||
std::array<VariableType, 5> params = {
|
||||
VariableType::POINTER(),
|
||||
@ -282,15 +277,15 @@ CALL_STUB_INIT_DESCRIPTOR(TryLoadICByValue)
|
||||
VariableType::JS_ANY(),
|
||||
VariableType::JS_ANY(),
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
callSign->SetParameters(params.data());
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(TryStoreICByName)
|
||||
DEF_CALL_SIGNATURE(TryStoreICByName)
|
||||
{
|
||||
// 5 : 5 input parameters
|
||||
StubDescriptor tryStoreICByName("TryStoreICByName", 0, 5,
|
||||
CallSignature tryStoreICByName("TryStoreICByName", 0, 5,
|
||||
ArgumentsOrder::DEFAULT_ORDER, VariableType::INT64()); // undefined or hole
|
||||
*descriptor = tryStoreICByName;
|
||||
*callSign = tryStoreICByName;
|
||||
// 5 : 5 input parameters
|
||||
std::array<VariableType, 5> params = {
|
||||
VariableType::POINTER(),
|
||||
@ -299,15 +294,15 @@ CALL_STUB_INIT_DESCRIPTOR(TryStoreICByName)
|
||||
VariableType::JS_ANY(),
|
||||
VariableType::JS_POINTER(),
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
callSign->SetParameters(params.data());
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(TryStoreICByValue)
|
||||
DEF_CALL_SIGNATURE(TryStoreICByValue)
|
||||
{
|
||||
// 6 : 6 input parameters
|
||||
StubDescriptor tryStoreICByValue("TryStoreICByValue", 0, 6,
|
||||
CallSignature tryStoreICByValue("TryStoreICByValue", 0, 6,
|
||||
ArgumentsOrder::DEFAULT_ORDER, VariableType::INT64()); // undefined or hole
|
||||
*descriptor = tryStoreICByValue;
|
||||
*callSign = tryStoreICByValue;
|
||||
// 6 : 6 input parameters
|
||||
std::array<VariableType, 6> params = {
|
||||
VariableType::POINTER(),
|
||||
@ -317,44 +312,44 @@ CALL_STUB_INIT_DESCRIPTOR(TryStoreICByValue)
|
||||
VariableType::JS_ANY(),
|
||||
VariableType::JS_POINTER(),
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
callSign->SetParameters(params.data());
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(TestAbsoluteAddressRelocation)
|
||||
DEF_CALL_SIGNATURE(TestAbsoluteAddressRelocation)
|
||||
{
|
||||
// 2 : 2 input parameters
|
||||
StubDescriptor TestAbsoluteAddressRelocation("TestAbsoluteAddressRelocation", 0, 2,
|
||||
CallSignature TestAbsoluteAddressRelocation("TestAbsoluteAddressRelocation", 0, 2,
|
||||
ArgumentsOrder::DEFAULT_ORDER, VariableType::INT64()); // undefined or hole
|
||||
*descriptor = TestAbsoluteAddressRelocation;
|
||||
*callSign = TestAbsoluteAddressRelocation;
|
||||
// 2 : 2 input parameters
|
||||
std::array<VariableType, 2> params = {
|
||||
VariableType::INT64(),
|
||||
VariableType::INT64(),
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
callSign->SetParameters(params.data());
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(GetTaggedArrayPtrTest)
|
||||
DEF_CALL_SIGNATURE(GetTaggedArrayPtrTest)
|
||||
{
|
||||
// 2 : 2 input parameters
|
||||
StubDescriptor getTaggedArrayPtr("GetTaggedArrayPtrTest", 0, 2, ArgumentsOrder::DEFAULT_ORDER,
|
||||
CallSignature getTaggedArrayPtr("GetTaggedArrayPtrTest", 0, 2, ArgumentsOrder::DEFAULT_ORDER,
|
||||
VariableType::JS_POINTER());
|
||||
*descriptor = getTaggedArrayPtr;
|
||||
*callSign = getTaggedArrayPtr;
|
||||
// 2 : 2 input parameters
|
||||
std::array<VariableType, 2> params = {
|
||||
VariableType::POINTER(),
|
||||
VariableType::JS_ANY(),
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
descriptor->SetStubKind(StubDescriptor::CallStubKind::RUNTIME_STUB);
|
||||
callSign->SetParameters(params.data());
|
||||
callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB);
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(BytecodeHandler)
|
||||
DEF_CALL_SIGNATURE(BytecodeHandler)
|
||||
{
|
||||
// 7 : 7 input parameters
|
||||
StubDescriptor bytecodeHandler("bytecodeHandler", 0, 7,
|
||||
CallSignature bytecodeHandler("bytecodeHandler", 0, 7,
|
||||
ArgumentsOrder::DEFAULT_ORDER, VariableType::VOID());
|
||||
*descriptor = bytecodeHandler;
|
||||
*callSign = bytecodeHandler;
|
||||
std::array<VariableType, 7> params = { // 7 : 7 input parameters
|
||||
VariableType::POINTER(),
|
||||
VariableType::POINTER(),
|
||||
@ -364,16 +359,16 @@ CALL_STUB_INIT_DESCRIPTOR(BytecodeHandler)
|
||||
VariableType::JS_ANY(),
|
||||
VariableType::INT32(),
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
descriptor->SetStubKind(StubDescriptor::CallStubKind::BYTECODE_HANDLER);
|
||||
callSign->SetParameters(params.data());
|
||||
callSign->SetTargetKind(CallSignature::TargetKind::BYTECODE_HANDLER);
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(SingleStepDebugging)
|
||||
DEF_CALL_SIGNATURE(SingleStepDebugging)
|
||||
{
|
||||
// 7 : 7 input parameters
|
||||
StubDescriptor singleStepDebugging("singleStepDebugging", 0, 7,
|
||||
CallSignature singleStepDebugging("singleStepDebugging", 0, 7,
|
||||
ArgumentsOrder::DEFAULT_ORDER, VariableType::VOID());
|
||||
*descriptor = singleStepDebugging;
|
||||
*callSign = singleStepDebugging;
|
||||
std::array<VariableType, 7> params = { // 7 : 7 input parameters
|
||||
VariableType::POINTER(),
|
||||
VariableType::POINTER(),
|
||||
@ -383,16 +378,16 @@ CALL_STUB_INIT_DESCRIPTOR(SingleStepDebugging)
|
||||
VariableType::JS_ANY(),
|
||||
VariableType::INT32(),
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
descriptor->SetStubKind(StubDescriptor::CallStubKind::BYTECODE_HANDLER);
|
||||
callSign->SetParameters(params.data());
|
||||
callSign->SetTargetKind(CallSignature::TargetKind::BYTECODE_HANDLER);
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(AsmInterpreterEntry)
|
||||
DEF_CALL_SIGNATURE(AsmInterpreterEntry)
|
||||
{
|
||||
// 7 : 7 input parameters
|
||||
StubDescriptor asmInterpreterEntry("AsmInterpreterEntry", 0, 7,
|
||||
CallSignature asmInterpreterEntry("AsmInterpreterEntry", 0, 7,
|
||||
ArgumentsOrder::DEFAULT_ORDER, VariableType::VOID());
|
||||
*descriptor = asmInterpreterEntry;
|
||||
*callSign = asmInterpreterEntry;
|
||||
std::array<VariableType, 7> params = { // 7 : 7 input parameters
|
||||
VariableType::POINTER(),
|
||||
VariableType::POINTER(),
|
||||
@ -402,89 +397,89 @@ CALL_STUB_INIT_DESCRIPTOR(AsmInterpreterEntry)
|
||||
VariableType::JS_ANY(),
|
||||
VariableType::INT32(),
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
callSign->SetParameters(params.data());
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(RuntimeCallTrampolineInterpreterAsm)
|
||||
DEF_CALL_SIGNATURE(RuntimeCallTrampolineInterpreterAsm)
|
||||
{
|
||||
/* 3 : 3 input parameters */
|
||||
StubDescriptor runtimeCallTrampoline("RuntimeCallTrampolineInterpreterAsm", 0, 3,
|
||||
CallSignature runtimeCallTrampoline("RuntimeCallTrampolineInterpreterAsm", 0, 3,
|
||||
ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
|
||||
*descriptor = runtimeCallTrampoline;
|
||||
*callSign = runtimeCallTrampoline;
|
||||
std::array<VariableType, 3> params = { /* 3 : 3 input parameters */
|
||||
VariableType::POINTER(),
|
||||
VariableType::INT64(),
|
||||
VariableType::INT64(),
|
||||
};
|
||||
descriptor->SetVariableArgs(true);
|
||||
descriptor->SetParameters(params.data());
|
||||
descriptor->SetStubKind(StubDescriptor::CallStubKind::RUNTIME_STUB);
|
||||
callSign->SetVariableArgs(true);
|
||||
callSign->SetParameters(params.data());
|
||||
callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB);
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(RuntimeCallTrampolineAot)
|
||||
DEF_CALL_SIGNATURE(RuntimeCallTrampolineAot)
|
||||
{
|
||||
/* 3 : 3 input parameters */
|
||||
StubDescriptor runtimeCallTrampoline("RuntimeCallTrampolineAot", 0, 3,
|
||||
CallSignature runtimeCallTrampoline("RuntimeCallTrampolineAot", 0, 3,
|
||||
ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
|
||||
*descriptor = runtimeCallTrampoline;
|
||||
*callSign = runtimeCallTrampoline;
|
||||
std::array<VariableType, 3> params = { /* 3 : 3 input parameters */
|
||||
VariableType::POINTER(),
|
||||
VariableType::INT64(),
|
||||
VariableType::INT64(),
|
||||
};
|
||||
descriptor->SetVariableArgs(true);
|
||||
descriptor->SetParameters(params.data());
|
||||
descriptor->SetStubKind(StubDescriptor::CallStubKind::RUNTIME_STUB);
|
||||
callSign->SetVariableArgs(true);
|
||||
callSign->SetParameters(params.data());
|
||||
callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB);
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(DebugPrint)
|
||||
DEF_CALL_SIGNATURE(DebugPrint)
|
||||
{
|
||||
// 1 : 1 input parameters
|
||||
StubDescriptor debugPrint("DebugPrint", 0, 1,
|
||||
CallSignature debugPrint("DebugPrint", 0, 1,
|
||||
ArgumentsOrder::DEFAULT_ORDER, VariableType::VOID());
|
||||
*descriptor = debugPrint;
|
||||
*callSign = debugPrint;
|
||||
// 1 : 1 input parameters
|
||||
std::array<VariableType, 1> params = {
|
||||
VariableType::INT32(),
|
||||
};
|
||||
descriptor->SetVariableArgs(true);
|
||||
descriptor->SetParameters(params.data());
|
||||
descriptor->SetStubKind(StubDescriptor::CallStubKind::RUNTIME_STUB);
|
||||
callSign->SetVariableArgs(true);
|
||||
callSign->SetParameters(params.data());
|
||||
callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB);
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(InsertOldToNewRememberedSet)
|
||||
DEF_CALL_SIGNATURE(InsertOldToNewRememberedSet)
|
||||
{
|
||||
// 3 : 3 input parameters
|
||||
StubDescriptor index("InsertOldToNewRememberedSet", 0, 3, ArgumentsOrder::DEFAULT_ORDER, VariableType::VOID());
|
||||
*descriptor = index;
|
||||
CallSignature index("InsertOldToNewRememberedSet", 0, 3, ArgumentsOrder::DEFAULT_ORDER, VariableType::VOID());
|
||||
*callSign = index;
|
||||
// 3 : 3 input parameters
|
||||
std::array<VariableType, 3> params = {
|
||||
VariableType::POINTER(),
|
||||
VariableType::POINTER(),
|
||||
VariableType::POINTER(),
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
descriptor->SetStubKind(StubDescriptor::CallStubKind::RUNTIME_STUB);
|
||||
callSign->SetParameters(params.data());
|
||||
callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB);
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(DoubleToInt)
|
||||
DEF_CALL_SIGNATURE(DoubleToInt)
|
||||
{
|
||||
// 1 : 1 input parameters
|
||||
StubDescriptor index("DoubleToInt", 0, 1, ArgumentsOrder::DEFAULT_ORDER, VariableType::INT32());
|
||||
*descriptor = index;
|
||||
CallSignature index("DoubleToInt", 0, 1, ArgumentsOrder::DEFAULT_ORDER, VariableType::INT32());
|
||||
*callSign = index;
|
||||
// 1 : 1 input parameters
|
||||
std::array<VariableType, 1> params = {
|
||||
VariableType::FLOAT64(),
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
descriptor->SetStubKind(StubDescriptor::CallStubKind::RUNTIME_STUB);
|
||||
callSign->SetParameters(params.data());
|
||||
callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB);
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(MarkingBarrier)
|
||||
DEF_CALL_SIGNATURE(MarkingBarrier)
|
||||
{
|
||||
// 5 : 5 input parameters
|
||||
StubDescriptor index("MarkingBarrier", 0, 5, ArgumentsOrder::DEFAULT_ORDER, VariableType::VOID());
|
||||
*descriptor = index;
|
||||
CallSignature index("MarkingBarrier", 0, 5, ArgumentsOrder::DEFAULT_ORDER, VariableType::VOID());
|
||||
*callSign = index;
|
||||
// 5 : 5 input parameters
|
||||
std::array<VariableType, 5> params = {
|
||||
VariableType::POINTER(),
|
||||
@ -493,61 +488,61 @@ CALL_STUB_INIT_DESCRIPTOR(MarkingBarrier)
|
||||
VariableType::POINTER(),
|
||||
VariableType::POINTER(),
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
descriptor->SetStubKind(StubDescriptor::CallStubKind::RUNTIME_STUB);
|
||||
callSign->SetParameters(params.data());
|
||||
callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB);
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(CallArg0Dyn)
|
||||
DEF_CALL_SIGNATURE(CallArg0Dyn)
|
||||
{
|
||||
// 2 : 2 input parameters
|
||||
StubDescriptor callArg0Dyn("callArg0Dyn", 0, 2,
|
||||
CallSignature callArg0Dyn("callArg0Dyn", 0, 2,
|
||||
ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
|
||||
*descriptor = callArg0Dyn;
|
||||
*callSign = callArg0Dyn;
|
||||
std::array<VariableType, 2> params = { // 2 : 2 input parameters
|
||||
VariableType::POINTER(),
|
||||
VariableType::JS_ANY()
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
descriptor->SetStubKind(StubDescriptor::CallStubKind::RUNTIME_STUB);
|
||||
callSign->SetParameters(params.data());
|
||||
callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB);
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(CallArg1Dyn)
|
||||
DEF_CALL_SIGNATURE(CallArg1Dyn)
|
||||
{
|
||||
// 3 : 3 input parameters
|
||||
StubDescriptor callArg1Dyn("callArg1Dyn", 0, 3,
|
||||
CallSignature callArg1Dyn("callArg1Dyn", 0, 3,
|
||||
ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
|
||||
*descriptor = callArg1Dyn;
|
||||
*callSign = callArg1Dyn;
|
||||
std::array<VariableType, 3> params = { // 3 : 3 input parameters
|
||||
VariableType::POINTER(),
|
||||
VariableType::JS_ANY(),
|
||||
VariableType::JS_ANY()
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
descriptor->SetStubKind(StubDescriptor::CallStubKind::RUNTIME_STUB);
|
||||
callSign->SetParameters(params.data());
|
||||
callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB);
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(CallArgs2Dyn)
|
||||
DEF_CALL_SIGNATURE(CallArgs2Dyn)
|
||||
{
|
||||
// 4 : 4 input parameters
|
||||
StubDescriptor callArgs2Dyn("callArgs2Dyn", 0, 4,
|
||||
CallSignature callArgs2Dyn("callArgs2Dyn", 0, 4,
|
||||
ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
|
||||
*descriptor = callArgs2Dyn;
|
||||
*callSign = callArgs2Dyn;
|
||||
std::array<VariableType, 4> params = { // 4 : 4 input parameters
|
||||
VariableType::POINTER(),
|
||||
VariableType::JS_ANY(),
|
||||
VariableType::JS_ANY(),
|
||||
VariableType::JS_ANY()
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
descriptor->SetStubKind(StubDescriptor::CallStubKind::RUNTIME_STUB);
|
||||
callSign->SetParameters(params.data());
|
||||
callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB);
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(CallArgs3Dyn)
|
||||
DEF_CALL_SIGNATURE(CallArgs3Dyn)
|
||||
{
|
||||
// 5 : 5 input parameters
|
||||
StubDescriptor callArgs3Dyn("callArgs3Dyn", 0, 5,
|
||||
CallSignature callArgs3Dyn("callArgs3Dyn", 0, 5,
|
||||
ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
|
||||
*descriptor = callArgs3Dyn;
|
||||
*callSign = callArgs3Dyn;
|
||||
std::array<VariableType, 5> params = { // 5 : 5 input parameters
|
||||
VariableType::POINTER(),
|
||||
VariableType::JS_ANY(),
|
||||
@ -555,53 +550,38 @@ CALL_STUB_INIT_DESCRIPTOR(CallArgs3Dyn)
|
||||
VariableType::JS_ANY(),
|
||||
VariableType::JS_ANY()
|
||||
};
|
||||
descriptor->SetParameters(params.data());
|
||||
descriptor->SetStubKind(StubDescriptor::CallStubKind::RUNTIME_STUB);
|
||||
callSign->SetParameters(params.data());
|
||||
callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB);
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(CallIThisRangeDyn)
|
||||
DEF_CALL_SIGNATURE(CallIThisRangeDyn)
|
||||
{
|
||||
// 3 : 3 input parameters
|
||||
StubDescriptor callIThisRangeDyn("callIThisRangeDyn", 0, 3,
|
||||
CallSignature callIThisRangeDyn("callIThisRangeDyn", 0, 3,
|
||||
ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
|
||||
*descriptor = callIThisRangeDyn;
|
||||
*callSign = callIThisRangeDyn;
|
||||
std::array<VariableType, 3> params = { // 3 : 3 input parameters
|
||||
VariableType::POINTER(),
|
||||
VariableType::JS_ANY(),
|
||||
VariableType::JS_ANY()
|
||||
};
|
||||
descriptor->SetVariableArgs(true);
|
||||
descriptor->SetParameters(params.data());
|
||||
descriptor->SetStubKind(StubDescriptor::CallStubKind::RUNTIME_STUB);
|
||||
callSign->SetVariableArgs(true);
|
||||
callSign->SetParameters(params.data());
|
||||
callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB);
|
||||
}
|
||||
|
||||
CALL_STUB_INIT_DESCRIPTOR(CallIRangeDyn)
|
||||
DEF_CALL_SIGNATURE(CallIRangeDyn)
|
||||
{
|
||||
// 2 : 2 input parameters
|
||||
StubDescriptor callIRangeDyn("callIRangeDyn", 0, 2,
|
||||
CallSignature callIRangeDyn("callIRangeDyn", 0, 2,
|
||||
ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
|
||||
*descriptor = callIRangeDyn;
|
||||
*callSign = callIRangeDyn;
|
||||
std::array<VariableType, 2> params = { // 2 : 2 input parameters
|
||||
VariableType::POINTER(),
|
||||
VariableType::JS_ANY()
|
||||
};
|
||||
descriptor->SetVariableArgs(true);
|
||||
descriptor->SetParameters(params.data());
|
||||
descriptor->SetStubKind(StubDescriptor::CallStubKind::RUNTIME_STUB);
|
||||
}
|
||||
|
||||
void FastStubDescriptors::InitializeStubDescriptors()
|
||||
{
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
||||
#define DEF_CALL_STUB(name) NAME_##name
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
||||
#define INITIALIZE_CALL_STUB_DESCRIPTOR(name, argcounts) \
|
||||
Stub##name##InterfaceDescriptor::Initialize(&callStubsDescriptor_[DEF_CALL_STUB(name)]);
|
||||
CALL_STUB_LIST(INITIALIZE_CALL_STUB_DESCRIPTOR)
|
||||
#ifndef NDEBUG
|
||||
TEST_FUNC_LIST(INITIALIZE_CALL_STUB_DESCRIPTOR)
|
||||
#endif
|
||||
#undef INITIALIZE_CALL_STUB_DESCRIPTOR
|
||||
#undef DEF_CALL_STUB
|
||||
callSign->SetVariableArgs(true);
|
||||
callSign->SetParameters(params.data());
|
||||
callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB);
|
||||
}
|
||||
} // namespace panda::ecmascript::kungfu
|
@ -12,48 +12,61 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef ECMASCRIPT_COMPILER_STUB_DESCRIPTOR_H
|
||||
#define ECMASCRIPT_COMPILER_STUB_DESCRIPTOR_H
|
||||
#ifndef ECMASCRIPT_COMPILER_CALL_SIGNATURE_H
|
||||
#define ECMASCRIPT_COMPILER_CALL_SIGNATURE_H
|
||||
|
||||
#include <array>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
#include "ecmascript/compiler/fast_stub_define.h"
|
||||
#include "ecmascript/compiler/variable_type.h"
|
||||
#include "libpandabase/macros.h"
|
||||
#include "libpandabase/utils/bit_field.h"
|
||||
#include "llvm-c/Types.h"
|
||||
|
||||
namespace panda::ecmascript::kungfu {
|
||||
class Stub;
|
||||
class Circuit;
|
||||
|
||||
enum class ArgumentsOrder {
|
||||
DEFAULT_ORDER, // Push Arguments in stack from right -> left
|
||||
};
|
||||
|
||||
class StubDescriptor {
|
||||
class CallSignature {
|
||||
public:
|
||||
using TargetConstructor = std::function<void *(void *)>;
|
||||
using VariableArgsBits = panda::BitField<bool, 0, 1>; // 1 variable argument
|
||||
enum class CallStubKind {
|
||||
CODE_STUB,
|
||||
enum class TargetKind : uint8_t {
|
||||
COMMON_STUB = 0,
|
||||
RUNTIME_STUB,
|
||||
BYTECODE_HANDLER,
|
||||
RUNTIME_STUB_NO_GC,
|
||||
TEST_FUNC,
|
||||
BYTECODE_HANDLER,
|
||||
JSFUNCTION,
|
||||
|
||||
STUB_BEGIN = COMMON_STUB,
|
||||
STUB_END = BYTECODE_HANDLER,
|
||||
BCHANDLER_BEGIN = BYTECODE_HANDLER,
|
||||
BCHANDLER_END = JSFUNCTION
|
||||
};
|
||||
explicit StubDescriptor(std::string name, int flags, int paramCounter, ArgumentsOrder order,
|
||||
VariableType returnType)
|
||||
|
||||
explicit CallSignature(std::string name, int flags, int paramCounter, ArgumentsOrder order, VariableType returnType)
|
||||
: name_(name), flags_(flags), paramCounter_(paramCounter), order_(order), returnType_(returnType)
|
||||
{
|
||||
}
|
||||
StubDescriptor() = default;
|
||||
~StubDescriptor() = default;
|
||||
StubDescriptor(StubDescriptor const &other)
|
||||
|
||||
CallSignature() = default;
|
||||
|
||||
~CallSignature() = default;
|
||||
|
||||
CallSignature(CallSignature const &other)
|
||||
{
|
||||
name_ = other.name_;
|
||||
flags_ = other.flags_;
|
||||
paramCounter_ = other.paramCounter_;
|
||||
order_ = other.order_;
|
||||
kind_ = other.kind_;
|
||||
id_ = other.id_;
|
||||
returnType_ = other.returnType_;
|
||||
constructor_ = other.constructor_;
|
||||
if (paramCounter_ > 0 && other.paramsType_ != nullptr) {
|
||||
paramsType_ = std::make_unique<std::vector<VariableType>>(paramCounter_);
|
||||
for (int i = 0; i < paramCounter_; i++) {
|
||||
@ -62,14 +75,16 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
StubDescriptor &operator=(StubDescriptor const &other)
|
||||
CallSignature &operator=(CallSignature const &other)
|
||||
{
|
||||
name_ = other.name_;
|
||||
flags_ = other.flags_;
|
||||
paramCounter_ = other.paramCounter_;
|
||||
order_ = other.order_;
|
||||
kind_ = other.kind_;
|
||||
id_ = other.id_;
|
||||
returnType_ = other.returnType_;
|
||||
constructor_ = other.constructor_;
|
||||
if (paramCounter_ > 0 && other.paramsType_ != nullptr) {
|
||||
paramsType_ = std::make_unique<std::vector<VariableType>>(paramCounter_);
|
||||
for (int i = 0; i < paramCounter_; i++) {
|
||||
@ -79,6 +94,21 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool IsCommonStub() const
|
||||
{
|
||||
return (kind_ == TargetKind::COMMON_STUB);
|
||||
}
|
||||
|
||||
bool IsStub() const
|
||||
{
|
||||
return TargetKind::STUB_BEGIN <= kind_ && kind_ < TargetKind::STUB_END;
|
||||
}
|
||||
|
||||
bool IsBCHandler() const
|
||||
{
|
||||
return TargetKind::BCHANDLER_BEGIN <= kind_ && kind_ < TargetKind::BCHANDLER_END;
|
||||
}
|
||||
|
||||
void SetParameters(VariableType *paramsType)
|
||||
{
|
||||
if (paramCounter_ > 0 && paramsType_ == nullptr) {
|
||||
@ -134,12 +164,12 @@ public:
|
||||
SetFlags(newVal);
|
||||
}
|
||||
|
||||
CallStubKind GetStubKind() const
|
||||
TargetKind GetTargetKind() const
|
||||
{
|
||||
return kind_;
|
||||
}
|
||||
|
||||
void SetStubKind(CallStubKind kind)
|
||||
void SetTargetKind(TargetKind kind)
|
||||
{
|
||||
kind_ = kind;
|
||||
}
|
||||
@ -149,44 +179,88 @@ public:
|
||||
return name_;
|
||||
}
|
||||
|
||||
void SetConstructor(TargetConstructor ctor)
|
||||
{
|
||||
constructor_ = ctor;
|
||||
}
|
||||
|
||||
TargetConstructor GetConstructor() const
|
||||
{
|
||||
return constructor_;
|
||||
}
|
||||
|
||||
bool HasConstructor() const
|
||||
{
|
||||
return constructor_ != nullptr;
|
||||
}
|
||||
|
||||
int GetID() const
|
||||
{
|
||||
return id_;
|
||||
}
|
||||
|
||||
void SetID(int id)
|
||||
{
|
||||
id_ = id;
|
||||
}
|
||||
|
||||
private:
|
||||
std::string name_;
|
||||
CallStubKind kind_ {CallStubKind::CODE_STUB};
|
||||
TargetKind kind_ {TargetKind::COMMON_STUB};
|
||||
int flags_ {0};
|
||||
int paramCounter_ {0};
|
||||
int id_ {-1};
|
||||
ArgumentsOrder order_ {ArgumentsOrder::DEFAULT_ORDER};
|
||||
|
||||
VariableType returnType_ {VariableType::VOID()};
|
||||
std::unique_ptr<std::vector<VariableType>> paramsType_ {nullptr};
|
||||
|
||||
TargetConstructor constructor_ {nullptr};
|
||||
};
|
||||
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
||||
#define GET_STUBDESCRIPTOR(name) FastStubDescriptors::GetInstance().GetStubDescriptor(FAST_STUB_ID(name))
|
||||
#define EXPLICIT_CALL_SIGNATURE_LIST(V) \
|
||||
V(FastAdd) \
|
||||
V(FastSub) \
|
||||
V(FastMul) \
|
||||
V(FastMulGCTest) \
|
||||
V(FastDiv) \
|
||||
V(FastMod) \
|
||||
V(FastTypeOf) \
|
||||
V(FastEqual) \
|
||||
V(SetPropertyByName) \
|
||||
V(SetPropertyByNameWithOwn) \
|
||||
V(SetPropertyByValue) \
|
||||
V(GetPropertyByName) \
|
||||
V(GetPropertyByIndex) \
|
||||
V(SetPropertyByIndex) \
|
||||
V(GetPropertyByValue) \
|
||||
V(TryLoadICByName) \
|
||||
V(TryLoadICByValue) \
|
||||
V(TryStoreICByName) \
|
||||
V(TryStoreICByValue) \
|
||||
V(TestAbsoluteAddressRelocation) \
|
||||
V(GetTaggedArrayPtrTest) \
|
||||
V(BytecodeHandler) \
|
||||
V(SingleStepDebugging) \
|
||||
V(AsmInterpreterEntry) \
|
||||
V(RuntimeCallTrampolineInterpreterAsm) \
|
||||
V(RuntimeCallTrampolineAot) \
|
||||
V(DebugPrint) \
|
||||
V(InsertOldToNewRememberedSet) \
|
||||
V(DoubleToInt) \
|
||||
V(MarkingBarrier) \
|
||||
V(CallArg0Dyn) \
|
||||
V(CallArg1Dyn) \
|
||||
V(CallArgs2Dyn) \
|
||||
V(CallArgs3Dyn) \
|
||||
V(CallIThisRangeDyn) \
|
||||
V(CallIRangeDyn)
|
||||
|
||||
class FastStubDescriptors {
|
||||
public:
|
||||
static FastStubDescriptors &GetInstance()
|
||||
{
|
||||
static FastStubDescriptors instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
void InitializeStubDescriptors();
|
||||
|
||||
StubDescriptor *GetStubDescriptor(int index)
|
||||
{
|
||||
return &callStubsDescriptor_[index];
|
||||
}
|
||||
|
||||
private:
|
||||
FastStubDescriptors()
|
||||
{
|
||||
InitializeStubDescriptors();
|
||||
}
|
||||
~FastStubDescriptors() {}
|
||||
NO_MOVE_SEMANTIC(FastStubDescriptors);
|
||||
NO_COPY_SEMANTIC(FastStubDescriptors);
|
||||
std::array<StubDescriptor, CALL_STUB_MAXCOUNT> callStubsDescriptor_ {};
|
||||
};
|
||||
#define DECL_CALL_SIGNATURE(name) \
|
||||
class name##CallSignature final { \
|
||||
public: \
|
||||
static void Initialize(CallSignature *descriptor); \
|
||||
};
|
||||
EXPLICIT_CALL_SIGNATURE_LIST(DECL_CALL_SIGNATURE)
|
||||
} // namespace panda::ecmascript::kungfu
|
||||
#endif // ECMASCRIPT_COMPILER_STUB_DESCRIPTOR_H
|
||||
#endif // ECMASCRIPT_COMPILER_CALL_SIGNATURE_H
|
@ -18,7 +18,7 @@
|
||||
#include "ecmascript/compiler/circuit_builder.h"
|
||||
|
||||
namespace panda::ecmascript::kungfu {
|
||||
GateRef CircuitBuilder::CallRuntime(StubDescriptor *descriptor, GateRef glue, GateRef target,
|
||||
GateRef CircuitBuilder::CallRuntime(const CallSignature *descriptor, GateRef glue, GateRef target,
|
||||
std::initializer_list<GateRef> args)
|
||||
{
|
||||
auto label = lm_->GetCurrentLabel();
|
||||
@ -28,7 +28,7 @@ GateRef CircuitBuilder::CallRuntime(StubDescriptor *descriptor, GateRef glue, Ga
|
||||
return result;
|
||||
}
|
||||
|
||||
GateRef CircuitBuilder::CallRuntime(StubDescriptor *descriptor, GateRef glue, GateRef target, GateRef depend,
|
||||
GateRef CircuitBuilder::CallRuntime(const CallSignature *descriptor, GateRef glue, GateRef target, GateRef depend,
|
||||
std::initializer_list<GateRef> args)
|
||||
{
|
||||
auto label = lm_->GetCurrentLabel();
|
||||
|
@ -15,6 +15,8 @@
|
||||
|
||||
#include "ecmascript/compiler/circuit_builder.h"
|
||||
#include "ecmascript/compiler/circuit_builder-inl.h"
|
||||
#include "ecmascript/compiler/fast_stub.h"
|
||||
#include "ecmascript/compiler/rt_call_signature.h"
|
||||
#include "include/coretypes/tagged_value.h"
|
||||
#include "utils/bit_utils.h"
|
||||
|
||||
@ -294,7 +296,7 @@ MachineType CircuitBuilder::GetCallMachineTypeFromVariableType(VariableType type
|
||||
return type.GetMachineType();
|
||||
}
|
||||
|
||||
GateRef CircuitBuilder::NewCallGate(StubDescriptor *descriptor, GateRef glue, GateRef target,
|
||||
GateRef CircuitBuilder::NewCallGate(const CallSignature *descriptor, GateRef glue, GateRef target,
|
||||
std::initializer_list<GateRef> args)
|
||||
{
|
||||
std::vector<GateRef> inputs;
|
||||
@ -312,7 +314,7 @@ GateRef CircuitBuilder::NewCallGate(StubDescriptor *descriptor, GateRef glue, Ga
|
||||
return circuit_->NewGate(OpCode(OpCode::CALL), machineType, args.size() + extraparamCnt, inputs, type);
|
||||
}
|
||||
|
||||
GateRef CircuitBuilder::NewCallGate(StubDescriptor *descriptor, GateRef glue, GateRef target,
|
||||
GateRef CircuitBuilder::NewCallGate(const CallSignature *descriptor, GateRef glue, GateRef target,
|
||||
GateRef depend, std::initializer_list<GateRef> args)
|
||||
{
|
||||
std::vector<GateRef> inputs;
|
||||
@ -339,7 +341,7 @@ GateRef CircuitBuilder::NewRuntimeCallGate(GateRef glue, GateRef target,
|
||||
inputs.push_back(arg);
|
||||
}
|
||||
OpCode opcode(OpCode::RUNTIME_CALL);
|
||||
StubDescriptor *descriptor = GET_STUBDESCRIPTOR(RuntimeCallTrampolineAot);
|
||||
const CallSignature *descriptor = RuntimeStubCSigns::Get(RTSTUB_ID(RuntimeCallTrampolineAot));
|
||||
MachineType machineType = GetCallMachineTypeFromVariableType(descriptor->GetReturnType());
|
||||
GateType type = VariableType2GateType(descriptor->GetReturnType());
|
||||
// 2 : 2 means extra two input gates (target glue)
|
||||
@ -352,7 +354,7 @@ GateRef CircuitBuilder::CallRuntimeVariadic(GateRef glue, GateRef target, GateRe
|
||||
std::vector<GateRef> inputs {depend, target, glue};
|
||||
inputs.insert(inputs.end(), args.begin(), args.end());
|
||||
OpCode opcode(OpCode::RUNTIME_CALL);
|
||||
StubDescriptor *descriptor = GET_STUBDESCRIPTOR(RuntimeCallTrampolineAot);
|
||||
const CallSignature *descriptor = RuntimeStubCSigns::Get(RTSTUB_ID(RuntimeCallTrampolineAot));
|
||||
MachineType machineType = GetCallMachineTypeFromVariableType(descriptor->GetReturnType());
|
||||
GateType type = VariableType2GateType(descriptor->GetReturnType());
|
||||
// 2 : 2 means extra two input gates (target glue)
|
||||
@ -360,7 +362,7 @@ GateRef CircuitBuilder::CallRuntimeVariadic(GateRef glue, GateRef target, GateRe
|
||||
return circuit_->NewGate(opcode, machineType, args.size() + extraparamCnt, inputs, type);
|
||||
}
|
||||
|
||||
GateRef CircuitBuilder::NewBytecodeCallGate(StubDescriptor *descriptor, GateRef glue, GateRef target,
|
||||
GateRef CircuitBuilder::NewBytecodeCallGate(const CallSignature *descriptor, GateRef glue, GateRef target,
|
||||
GateRef depend, std::initializer_list<GateRef> args)
|
||||
{
|
||||
std::vector<GateRef> inputs;
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "ecmascript/compiler/gate.h"
|
||||
#include "ecmascript/compiler/gate_accessor.h"
|
||||
#include "ecmascript/compiler/variable_type.h"
|
||||
#include "ecmascript/compiler/stub_descriptor.h"
|
||||
#include "ecmascript/compiler/call_signature.h"
|
||||
|
||||
namespace panda::ecmascript::kungfu {
|
||||
using namespace panda::ecmascript;
|
||||
@ -81,13 +81,13 @@ public:
|
||||
GateRef NewLogicGate(OpCode opcode, MachineType machineType, GateRef left, GateRef right);
|
||||
GateRef NewLogicGate(OpCode opcode, GateRef left, GateRef right);
|
||||
GateRef NewLogicGate(OpCode opcode, MachineType machineType, GateRef value);
|
||||
GateRef NewCallGate(StubDescriptor *descriptor, GateRef glue, GateRef target,
|
||||
GateRef NewCallGate(const CallSignature *descriptor, GateRef glue, GateRef target,
|
||||
std::initializer_list<GateRef> args);
|
||||
GateRef NewCallGate(StubDescriptor *descriptor, GateRef glue, GateRef target,
|
||||
GateRef NewCallGate(const CallSignature *descriptor, GateRef glue, GateRef target,
|
||||
GateRef depend, std::initializer_list<GateRef> args);
|
||||
GateRef NewRuntimeCallGate(GateRef glue, GateRef target, GateRef depend, std::initializer_list<GateRef> args);
|
||||
GateRef CallRuntimeVariadic(GateRef glue, GateRef target, GateRef depend, const std::vector<GateRef> &args);
|
||||
GateRef NewBytecodeCallGate(StubDescriptor *descriptor, GateRef glue, GateRef target,
|
||||
GateRef NewBytecodeCallGate(const CallSignature *descriptor, GateRef glue, GateRef target,
|
||||
GateRef depend, std::initializer_list<GateRef> args);
|
||||
static MachineType GetLoadMachineTypeFromVariableType(VariableType type);
|
||||
static MachineType GetStoreMachineTypeFromVariableType(VariableType type);
|
||||
@ -99,9 +99,9 @@ public:
|
||||
return type.GetGateType();
|
||||
}
|
||||
// call operation
|
||||
inline GateRef CallRuntime(StubDescriptor *descriptor, GateRef glue, GateRef target,
|
||||
inline GateRef CallRuntime(const CallSignature *descriptor, GateRef glue, GateRef target,
|
||||
std::initializer_list<GateRef> args);
|
||||
inline GateRef CallRuntime(StubDescriptor *descriptor, GateRef glue, GateRef target, GateRef depend,
|
||||
inline GateRef CallRuntime(const CallSignature *descriptor, GateRef glue, GateRef target, GateRef depend,
|
||||
std::initializer_list<GateRef> args);
|
||||
inline GateRef CallRuntimeTrampoline(GateRef glue, GateRef target,
|
||||
std::initializer_list<GateRef> args);
|
||||
|
@ -25,7 +25,7 @@ class CodeGeneratorImpl {
|
||||
public:
|
||||
CodeGeneratorImpl() = default;
|
||||
virtual ~CodeGeneratorImpl() = default;
|
||||
virtual void GenerateCodeForStub(Circuit *circuit, const ControlFlowGraph &graph, int index,
|
||||
virtual void GenerateCodeForStub(Circuit *circuit, const ControlFlowGraph &graph, size_t index,
|
||||
const CompilationConfig *cfg) = 0;
|
||||
};
|
||||
|
||||
@ -33,7 +33,7 @@ class CodeGenerator {
|
||||
public:
|
||||
explicit CodeGenerator(std::unique_ptr<CodeGeneratorImpl> &impl) : impl_(std::move(impl)) {}
|
||||
~CodeGenerator() = default;
|
||||
void Run(Circuit *circuit, const ControlFlowGraph &graph, int index, const CompilationConfig *cfg)
|
||||
void Run(Circuit *circuit, const ControlFlowGraph &graph, size_t index, const CompilationConfig *cfg)
|
||||
{
|
||||
impl_->GenerateCodeForStub(circuit, graph, index, cfg);
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "ecmascript/js_array.h"
|
||||
#include "ecmascript/message_string.h"
|
||||
#include "ecmascript/tagged_hash_table-inl.h"
|
||||
#include "stub-inl.h"
|
||||
|
||||
namespace panda::ecmascript::kungfu {
|
||||
using namespace panda::ecmascript;
|
||||
@ -88,9 +89,9 @@ void FastMulGCTestStub::GenerateCircuit(const CompilationConfig *cfg)
|
||||
}
|
||||
Bind(&xIsDoubleAndyIsDouble);
|
||||
doubleX = DoubleMul(*doubleX, *doubleY);
|
||||
GateRef ptr1 = CallRuntimeTrampoline(glue, GetInt64Constant(RUNTIME_CALL_ID(GetTaggedArrayPtrTest)),
|
||||
GateRef ptr1 = CallRuntimeTrampoline(glue, GetInt64Constant(RTSTUB_ID(GetTaggedArrayPtrTest)),
|
||||
{GetInt64Constant(JSTaggedValue::VALUE_UNDEFINED)});
|
||||
GateRef ptr2 = CallRuntimeTrampoline(glue, GetInt64Constant(RUNTIME_CALL_ID(GetTaggedArrayPtrTest)), {ptr1});
|
||||
GateRef ptr2 = CallRuntimeTrampoline(glue, GetInt64Constant(RTSTUB_ID(GetTaggedArrayPtrTest)), {ptr1});
|
||||
auto value1 = GetValueFromTaggedArray(VariableType::INT64(), ptr1, GetInt32Constant(0));
|
||||
GateRef tmp = CastInt64ToFloat64(value1);
|
||||
doubleX = DoubleMul(*doubleX, tmp);
|
||||
@ -269,7 +270,7 @@ void GetPropertyByValueStub::GenerateCircuit(const CompilationConfig *cfg)
|
||||
Bind(¬IntenalString);
|
||||
{
|
||||
key = CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(RUNTIME_CALL_ID(NewInternalString)), { *key });
|
||||
GetInt64Constant(RTSTUB_ID(NewInternalString)), { *key });
|
||||
Jump(&getByName);
|
||||
}
|
||||
}
|
||||
@ -342,7 +343,7 @@ void SetPropertyByValueStub::GenerateCircuit(const CompilationConfig *cfg)
|
||||
Bind(¬IntenalString);
|
||||
{
|
||||
key = CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(RUNTIME_CALL_ID(NewInternalString)), { *key });
|
||||
GetInt64Constant(RTSTUB_ID(NewInternalString)), { *key });
|
||||
Jump(&getByName);
|
||||
}
|
||||
}
|
||||
@ -537,4 +538,28 @@ void TestAbsoluteAddressRelocationStub::GenerateCircuit(const CompilationConfig
|
||||
GateRef result = Int64Add(a, Int64Add(b, Int64Add(dummyValueC, Int64Add(dummyValueD, dummyValueC1))));
|
||||
Return(result);
|
||||
}
|
||||
|
||||
CallSignature CommonStubCSigns::callSigns_[CommonStubCSigns::NUM_OF_STUBS];
|
||||
|
||||
void CommonStubCSigns::Initialize()
|
||||
{
|
||||
#define INIT_SIGNATURES(name, counter) \
|
||||
name##CallSignature::Initialize(&callSigns_[name]); \
|
||||
callSigns_[name].SetID(name); \
|
||||
callSigns_[name].SetConstructor( \
|
||||
[](void* ciruit) { \
|
||||
return static_cast<void*>( \
|
||||
new name##Stub(static_cast<Circuit*>(ciruit))); \
|
||||
});
|
||||
|
||||
COMMON_FAST_STUB_ID_LIST(INIT_SIGNATURES)
|
||||
#undef INIT_SIGNATURES
|
||||
}
|
||||
|
||||
void CommonStubCSigns::GetCSigns(std::vector<CallSignature*>& outCSigns)
|
||||
{
|
||||
for (size_t i = 0; i < NUM_OF_STUBS; i++) {
|
||||
outCSigns.push_back(&callSigns_[i]);
|
||||
}
|
||||
}
|
||||
} // namespace panda::ecmascript::kungfu
|
||||
|
@ -16,11 +16,37 @@
|
||||
#ifndef ECMASCRIPT_COMPILER_FASTPATH_STUB_H
|
||||
#define ECMASCRIPT_COMPILER_FASTPATH_STUB_H
|
||||
|
||||
#include "ecmascript/compiler/fast_stub_define.h"
|
||||
#include "ecmascript/compiler/stub-inl.h"
|
||||
#include "ecmascript/compiler/stub.h"
|
||||
|
||||
namespace panda::ecmascript::kungfu {
|
||||
#ifndef NDEBUG
|
||||
#define INTERPRETER_STUB_HELPER_LIST(V) \
|
||||
V(AsmInterpreterEntry, 7) \
|
||||
V(SingleStepDebugging, 7)
|
||||
|
||||
#define COMMON_FAST_STUB_LIST(V) \
|
||||
V(FastAdd, 3) \
|
||||
V(FastSub, 3) \
|
||||
V(FastMul, 3) \
|
||||
V(FastDiv, 3) \
|
||||
V(FastMod, 3) \
|
||||
V(FastEqual, 3) \
|
||||
V(FastTypeOf, 2) \
|
||||
V(GetPropertyByName, 3) \
|
||||
V(SetPropertyByName, 4) \
|
||||
V(SetPropertyByNameWithOwn, 4) \
|
||||
V(GetPropertyByIndex, 3) \
|
||||
V(SetPropertyByIndex, 4) \
|
||||
V(GetPropertyByValue, 3) \
|
||||
V(SetPropertyByValue, 4) \
|
||||
V(TryLoadICByName, 4) \
|
||||
V(TryLoadICByValue, 5) \
|
||||
V(TryStoreICByName, 5) \
|
||||
V(TryStoreICByValue, 6)
|
||||
|
||||
#define COMMON_FAST_STUB_ID_LIST(V) \
|
||||
COMMON_FAST_STUB_LIST(V) \
|
||||
INTERPRETER_STUB_HELPER_LIST(V)
|
||||
|
||||
class FastMulGCTestStub : public Stub {
|
||||
public:
|
||||
// 3 : 3 means argument counts
|
||||
@ -30,7 +56,6 @@ public:
|
||||
NO_COPY_SEMANTIC(FastMulGCTestStub);
|
||||
void GenerateCircuit(const CompilationConfig *cfg) override;
|
||||
};
|
||||
#endif
|
||||
|
||||
class FastAddStub : public Stub {
|
||||
public:
|
||||
@ -267,6 +292,27 @@ public:
|
||||
NO_COPY_SEMANTIC(TestAbsoluteAddressRelocationStub);
|
||||
void GenerateCircuit(const CompilationConfig *cfg) override;
|
||||
};
|
||||
} // namespace panda::ecmascript::kungfu
|
||||
|
||||
class CommonStubCSigns {
|
||||
public:
|
||||
enum ID {
|
||||
#define DEF_STUB_ID(name, counter) name,
|
||||
COMMON_FAST_STUB_ID_LIST(DEF_STUB_ID)
|
||||
#undef DEF_STUB_ID
|
||||
NUM_OF_STUBS
|
||||
};
|
||||
|
||||
static void Initialize();
|
||||
|
||||
static void GetCSigns(std::vector<CallSignature*>& callSigns);
|
||||
|
||||
static const CallSignature *Get(size_t index)
|
||||
{
|
||||
ASSERT(index < NUM_OF_STUBS);
|
||||
return &callSigns_[index];
|
||||
}
|
||||
private:
|
||||
static CallSignature callSigns_[NUM_OF_STUBS];
|
||||
};
|
||||
} // namespace panda::ecmascript::kungfu
|
||||
#endif // ECMASCRIPT_COMPILER_FASTPATH_STUB_H
|
||||
|
@ -1,108 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ECMASCRIPT_COMPILER_FASTSTUB_DEFINE_H
|
||||
#define ECMASCRIPT_COMPILER_FASTSTUB_DEFINE_H
|
||||
|
||||
#include "ecmascript/base/config.h"
|
||||
#include "ecmascript/trampoline/runtime_define.h"
|
||||
#include "interpreter_stub_define.h"
|
||||
|
||||
namespace panda::ecmascript::kungfu {
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
||||
#define FAST_STUB_LIST_BASE(V) \
|
||||
V(FastAdd, 3) \
|
||||
V(FastSub, 3) \
|
||||
V(FastMul, 3) \
|
||||
V(FastDiv, 3) \
|
||||
V(FastMod, 3) \
|
||||
V(FastEqual, 3) \
|
||||
V(FastTypeOf, 2) \
|
||||
V(GetPropertyByName, 3) \
|
||||
V(SetPropertyByName, 4) \
|
||||
V(SetPropertyByNameWithOwn, 4) \
|
||||
V(GetPropertyByIndex, 3) \
|
||||
V(SetPropertyByIndex, 4) \
|
||||
V(GetPropertyByValue, 3) \
|
||||
V(SetPropertyByValue, 4) \
|
||||
V(TryLoadICByName, 4) \
|
||||
V(TryLoadICByValue, 5) \
|
||||
V(TryStoreICByName, 5) \
|
||||
V(TryStoreICByValue, 6)
|
||||
|
||||
#if ECMASCRIPT_COMPILE_INTERPRETER_ASM
|
||||
#define FAST_STUB_LIST(V) \
|
||||
FAST_STUB_LIST_BASE(V) \
|
||||
INTERPRETER_STUB_HELPER_LIST(V)
|
||||
#else
|
||||
#define FAST_STUB_LIST(V) \
|
||||
FAST_STUB_LIST_BASE(V)
|
||||
#endif
|
||||
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
||||
#define TEST_FUNC_LIST(V) \
|
||||
V(FastMulGCTest, 3) \
|
||||
V(TestAbsoluteAddressRelocation, 2)
|
||||
|
||||
#define CALL_STUB_LIST(V) \
|
||||
FAST_STUB_LIST(V) \
|
||||
NO_GC_RUNTIME_CALL_LIST(V) \
|
||||
V(BytecodeHandler, 7)
|
||||
|
||||
enum FastStubId {
|
||||
#define DEF_STUB(name, counter) name##Id,
|
||||
FAST_STUB_LIST(DEF_STUB) FAST_STUB_MAXCOUNT,
|
||||
#undef DEF_STUB
|
||||
};
|
||||
|
||||
#ifndef NDEBUG
|
||||
enum TestFuncStubId {
|
||||
#define DEF_STUB(name, counter) name##Id,
|
||||
TEST_FUNC_LIST(DEF_STUB) TEST_FUNC_MAXCOUNT,
|
||||
#undef DEF_STUB
|
||||
};
|
||||
#endif
|
||||
|
||||
enum CallStubId {
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
||||
#define DEF_STUB(name, counter) NAME_##name,
|
||||
CALL_STUB_LIST(DEF_STUB)
|
||||
#undef DEF_STUB
|
||||
#ifndef NDEBUG
|
||||
TEST_FUNC_OFFSET,
|
||||
TEST_FUNC_BEGIN = TEST_FUNC_OFFSET - 1,
|
||||
#define DEF_STUB(name, counter) NAME_##name,
|
||||
TEST_FUNC_LIST(DEF_STUB)
|
||||
#undef DEF_STUB
|
||||
#endif
|
||||
CALL_STUB_MAXCOUNT,
|
||||
};
|
||||
|
||||
enum StubId {
|
||||
#define DEF_STUB(name, counter) STUB_##name,
|
||||
FAST_STUB_LIST(DEF_STUB)
|
||||
#if ECMASCRIPT_COMPILE_INTERPRETER_ASM
|
||||
INTERPRETER_STUB_LIST(DEF_STUB)
|
||||
#endif
|
||||
#undef DEF_STUB
|
||||
ALL_STUB_MAXCOUNT
|
||||
};
|
||||
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
||||
#define TEST_STUB_ID(name) panda::ecmascript::kungfu::TestFuncStubId::name##Id
|
||||
#define FAST_STUB_ID(name) panda::ecmascript::kungfu::CallStubId::NAME_##name
|
||||
#define STUB_ID(name) panda::ecmascript::kungfu::StubId::STUB_##name
|
||||
} // namespace panda::ecmascript::kungfu
|
||||
#endif // ECMASCRIPT_COMPILER_FASTSTUB_DEFINE_H
|
@ -17,6 +17,7 @@
|
||||
#define ECMASCRIPT_COMPILER_INTERPRETER_STUB_INL_H
|
||||
|
||||
#include "ecmascript/compiler/interpreter_stub.h"
|
||||
#include "ecmascript/js_function.h"
|
||||
|
||||
namespace panda::ecmascript::kungfu {
|
||||
void InterpreterStub::SetVregValue(GateRef glue, GateRef sp, GateRef idx, GateRef val)
|
||||
@ -329,7 +330,7 @@ void InterpreterStub::Dispatch(GateRef glue, GateRef pc, GateRef sp, GateRef con
|
||||
GateRef opcode = Load(VariableType::INT8(), newPc);
|
||||
GateRef opcodeOffset = IntPtrMul(
|
||||
ChangeInt32ToIntPtr(ZExtInt8ToInt32(opcode)), GetIntPtrSize());
|
||||
StubDescriptor *bytecodeHandler = GET_STUBDESCRIPTOR(BytecodeHandler);
|
||||
const CallSignature *bytecodeHandler = BytecodeStubCSigns::Get(BYTECODE_STUB_BEGIN_ID);
|
||||
auto depend = GetEnvironment()->GetCurrentLabel()->GetDepend();
|
||||
GateRef result = GetEnvironment()->GetCircuitBuilder().NewBytecodeCallGate(bytecodeHandler, glue, opcodeOffset,
|
||||
depend, {glue, newPc, sp, constpool, profileTypeInfo, acc, hotnessCounter});
|
||||
@ -341,8 +342,8 @@ void InterpreterStub::DispatchLast(GateRef glue, GateRef pc, GateRef sp, GateRef
|
||||
GateRef profileTypeInfo, GateRef acc, GateRef hotnessCounter)
|
||||
{
|
||||
GateRef opcodeOffset = IntPtrMul(
|
||||
GetIntPtrConstant(InterpreterStubId::ExceptionHandlerId), GetIntPtrSize());
|
||||
StubDescriptor *bytecodeHandler = GET_STUBDESCRIPTOR(BytecodeHandler);
|
||||
GetIntPtrConstant(BytecodeStubCSigns::ID_ExceptionHandler), GetIntPtrSize());
|
||||
const CallSignature *bytecodeHandler = BytecodeStubCSigns::Get(BYTECODE_STUB_BEGIN_ID);
|
||||
auto depend = GetEnvironment()->GetCurrentLabel()->GetDepend();
|
||||
GateRef result = GetEnvironment()->GetCircuitBuilder().NewBytecodeCallGate(bytecodeHandler, glue, opcodeOffset,
|
||||
depend, {glue, pc, sp, constpool, profileTypeInfo, acc, hotnessCounter});
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -17,10 +17,174 @@
|
||||
#define ECMASCRIPT_COMPILER_INTERPRETER_STUB_H
|
||||
|
||||
#include "ecmascript/base/config.h"
|
||||
#include "ecmascript/compiler/fast_stub_define.h"
|
||||
#include "ecmascript/compiler/stub-inl.h"
|
||||
#include "ecmascript/compiler/stub.h"
|
||||
|
||||
namespace panda::ecmascript::kungfu {
|
||||
#define IGNORE_BC_STUB(...)
|
||||
#define ASM_INTERPRETER_BC_STUB_LIST(V, T, I) \
|
||||
T(HandleLdNanPref, 7) \
|
||||
T(HandleLdInfinityPref, 7) \
|
||||
T(HandleLdGlobalThisPref, 7) \
|
||||
T(HandleLdUndefinedPref, 7) \
|
||||
T(HandleLdNullPref, 7) \
|
||||
T(HandleLdSymbolPref, 7) \
|
||||
T(HandleLdGlobalPref, 7) \
|
||||
T(HandleLdTruePref, 7) \
|
||||
T(HandleLdFalsePref, 7) \
|
||||
T(HandleThrowDynPref, 7) \
|
||||
T(HandleTypeOfDynPref, 7) \
|
||||
T(HandleLdLexEnvDynPref, 7) \
|
||||
T(HandlePopLexEnvDynPref, 7) \
|
||||
T(HandleGetUnmappedArgsPref, 7) \
|
||||
T(HandleGetPropIteratorPref, 7) \
|
||||
T(HandleAsyncFunctionEnterPref, 7) \
|
||||
T(HandleLdHolePref, 7) \
|
||||
T(HandleReturnUndefinedPref, 7) \
|
||||
T(HandleCreateEmptyObjectPref, 7) \
|
||||
T(HandleCreateEmptyArrayPref, 7) \
|
||||
T(HandleGetIteratorPref, 7) \
|
||||
T(HandleThrowThrowNotExistsPref, 7) \
|
||||
T(HandleThrowPatternNonCoerciblePref, 7) \
|
||||
T(HandleLdHomeObjectPref, 7) \
|
||||
T(HandleThrowDeleteSuperPropertyPref, 7) \
|
||||
T(HandleDebuggerPref, 7) \
|
||||
T(HandleAdd2DynPrefV8, 7) \
|
||||
T(HandleSub2DynPrefV8, 7) \
|
||||
T(HandleMul2DynPrefV8, 7) \
|
||||
T(HandleDiv2DynPrefV8, 7) \
|
||||
T(HandleMod2DynPrefV8, 7) \
|
||||
T(HandleEqDynPrefV8, 7) \
|
||||
T(HandleNotEqDynPrefV8, 7) \
|
||||
T(HandleLessDynPrefV8, 7) \
|
||||
T(HandleLessEqDynPrefV8, 7) \
|
||||
T(HandleGreaterDynPrefV8, 7) \
|
||||
T(HandleGreaterEqDynPrefV8, 7) \
|
||||
T(HandleShl2DynPrefV8, 7) \
|
||||
T(HandleShr2DynPrefV8, 7) \
|
||||
T(HandleAshr2DynPrefV8, 7) \
|
||||
T(HandleAnd2DynPrefV8, 7) \
|
||||
T(HandleOr2DynPrefV8, 7) \
|
||||
T(HandleXOr2DynPrefV8, 7) \
|
||||
T(HandleToNumberPrefV8, 7) \
|
||||
T(HandleNegDynPrefV8, 7) \
|
||||
T(HandleNotDynPrefV8, 7) \
|
||||
T(HandleIncDynPrefV8, 7) \
|
||||
T(HandleDecDynPrefV8, 7) \
|
||||
T(HandleExpDynPrefV8, 7) \
|
||||
T(HandleIsInDynPrefV8, 7) \
|
||||
T(HandleInstanceOfDynPrefV8, 7) \
|
||||
T(HandleStrictNotEqDynPrefV8, 7) \
|
||||
T(HandleStrictEqDynPrefV8, 7) \
|
||||
T(HandleResumeGeneratorPrefV8, 7) \
|
||||
T(HandleGetResumeModePrefV8, 7) \
|
||||
T(HandleCreateGeneratorObjPrefV8, 7) \
|
||||
T(HandleThrowConstAssignmentPrefV8, 7) \
|
||||
T(HandleGetTemplateObjectPrefV8, 7) \
|
||||
T(HandleGetNextPropNamePrefV8, 7) \
|
||||
I(HandleCallArg0DynPrefV8, 7) \
|
||||
T(HandleThrowIfNotObjectPrefV8, 7) \
|
||||
T(HandleIterNextPrefV8, 7) \
|
||||
T(HandleCloseIteratorPrefV8, 7) \
|
||||
T(HandleCopyModulePrefV8, 7) \
|
||||
T(HandleSuperCallSpreadPrefV8, 7) \
|
||||
T(HandleDelObjPropPrefV8V8, 7) \
|
||||
T(HandleNewObjSpreadDynPrefV8V8, 7) \
|
||||
T(HandleCreateIterResultObjPrefV8V8, 7) \
|
||||
T(HandleSuspendGeneratorPrefV8V8, 7) \
|
||||
T(HandleAsyncFunctionAwaitUncaughtPrefV8V8, 7) \
|
||||
T(HandleThrowUndefinedIfHolePrefV8V8, 7) \
|
||||
I(HandleCallArg1DynPrefV8V8, 7) \
|
||||
T(HandleCopyDataPropertiesPrefV8V8, 7) \
|
||||
T(HandleStArraySpreadPrefV8V8, 7) \
|
||||
T(HandleGetIteratorNextPrefV8V8, 7) \
|
||||
T(HandleSetObjectWithProtoPrefV8V8, 7) \
|
||||
T(HandleLdObjByValuePrefV8V8, 7) \
|
||||
T(HandleStObjByValuePrefV8V8, 7) \
|
||||
T(HandleStOwnByValuePrefV8V8, 7) \
|
||||
T(HandleLdSuperByValuePrefV8V8, 7) \
|
||||
T(HandleStSuperByValuePrefV8V8, 7) \
|
||||
T(HandleLdObjByIndexPrefV8Imm32, 7) \
|
||||
T(HandleStObjByIndexPrefV8Imm32, 7) \
|
||||
T(HandleStOwnByIndexPrefV8Imm32, 7) \
|
||||
T(HandleCallSpreadDynPrefV8V8V8, 7) \
|
||||
T(HandleAsyncFunctionResolvePrefV8V8V8, 7) \
|
||||
T(HandleAsyncFunctionRejectPrefV8V8V8, 7) \
|
||||
I(HandleCallArgs2DynPrefV8V8V8, 7) \
|
||||
I(HandleCallArgs3DynPrefV8V8V8V8, 7) \
|
||||
T(HandleDefineGetterSetterByValuePrefV8V8V8V8, 7) \
|
||||
T(HandleNewObjDynRangePrefImm16V8, 7) \
|
||||
I(HandleCallIRangeDynPrefImm16V8, 7) \
|
||||
I(HandleCallIThisRangeDynPrefImm16V8, 7) \
|
||||
T(HandleSuperCallPrefImm16V8, 7) \
|
||||
T(HandleCreateObjectWithExcludedKeysPrefImm16V8V8, 7) \
|
||||
T(HandleDefineFuncDynPrefId16Imm16V8, 7) \
|
||||
T(HandleDefineNCFuncDynPrefId16Imm16V8, 7) \
|
||||
T(HandleDefineGeneratorFuncPrefId16Imm16V8, 7) \
|
||||
T(HandleDefineAsyncFuncPrefId16Imm16V8, 7) \
|
||||
T(HandleDefineMethodPrefId16Imm16V8, 7) \
|
||||
T(HandleNewLexEnvDynPrefImm16, 7) \
|
||||
T(HandleCopyRestArgsPrefImm16, 7) \
|
||||
T(HandleCreateArrayWithBufferPrefImm16, 7) \
|
||||
T(HandleCreateObjectHavingMethodPrefImm16, 7) \
|
||||
T(HandleThrowIfSuperNotCorrectCallPrefImm16, 7) \
|
||||
T(HandleCreateObjectWithBufferPrefImm16, 7) \
|
||||
T(HandleLdLexVarDynPrefImm4Imm4, 7) \
|
||||
T(HandleLdLexVarDynPrefImm8Imm8, 7) \
|
||||
T(HandleLdLexVarDynPrefImm16Imm16, 7) \
|
||||
T(HandleStLexVarDynPrefImm4Imm4V8, 7) \
|
||||
T(HandleStLexVarDynPrefImm8Imm8V8, 7) \
|
||||
T(HandleStLexVarDynPrefImm16Imm16V8, 7) \
|
||||
T(HandleDefineClassWithBufferPrefId16Imm16Imm16V8V8, 7) \
|
||||
T(HandleGetModuleNamespacePrefId32, 7) \
|
||||
T(HandleStModuleVarPrefId32, 7) \
|
||||
T(HandleTryLdGlobalByNamePrefId32, 7) \
|
||||
T(HandleTryStGlobalByNamePrefId32, 7) \
|
||||
T(HandleLdGlobalVarPrefId32, 7) \
|
||||
T(HandleStGlobalVarPrefId32, 7) \
|
||||
T(HandleLdObjByNamePrefId32V8, 7) \
|
||||
T(HandleStObjByNamePrefId32V8, 7) \
|
||||
T(HandleStOwnByNamePrefId32V8, 7) \
|
||||
T(HandleLdSuperByNamePrefId32V8, 7) \
|
||||
T(HandleStSuperByNamePrefId32V8, 7) \
|
||||
T(HandleLdModuleVarPrefId32Imm8, 7) \
|
||||
T(HandleCreateRegExpWithLiteralPrefId32Imm8, 7) \
|
||||
T(HandleIsTruePref, 7) \
|
||||
T(HandleIsFalsePref, 7) \
|
||||
T(HandleStConstToGlobalRecordPrefId32, 7) \
|
||||
T(HandleStLetToGlobalRecordPrefId32, 7) \
|
||||
T(HandleStClassToGlobalRecordPrefId32, 7) \
|
||||
T(HandleStOwnByValueWithNameSetPrefV8V8, 7) \
|
||||
T(HandleStOwnByNameWithNameSetPrefId32V8, 7) \
|
||||
T(HandleLdFunctionPref, 7) \
|
||||
V(HandleLdBigIntPrefId32, 7) \
|
||||
V(HandleNewLexEnvWithNameDynPrefImm16Imm16, 7) \
|
||||
T(HandleMovDynV8V8, 7) \
|
||||
T(HandleMovDynV16V16, 7) \
|
||||
T(HandleLdaStrId32, 7) \
|
||||
T(HandleLdaiDynImm32, 7) \
|
||||
T(HandleFldaiDynImm64, 7) \
|
||||
T(HandleJmpImm8, 7) \
|
||||
T(HandleJmpImm16, 7) \
|
||||
T(HandleJmpImm32, 7) \
|
||||
T(HandleJeqzImm8, 7) \
|
||||
T(HandleJeqzImm16, 7) \
|
||||
T(HandleLdaDynV8, 7) \
|
||||
T(HandleStaDynV8, 7) \
|
||||
T(HandleReturnDyn, 7) \
|
||||
T(HandleMovV4V4, 7) \
|
||||
T(HandleJnezImm8, 7) \
|
||||
T(HandleJnezImm16, 7) \
|
||||
T(ExceptionHandler, 7)
|
||||
|
||||
#define INTERPRETER_IGNORED_BC_STUB_LIST(V) \
|
||||
ASM_INTERPRETER_BC_STUB_LIST(IGNORE_BC_STUB, IGNORE_BC_STUB, V)
|
||||
|
||||
#define INTERPRETER_BC_STUB_LIST(V) \
|
||||
ASM_INTERPRETER_BC_STUB_LIST(IGNORE_BC_STUB, V, V)
|
||||
|
||||
#define ASM_INTERPRETER_BC_STUB_ID_LIST(V) \
|
||||
ASM_INTERPRETER_BC_STUB_LIST(V, V, V)
|
||||
|
||||
class InterpreterStub : public Stub {
|
||||
public:
|
||||
InterpreterStub(const char* name, int argCount, Circuit *circuit)
|
||||
@ -86,7 +250,6 @@ public:
|
||||
inline GateRef GetObjectFromConstPool(GateRef constpool, GateRef index);
|
||||
};
|
||||
|
||||
#if ECMASCRIPT_COMPILE_INTERPRETER_ASM
|
||||
class AsmInterpreterEntryStub : public InterpreterStub {
|
||||
public:
|
||||
// 7 : 7 means argument counts
|
||||
@ -103,7 +266,6 @@ private:
|
||||
void GenerateCircuitImpl(GateRef glue, GateRef pc, GateRef sp, GateRef constpool,
|
||||
GateRef profileTypeInfo, GateRef acc, GateRef hotnessCounter);
|
||||
};
|
||||
#endif
|
||||
|
||||
#define DECLARE_HANDLE_STUB_CLASS(name, argc) \
|
||||
class name##Stub : public InterpreterStub { \
|
||||
@ -121,11 +283,39 @@ private:
|
||||
void GenerateCircuitImpl(GateRef glue, GateRef pc, GateRef sp, GateRef constpool, \
|
||||
GateRef profileTypeInfo, GateRef acc, GateRef hotnessCounter); \
|
||||
};
|
||||
#if ECMASCRIPT_COMPILE_INTERPRETER_ASM
|
||||
INTERPRETER_STUB_LIST(DECLARE_HANDLE_STUB_CLASS)
|
||||
#endif
|
||||
INTERPRETER_BC_STUB_LIST(DECLARE_HANDLE_STUB_CLASS)
|
||||
DECLARE_HANDLE_STUB_CLASS(SingleStepDebugging, 7)
|
||||
#undef DECLARE_HANDLE_STUB_CLASS
|
||||
} // namespace panda::ecmascript::kungfu
|
||||
|
||||
class BytecodeStubCSigns {
|
||||
public:
|
||||
enum ValidID {
|
||||
#define DEF_VALID_BC_STUB_ID(name, counter) name,
|
||||
INTERPRETER_BC_STUB_LIST(DEF_VALID_BC_STUB_ID)
|
||||
#undef DEF_VALID_BC_STUB_ID
|
||||
NUM_OF_VALID_STUBS
|
||||
};
|
||||
|
||||
enum ID {
|
||||
#define DEF_BC_STUB_ID(name, counter) ID_##name,
|
||||
ASM_INTERPRETER_BC_STUB_ID_LIST(DEF_BC_STUB_ID)
|
||||
#undef DEF_BC_STUB_ID
|
||||
NUM_OF_ALL_STUBS
|
||||
};
|
||||
static void Initialize();
|
||||
|
||||
static void GetCSigns(std::vector<CallSignature*>& outCSigns);
|
||||
|
||||
static const CallSignature* Get(size_t index)
|
||||
{
|
||||
ASSERT(index < NUM_OF_VALID_STUBS);
|
||||
return &callSigns_[index];
|
||||
}
|
||||
private:
|
||||
static CallSignature callSigns_[NUM_OF_VALID_STUBS];
|
||||
};
|
||||
|
||||
#define BYTECODE_STUB_BEGIN_ID BytecodeStubCSigns::ID_HandleLdNanPref
|
||||
#define BYTECODE_STUB_END_ID BytecodeStubCSigns::ID_ExceptionHandler
|
||||
} // namespace panda::ecmascript::kungfu
|
||||
#endif // ECMASCRIPT_COMPILER_INTERPRETER_STUB_H
|
||||
|
@ -1,196 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ECMASCRIPT_COMPILER_INTERPRETER_STUB_DEFINE_H
|
||||
#define ECMASCRIPT_COMPILER_INTERPRETER_STUB_DEFINE_H
|
||||
|
||||
namespace panda::ecmascript::kungfu {
|
||||
#define INTERPRETER_STUB_HELPER_LIST(V) \
|
||||
V(AsmInterpreterEntry, 7) \
|
||||
V(SingleStepDebugging, 7)
|
||||
|
||||
#define IGNORE_STUB(...)
|
||||
|
||||
#define INTERPRETER_STUB_LIST(V) \
|
||||
ASM_INTERPRETER_STUB_LIST(IGNORE_STUB, V, V)
|
||||
|
||||
#define INTERPRETER_IGNORE_STUB_LIST(V) \
|
||||
ASM_INTERPRETER_STUB_LIST(IGNORE_STUB, IGNORE_STUB, V)
|
||||
|
||||
#define ASM_INTERPRETER_ID_LIST(V) \
|
||||
ASM_INTERPRETER_STUB_LIST(V, V, V)
|
||||
|
||||
#define ASM_INTERPRETER_STUB_LIST(V, T, I) \
|
||||
T(HandleLdNanPref, 7) \
|
||||
T(HandleLdInfinityPref, 7) \
|
||||
T(HandleLdGlobalThisPref, 7) \
|
||||
T(HandleLdUndefinedPref, 7) \
|
||||
T(HandleLdNullPref, 7) \
|
||||
T(HandleLdSymbolPref, 7) \
|
||||
T(HandleLdGlobalPref, 7) \
|
||||
T(HandleLdTruePref, 7) \
|
||||
T(HandleLdFalsePref, 7) \
|
||||
T(HandleThrowDynPref, 7) \
|
||||
T(HandleTypeOfDynPref, 7) \
|
||||
T(HandleLdLexEnvDynPref, 7) \
|
||||
T(HandlePopLexEnvDynPref, 7) \
|
||||
T(HandleGetUnmappedArgsPref, 7) \
|
||||
T(HandleGetPropIteratorPref, 7) \
|
||||
T(HandleAsyncFunctionEnterPref, 7) \
|
||||
T(HandleLdHolePref, 7) \
|
||||
T(HandleReturnUndefinedPref, 7) \
|
||||
T(HandleCreateEmptyObjectPref, 7) \
|
||||
T(HandleCreateEmptyArrayPref, 7) \
|
||||
T(HandleGetIteratorPref, 7) \
|
||||
T(HandleThrowThrowNotExistsPref, 7) \
|
||||
T(HandleThrowPatternNonCoerciblePref, 7) \
|
||||
T(HandleLdHomeObjectPref, 7) \
|
||||
T(HandleThrowDeleteSuperPropertyPref, 7) \
|
||||
T(HandleDebuggerPref, 7) \
|
||||
T(HandleAdd2DynPrefV8, 7) \
|
||||
T(HandleSub2DynPrefV8, 7) \
|
||||
T(HandleMul2DynPrefV8, 7) \
|
||||
T(HandleDiv2DynPrefV8, 7) \
|
||||
T(HandleMod2DynPrefV8, 7) \
|
||||
T(HandleEqDynPrefV8, 7) \
|
||||
T(HandleNotEqDynPrefV8, 7) \
|
||||
T(HandleLessDynPrefV8, 7) \
|
||||
T(HandleLessEqDynPrefV8, 7) \
|
||||
T(HandleGreaterDynPrefV8, 7) \
|
||||
T(HandleGreaterEqDynPrefV8, 7) \
|
||||
T(HandleShl2DynPrefV8, 7) \
|
||||
T(HandleShr2DynPrefV8, 7) \
|
||||
T(HandleAshr2DynPrefV8, 7) \
|
||||
T(HandleAnd2DynPrefV8, 7) \
|
||||
T(HandleOr2DynPrefV8, 7) \
|
||||
T(HandleXOr2DynPrefV8, 7) \
|
||||
T(HandleToNumberPrefV8, 7) \
|
||||
T(HandleNegDynPrefV8, 7) \
|
||||
T(HandleNotDynPrefV8, 7) \
|
||||
T(HandleIncDynPrefV8, 7) \
|
||||
T(HandleDecDynPrefV8, 7) \
|
||||
T(HandleExpDynPrefV8, 7) \
|
||||
T(HandleIsInDynPrefV8, 7) \
|
||||
T(HandleInstanceOfDynPrefV8, 7) \
|
||||
T(HandleStrictNotEqDynPrefV8, 7) \
|
||||
T(HandleStrictEqDynPrefV8, 7) \
|
||||
T(HandleResumeGeneratorPrefV8, 7) \
|
||||
T(HandleGetResumeModePrefV8, 7) \
|
||||
T(HandleCreateGeneratorObjPrefV8, 7) \
|
||||
T(HandleThrowConstAssignmentPrefV8, 7) \
|
||||
T(HandleGetTemplateObjectPrefV8, 7) \
|
||||
T(HandleGetNextPropNamePrefV8, 7) \
|
||||
I(HandleCallArg0DynPrefV8, 7) \
|
||||
T(HandleThrowIfNotObjectPrefV8, 7) \
|
||||
T(HandleIterNextPrefV8, 7) \
|
||||
T(HandleCloseIteratorPrefV8, 7) \
|
||||
T(HandleCopyModulePrefV8, 7) \
|
||||
T(HandleSuperCallSpreadPrefV8, 7) \
|
||||
T(HandleDelObjPropPrefV8V8, 7) \
|
||||
T(HandleNewObjSpreadDynPrefV8V8, 7) \
|
||||
T(HandleCreateIterResultObjPrefV8V8, 7) \
|
||||
T(HandleSuspendGeneratorPrefV8V8, 7) \
|
||||
T(HandleAsyncFunctionAwaitUncaughtPrefV8V8, 7) \
|
||||
T(HandleThrowUndefinedIfHolePrefV8V8, 7) \
|
||||
I(HandleCallArg1DynPrefV8V8, 7) \
|
||||
T(HandleCopyDataPropertiesPrefV8V8, 7) \
|
||||
T(HandleStArraySpreadPrefV8V8, 7) \
|
||||
T(HandleGetIteratorNextPrefV8V8, 7) \
|
||||
T(HandleSetObjectWithProtoPrefV8V8, 7) \
|
||||
T(HandleLdObjByValuePrefV8V8, 7) \
|
||||
T(HandleStObjByValuePrefV8V8, 7) \
|
||||
T(HandleStOwnByValuePrefV8V8, 7) \
|
||||
T(HandleLdSuperByValuePrefV8V8, 7) \
|
||||
T(HandleStSuperByValuePrefV8V8, 7) \
|
||||
T(HandleLdObjByIndexPrefV8Imm32, 7) \
|
||||
T(HandleStObjByIndexPrefV8Imm32, 7) \
|
||||
T(HandleStOwnByIndexPrefV8Imm32, 7) \
|
||||
T(HandleCallSpreadDynPrefV8V8V8, 7) \
|
||||
T(HandleAsyncFunctionResolvePrefV8V8V8, 7) \
|
||||
T(HandleAsyncFunctionRejectPrefV8V8V8, 7) \
|
||||
I(HandleCallArgs2DynPrefV8V8V8, 7) \
|
||||
I(HandleCallArgs3DynPrefV8V8V8V8, 7) \
|
||||
T(HandleDefineGetterSetterByValuePrefV8V8V8V8, 7) \
|
||||
T(HandleNewObjDynRangePrefImm16V8, 7) \
|
||||
I(HandleCallIRangeDynPrefImm16V8, 7) \
|
||||
I(HandleCallIThisRangeDynPrefImm16V8, 7) \
|
||||
T(HandleSuperCallPrefImm16V8, 7) \
|
||||
T(HandleCreateObjectWithExcludedKeysPrefImm16V8V8, 7) \
|
||||
T(HandleDefineFuncDynPrefId16Imm16V8, 7) \
|
||||
T(HandleDefineNCFuncDynPrefId16Imm16V8, 7) \
|
||||
T(HandleDefineGeneratorFuncPrefId16Imm16V8, 7) \
|
||||
T(HandleDefineAsyncFuncPrefId16Imm16V8, 7) \
|
||||
T(HandleDefineMethodPrefId16Imm16V8, 7) \
|
||||
T(HandleNewLexEnvDynPrefImm16, 7) \
|
||||
T(HandleCopyRestArgsPrefImm16, 7) \
|
||||
T(HandleCreateArrayWithBufferPrefImm16, 7) \
|
||||
T(HandleCreateObjectHavingMethodPrefImm16, 7) \
|
||||
T(HandleThrowIfSuperNotCorrectCallPrefImm16, 7) \
|
||||
T(HandleCreateObjectWithBufferPrefImm16, 7) \
|
||||
T(HandleLdLexVarDynPrefImm4Imm4, 7) \
|
||||
T(HandleLdLexVarDynPrefImm8Imm8, 7) \
|
||||
T(HandleLdLexVarDynPrefImm16Imm16, 7) \
|
||||
T(HandleStLexVarDynPrefImm4Imm4V8, 7) \
|
||||
T(HandleStLexVarDynPrefImm8Imm8V8, 7) \
|
||||
T(HandleStLexVarDynPrefImm16Imm16V8, 7) \
|
||||
T(HandleDefineClassWithBufferPrefId16Imm16Imm16V8V8, 7) \
|
||||
T(HandleGetModuleNamespacePrefId32, 7) \
|
||||
T(HandleStModuleVarPrefId32, 7) \
|
||||
T(HandleTryLdGlobalByNamePrefId32, 7) \
|
||||
T(HandleTryStGlobalByNamePrefId32, 7) \
|
||||
T(HandleLdGlobalVarPrefId32, 7) \
|
||||
T(HandleStGlobalVarPrefId32, 7) \
|
||||
T(HandleLdObjByNamePrefId32V8, 7) \
|
||||
T(HandleStObjByNamePrefId32V8, 7) \
|
||||
T(HandleStOwnByNamePrefId32V8, 7) \
|
||||
T(HandleLdSuperByNamePrefId32V8, 7) \
|
||||
T(HandleStSuperByNamePrefId32V8, 7) \
|
||||
T(HandleLdModuleVarPrefId32Imm8, 7) \
|
||||
T(HandleCreateRegExpWithLiteralPrefId32Imm8, 7) \
|
||||
T(HandleIsTruePref, 7) \
|
||||
T(HandleIsFalsePref, 7) \
|
||||
T(HandleStConstToGlobalRecordPrefId32, 7) \
|
||||
T(HandleStLetToGlobalRecordPrefId32, 7) \
|
||||
T(HandleStClassToGlobalRecordPrefId32, 7) \
|
||||
T(HandleStOwnByValueWithNameSetPrefV8V8, 7) \
|
||||
T(HandleStOwnByNameWithNameSetPrefId32V8, 7) \
|
||||
T(HandleLdFunctionPref, 7) \
|
||||
V(HandleLdBigIntPrefId32, 7) \
|
||||
V(HandleNewLexEnvWithNameDynPrefImm16Imm16, 7) \
|
||||
T(HandleMovDynV8V8, 7) \
|
||||
T(HandleMovDynV16V16, 7) \
|
||||
T(HandleLdaStrId32, 7) \
|
||||
T(HandleLdaiDynImm32, 7) \
|
||||
T(HandleFldaiDynImm64, 7) \
|
||||
T(HandleJmpImm8, 7) \
|
||||
T(HandleJmpImm16, 7) \
|
||||
T(HandleJmpImm32, 7) \
|
||||
T(HandleJeqzImm8, 7) \
|
||||
T(HandleJeqzImm16, 7) \
|
||||
T(HandleLdaDynV8, 7) \
|
||||
T(HandleStaDynV8, 7) \
|
||||
T(HandleReturnDyn, 7) \
|
||||
T(HandleMovV4V4, 7) \
|
||||
T(HandleJnezImm8, 7) \
|
||||
T(HandleJnezImm16, 7) \
|
||||
T(ExceptionHandler, 7) \
|
||||
|
||||
enum InterpreterStubId {
|
||||
#define DEF_STUB(name, counter) name##Id,
|
||||
ASM_INTERPRETER_ID_LIST(DEF_STUB) INTERPRETER_STUB_MAXCOUNT,
|
||||
#undef DEF_STUB
|
||||
};
|
||||
} // namespace panda::ecmascript::kungfu
|
||||
#endif // ECMASCRIPT_COMPILER_INTERPRETER_STUB_DEFINE_H
|
@ -50,14 +50,14 @@
|
||||
#include "llvm/Support/TargetSelect.h"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/llvm_stackmap_parser.h"
|
||||
#include "stub_descriptor.h"
|
||||
#include "call_signature.h"
|
||||
|
||||
using namespace panda::ecmascript;
|
||||
namespace panda::ecmascript::kungfu {
|
||||
void LLVMIRGeneratorImpl::GenerateCodeForStub(Circuit *circuit, const ControlFlowGraph &graph, int index,
|
||||
void LLVMIRGeneratorImpl::GenerateCodeForStub(Circuit *circuit, const ControlFlowGraph &graph, size_t index,
|
||||
const CompilationConfig *cfg)
|
||||
{
|
||||
LLVMValueRef function = module_->GetStubFunction(index);
|
||||
LLVMValueRef function = module_->GetFunction(index);
|
||||
LLVMIRBuilder builder(&graph, circuit, module_, function, cfg);
|
||||
builder.Build();
|
||||
}
|
||||
@ -71,32 +71,24 @@ void LLVMModuleAssembler::AssembleStubModule(StubModule *module)
|
||||
{
|
||||
auto codeBuff = reinterpret_cast<uintptr_t>(assembler_.GetCodeBuffer());
|
||||
auto engine = assembler_.GetEngine();
|
||||
std::map<uint64_t, std::string> addr2name;
|
||||
for (int i = 0; i < ALL_STUB_MAXCOUNT; i++) {
|
||||
auto stubfunction = stubmodule_->GetStubFunction(i);
|
||||
#ifndef NDEBUG
|
||||
COMPILER_LOG(DEBUG) << " AssembleStubModule :" << i << " th " << std::endl;
|
||||
#endif
|
||||
if (stubfunction != nullptr) {
|
||||
uintptr_t stubEntry = reinterpret_cast<uintptr_t>(LLVMGetPointerToGlobal(engine, stubfunction));
|
||||
module->SetStubEntry(i, stubEntry - codeBuff);
|
||||
if (i >= FAST_STUB_MAXCOUNT) {
|
||||
addr2name[stubEntry] = FastStubDescriptors::GetInstance()
|
||||
.GetStubDescriptor(CallStubId::NAME_BytecodeHandler)->GetName();
|
||||
} else {
|
||||
addr2name[stubEntry] = FastStubDescriptors::GetInstance().GetStubDescriptor(i)->GetName();
|
||||
}
|
||||
#ifndef NDEBUG
|
||||
COMPILER_LOG(DEBUG) << "name : " << addr2name[codeBuff] << std::endl;
|
||||
#endif
|
||||
}
|
||||
std::map<uintptr_t, std::string> addr2name;
|
||||
|
||||
auto callSigns = stubmodule_->GetCSigns();
|
||||
for (size_t i = 0; i < stubmodule_->GetFuncsSize(); i++) {
|
||||
auto cs = callSigns[i];
|
||||
LLVMValueRef func = stubmodule_->GetFunction(i);
|
||||
ASSERT(func != nullptr);
|
||||
uintptr_t entry = reinterpret_cast<uintptr_t>(LLVMGetPointerToGlobal(engine, func));
|
||||
module->AddStubEntry(cs->GetTargetKind(), cs->GetID(), entry - codeBuff);
|
||||
ASSERT(!cs->GetName().empty());
|
||||
addr2name[entry] = cs->GetName();
|
||||
}
|
||||
module->SetHostCodeSectionAddr(codeBuff);
|
||||
// stackmaps ptr and size
|
||||
module->SetStackMapAddr(reinterpret_cast<uintptr_t>(assembler_.GetStackMapsSection()));
|
||||
module->SetStackMapSize(assembler_.GetStackMapsSize());
|
||||
#ifndef NDEBUG
|
||||
assembler_.Disassemble(addr2name);
|
||||
assembler_.Disassemble(&addr2name);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -275,7 +267,7 @@ static const char *SymbolLookupCallback([[maybe_unused]] void *disInfo, [[maybe_
|
||||
}
|
||||
#endif
|
||||
|
||||
void LLVMAssembler::Disassemble(std::map<uint64_t, std::string> addr2name) const
|
||||
void LLVMAssembler::Disassemble(std::map<uint64_t, std::string> &addr2name) const
|
||||
{
|
||||
#if ECMASCRIPT_ENABLE_COMPILER_LOG
|
||||
LLVMDisasmContextRef dcr = LLVMCreateDisasm(LLVMGetTarget(module_), nullptr, 0, nullptr, SymbolLookupCallback);
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "code_generator.h"
|
||||
#include "ecmascript/compiler/llvm_ir_builder.h"
|
||||
#include "ecmascript/ecma_macros.h"
|
||||
#include "ecmascript/js_thread.h"
|
||||
#include "ecmascript/stub_module.h"
|
||||
#include "llvm-c/Analysis.h"
|
||||
#include "llvm-c/Core.h"
|
||||
@ -154,7 +153,7 @@ public:
|
||||
{
|
||||
return engine_;
|
||||
}
|
||||
void Disassemble(std::map<uint64_t, std::string> addr2name = std::map<uint64_t, std::string>()) const;
|
||||
void Disassemble(std::map<uint64_t, std::string> &addr2name) const;
|
||||
uint8_t *GetStackMapsSection() const
|
||||
{
|
||||
return codeInfo_.GetStackMapsSection();
|
||||
@ -181,14 +180,11 @@ private:
|
||||
void UseRoundTripSectionMemoryManager();
|
||||
bool BuildMCJITEngine();
|
||||
void BuildAndRunPasses();
|
||||
void BuildSimpleFunction();
|
||||
void Initialize();
|
||||
void InitMember();
|
||||
|
||||
LLVMMCJITCompilerOptions options_ {};
|
||||
LLVMModuleRef module_;
|
||||
LLVMExecutionEngineRef engine_ {nullptr};
|
||||
const CompilationConfig *compCfg_;
|
||||
char *error_ {nullptr};
|
||||
struct CodeInfo codeInfo_ {};
|
||||
};
|
||||
@ -197,7 +193,7 @@ class LLVMIRGeneratorImpl : public CodeGeneratorImpl {
|
||||
public:
|
||||
explicit LLVMIRGeneratorImpl(LLVMStubModule *module) : module_(module) {}
|
||||
~LLVMIRGeneratorImpl() = default;
|
||||
void GenerateCodeForStub(Circuit *circuit, const ControlFlowGraph &graph, int index,
|
||||
void GenerateCodeForStub(Circuit *circuit, const ControlFlowGraph &graph, size_t index,
|
||||
const CompilationConfig *cfg) override;
|
||||
|
||||
private:
|
||||
|
@ -21,9 +21,10 @@
|
||||
|
||||
#include "ecmascript/compiler/circuit.h"
|
||||
#include "ecmascript/compiler/compiler_macros.h"
|
||||
#include "ecmascript/compiler/call_signature.h"
|
||||
#include "ecmascript/compiler/fast_stub.h"
|
||||
#include "ecmascript/compiler/gate.h"
|
||||
#include "ecmascript/compiler/stub_descriptor.h"
|
||||
#include "ecmascript/compiler/rt_call_signature.h"
|
||||
#include "ecmascript/frames.h"
|
||||
#include "ecmascript/js_thread.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
@ -463,7 +464,8 @@ void LLVMIRBuilder::VisitRuntimeCall(GateRef gate, const std::vector<GateRef> &i
|
||||
ASSERT(stubModule_ != nullptr);
|
||||
LLVMValueRef callee;
|
||||
LLVMValueRef rtoffset;
|
||||
LLVMTypeRef rtfuncType = stubModule_->GetStubFunctionType(FAST_STUB_ID(RuntimeCallTrampolineAot));
|
||||
LLVMTypeRef rtfuncType = stubModule_->GetFunctionType(RTSTUB_ID(RuntimeCallTrampolineAot) +
|
||||
NOGC_RTSTUB_CSIGNS_BEGIN);
|
||||
LLVMTypeRef rtfuncTypePtr = LLVMPointerType(rtfuncType, 0);
|
||||
LLVMValueRef glue = gateToLLVMMaps_[inList[2]]; // 2 : 2 means skip two input gates (target glue)
|
||||
LLVMTypeRef glue_type = LLVMTypeOf(glue);
|
||||
@ -471,12 +473,12 @@ void LLVMIRBuilder::VisitRuntimeCall(GateRef gate, const std::vector<GateRef> &i
|
||||
circuit_->GetFrameType() == FrameType::OPTIMIZED_ENTRY_FRAME) {
|
||||
rtoffset = LLVMConstInt(glue_type,
|
||||
JSThread::GlueData::GetRTInterfacesOffset(compCfg_->Is32Bit()) +
|
||||
(RUNTIME_CALL_ID(RuntimeCallTrampolineInterpreterAsm)) * slotSize_,
|
||||
(RTSTUB_ID(RuntimeCallTrampolineInterpreterAsm)) * slotSize_,
|
||||
0);
|
||||
} else {
|
||||
rtoffset = LLVMConstInt(glue_type,
|
||||
JSThread::GlueData::GetRTInterfacesOffset(compCfg_->Is32Bit()) +
|
||||
(RUNTIME_CALL_ID(RuntimeCallTrampolineAot)) * slotSize_,
|
||||
(RTSTUB_ID(RuntimeCallTrampolineAot)) * slotSize_,
|
||||
0);
|
||||
}
|
||||
LLVMValueRef rtbaseoffset = LLVMBuildAdd(builder_, glue, rtoffset, "");
|
||||
@ -578,26 +580,23 @@ LLVMValueRef LLVMIRBuilder::GetCurrentFrameType(LLVMValueRef currentSpFrameAddr)
|
||||
void LLVMIRBuilder::VisitCall(GateRef gate, const std::vector<GateRef> &inList)
|
||||
{
|
||||
int paraStartIndex = 3;
|
||||
int index = circuit_->GetBitField(inList[1]);
|
||||
size_t index = circuit_->GetBitField(inList[1]);
|
||||
ASSERT(stubModule_ != nullptr);
|
||||
LLVMValueRef callee;
|
||||
LLVMValueRef rtoffset;
|
||||
StubDescriptor *calleeDescriptor = FastStubDescriptors::GetInstance().GetStubDescriptor(index);
|
||||
LLVMTypeRef rtfuncType = stubModule_->GetStubFunctionType(index);
|
||||
const CallSignature *calleeDescriptor = stubModule_->GetCSign(index);
|
||||
LLVMTypeRef rtfuncType = stubModule_->GetFunctionType(index);
|
||||
LLVMTypeRef rtfuncTypePtr = LLVMPointerType(rtfuncType, 0);
|
||||
LLVMValueRef glue = gateToLLVMMaps_[inList[2]]; // 2 : 2 means skip two input gates (target glue)
|
||||
LLVMTypeRef glue_type = LLVMTypeOf(glue);
|
||||
// runtime case
|
||||
if (calleeDescriptor->GetStubKind() == StubDescriptor::CallStubKind::RUNTIME_STUB ||
|
||||
calleeDescriptor->GetStubKind() == StubDescriptor::CallStubKind::RUNTIME_STUB_NO_GC) {
|
||||
rtoffset = LLVMConstInt(glue_type,
|
||||
JSThread::GlueData::GetRTInterfacesOffset(compCfg_->Is32Bit()) +
|
||||
(index - FAST_STUB_MAXCOUNT) * slotSize_,
|
||||
0);
|
||||
if (calleeDescriptor->GetTargetKind() == CallSignature::TargetKind::RUNTIME_STUB ||
|
||||
calleeDescriptor->GetTargetKind() == CallSignature::TargetKind::RUNTIME_STUB_NO_GC) {
|
||||
rtoffset = LLVMConstInt(glue_type, JSThread::GlueData::GetRTInterfacesOffset(compCfg_->Is32Bit()) +
|
||||
(index - NOGC_RTSTUB_CSIGNS_BEGIN) * slotSize_, 0);
|
||||
} else {
|
||||
rtoffset = LLVMConstInt(glue_type,
|
||||
JSThread::GlueData::GetStubEntriesOffset(compCfg_->Is32Bit()) + index * slotSize_,
|
||||
0);
|
||||
JSThread::GlueData::GetStubEntriesOffset(compCfg_->Is32Bit()) + index * slotSize_, 0);
|
||||
}
|
||||
LLVMValueRef rtbaseoffset = LLVMBuildAdd(builder_, glue, rtoffset, "");
|
||||
LLVMValueRef rtbaseAddr = LLVMBuildIntToPtr(builder_, rtbaseoffset, LLVMPointerType(glue_type, 0), "");
|
||||
@ -612,7 +611,7 @@ void LLVMIRBuilder::VisitCall(GateRef gate, const std::vector<GateRef> &inList)
|
||||
GateRef glueGate = inList[paraStartIndex];
|
||||
params[dstParaIndex++] = gateToLLVMMaps_[glueGate];
|
||||
// for arm32, r0-r4 must be occupied by fake parameters, then the actual paramters will be in stack.
|
||||
if (compCfg_->Is32Bit() && calleeDescriptor->GetStubKind() != StubDescriptor::CallStubKind::RUNTIME_STUB) {
|
||||
if (compCfg_->Is32Bit() && calleeDescriptor->GetTargetKind() != CallSignature::TargetKind::RUNTIME_STUB) {
|
||||
for (int i = 0; i < CompilationConfig::FAKE_REGISTER_PARAMTERS_ARM32; i++) {
|
||||
params[dstParaIndex++] = gateToLLVMMaps_[glueGate];
|
||||
}
|
||||
@ -642,7 +641,8 @@ void LLVMIRBuilder::VisitBytecodeCall(GateRef gate, const std::vector<GateRef> &
|
||||
LLVMValueRef opcodeOffset = gateToLLVMMaps_[inList[1]];
|
||||
ASSERT(stubModule_ != nullptr);
|
||||
LLVMValueRef callee;
|
||||
LLVMTypeRef rtfuncType = stubModule_->GetStubFunctionType(CallStubId::NAME_BytecodeHandler);
|
||||
// start index of bytecode handler csign in llvmModule
|
||||
LLVMTypeRef rtfuncType = stubModule_->GetFunctionType(CommonStubCSigns::NUM_OF_STUBS);
|
||||
LLVMTypeRef rtfuncTypePtr = LLVMPointerType(rtfuncType, 0);
|
||||
LLVMValueRef glue = gateToLLVMMaps_[inList[2]]; // 2 : 2 means skip two input gates (target glue)
|
||||
LLVMTypeRef glue_type = LLVMTypeOf(glue);
|
||||
@ -1721,49 +1721,31 @@ LLVMStubModule::~LLVMStubModule()
|
||||
}
|
||||
}
|
||||
|
||||
void LLVMStubModule::Initialize(const std::vector<int> &stubIndices)
|
||||
void LLVMStubModule::Initialize()
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i < CALL_STUB_MAXCOUNT; i++) {
|
||||
auto stubDescriptor = FastStubDescriptors::GetInstance().GetStubDescriptor(i);
|
||||
if (!stubDescriptor->GetName().empty()) {
|
||||
stubFunctionType_[i] = GetLLVMFunctionTypeStubDescriptor(stubDescriptor);
|
||||
}
|
||||
}
|
||||
for (i = 0; i < FAST_STUB_MAXCOUNT; i++) {
|
||||
uint32_t index = stubIndices[i];
|
||||
auto stubDescriptor = FastStubDescriptors::GetInstance().GetStubDescriptor(index);
|
||||
if (!stubDescriptor->GetName().empty()) {
|
||||
stubFunctions_[i] = GetLLVMFunctionByStubDescriptor(stubDescriptor);
|
||||
}
|
||||
}
|
||||
#define DEF_STUB_FUNCTION(name, argc) \
|
||||
{ \
|
||||
auto funcType = stubFunctionType_[CallStubId::NAME_BytecodeHandler]; \
|
||||
stubFunctions_[StubId::STUB_##name] = LLVMAddFunction(module_, #name, funcType); \
|
||||
}
|
||||
#if ECMASCRIPT_COMPILE_INTERPRETER_ASM
|
||||
INTERPRETER_STUB_LIST(DEF_STUB_FUNCTION)
|
||||
#endif
|
||||
#undef DEF_STUB_FUNCTION
|
||||
CommonStubCSigns::GetCSigns(callSigns_);
|
||||
BytecodeStubCSigns::GetCSigns(callSigns_);
|
||||
RuntimeStubCSigns::GetCSigns(callSigns_);
|
||||
|
||||
#ifndef NDEBUG
|
||||
for (i = 0; i < TEST_FUNC_MAXCOUNT; i++) {
|
||||
auto testFuncDescriptor = FastStubDescriptors::GetInstance().GetStubDescriptor(i + TEST_FUNC_OFFSET);
|
||||
if (!testFuncDescriptor->GetName().empty()) {
|
||||
testFunctions_[i] = GetLLVMFunctionByStubDescriptor(testFuncDescriptor);
|
||||
for (size_t i = 0; i < callSigns_.size(); i++) {
|
||||
CallSignature* cs = callSigns_[i];
|
||||
ASSERT(!cs->GetName().empty());
|
||||
LLVMTypeRef type = GetLLVMFunctionTypeCallSignature(cs);
|
||||
functionTypes_.emplace_back(type);
|
||||
if (cs->IsCommonStub() || cs->IsBCHandler()) {
|
||||
LLVMValueRef value = GetLLVMFunctionByCallSignature(cs);
|
||||
functions_.emplace_back(value);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
LLVMValueRef LLVMStubModule::GetLLVMFunctionByStubDescriptor(StubDescriptor *stubDescriptor)
|
||||
LLVMValueRef LLVMStubModule::GetLLVMFunctionByCallSignature(CallSignature *stubDescriptor)
|
||||
{
|
||||
auto funcType = GetLLVMFunctionTypeStubDescriptor(stubDescriptor);
|
||||
auto funcType = GetLLVMFunctionTypeCallSignature(stubDescriptor);
|
||||
return LLVMAddFunction(module_, stubDescriptor->GetName().c_str(), funcType);
|
||||
}
|
||||
|
||||
LLVMTypeRef LLVMStubModule::GetLLVMFunctionTypeStubDescriptor(StubDescriptor *stubDescriptor)
|
||||
LLVMTypeRef LLVMStubModule::GetLLVMFunctionTypeCallSignature(CallSignature *stubDescriptor)
|
||||
{
|
||||
LLVMTypeRef returnType = ConvertLLVMTypeFromVariableType(stubDescriptor->GetReturnType());
|
||||
std::vector<LLVMTypeRef> paramTys;
|
||||
@ -1775,7 +1757,7 @@ LLVMTypeRef LLVMStubModule::GetLLVMFunctionTypeStubDescriptor(StubDescriptor *st
|
||||
// first argument is glue
|
||||
LLVMTypeRef glueType = ConvertLLVMTypeFromVariableType(paramsType[0]);
|
||||
paramTys.push_back(glueType);
|
||||
if (compCfg_.Is32Bit() && stubDescriptor->GetStubKind() != StubDescriptor::CallStubKind::RUNTIME_STUB) {
|
||||
if (compCfg_.Is32Bit() && stubDescriptor->GetTargetKind() != CallSignature::TargetKind::RUNTIME_STUB) {
|
||||
for (int i = 0; i < CompilationConfig::FAKE_REGISTER_PARAMTERS_ARM32; i++) {
|
||||
paramTys.push_back(glueType); // fake paramter's type is same with glue type
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "ecmascript/compiler/circuit.h"
|
||||
#include "ecmascript/compiler/gate.h"
|
||||
#include "ecmascript/compiler/stub.h"
|
||||
#include "ecmascript/compiler/stub_descriptor.h"
|
||||
#include "ecmascript/compiler/call_signature.h"
|
||||
#include "llvm-c/Core.h"
|
||||
#include "llvm-c/Types.h"
|
||||
|
||||
@ -110,33 +110,24 @@ class LLVMStubModule {
|
||||
public:
|
||||
LLVMStubModule(const std::string &name, const std::string &triple);
|
||||
~LLVMStubModule();
|
||||
|
||||
void Initialize(const std::vector<int> &stubIndices);
|
||||
|
||||
void Initialize();
|
||||
LLVMModuleRef GetModule() const
|
||||
{
|
||||
return module_;
|
||||
}
|
||||
LLVMTypeRef GetStubFunctionType(uint32_t index) const
|
||||
LLVMTypeRef GetFunctionType(size_t index) const
|
||||
{
|
||||
ASSERT(index < CALL_STUB_MAXCOUNT);
|
||||
return stubFunctionType_[index];
|
||||
return functionTypes_[index];
|
||||
}
|
||||
|
||||
LLVMValueRef GetStubFunction(uint32_t index)
|
||||
LLVMValueRef GetFunction(size_t index)
|
||||
{
|
||||
ASSERT(index < ALL_STUB_MAXCOUNT);
|
||||
return stubFunctions_[index];
|
||||
return functions_[index];
|
||||
}
|
||||
|
||||
LLVMValueRef GetTestFunction(uint32_t index)
|
||||
const CallSignature *GetCSign(size_t index) const
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
ASSERT(index < TEST_FUNC_MAXCOUNT);
|
||||
return testFunctions_[index];
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
return callSigns_[index];
|
||||
}
|
||||
|
||||
const CompilationConfig *GetCompilationConfig() const
|
||||
@ -144,15 +135,22 @@ public:
|
||||
return &compCfg_;
|
||||
}
|
||||
|
||||
const std::vector<CallSignature*> &GetCSigns() const
|
||||
{
|
||||
return callSigns_;
|
||||
}
|
||||
|
||||
size_t GetFuncsSize() const
|
||||
{
|
||||
return functions_.size();
|
||||
}
|
||||
private:
|
||||
LLVMValueRef GetLLVMFunctionByStubDescriptor(StubDescriptor *stubDescriptor);
|
||||
LLVMTypeRef GetLLVMFunctionTypeStubDescriptor(StubDescriptor *stubDescriptor);
|
||||
LLVMValueRef GetLLVMFunctionByCallSignature(CallSignature *stubDescriptor);
|
||||
LLVMTypeRef GetLLVMFunctionTypeCallSignature(CallSignature *stubDescriptor);
|
||||
LLVMTypeRef ConvertLLVMTypeFromVariableType(VariableType type);
|
||||
std::array<LLVMValueRef, ALL_STUB_MAXCOUNT> stubFunctions_ {nullptr};
|
||||
std::array<LLVMTypeRef, CALL_STUB_MAXCOUNT> stubFunctionType_ {nullptr};
|
||||
#ifndef NDEBUG
|
||||
std::array<LLVMValueRef, TEST_FUNC_MAXCOUNT> testFunctions_ {nullptr};
|
||||
#endif
|
||||
std::vector<LLVMValueRef> functions_;
|
||||
std::vector<LLVMTypeRef> functionTypes_;
|
||||
std::vector<CallSignature*> callSigns_;
|
||||
LLVMModuleRef module_;
|
||||
CompilationConfig compCfg_;
|
||||
};
|
||||
|
37
ecmascript/compiler/rt_call_signature.cpp
Normal file
37
ecmascript/compiler/rt_call_signature.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
#include "ecmascript/compiler/rt_call_signature.h"
|
||||
#include "ecmascript/compiler/call_signature.h"
|
||||
#include "ecmascript/stubs/runtime_stubs.h"
|
||||
|
||||
namespace panda::ecmascript::kungfu {
|
||||
CallSignature RuntimeStubCSigns::callSigns_[RuntimeStubCSigns::NUM_OF_RTSTUBS_WITHOUT_GC];
|
||||
|
||||
void RuntimeStubCSigns::Initialize()
|
||||
{
|
||||
#define INIT_SIGNATURES(name, counter) \
|
||||
name##CallSignature::Initialize(&callSigns_[ID_##name]); \
|
||||
callSigns_[ID_##name].SetID(ID_##name);
|
||||
RUNTIME_STUB_WITHOUT_GC_LIST(INIT_SIGNATURES)
|
||||
#undef INIT_SIGNATURES
|
||||
}
|
||||
|
||||
void RuntimeStubCSigns::GetCSigns(std::vector<CallSignature*>& outputCallSigns)
|
||||
{
|
||||
for (size_t i = 0; i < NUM_OF_RTSTUBS_WITHOUT_GC; i++) {
|
||||
outputCallSigns.push_back(&callSigns_[i]);
|
||||
}
|
||||
}
|
||||
} // namespace panda::ecmascript::kungfu
|
52
ecmascript/compiler/rt_call_signature.h
Normal file
52
ecmascript/compiler/rt_call_signature.h
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef ECMASCRIPT_COMPILER_RT_CALL_SIGNATURE_H
|
||||
#define ECMASCRIPT_COMPILER_RT_CALL_SIGNATURE_H
|
||||
|
||||
#include "ecmascript/compiler/call_signature.h"
|
||||
#include "ecmascript/stubs/runtime_stubs.h"
|
||||
|
||||
namespace panda::ecmascript::kungfu {
|
||||
class RuntimeStubCSigns {
|
||||
public:
|
||||
enum ID {
|
||||
#define DEF_RUNTIME_STUB_ID(name, counter) ID_##name,
|
||||
RUNTIME_STUB_LIST(DEF_RUNTIME_STUB_ID)
|
||||
#undef DEF_RUNTIME_STUB_ID
|
||||
NUM_OF_STUBS
|
||||
};
|
||||
|
||||
enum NoGCStubID {
|
||||
#define DEF_RUNTIME_STUB_ID(name, counter) NOGCSTUB_ID_##name,
|
||||
RUNTIME_STUB_WITHOUT_GC_LIST(DEF_RUNTIME_STUB_ID)
|
||||
#undef DEF_RUNTIME_STUB_ID
|
||||
NUM_OF_RTSTUBS_WITHOUT_GC
|
||||
};
|
||||
|
||||
static void Initialize();
|
||||
|
||||
static void GetCSigns(std::vector<CallSignature*>& callSigns);
|
||||
|
||||
static const CallSignature *Get(size_t index)
|
||||
{
|
||||
ASSERT(index < NUM_OF_RTSTUBS_WITHOUT_GC);
|
||||
return &callSigns_[index];
|
||||
}
|
||||
private:
|
||||
static CallSignature callSigns_[NUM_OF_RTSTUBS_WITHOUT_GC];
|
||||
};
|
||||
#define RTSTUB_ID(name) RuntimeStubCSigns::ID_##name
|
||||
} // namespace panda::ecmascript::kungfu
|
||||
#endif // ECMASCRIPT_COMPILER_RT_CALL_SIGNATURE_H
|
@ -196,7 +196,7 @@ void SlowPathLowering::LowerAdd2Dyn(GateRef gate, GateRef glue)
|
||||
{
|
||||
GateAccessor acc(circuit_);
|
||||
CircuitBuilder cirBuilder(circuit_);
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RUNTIME_CALL_ID(Add2Dyn));
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RTSTUB_ID(Add2Dyn));
|
||||
// 2: number of value inputs
|
||||
ASSERT(acc.GetNumValueIn(gate) == 2);
|
||||
GateRef newGate = cirBuilder.NewRuntimeCallGate(glue, id, Circuit::GetCircuitRoot(OpCode(OpCode::DEPEND_ENTRY)),
|
||||
@ -208,7 +208,7 @@ void SlowPathLowering::LowerCreateIterResultObj(GateRef gate, GateRef glue)
|
||||
{
|
||||
GateAccessor acc(circuit_);
|
||||
CircuitBuilder cirBuilder(circuit_);
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RUNTIME_CALL_ID(CreateIterResultObj));
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RTSTUB_ID(CreateIterResultObj));
|
||||
// 2: number of value inputs
|
||||
ASSERT(acc.GetNumValueIn(gate) == 2);
|
||||
GateRef newGate = cirBuilder.NewRuntimeCallGate(glue, id, Circuit::GetCircuitRoot(OpCode(OpCode::DEPEND_ENTRY)),
|
||||
@ -220,7 +220,7 @@ void SlowPathLowering::LowerSuspendGenerator(GateRef gate, GateRef glue)
|
||||
{
|
||||
GateAccessor acc(circuit_);
|
||||
CircuitBuilder cirBuilder(circuit_);
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RUNTIME_CALL_ID(SuspendGenerator));
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RTSTUB_ID(SuspendGenerator));
|
||||
// 2: number of value inputs
|
||||
ASSERT(acc.GetNumValueIn(gate) == 2);
|
||||
GateRef newGate = cirBuilder.NewRuntimeCallGate(glue, id, Circuit::GetCircuitRoot(OpCode(OpCode::DEPEND_ENTRY)),
|
||||
@ -232,7 +232,7 @@ void SlowPathLowering::LowerAsyncFunctionAwaitUncaught(GateRef gate, GateRef glu
|
||||
{
|
||||
GateAccessor acc(circuit_);
|
||||
CircuitBuilder cirBuilder(circuit_);
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RUNTIME_CALL_ID(AsyncFunctionAwaitUncaught));
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RTSTUB_ID(AsyncFunctionAwaitUncaught));
|
||||
// 2: number of value inputs
|
||||
ASSERT(acc.GetNumValueIn(gate) == 2);
|
||||
GateRef newGate = cirBuilder.NewRuntimeCallGate(glue, id, Circuit::GetCircuitRoot(OpCode(OpCode::DEPEND_ENTRY)),
|
||||
@ -244,7 +244,7 @@ void SlowPathLowering::LowerAsyncFunctionResolve(GateRef gate, GateRef glue)
|
||||
{
|
||||
GateAccessor acc(circuit_);
|
||||
CircuitBuilder cirBuilder(circuit_);
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RUNTIME_CALL_ID(AsyncFunctionResolveOrReject));
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RTSTUB_ID(AsyncFunctionResolveOrReject));
|
||||
// 2: number of value inputs
|
||||
ASSERT(acc.GetNumValueIn(gate) == 2);
|
||||
GateRef tureConst = cirBuilder.NewBooleanConstant(true);
|
||||
@ -258,7 +258,7 @@ void SlowPathLowering::LowerAsyncFunctionReject(GateRef gate, GateRef glue)
|
||||
{
|
||||
GateAccessor acc(circuit_);
|
||||
CircuitBuilder cirBuilder(circuit_);
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RUNTIME_CALL_ID(AsyncFunctionResolveOrReject));
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RTSTUB_ID(AsyncFunctionResolveOrReject));
|
||||
// 2: number of value inputs
|
||||
ASSERT(acc.GetNumValueIn(gate) == 2);
|
||||
GateRef falseConst = cirBuilder.NewBooleanConstant(false);
|
||||
@ -271,7 +271,7 @@ GateRef SlowPathLowering::GetValueFromConstantStringTable(CircuitBuilder &builde
|
||||
GateRef gate, uint32_t inIndex)
|
||||
{
|
||||
GateAccessor accessor(circuit_);
|
||||
GateRef id = builder.NewInteger64Constant(RUNTIME_CALL_ID(LoadValueFromConstantStringTable));
|
||||
GateRef id = builder.NewInteger64Constant(RTSTUB_ID(LoadValueFromConstantStringTable));
|
||||
auto idGate = accessor.GetValueIn(gate, inIndex);
|
||||
return builder.NewRuntimeCallGate(glue, id, Circuit::GetCircuitRoot(OpCode(OpCode::DEPEND_ENTRY)), {idGate});
|
||||
}
|
||||
@ -286,7 +286,7 @@ void SlowPathLowering::LowerLoadStr(GateRef gate, GateRef glue)
|
||||
void SlowPathLowering::LowerLexicalEnv(GateRef gate, GateRef glue)
|
||||
{
|
||||
CircuitBuilder cirBuilder(circuit_);
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RUNTIME_CALL_ID(GetLexicalEnv));
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RTSTUB_ID(GetLexicalEnv));
|
||||
GateRef newGate =
|
||||
cirBuilder.NewRuntimeCallGate(glue, id, Circuit::GetCircuitRoot(OpCode(OpCode::DEPEND_ENTRY)), {});
|
||||
LowerHirToCall(cirBuilder, gate, newGate);
|
||||
@ -297,7 +297,7 @@ void SlowPathLowering::LowerTryLdGlobalByName(GateRef gate, GateRef glue)
|
||||
GateAccessor gateAcc(circuit_);
|
||||
CircuitBuilder cirBuilder(circuit_);
|
||||
GateRef prop = GetValueFromConstantStringTable(cirBuilder, glue, gate, 0);
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RUNTIME_CALL_ID(TryLdGlobalByName));
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RTSTUB_ID(TryLdGlobalByName));
|
||||
ASSERT(gateAcc.GetNumValueIn(gate) == 1);
|
||||
GateRef newGate =
|
||||
cirBuilder.NewRuntimeCallGate(glue, id, Circuit::GetCircuitRoot(OpCode(OpCode::DEPEND_ENTRY)), {prop});
|
||||
@ -309,7 +309,7 @@ void SlowPathLowering::LowerStGlobalVar(GateRef gate, GateRef glue)
|
||||
GateAccessor acc(circuit_);
|
||||
CircuitBuilder cirBuilder(circuit_);
|
||||
GateRef prop = GetValueFromConstantStringTable(cirBuilder, glue, gate, 0);
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RUNTIME_CALL_ID(StGlobalVar));
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RTSTUB_ID(StGlobalVar));
|
||||
ASSERT(acc.GetNumValueIn(gate) == 2); // 2: number of value inputs
|
||||
GateRef newGate = cirBuilder.NewRuntimeCallGate(glue, id, Circuit::GetCircuitRoot(OpCode(OpCode::DEPEND_ENTRY)),
|
||||
{prop, acc.GetValueIn(gate, 0)});
|
||||
@ -320,7 +320,7 @@ void SlowPathLowering::LowerGetIterator(GateRef gate, GateRef glue)
|
||||
{
|
||||
GateAccessor acc(circuit_);
|
||||
CircuitBuilder cirBuilder(circuit_);
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RUNTIME_CALL_ID(GetIterator));
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RTSTUB_ID(GetIterator));
|
||||
// 1: number of value inputs
|
||||
ASSERT(acc.GetNumValueIn(gate) == 1);
|
||||
GateRef newGate = cirBuilder.NewRuntimeCallGate(glue, id, Circuit::GetCircuitRoot(OpCode(OpCode::DEPEND_ENTRY)),
|
||||
@ -333,7 +333,7 @@ void SlowPathLowering::LowerCallArg0Dyn(GateRef gate, GateRef glue)
|
||||
{
|
||||
GateAccessor gateAcc(circuit_);
|
||||
CircuitBuilder cirBuilder(circuit_);
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RUNTIME_CALL_ID(CallArg0Dyn));
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RTSTUB_ID(CallArg0Dyn));
|
||||
|
||||
ASSERT(gateAcc.GetNumValueIn(gate) == 1);
|
||||
GateRef newGate = cirBuilder.NewRuntimeCallGate(glue, id, Circuit::GetCircuitRoot(OpCode(OpCode::DEPEND_ENTRY)),
|
||||
@ -345,7 +345,7 @@ void SlowPathLowering::LowerCallArg1Dyn(GateRef gate, GateRef glue)
|
||||
{
|
||||
GateAccessor gateAcc(circuit_);
|
||||
CircuitBuilder cirBuilder(circuit_);
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RUNTIME_CALL_ID(CallArg1Dyn));
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RTSTUB_ID(CallArg1Dyn));
|
||||
// 2: number of value inputs
|
||||
ASSERT(gateAcc.GetNumValueIn(gate) == 2);
|
||||
GateRef newGate = cirBuilder.NewRuntimeCallGate(glue, id, Circuit::GetCircuitRoot(OpCode(OpCode::DEPEND_ENTRY)),
|
||||
@ -358,7 +358,7 @@ void SlowPathLowering::LowerCallArgs2Dyn(GateRef gate, GateRef glue)
|
||||
{
|
||||
GateAccessor gateAcc(circuit_);
|
||||
CircuitBuilder cirBuilder(circuit_);
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RUNTIME_CALL_ID(CallArgs2Dyn));
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RTSTUB_ID(CallArgs2Dyn));
|
||||
// 3: number of value inputs
|
||||
ASSERT(gateAcc.GetNumValueIn(gate) == 3);
|
||||
GateRef newGate = cirBuilder.NewRuntimeCallGate(glue, id, Circuit::GetCircuitRoot(OpCode(OpCode::DEPEND_ENTRY)),
|
||||
@ -372,7 +372,7 @@ void SlowPathLowering::LowerCallArgs3Dyn(GateRef gate, GateRef glue)
|
||||
{
|
||||
GateAccessor gateAcc(circuit_);
|
||||
CircuitBuilder cirBuilder(circuit_);
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RUNTIME_CALL_ID(CallArgs3Dyn));
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RTSTUB_ID(CallArgs3Dyn));
|
||||
// 4: number of value inputs
|
||||
ASSERT(gateAcc.GetNumValueIn(gate) == 4);
|
||||
GateRef newGate = cirBuilder.NewRuntimeCallGate(glue, id, Circuit::GetCircuitRoot(OpCode(OpCode::DEPEND_ENTRY)),
|
||||
@ -387,7 +387,7 @@ void SlowPathLowering::LowerCallIThisRangeDyn(GateRef gate, GateRef glue)
|
||||
{
|
||||
GateAccessor gateAcc(circuit_);
|
||||
CircuitBuilder cirBuilder(circuit_);
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RUNTIME_CALL_ID(CallIThisRangeDyn));
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RTSTUB_ID(CallIThisRangeDyn));
|
||||
std::vector<GateRef> vec;
|
||||
size_t numArgs = gateAcc.GetNumValueIn(gate);
|
||||
for (size_t i = 0; i < numArgs; i++) {
|
||||
@ -402,7 +402,7 @@ void SlowPathLowering::LowerCallSpreadDyn(GateRef gate, GateRef glue)
|
||||
{
|
||||
GateAccessor gateAcc(circuit_);
|
||||
CircuitBuilder cirBuilder(circuit_);
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RUNTIME_CALL_ID(CallSpreadDyn));
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RTSTUB_ID(CallSpreadDyn));
|
||||
// 3: number of value inputs
|
||||
ASSERT(gateAcc.GetNumValueIn(gate) == 3);
|
||||
GateRef newGate = cirBuilder.NewRuntimeCallGate(glue, id, Circuit::GetCircuitRoot(OpCode(OpCode::DEPEND_ENTRY)),
|
||||
@ -416,7 +416,7 @@ void SlowPathLowering::LowerCallIRangeDyn(GateRef gate, GateRef glue)
|
||||
{
|
||||
GateAccessor gateAcc(circuit_);
|
||||
CircuitBuilder cirBuilder(circuit_);
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RUNTIME_CALL_ID(CallIRangeDyn));
|
||||
GateRef id = cirBuilder.NewInteger64Constant(RTSTUB_ID(CallIRangeDyn));
|
||||
std::vector<GateRef> vec;
|
||||
size_t numArgs = gateAcc.GetNumValueIn(gate);
|
||||
for (size_t i = 0; i < numArgs; i++) {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -19,10 +19,11 @@
|
||||
#include "ecmascript/js_api_arraylist.h"
|
||||
#include "ecmascript/js_object.h"
|
||||
#include "ecmascript/message_string.h"
|
||||
#include "ecmascript/tagged_dictionary.h"
|
||||
#include "ecmascript/tagged_hash_table-inl.h"
|
||||
#include "ecmascript/compiler/rt_call_signature.h"
|
||||
#include "libpandabase/macros.h"
|
||||
|
||||
|
||||
namespace panda::ecmascript::kungfu {
|
||||
Stub::Label::Label(Environment *env)
|
||||
{
|
||||
@ -421,7 +422,7 @@ GateRef Stub::FindElementWithCache(GateRef glue, GateRef layoutInfo, GateRef hCl
|
||||
Jump(&afterExceedCon);
|
||||
}
|
||||
Bind(&afterExceedCon);
|
||||
result = TaggedCastToInt32(CallRuntimeTrampoline(glue, GetInt64Constant(RUNTIME_CALL_ID(FindElementWithCache)), {
|
||||
result = TaggedCastToInt32(CallRuntimeTrampoline(glue, GetInt64Constant(RTSTUB_ID(FindElementWithCache)), {
|
||||
hClass, key, IntBuildTaggedTypeWithNoGC(propsNum)
|
||||
}));
|
||||
Jump(&exit);
|
||||
@ -446,7 +447,7 @@ GateRef Stub::FindElementFromNumberDictionary(GateRef glue, GateRef elements, Ga
|
||||
IntPtrAdd(dataoffset, capcityoffset)));
|
||||
DEFVARIABLE(count, VariableType::INT32(), GetInt32Constant(1));
|
||||
GateRef len = GetInt32Constant(sizeof(int) / sizeof(uint8_t));
|
||||
GateRef hash = CallRuntimeTrampoline(glue, GetInt64Constant(RUNTIME_CALL_ID(GetHash32)),
|
||||
GateRef hash = CallRuntimeTrampoline(glue, GetInt64Constant(RTSTUB_ID(GetHash32)),
|
||||
{ IntBuildTaggedTypeWithNoGC(index), IntBuildTaggedTypeWithNoGC(len) });
|
||||
DEFVARIABLE(entry, VariableType::INT32(),
|
||||
Int32And(TruncInt64ToInt32(ChangeTaggedPointerToInt64(hash)), Int32Sub(capacity, GetInt32Constant(1))));
|
||||
@ -525,7 +526,7 @@ GateRef Stub::FindEntryFromNameDictionary(GateRef glue, GateRef elements, GateRe
|
||||
Bind(&isString);
|
||||
{
|
||||
hash = TruncInt64ToInt32(ChangeTaggedPointerToInt64(CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(RUNTIME_CALL_ID(StringGetHashCode)), { key })));
|
||||
GetInt64Constant(RTSTUB_ID(StringGetHashCode)), { key })));
|
||||
Jump(&beforeDefineHash);
|
||||
}
|
||||
Bind(¬String);
|
||||
@ -539,7 +540,7 @@ GateRef Stub::FindEntryFromNameDictionary(GateRef glue, GateRef elements, GateRe
|
||||
Jump(&loopHead);
|
||||
LoopBegin(&loopHead);
|
||||
{
|
||||
GateRef element = GetKeyFromDictionary(VariableType::JS_ANY(), elements, *entry);
|
||||
GateRef element = GetKeyFromDictionary<NameDictionary>(VariableType::JS_ANY(), elements, *entry);
|
||||
Label isHole(env);
|
||||
Label notHole(env);
|
||||
Branch(TaggedIsHole(element), &isHole, ¬Hole);
|
||||
@ -636,7 +637,7 @@ GateRef Stub::FindEntryFromTransitionDictionary(GateRef glue, GateRef elements,
|
||||
Bind(&isString);
|
||||
{
|
||||
hash = TruncInt64ToInt32(ChangeTaggedPointerToInt64(CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(RUNTIME_CALL_ID(StringGetHashCode)), { key })));
|
||||
GetInt64Constant(RTSTUB_ID(StringGetHashCode)), { key })));
|
||||
Jump(&beforeDefineHash);
|
||||
}
|
||||
Bind(¬String);
|
||||
@ -809,7 +810,7 @@ GateRef Stub::CallSetterUtil(GateRef glue, GateRef holder, GateRef accessor, Gat
|
||||
env->PushCurrentLabel(&subEntry);
|
||||
Label exit(env);
|
||||
DEFVARIABLE(result, VariableType::INT64(), GetUndefinedConstant(VariableType::INT64()));
|
||||
GateRef callRes = CallRuntimeTrampoline(glue, GetInt64Constant(RUNTIME_CALL_ID(CallSetter)), {
|
||||
GateRef callRes = CallRuntimeTrampoline(glue, GetInt64Constant(RTSTUB_ID(CallSetter)), {
|
||||
accessor, holder, value, TaggedTrue()
|
||||
});
|
||||
Label callSuccess(env);
|
||||
@ -888,12 +889,12 @@ void Stub::JSHClassAddProperty(GateRef glue, GateRef receiver, GateRef key, Gate
|
||||
GateRef size = Int32Mul(GetInlinedPropsStartFromHClass(hclass),
|
||||
GetInt32Constant(JSTaggedValue::TaggedTypeSize()));
|
||||
GateRef inlineProps = GetInlinedPropertiesFromHClass(hclass);
|
||||
GateRef newJshclass = CallRuntimeTrampoline(glue, GetInt64Constant(RUNTIME_CALL_ID(NewEcmaDynClass)), {
|
||||
GateRef newJshclass = CallRuntimeTrampoline(glue, GetInt64Constant(RTSTUB_ID(NewEcmaDynClass)), {
|
||||
IntBuildTaggedTypeWithNoGC(size), IntBuildTaggedTypeWithNoGC(type),
|
||||
IntBuildTaggedTypeWithNoGC(inlineProps)
|
||||
});
|
||||
CopyAllHClass(glue, newJshclass, hclass);
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(RUNTIME_CALL_ID(UpdateLayOutAndAddTransition)), {
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(RTSTUB_ID(UpdateLayOutAndAddTransition)), {
|
||||
hclass, newJshclass, key, IntBuildTaggedTypeWithNoGC(attr) });
|
||||
#if ECMASCRIPT_ENABLE_IC
|
||||
NotifyHClassChanged(glue, hclass, newJshclass);
|
||||
@ -976,7 +977,7 @@ GateRef Stub::AddPropertyByName(GateRef glue, GateRef receiver, GateRef key, Gat
|
||||
{
|
||||
length = GetInt32Constant(JSObject::MIN_PROPERTIES_LENGTH);
|
||||
array = CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(RUNTIME_CALL_ID(NewTaggedArray)), { IntBuildTaggedTypeWithNoGC(*length) });
|
||||
GetInt64Constant(RTSTUB_ID(NewTaggedArray)), { IntBuildTaggedTypeWithNoGC(*length) });
|
||||
SetPropertiesArray(glue, receiver, *array);
|
||||
Jump(&afterLenCon);
|
||||
}
|
||||
@ -991,7 +992,7 @@ GateRef Stub::AddPropertyByName(GateRef glue, GateRef receiver, GateRef key, Gat
|
||||
Bind(&isDictMode);
|
||||
{
|
||||
GateRef res = CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(RUNTIME_CALL_ID(NameDictPutIfAbsent)), {
|
||||
GetInt64Constant(RTSTUB_ID(NameDictPutIfAbsent)), {
|
||||
receiver, *array, key, value, IntBuildTaggedTypeWithNoGC(*attr), TaggedFalse()
|
||||
});
|
||||
SetPropertiesArray(glue, receiver, res);
|
||||
@ -1019,7 +1020,7 @@ GateRef Stub::AddPropertyByName(GateRef glue, GateRef receiver, GateRef key, Gat
|
||||
attr = SetDictionaryOrderFieldInPropAttr(*attr,
|
||||
GetInt32Constant(PropertyAttributes::MAX_CAPACITY_OF_PROPERTIES));
|
||||
GateRef res = CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(RUNTIME_CALL_ID(NameDictPutIfAbsent)), {
|
||||
GetInt64Constant(RTSTUB_ID(NameDictPutIfAbsent)), {
|
||||
receiver, *array, key, value, IntBuildTaggedTypeWithNoGC(*attr), TaggedTrue()
|
||||
});
|
||||
SetPropertiesArray(glue, receiver, res);
|
||||
@ -1031,7 +1032,7 @@ GateRef Stub::AddPropertyByName(GateRef glue, GateRef receiver, GateRef key, Gat
|
||||
}
|
||||
Bind(&afterDictChangeCon);
|
||||
GateRef capacity = ComputePropertyCapacityInJSObj(*length);
|
||||
array = CallRuntimeTrampoline(glue, GetInt64Constant(RUNTIME_CALL_ID(CopyArray)),
|
||||
array = CallRuntimeTrampoline(glue, GetInt64Constant(RTSTUB_ID(CopyArray)),
|
||||
{ *array, IntBuildTaggedTypeWithNoGC(*length), IntBuildTaggedTypeWithNoGC(capacity) });
|
||||
SetPropertiesArray(glue, receiver, *array);
|
||||
Jump(&afterArrLenCon);
|
||||
@ -1057,7 +1058,7 @@ GateRef Stub::AddPropertyByName(GateRef glue, GateRef receiver, GateRef key, Gat
|
||||
void Stub::ThrowTypeAndReturn(GateRef glue, int messageId, GateRef val)
|
||||
{
|
||||
GateRef msgIntId = GetInt32Constant(messageId);
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(RUNTIME_CALL_ID(ThrowTypeError)),
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(RTSTUB_ID(ThrowTypeError)),
|
||||
{ IntBuildTaggedTypeWithNoGC(msgIntId) });
|
||||
Return(val);
|
||||
}
|
||||
@ -1178,9 +1179,10 @@ void Stub::SetValueWithBarrier(GateRef glue, GateRef obj, GateRef offset, GateRe
|
||||
}
|
||||
Bind(&isNullPtr);
|
||||
{
|
||||
StubDescriptor *insertOldToNewRememberedSet = GET_STUBDESCRIPTOR(InsertOldToNewRememberedSet);
|
||||
const CallSignature *insertOldToNewRememberedSet =
|
||||
RuntimeStubCSigns::Get(RTSTUB_ID(InsertOldToNewRememberedSet));
|
||||
CallRuntime(insertOldToNewRememberedSet, glue,
|
||||
GetIntPtrConstant(FAST_STUB_ID(InsertOldToNewRememberedSet)),
|
||||
GetIntPtrConstant(RTSTUB_ID(InsertOldToNewRememberedSet) + NOGC_RTSTUB_CSIGNS_BEGIN),
|
||||
{ glue, objectRegion, slotAddr });
|
||||
Jump(¬ValidIndex);
|
||||
}
|
||||
@ -1195,8 +1197,9 @@ void Stub::SetValueWithBarrier(GateRef glue, GateRef obj, GateRef offset, GateRe
|
||||
Branch(Int64Equal(stateBitField, GetInt64Constant(0)), &exit, &marking);
|
||||
|
||||
Bind(&marking);
|
||||
StubDescriptor *markingBarrier = GET_STUBDESCRIPTOR(MarkingBarrier);
|
||||
CallRuntime(markingBarrier, glue, GetIntPtrConstant(FAST_STUB_ID(MarkingBarrier)), {
|
||||
const CallSignature *markingBarrier = RuntimeStubCSigns::Get(RTSTUB_ID(MarkingBarrier));
|
||||
CallRuntime(markingBarrier, glue,
|
||||
GetIntPtrConstant(RTSTUB_ID(MarkingBarrier) + NOGC_RTSTUB_CSIGNS_BEGIN), {
|
||||
glue, slotAddr, objectRegion, TaggedCastToIntPtr(value), valueRegion });
|
||||
Jump(&exit);
|
||||
}
|
||||
@ -1590,7 +1593,7 @@ GateRef Stub::LoadICWithHandler(GateRef glue, GateRef receiver, GateRef argHolde
|
||||
Jump(&exit);
|
||||
Bind(&handlerInfoNotNonExist);
|
||||
GateRef accessor = LoadFromField(*holder, handlerInfo);
|
||||
result = CallRuntimeTrampoline(glue, GetInt64Constant(RUNTIME_CALL_ID(CallGetter2)),
|
||||
result = CallRuntimeTrampoline(glue, GetInt64Constant(RTSTUB_ID(CallGetter2)),
|
||||
{ receiver, *holder, accessor });
|
||||
Jump(&exit);
|
||||
}
|
||||
@ -1710,7 +1713,7 @@ GateRef Stub::ICStoreElement(GateRef glue, GateRef receiver, GateRef key, GateRe
|
||||
Bind(&callRuntime);
|
||||
{
|
||||
result = ChangeTaggedPointerToInt64(CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(RUNTIME_CALL_ID(TaggedArraySetValue)), {
|
||||
GetInt64Constant(RTSTUB_ID(TaggedArraySetValue)), {
|
||||
receiver, value, elements, IntBuildTaggedTypeWithNoGC(index),
|
||||
IntBuildTaggedTypeWithNoGC(capacity)
|
||||
}));
|
||||
@ -1812,7 +1815,7 @@ GateRef Stub::StoreICWithHandler(GateRef glue, GateRef receiver, GateRef argHold
|
||||
{
|
||||
GateRef accessor = LoadFromField(*holder, handlerInfo);
|
||||
result = ChangeTaggedPointerToInt64(CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(RUNTIME_CALL_ID(CallSetter2)), {
|
||||
GetInt64Constant(RTSTUB_ID(CallSetter2)), {
|
||||
receiver, value, accessor
|
||||
}));
|
||||
Jump(&exit);
|
||||
@ -1913,7 +1916,7 @@ void Stub::StoreWithTransition(GateRef glue, GateRef receiver, GateRef value, Ga
|
||||
Branch(Int32GreaterThanOrEqual(index, capacity), &indexMoreCapacity, &indexLessCapacity);
|
||||
Bind(&indexMoreCapacity);
|
||||
{
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(RUNTIME_CALL_ID(PropertiesSetValue)), {
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(RTSTUB_ID(PropertiesSetValue)), {
|
||||
receiver, value, array, IntBuildTaggedTypeWithNoGC(capacity), IntBuildTaggedTypeWithNoGC(index)
|
||||
});
|
||||
Jump(&exit);
|
||||
@ -1961,6 +1964,85 @@ GateRef Stub::StoreGlobal(GateRef glue, GateRef value, GateRef cell)
|
||||
return ret;
|
||||
}
|
||||
|
||||
template<typename DictionaryT>
|
||||
GateRef Stub::GetAttributesFromDictionary(GateRef elements, GateRef entry)
|
||||
{
|
||||
GateRef arrayIndex =
|
||||
Int32Add(GetInt32Constant(DictionaryT::TABLE_HEADER_SIZE),
|
||||
Int32Mul(entry, GetInt32Constant(DictionaryT::ENTRY_SIZE)));
|
||||
GateRef attributesIndex =
|
||||
Int32Add(arrayIndex, GetInt32Constant(DictionaryT::ENTRY_DETAILS_INDEX));
|
||||
return TaggedCastToInt32(GetValueFromTaggedArray(VariableType::INT64(), elements, attributesIndex));
|
||||
}
|
||||
|
||||
template<typename DictionaryT>
|
||||
GateRef Stub::GetValueFromDictionary(VariableType returnType, GateRef elements, GateRef entry)
|
||||
{
|
||||
GateRef arrayIndex =
|
||||
Int32Add(GetInt32Constant(DictionaryT::TABLE_HEADER_SIZE),
|
||||
Int32Mul(entry, GetInt32Constant(DictionaryT::ENTRY_SIZE)));
|
||||
GateRef valueIndex =
|
||||
Int32Add(arrayIndex, GetInt32Constant(DictionaryT::ENTRY_VALUE_INDEX));
|
||||
return GetValueFromTaggedArray(returnType, elements, valueIndex);
|
||||
}
|
||||
|
||||
template<typename DictionaryT>
|
||||
GateRef Stub::GetKeyFromDictionary(VariableType returnType, GateRef elements, GateRef entry)
|
||||
{
|
||||
auto env = GetEnvironment();
|
||||
Label subentry(env);
|
||||
env->PushCurrentLabel(&subentry);
|
||||
Label exit(env);
|
||||
DEFVARIABLE(result, returnType, GetUndefinedConstant());
|
||||
Label ltZero(env);
|
||||
Label notLtZero(env);
|
||||
Label gtLength(env);
|
||||
Label notGtLength(env);
|
||||
GateRef dictionaryLength =
|
||||
Load(VariableType::INT32(), elements, GetIntPtrConstant(TaggedArray::LENGTH_OFFSET));
|
||||
GateRef arrayIndex =
|
||||
Int32Add(GetInt32Constant(DictionaryT::TABLE_HEADER_SIZE),
|
||||
Int32Mul(entry, GetInt32Constant(DictionaryT::ENTRY_SIZE)));
|
||||
Branch(Int32LessThan(arrayIndex, GetInt32Constant(0)), <Zero, ¬LtZero);
|
||||
Bind(<Zero);
|
||||
Jump(&exit);
|
||||
Bind(¬LtZero);
|
||||
Branch(Int32GreaterThan(arrayIndex, dictionaryLength), >Length, ¬GtLength);
|
||||
Bind(>Length);
|
||||
Jump(&exit);
|
||||
Bind(¬GtLength);
|
||||
result = GetValueFromTaggedArray(returnType, elements, arrayIndex);
|
||||
Jump(&exit);
|
||||
Bind(&exit);
|
||||
auto ret = *result;
|
||||
env->PopCurrentLabel();
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline void Stub::UpdateValueAndAttributes(GateRef glue, GateRef elements, GateRef index, GateRef value, GateRef attr)
|
||||
{
|
||||
GateRef arrayIndex =
|
||||
Int32Add(GetInt32Constant(NameDictionary::TABLE_HEADER_SIZE),
|
||||
Int32Mul(index, GetInt32Constant(NameDictionary::ENTRY_SIZE)));
|
||||
GateRef valueIndex =
|
||||
Int32Add(arrayIndex, GetInt32Constant(NameDictionary::ENTRY_VALUE_INDEX));
|
||||
GateRef attributesIndex =
|
||||
Int32Add(arrayIndex, GetInt32Constant(NameDictionary::ENTRY_DETAILS_INDEX));
|
||||
SetValueToTaggedArray(VariableType::JS_ANY(), glue, elements, valueIndex, value);
|
||||
GateRef attroffset =
|
||||
IntPtrMul(ChangeInt32ToIntPtr(attributesIndex), GetIntPtrConstant(JSTaggedValue::TaggedTypeSize()));
|
||||
GateRef dataOffset = IntPtrAdd(attroffset, GetIntPtrConstant(TaggedArray::DATA_OFFSET));
|
||||
Store(VariableType::INT64(), glue, elements, dataOffset, IntBuildTaggedWithNoGC(attr));
|
||||
}
|
||||
|
||||
inline void Stub::UpdateValueInDict(GateRef glue, GateRef elements, GateRef index, GateRef value)
|
||||
{
|
||||
GateRef arrayIndex = Int32Add(GetInt32Constant(NameDictionary::TABLE_HEADER_SIZE),
|
||||
Int32Mul(index, GetInt32Constant(NameDictionary::ENTRY_SIZE)));
|
||||
GateRef valueIndex = Int32Add(arrayIndex, GetInt32Constant(NameDictionary::ENTRY_VALUE_INDEX));
|
||||
SetValueToTaggedArray(VariableType::JS_ANY(), glue, elements, valueIndex, value);
|
||||
}
|
||||
|
||||
GateRef Stub::GetPropertyByIndex(GateRef glue, GateRef receiver, GateRef index)
|
||||
{
|
||||
auto env = GetEnvironment();
|
||||
@ -2052,13 +2134,13 @@ GateRef Stub::GetPropertyByIndex(GateRef glue, GateRef receiver, GateRef index)
|
||||
Bind(&isInternal);
|
||||
{
|
||||
result = CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(RUNTIME_CALL_ID(CallInternalGetter)), { value, *holder });
|
||||
GetInt64Constant(RTSTUB_ID(CallInternalGetter)), { value, *holder });
|
||||
Jump(&exit);
|
||||
}
|
||||
Bind(¬Internal);
|
||||
{
|
||||
result = CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(RUNTIME_CALL_ID(CallGetter)), { value, receiver });
|
||||
GetInt64Constant(RTSTUB_ID(CallGetter)), { value, receiver });
|
||||
Jump(&exit);
|
||||
}
|
||||
}
|
||||
@ -2145,13 +2227,13 @@ GateRef Stub::GetPropertyByName(GateRef glue, GateRef receiver, GateRef key)
|
||||
Bind(&isInternal);
|
||||
{
|
||||
result = CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(RUNTIME_CALL_ID(CallInternalGetter)), { value, *holder });
|
||||
GetInt64Constant(RTSTUB_ID(CallInternalGetter)), { value, *holder });
|
||||
Jump(&exit);
|
||||
}
|
||||
Bind(¬Internal);
|
||||
{
|
||||
result = CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(RUNTIME_CALL_ID(CallGetter)), { value, receiver });
|
||||
GetInt64Constant(RTSTUB_ID(CallGetter)), { value, receiver });
|
||||
Jump(&exit);
|
||||
}
|
||||
}
|
||||
@ -2175,8 +2257,8 @@ GateRef Stub::GetPropertyByName(GateRef glue, GateRef receiver, GateRef key)
|
||||
Branch(Int32NotEqual(entry, GetInt32Constant(-1)), ¬NegtiveOne, &negtiveOne);
|
||||
Bind(¬NegtiveOne);
|
||||
{
|
||||
GateRef attr = GetAttributesFromDictionary(array, entry);
|
||||
GateRef value = GetValueFromDictionary(VariableType::JS_ANY(), array, entry);
|
||||
GateRef attr = GetAttributesFromDictionary<NameDictionary>(array, entry);
|
||||
GateRef value = GetValueFromDictionary<NameDictionary>(VariableType::JS_ANY(), array, entry);
|
||||
Label isAccessor1(env);
|
||||
Label notAccessor1(env);
|
||||
Branch(IsAccessor(attr), &isAccessor1, ¬Accessor1);
|
||||
@ -2188,13 +2270,13 @@ GateRef Stub::GetPropertyByName(GateRef glue, GateRef receiver, GateRef key)
|
||||
Bind(&isInternal1);
|
||||
{
|
||||
result = CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(RUNTIME_CALL_ID(CallInternalGetter)), { value, *holder });
|
||||
GetInt64Constant(RTSTUB_ID(CallInternalGetter)), { value, *holder });
|
||||
Jump(&exit);
|
||||
}
|
||||
Bind(¬Internal1);
|
||||
{
|
||||
result = CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(RUNTIME_CALL_ID(CallGetter)), { value, receiver });
|
||||
GetInt64Constant(RTSTUB_ID(CallGetter)), { value, receiver });
|
||||
Jump(&exit);
|
||||
}
|
||||
}
|
||||
@ -2410,7 +2492,7 @@ GateRef Stub::SetPropertyByIndex(GateRef glue, GateRef receiver, GateRef index,
|
||||
Bind(&isExtensible);
|
||||
{
|
||||
GateRef result =
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(RUNTIME_CALL_ID(AddElementInternal)), {
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(RTSTUB_ID(AddElementInternal)), {
|
||||
receiver, IntBuildTaggedTypeWithNoGC(index), value,
|
||||
IntBuildTaggedTypeWithNoGC(GetInt32Constant(PropertyAttributes::GetDefaultAttributes()))
|
||||
});
|
||||
@ -2428,7 +2510,7 @@ GateRef Stub::SetPropertyByIndex(GateRef glue, GateRef receiver, GateRef index,
|
||||
{
|
||||
GateRef taggedId = GetInt32Constant(GET_MESSAGE_STRING_ID(SetPropertyWhenNotExtensible));
|
||||
CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(RUNTIME_CALL_ID(ThrowTypeError)), { IntBuildTaggedTypeWithNoGC(taggedId) });
|
||||
GetInt64Constant(RTSTUB_ID(ThrowTypeError)), { IntBuildTaggedTypeWithNoGC(taggedId) });
|
||||
returnValue = GetExceptionConstant(VariableType::INT64());
|
||||
Jump(&exit);
|
||||
}
|
||||
@ -2472,7 +2554,7 @@ GateRef Stub::SetPropertyByName(GateRef glue, GateRef receiver, GateRef key, Gat
|
||||
Bind(&isSpecialContainer);
|
||||
{
|
||||
GateRef taggedId = GetInt32Constant(GET_MESSAGE_STRING_ID(CanNotSetPropertyOnContainer));
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(RUNTIME_CALL_ID(ThrowTypeError)),
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(RTSTUB_ID(ThrowTypeError)),
|
||||
{ IntBuildTaggedTypeWithNoGC(taggedId) });
|
||||
result = GetExceptionConstant(VariableType::INT64());
|
||||
Jump(&exit);
|
||||
@ -2539,7 +2621,7 @@ GateRef Stub::SetPropertyByName(GateRef glue, GateRef receiver, GateRef key, Gat
|
||||
Jump(&afterIsWritable);
|
||||
Bind(¬Writable);
|
||||
GateRef taggedId = GetInt32Constant(GET_MESSAGE_STRING_ID(SetPropertyWhenNotExtensible));
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(RUNTIME_CALL_ID(ThrowTypeError)),
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(RTSTUB_ID(ThrowTypeError)),
|
||||
{ IntBuildTaggedTypeWithNoGC(taggedId) });
|
||||
result = GetExceptionConstant(VariableType::INT64());
|
||||
Jump(&exit);
|
||||
@ -2582,7 +2664,7 @@ GateRef Stub::SetPropertyByName(GateRef glue, GateRef receiver, GateRef key, Gat
|
||||
Bind(¬NegtiveOne);
|
||||
{
|
||||
// auto attr = dict->GetAttributes(entry)
|
||||
GateRef attr1 = GetAttributesFromDictionary(array, entry1);
|
||||
GateRef attr1 = GetAttributesFromDictionary<NameDictionary>(array, entry1);
|
||||
Label isAccessor1(env);
|
||||
Label notAccessor1(env);
|
||||
Label afterIsAccessor1(env);
|
||||
@ -2593,7 +2675,8 @@ GateRef Stub::SetPropertyByName(GateRef glue, GateRef receiver, GateRef key, Gat
|
||||
Label isInternal1(env);
|
||||
Label notInternal1(env);
|
||||
// auto accessor = dict->GetValue(entry)
|
||||
GateRef accessor1 = GetValueFromDictionary(VariableType::JS_ANY(), array, entry1);
|
||||
GateRef accessor1 = GetValueFromDictionary<NameDictionary>(VariableType::JS_ANY(),
|
||||
array, entry1);
|
||||
Label shouldCall1(env);
|
||||
Label shouldNotCall1(env);
|
||||
Branch(ShouldCallSetter(receiver, *holder, accessor1, attr1), &shouldCall1, &shouldNotCall1);
|
||||
@ -2616,7 +2699,7 @@ GateRef Stub::SetPropertyByName(GateRef glue, GateRef receiver, GateRef key, Gat
|
||||
Jump(&afterIsWritable1);
|
||||
Bind(¬Writable1);
|
||||
GateRef taggedId = GetInt32Constant(GET_MESSAGE_STRING_ID(SetPropertyWhenNotExtensible));
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(RUNTIME_CALL_ID(ThrowTypeError)),
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(RTSTUB_ID(ThrowTypeError)),
|
||||
{ IntBuildTaggedTypeWithNoGC(taggedId) });
|
||||
result = GetExceptionConstant(VariableType::INT64());
|
||||
Jump(&exit);
|
||||
@ -2667,7 +2750,7 @@ GateRef Stub::SetPropertyByName(GateRef glue, GateRef receiver, GateRef key, Gat
|
||||
Jump(&afterExtenCon);
|
||||
Bind(&inextensible);
|
||||
GateRef taggedId = GetInt32Constant(GET_MESSAGE_STRING_ID(SetPropertyWhenNotExtensible));
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(RUNTIME_CALL_ID(ThrowTypeError)),
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(RTSTUB_ID(ThrowTypeError)),
|
||||
{ IntBuildTaggedTypeWithNoGC(taggedId) });
|
||||
result = GetExceptionConstant(VariableType::INT64());
|
||||
Jump(&exit);
|
||||
@ -2709,7 +2792,7 @@ GateRef Stub::SetPropertyByNameWithOwn(GateRef glue, GateRef receiver, GateRef k
|
||||
Bind(&isSpecialContainer);
|
||||
{
|
||||
GateRef taggedId = GetInt32Constant(GET_MESSAGE_STRING_ID(CanNotSetPropertyOnContainer));
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(RUNTIME_CALL_ID(ThrowTypeError)),
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(RTSTUB_ID(ThrowTypeError)),
|
||||
{ IntBuildTaggedTypeWithNoGC(taggedId) });
|
||||
result = GetExceptionConstant(VariableType::INT64());
|
||||
Jump(&exit);
|
||||
@ -2777,7 +2860,7 @@ GateRef Stub::SetPropertyByNameWithOwn(GateRef glue, GateRef receiver, GateRef k
|
||||
Bind(¬Writable);
|
||||
GateRef taggedId = GetInt32Constant(GET_MESSAGE_STRING_ID(SetPropertyWhenNotExtensible));
|
||||
CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(RUNTIME_CALL_ID(ThrowTypeError)), { IntBuildTaggedTypeWithNoGC(taggedId) });
|
||||
GetInt64Constant(RTSTUB_ID(ThrowTypeError)), { IntBuildTaggedTypeWithNoGC(taggedId) });
|
||||
result = GetExceptionConstant(VariableType::INT64());
|
||||
Jump(&exit);
|
||||
}
|
||||
@ -2820,7 +2903,7 @@ GateRef Stub::SetPropertyByNameWithOwn(GateRef glue, GateRef receiver, GateRef k
|
||||
Bind(¬NegtiveOne);
|
||||
{
|
||||
// auto attr = dict->GetAttributes(entry)
|
||||
GateRef attr1 = GetAttributesFromDictionary(array, entry1);
|
||||
GateRef attr1 = GetAttributesFromDictionary<NameDictionary>(array, entry1);
|
||||
Label isAccessor1(env);
|
||||
Label notAccessor1(env);
|
||||
Label afterIsAccessor1(env);
|
||||
@ -2831,7 +2914,7 @@ GateRef Stub::SetPropertyByNameWithOwn(GateRef glue, GateRef receiver, GateRef k
|
||||
Label isInternal1(env);
|
||||
Label notInternal1(env);
|
||||
// auto accessor = dict->GetValue(entry)
|
||||
GateRef accessor1 = GetValueFromDictionary(VariableType::JS_ANY(), array, entry1);
|
||||
GateRef accessor1 = GetValueFromDictionary<NameDictionary>(VariableType::JS_ANY(), array, entry1);
|
||||
Label shouldCall1(env);
|
||||
Label shouldNotCall1(env);
|
||||
Branch(ShouldCallSetter(receiver, *holder, accessor1, attr1), &shouldCall1, &shouldNotCall1);
|
||||
@ -2855,7 +2938,7 @@ GateRef Stub::SetPropertyByNameWithOwn(GateRef glue, GateRef receiver, GateRef k
|
||||
Bind(¬Writable1);
|
||||
GateRef taggedId = GetInt32Constant(GET_MESSAGE_STRING_ID(SetPropertyWhenNotExtensible));
|
||||
CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(RUNTIME_CALL_ID(ThrowTypeError)), { IntBuildTaggedTypeWithNoGC(taggedId) });
|
||||
GetInt64Constant(RTSTUB_ID(ThrowTypeError)), { IntBuildTaggedTypeWithNoGC(taggedId) });
|
||||
result = GetExceptionConstant(VariableType::INT64());
|
||||
Jump(&exit);
|
||||
}
|
||||
@ -2895,7 +2978,7 @@ GateRef Stub::SetPropertyByNameWithOwn(GateRef glue, GateRef receiver, GateRef k
|
||||
Jump(&afterExtenCon);
|
||||
Bind(&inextensible);
|
||||
GateRef taggedId = GetInt32Constant(GET_MESSAGE_STRING_ID(SetPropertyWhenNotExtensible));
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(RUNTIME_CALL_ID(ThrowTypeError)),
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(RTSTUB_ID(ThrowTypeError)),
|
||||
{ IntBuildTaggedTypeWithNoGC(taggedId) });
|
||||
result = GetExceptionConstant(VariableType::INT64());
|
||||
Jump(&exit);
|
||||
@ -2926,7 +3009,7 @@ void Stub::NotifyHClassChanged(GateRef glue, GateRef oldHClass, GateRef newHClas
|
||||
Bind(¬EqualHClass);
|
||||
{
|
||||
SetIsProtoTypeToHClass(glue, newHClass, TrueConstant());
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(RUNTIME_CALL_ID(NoticeThroughChainAndRefreshUser)), {
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(RTSTUB_ID(NoticeThroughChainAndRefreshUser)), {
|
||||
oldHClass, newHClass
|
||||
});
|
||||
Jump(&exit);
|
||||
@ -3552,7 +3635,7 @@ GateRef Stub::FastMod(GateRef glue, GateRef left, GateRef right)
|
||||
Bind(&rightNotInf);
|
||||
{
|
||||
doubleLeft = TaggedCastToDouble(CallRuntimeTrampoline(glue,
|
||||
GetInt64Constant(RUNTIME_CALL_ID(FloatMod)), { DoubleBuildTaggedTypeWithNoGC(*doubleLeft),
|
||||
GetInt64Constant(RTSTUB_ID(FloatMod)), { DoubleBuildTaggedTypeWithNoGC(*doubleLeft),
|
||||
DoubleBuildTaggedTypeWithNoGC(*doubleRight)
|
||||
}));
|
||||
result = DoubleBuildTaggedWithNoGC(*doubleLeft);
|
||||
@ -3618,7 +3701,7 @@ GateRef Stub::JSArrayListGet(GateRef glue, GateRef receiver, GateRef index)
|
||||
Bind(¬ValidIndex);
|
||||
{
|
||||
GateRef taggedId = GetInt32Constant(GET_MESSAGE_STRING_ID(GetPropertyOutOfBounds));
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(RUNTIME_CALL_ID(ThrowTypeError)),
|
||||
CallRuntimeTrampoline(glue, GetInt64Constant(RTSTUB_ID(ThrowTypeError)),
|
||||
{ IntBuildTaggedTypeWithNoGC(taggedId) });
|
||||
result = GetExceptionConstant();
|
||||
Jump(&exit);
|
||||
@ -3656,9 +3739,9 @@ GateRef Stub::DoubleToInt(GateRef glue, GateRef x)
|
||||
}
|
||||
Bind(&overflow);
|
||||
{
|
||||
StubDescriptor *doubleToInt = GET_STUBDESCRIPTOR(DoubleToInt);
|
||||
const CallSignature *doubleToInt = RuntimeStubCSigns::Get(RTSTUB_ID(DoubleToInt));
|
||||
result = CallRuntime(doubleToInt, glue,
|
||||
GetIntPtrConstant(FAST_STUB_ID(DoubleToInt)), { x });
|
||||
GetIntPtrConstant(RTSTUB_ID(DoubleToInt) + NOGC_RTSTUB_CSIGNS_BEGIN), { x });
|
||||
Jump(&exit);
|
||||
}
|
||||
Bind(&exit);
|
||||
|
@ -16,31 +16,19 @@
|
||||
#ifndef ECMASCRIPT_COMPILER_STUB_H
|
||||
#define ECMASCRIPT_COMPILER_STUB_H
|
||||
|
||||
#include "ecmascript/accessor_data.h"
|
||||
#include "ecmascript/base/number_helper.h"
|
||||
#include "ecmascript/compiler/circuit.h"
|
||||
#include "ecmascript/compiler/circuit_builder.h"
|
||||
#include "ecmascript/compiler/circuit_builder-inl.h"
|
||||
#include "ecmascript/compiler/gate.h"
|
||||
#include "ecmascript/compiler/variable_type.h"
|
||||
#include "ecmascript/compiler/stub_descriptor.h"
|
||||
#include "ecmascript/global_dictionary.h"
|
||||
#include "ecmascript/ic/ic_handler.h"
|
||||
#include "ecmascript/ic/proto_change_details.h"
|
||||
#include "ecmascript/js_array.h"
|
||||
#include "ecmascript/js_function.h"
|
||||
#include "ecmascript/js_generator_object.h"
|
||||
#include "ecmascript/js_object.h"
|
||||
#include "ecmascript/js_tagged_value.h"
|
||||
#include "ecmascript/layout_info.h"
|
||||
#include "ecmascript/message_string.h"
|
||||
#include "ecmascript/tagged_dictionary.h"
|
||||
#include "ecmascript/compiler/call_signature.h"
|
||||
#include "ecmascript/global_env_constants.h"
|
||||
|
||||
namespace panda::ecmascript::kungfu {
|
||||
using namespace panda::ecmascript;
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
||||
#define DEFVARIABLE(varname, type, val) Stub::Variable varname(GetEnvironment(), type, NextVariableId(), val)
|
||||
|
||||
#define NOGC_RTSTUB_CSIGNS_BEGIN (CommonStubCSigns::NUM_OF_STUBS + BytecodeStubCSigns::NUM_OF_VALID_STUBS)
|
||||
class CompilationConfig {
|
||||
public:
|
||||
enum class Triple {
|
||||
@ -188,20 +176,20 @@ public:
|
||||
Label &operator=(Label const &label) = default;
|
||||
Label(Label &&label) = default;
|
||||
Label &operator=(Label &&label) = default;
|
||||
inline void Seal();
|
||||
inline void WriteVariable(Variable *var, GateRef value);
|
||||
inline GateRef ReadVariable(Variable *var);
|
||||
inline void Bind();
|
||||
inline void MergeAllControl();
|
||||
inline void MergeAllDepend();
|
||||
inline void AppendPredecessor(const Label *predecessor);
|
||||
inline std::vector<Label> GetPredecessors() const;
|
||||
inline void SetControl(GateRef control);
|
||||
inline void SetPreControl(GateRef control);
|
||||
inline void MergeControl(GateRef control);
|
||||
inline GateRef GetControl() const;
|
||||
inline GateRef GetDepend() const;
|
||||
inline void SetDepend(GateRef depend);
|
||||
void Seal();
|
||||
void WriteVariable(Variable *var, GateRef value);
|
||||
GateRef ReadVariable(Variable *var);
|
||||
void Bind();
|
||||
void MergeAllControl();
|
||||
void MergeAllDepend();
|
||||
void AppendPredecessor(const Label *predecessor);
|
||||
std::vector<Label> GetPredecessors() const;
|
||||
void SetControl(GateRef control);
|
||||
void SetPreControl(GateRef control);
|
||||
void MergeControl(GateRef control);
|
||||
GateRef GetControl() const;
|
||||
GateRef GetDepend() const;
|
||||
void SetDepend(GateRef depend);
|
||||
private:
|
||||
friend class Environment;
|
||||
LabelImpl *GetRawLabel() const
|
||||
@ -269,14 +257,14 @@ public:
|
||||
return compCfg_->Is32Bit();
|
||||
}
|
||||
|
||||
inline GateType GetGateType(GateRef gate) const;
|
||||
inline Label GetLabelFromSelector(GateRef sel);
|
||||
inline void AddSelectorToLabel(GateRef sel, Label label);
|
||||
inline LabelImpl *NewLabel(Environment *env, GateRef control = -1);
|
||||
inline void PushCurrentLabel(Label *entry);
|
||||
inline void PopCurrentLabel();
|
||||
inline void SetFrameType(FrameType type);
|
||||
inline GateRef GetArgument(size_t index) const;
|
||||
GateType GetGateType(GateRef gate) const;
|
||||
Label GetLabelFromSelector(GateRef sel);
|
||||
void AddSelectorToLabel(GateRef sel, Label label);
|
||||
LabelImpl *NewLabel(Environment *env, GateRef control = -1);
|
||||
void PushCurrentLabel(Label *entry);
|
||||
void PopCurrentLabel();
|
||||
void SetFrameType(FrameType type);
|
||||
GateRef GetArgument(size_t index) const;
|
||||
private:
|
||||
const CompilationConfig *compCfg_;
|
||||
Label *currentLabel_ {nullptr};
|
||||
@ -386,37 +374,37 @@ public:
|
||||
return methodName_;
|
||||
}
|
||||
// constant
|
||||
inline GateRef GetInt8Constant(int8_t value);
|
||||
inline GateRef GetInt16Constant(int16_t value);
|
||||
inline GateRef GetInt32Constant(int32_t value);
|
||||
inline GateRef GetInt64Constant(int64_t value);
|
||||
inline GateRef GetIntPtrConstant(int64_t value);
|
||||
inline GateRef GetIntPtrSize();
|
||||
inline GateRef GetRelocatableData(uint64_t value);
|
||||
inline GateRef TrueConstant();
|
||||
inline GateRef FalseConstant();
|
||||
inline GateRef GetBooleanConstant(bool value);
|
||||
inline GateRef GetDoubleConstant(double value);
|
||||
inline GateRef GetUndefinedConstant(VariableType type = VariableType::JS_ANY());
|
||||
inline GateRef GetHoleConstant(VariableType type = VariableType::JS_ANY());
|
||||
inline GateRef GetNullConstant(VariableType type = VariableType::JS_ANY());
|
||||
inline GateRef GetExceptionConstant(VariableType type = VariableType::JS_ANY());
|
||||
inline GateRef IntPtrMul(GateRef x, GateRef y);
|
||||
GateRef GetInt8Constant(int8_t value);
|
||||
GateRef GetInt16Constant(int16_t value);
|
||||
GateRef GetInt32Constant(int32_t value);
|
||||
GateRef GetInt64Constant(int64_t value);
|
||||
GateRef GetIntPtrConstant(int64_t value);
|
||||
GateRef GetIntPtrSize();
|
||||
GateRef GetRelocatableData(uint64_t value);
|
||||
GateRef TrueConstant();
|
||||
GateRef FalseConstant();
|
||||
GateRef GetBooleanConstant(bool value);
|
||||
GateRef GetDoubleConstant(double value);
|
||||
GateRef GetUndefinedConstant(VariableType type = VariableType::JS_ANY());
|
||||
GateRef GetHoleConstant(VariableType type = VariableType::JS_ANY());
|
||||
GateRef GetNullConstant(VariableType type = VariableType::JS_ANY());
|
||||
GateRef GetExceptionConstant(VariableType type = VariableType::JS_ANY());
|
||||
GateRef IntPtrMul(GateRef x, GateRef y);
|
||||
// parameter
|
||||
inline GateRef Argument(size_t index);
|
||||
inline GateRef Int1Argument(size_t index);
|
||||
inline GateRef Int32Argument(size_t index);
|
||||
inline GateRef Int64Argument(size_t index);
|
||||
inline GateRef TaggedArgument(size_t index);
|
||||
inline GateRef TaggedPointerArgument(size_t index, GateType type = GateType::TAGGED_POINTER);
|
||||
inline GateRef PtrArgument(size_t index, GateType type = GateType::C_VALUE);
|
||||
inline GateRef Float32Argument(size_t index);
|
||||
inline GateRef Float64Argument(size_t index);
|
||||
inline GateRef Alloca(int size);
|
||||
GateRef Argument(size_t index);
|
||||
GateRef Int1Argument(size_t index);
|
||||
GateRef Int32Argument(size_t index);
|
||||
GateRef Int64Argument(size_t index);
|
||||
GateRef TaggedArgument(size_t index);
|
||||
GateRef TaggedPointerArgument(size_t index, GateType type = GateType::TAGGED_POINTER);
|
||||
GateRef PtrArgument(size_t index, GateType type = GateType::C_VALUE);
|
||||
GateRef Float32Argument(size_t index);
|
||||
GateRef Float64Argument(size_t index);
|
||||
GateRef Alloca(int size);
|
||||
// control flow
|
||||
inline GateRef Return(GateRef value);
|
||||
inline GateRef Return();
|
||||
inline void Bind(Label *label);
|
||||
GateRef Return(GateRef value);
|
||||
GateRef Return();
|
||||
void Bind(Label *label);
|
||||
void Jump(Label *label);
|
||||
void Branch(GateRef condition, Label *trueLabel, Label *falseLabel);
|
||||
void Switch(GateRef index, Label *defaultLabel, int64_t *keysValue, Label *keysLabel, int numberOfKeys);
|
||||
@ -427,235 +415,233 @@ public:
|
||||
void LoopBegin(Label *loopHead);
|
||||
void LoopEnd(Label *loopHead);
|
||||
// call operation
|
||||
inline GateRef CallStub(StubDescriptor *descriptor, GateRef glue, GateRef target,
|
||||
std::initializer_list<GateRef> args);
|
||||
inline GateRef CallStub(StubDescriptor *descriptor, GateRef glue, GateRef target, GateRef depend,
|
||||
std::initializer_list<GateRef> args);
|
||||
inline GateRef CallRuntime(StubDescriptor *descriptor, GateRef glue, GateRef target,
|
||||
std::initializer_list<GateRef> args);
|
||||
inline GateRef CallRuntime(StubDescriptor *descriptor, GateRef glue, GateRef target, GateRef depend,
|
||||
std::initializer_list<GateRef> args);
|
||||
inline GateRef CallRuntimeTrampoline(GateRef glue, GateRef target,
|
||||
std::initializer_list<GateRef> args);
|
||||
inline GateRef CallRuntimeTrampoline(GateRef glue, GateRef target, GateRef depend,
|
||||
std::initializer_list<GateRef> args);
|
||||
inline void DebugPrint(GateRef thread, std::initializer_list<GateRef> args);
|
||||
GateRef CallStub(const CallSignature *descriptor, GateRef glue, GateRef target,
|
||||
std::initializer_list<GateRef> args);
|
||||
GateRef CallStub(const CallSignature *descriptor, GateRef glue, GateRef target, GateRef depend,
|
||||
std::initializer_list<GateRef> args);
|
||||
GateRef CallRuntime(const CallSignature *descriptor, GateRef glue, GateRef target,
|
||||
std::initializer_list<GateRef> args);
|
||||
GateRef CallRuntime(const CallSignature *descriptor, GateRef glue, GateRef target, GateRef depend,
|
||||
std::initializer_list<GateRef> args);
|
||||
GateRef CallRuntimeTrampoline(GateRef glue, GateRef target, std::initializer_list<GateRef> args);
|
||||
GateRef CallRuntimeTrampoline(GateRef glue, GateRef target, GateRef depend, std::initializer_list<GateRef> args);
|
||||
void DebugPrint(GateRef thread, std::initializer_list<GateRef> args);
|
||||
// memory
|
||||
inline GateRef Load(VariableType type, GateRef base, GateRef offset);
|
||||
inline GateRef Load(VariableType type, GateRef base);
|
||||
GateRef Load(VariableType type, GateRef base, GateRef offset);
|
||||
GateRef Load(VariableType type, GateRef base);
|
||||
GateRef Store(VariableType type, GateRef glue, GateRef base, GateRef offset, GateRef value);
|
||||
// arithmetic
|
||||
inline GateRef TaggedCastToIntPtr(GateRef x);
|
||||
inline GateRef Int16Add(GateRef x, GateRef y);
|
||||
inline GateRef Int32Add(GateRef x, GateRef y);
|
||||
inline GateRef Int64Add(GateRef x, GateRef y);
|
||||
inline GateRef DoubleAdd(GateRef x, GateRef y);
|
||||
inline GateRef IntPtrAdd(GateRef x, GateRef y);
|
||||
inline GateRef IntPtrSub(GateRef x, GateRef y);
|
||||
inline GateRef PointerSub(GateRef x, GateRef y);
|
||||
inline GateRef IntPtrEqual(GateRef x, GateRef y);
|
||||
inline GateRef Int16Sub(GateRef x, GateRef y);
|
||||
inline GateRef Int32Sub(GateRef x, GateRef y);
|
||||
inline GateRef Int64Sub(GateRef x, GateRef y);
|
||||
inline GateRef DoubleSub(GateRef x, GateRef y);
|
||||
inline GateRef Int32Mul(GateRef x, GateRef y);
|
||||
inline GateRef Int64Mul(GateRef x, GateRef y);
|
||||
inline GateRef DoubleMul(GateRef x, GateRef y);
|
||||
inline GateRef DoubleDiv(GateRef x, GateRef y);
|
||||
inline GateRef Int32Div(GateRef x, GateRef y);
|
||||
inline GateRef UInt32Div(GateRef x, GateRef y);
|
||||
inline GateRef UInt64Div(GateRef x, GateRef y);
|
||||
inline GateRef Int32Mod(GateRef x, GateRef y);
|
||||
inline GateRef DoubleMod(GateRef x, GateRef y);
|
||||
inline GateRef Int64Div(GateRef x, GateRef y);
|
||||
inline GateRef IntPtrDiv(GateRef x, GateRef y);
|
||||
GateRef TaggedCastToIntPtr(GateRef x);
|
||||
GateRef Int16Add(GateRef x, GateRef y);
|
||||
GateRef Int32Add(GateRef x, GateRef y);
|
||||
GateRef Int64Add(GateRef x, GateRef y);
|
||||
GateRef DoubleAdd(GateRef x, GateRef y);
|
||||
GateRef IntPtrAdd(GateRef x, GateRef y);
|
||||
GateRef IntPtrSub(GateRef x, GateRef y);
|
||||
GateRef PointerSub(GateRef x, GateRef y);
|
||||
GateRef IntPtrEqual(GateRef x, GateRef y);
|
||||
GateRef Int16Sub(GateRef x, GateRef y);
|
||||
GateRef Int32Sub(GateRef x, GateRef y);
|
||||
GateRef Int64Sub(GateRef x, GateRef y);
|
||||
GateRef DoubleSub(GateRef x, GateRef y);
|
||||
GateRef Int32Mul(GateRef x, GateRef y);
|
||||
GateRef Int64Mul(GateRef x, GateRef y);
|
||||
GateRef DoubleMul(GateRef x, GateRef y);
|
||||
GateRef DoubleDiv(GateRef x, GateRef y);
|
||||
GateRef Int32Div(GateRef x, GateRef y);
|
||||
GateRef UInt32Div(GateRef x, GateRef y);
|
||||
GateRef UInt64Div(GateRef x, GateRef y);
|
||||
GateRef Int32Mod(GateRef x, GateRef y);
|
||||
GateRef DoubleMod(GateRef x, GateRef y);
|
||||
GateRef Int64Div(GateRef x, GateRef y);
|
||||
GateRef IntPtrDiv(GateRef x, GateRef y);
|
||||
// bit operation
|
||||
inline GateRef Int32Or(GateRef x, GateRef y);
|
||||
inline GateRef Int8And(GateRef x, GateRef y);
|
||||
inline GateRef Int32And(GateRef x, GateRef y);
|
||||
inline GateRef IntPtrAnd(GateRef x, GateRef y);
|
||||
inline GateRef BoolAnd(GateRef x, GateRef y);
|
||||
inline GateRef BoolOr(GateRef x, GateRef y);
|
||||
inline GateRef Int32Not(GateRef x);
|
||||
inline GateRef BoolNot(GateRef x);
|
||||
inline GateRef Int32Xor(GateRef x, GateRef y);
|
||||
inline GateRef FixLoadType(GateRef x);
|
||||
inline GateRef Int64Or(GateRef x, GateRef y);
|
||||
inline GateRef IntPtrOr(GateRef x, GateRef y);
|
||||
inline GateRef Int64And(GateRef x, GateRef y);
|
||||
inline GateRef Int64Xor(GateRef x, GateRef y);
|
||||
inline GateRef Int64Not(GateRef x);
|
||||
inline GateRef Int16LSL(GateRef x, GateRef y);
|
||||
inline GateRef Int32LSL(GateRef x, GateRef y);
|
||||
inline GateRef Int64LSL(GateRef x, GateRef y);
|
||||
inline GateRef UInt64LSL(GateRef x, GateRef y);
|
||||
inline GateRef IntPtrLSL(GateRef x, GateRef y);
|
||||
inline GateRef Int8LSR(GateRef x, GateRef y);
|
||||
inline GateRef UInt32LSR(GateRef x, GateRef y);
|
||||
inline GateRef UInt64LSR(GateRef x, GateRef y);
|
||||
inline GateRef IntPtrLSR(GateRef x, GateRef y);
|
||||
inline GateRef TaggedIsInt(GateRef x);
|
||||
inline GateRef TaggedIsDouble(GateRef x);
|
||||
inline GateRef TaggedIsObject(GateRef x);
|
||||
inline GateRef TaggedIsNumber(GateRef x);
|
||||
inline GateRef TaggedIsHole(GateRef x);
|
||||
inline GateRef TaggedIsNotHole(GateRef x);
|
||||
inline GateRef TaggedIsUndefined(GateRef x);
|
||||
inline GateRef TaggedIsException(GateRef x);
|
||||
inline GateRef TaggedIsSpecial(GateRef x);
|
||||
inline GateRef TaggedIsHeapObject(GateRef x);
|
||||
inline GateRef ObjectAddressToRange(GateRef x);
|
||||
inline GateRef InYoungGeneration(GateRef glue, GateRef x);
|
||||
inline GateRef TaggedIsGeneratorObject(GateRef x);
|
||||
inline GateRef TaggedIsPropertyBox(GateRef x);
|
||||
inline GateRef TaggedIsWeak(GateRef x);
|
||||
inline GateRef TaggedIsPrototypeHandler(GateRef x);
|
||||
inline GateRef TaggedIsTransitionHandler(GateRef x);
|
||||
GateRef Int32Or(GateRef x, GateRef y);
|
||||
GateRef Int8And(GateRef x, GateRef y);
|
||||
GateRef Int32And(GateRef x, GateRef y);
|
||||
GateRef IntPtrAnd(GateRef x, GateRef y);
|
||||
GateRef BoolAnd(GateRef x, GateRef y);
|
||||
GateRef BoolOr(GateRef x, GateRef y);
|
||||
GateRef Int32Not(GateRef x);
|
||||
GateRef BoolNot(GateRef x);
|
||||
GateRef Int32Xor(GateRef x, GateRef y);
|
||||
GateRef FixLoadType(GateRef x);
|
||||
GateRef Int64Or(GateRef x, GateRef y);
|
||||
GateRef IntPtrOr(GateRef x, GateRef y);
|
||||
GateRef Int64And(GateRef x, GateRef y);
|
||||
GateRef Int64Xor(GateRef x, GateRef y);
|
||||
GateRef Int64Not(GateRef x);
|
||||
GateRef Int16LSL(GateRef x, GateRef y);
|
||||
GateRef Int32LSL(GateRef x, GateRef y);
|
||||
GateRef Int64LSL(GateRef x, GateRef y);
|
||||
GateRef UInt64LSL(GateRef x, GateRef y);
|
||||
GateRef IntPtrLSL(GateRef x, GateRef y);
|
||||
GateRef Int8LSR(GateRef x, GateRef y);
|
||||
GateRef UInt32LSR(GateRef x, GateRef y);
|
||||
GateRef UInt64LSR(GateRef x, GateRef y);
|
||||
GateRef IntPtrLSR(GateRef x, GateRef y);
|
||||
GateRef TaggedIsInt(GateRef x);
|
||||
GateRef TaggedIsDouble(GateRef x);
|
||||
GateRef TaggedIsObject(GateRef x);
|
||||
GateRef TaggedIsNumber(GateRef x);
|
||||
GateRef TaggedIsHole(GateRef x);
|
||||
GateRef TaggedIsNotHole(GateRef x);
|
||||
GateRef TaggedIsUndefined(GateRef x);
|
||||
GateRef TaggedIsException(GateRef x);
|
||||
GateRef TaggedIsSpecial(GateRef x);
|
||||
GateRef TaggedIsHeapObject(GateRef x);
|
||||
GateRef ObjectAddressToRange(GateRef x);
|
||||
GateRef InYoungGeneration(GateRef glue, GateRef x);
|
||||
GateRef TaggedIsGeneratorObject(GateRef x);
|
||||
GateRef TaggedIsPropertyBox(GateRef x);
|
||||
GateRef TaggedIsWeak(GateRef x);
|
||||
GateRef TaggedIsPrototypeHandler(GateRef x);
|
||||
GateRef TaggedIsTransitionHandler(GateRef x);
|
||||
GateRef TaggedIsString(GateRef obj);
|
||||
GateRef TaggedIsStringOrSymbol(GateRef obj);
|
||||
inline GateRef GetNextPositionForHash(GateRef last, GateRef count, GateRef size);
|
||||
inline GateRef DoubleIsNAN(GateRef x);
|
||||
inline GateRef DoubleIsINF(GateRef x);
|
||||
inline GateRef TaggedIsNull(GateRef x);
|
||||
inline GateRef TaggedIsUndefinedOrNull(GateRef x);
|
||||
inline GateRef TaggedIsTrue(GateRef x);
|
||||
inline GateRef TaggedIsFalse(GateRef x);
|
||||
inline GateRef TaggedIsBoolean(GateRef x);
|
||||
inline GateRef TaggedGetInt(GateRef x);
|
||||
inline GateRef Int8BuildTaggedTypeWithNoGC(GateRef x);
|
||||
inline GateRef Int16BuildTaggedWithNoGC(GateRef x);
|
||||
inline GateRef Int16BuildTaggedTypeWithNoGC(GateRef x);
|
||||
inline GateRef IntBuildTaggedWithNoGC(GateRef x);
|
||||
inline GateRef IntBuildTaggedTypeWithNoGC(GateRef x);
|
||||
inline GateRef DoubleBuildTaggedWithNoGC(GateRef x);
|
||||
inline GateRef DoubleBuildTaggedTypeWithNoGC(GateRef x);
|
||||
inline GateRef CastDoubleToInt64(GateRef x);
|
||||
inline GateRef TaggedTrue();
|
||||
inline GateRef TaggedFalse();
|
||||
GateRef GetNextPositionForHash(GateRef last, GateRef count, GateRef size);
|
||||
GateRef DoubleIsNAN(GateRef x);
|
||||
GateRef DoubleIsINF(GateRef x);
|
||||
GateRef TaggedIsNull(GateRef x);
|
||||
GateRef TaggedIsUndefinedOrNull(GateRef x);
|
||||
GateRef TaggedIsTrue(GateRef x);
|
||||
GateRef TaggedIsFalse(GateRef x);
|
||||
GateRef TaggedIsBoolean(GateRef x);
|
||||
GateRef TaggedGetInt(GateRef x);
|
||||
GateRef Int8BuildTaggedTypeWithNoGC(GateRef x);
|
||||
GateRef Int16BuildTaggedWithNoGC(GateRef x);
|
||||
GateRef Int16BuildTaggedTypeWithNoGC(GateRef x);
|
||||
GateRef IntBuildTaggedWithNoGC(GateRef x);
|
||||
GateRef IntBuildTaggedTypeWithNoGC(GateRef x);
|
||||
GateRef DoubleBuildTaggedWithNoGC(GateRef x);
|
||||
GateRef DoubleBuildTaggedTypeWithNoGC(GateRef x);
|
||||
GateRef CastDoubleToInt64(GateRef x);
|
||||
GateRef TaggedTrue();
|
||||
GateRef TaggedFalse();
|
||||
// compare operation
|
||||
inline GateRef Int8Equal(GateRef x, GateRef y);
|
||||
inline GateRef Int32Equal(GateRef x, GateRef y);
|
||||
inline GateRef Int32NotEqual(GateRef x, GateRef y);
|
||||
inline GateRef Int64Equal(GateRef x, GateRef y);
|
||||
inline GateRef DoubleEqual(GateRef x, GateRef y);
|
||||
inline GateRef Int64NotEqual(GateRef x, GateRef y);
|
||||
inline GateRef DoubleLessThan(GateRef x, GateRef y);
|
||||
inline GateRef DoubleLessThanOrEqual(GateRef x, GateRef y);
|
||||
inline GateRef DoubleGreaterThan(GateRef x, GateRef y);
|
||||
inline GateRef DoubleGreaterThanOrEqual(GateRef x, GateRef y);
|
||||
inline GateRef Int32GreaterThan(GateRef x, GateRef y);
|
||||
inline GateRef Int32LessThan(GateRef x, GateRef y);
|
||||
inline GateRef Int32GreaterThanOrEqual(GateRef x, GateRef y);
|
||||
inline GateRef Int32LessThanOrEqual(GateRef x, GateRef y);
|
||||
inline GateRef UInt32GreaterThan(GateRef x, GateRef y);
|
||||
inline GateRef UInt32LessThan(GateRef x, GateRef y);
|
||||
inline GateRef UInt32LessThanOrEqual(GateRef x, GateRef y);
|
||||
inline GateRef UInt32GreaterThanOrEqual(GateRef x, GateRef y);
|
||||
inline GateRef Int64GreaterThan(GateRef x, GateRef y);
|
||||
inline GateRef Int64LessThan(GateRef x, GateRef y);
|
||||
inline GateRef Int64LessThanOrEqual(GateRef x, GateRef y);
|
||||
inline GateRef Int64GreaterThanOrEqual(GateRef x, GateRef y);
|
||||
inline GateRef UInt6464GreaterThan(GateRef x, GateRef y);
|
||||
inline GateRef UInt64LessThan(GateRef x, GateRef y);
|
||||
inline GateRef UInt64LessThanOrEqual(GateRef x, GateRef y);
|
||||
inline GateRef UInt6464GreaterThanOrEqual(GateRef x, GateRef y);
|
||||
GateRef Int8Equal(GateRef x, GateRef y);
|
||||
GateRef Int32Equal(GateRef x, GateRef y);
|
||||
GateRef Int32NotEqual(GateRef x, GateRef y);
|
||||
GateRef Int64Equal(GateRef x, GateRef y);
|
||||
GateRef DoubleEqual(GateRef x, GateRef y);
|
||||
GateRef Int64NotEqual(GateRef x, GateRef y);
|
||||
GateRef DoubleLessThan(GateRef x, GateRef y);
|
||||
GateRef DoubleLessThanOrEqual(GateRef x, GateRef y);
|
||||
GateRef DoubleGreaterThan(GateRef x, GateRef y);
|
||||
GateRef DoubleGreaterThanOrEqual(GateRef x, GateRef y);
|
||||
GateRef Int32GreaterThan(GateRef x, GateRef y);
|
||||
GateRef Int32LessThan(GateRef x, GateRef y);
|
||||
GateRef Int32GreaterThanOrEqual(GateRef x, GateRef y);
|
||||
GateRef Int32LessThanOrEqual(GateRef x, GateRef y);
|
||||
GateRef UInt32GreaterThan(GateRef x, GateRef y);
|
||||
GateRef UInt32LessThan(GateRef x, GateRef y);
|
||||
GateRef UInt32LessThanOrEqual(GateRef x, GateRef y);
|
||||
GateRef UInt32GreaterThanOrEqual(GateRef x, GateRef y);
|
||||
GateRef Int64GreaterThan(GateRef x, GateRef y);
|
||||
GateRef Int64LessThan(GateRef x, GateRef y);
|
||||
GateRef Int64LessThanOrEqual(GateRef x, GateRef y);
|
||||
GateRef Int64GreaterThanOrEqual(GateRef x, GateRef y);
|
||||
GateRef UInt6464GreaterThan(GateRef x, GateRef y);
|
||||
GateRef UInt64LessThan(GateRef x, GateRef y);
|
||||
GateRef UInt64LessThanOrEqual(GateRef x, GateRef y);
|
||||
GateRef UInt6464GreaterThanOrEqual(GateRef x, GateRef y);
|
||||
// cast operation
|
||||
inline GateRef ChangeInt64ToInt32(GateRef val);
|
||||
inline GateRef ChangeInt64ToIntPtr(GateRef val);
|
||||
inline GateRef ChangeInt32ToIntPtr(GateRef val);
|
||||
GateRef ChangeInt64ToInt32(GateRef val);
|
||||
GateRef ChangeInt64ToIntPtr(GateRef val);
|
||||
GateRef ChangeInt32ToIntPtr(GateRef val);
|
||||
// math operation
|
||||
GateRef Sqrt(GateRef x);
|
||||
inline GateRef GetSetterFromAccessor(GateRef accessor);
|
||||
inline GateRef GetElementsArray(GateRef object);
|
||||
inline void SetElementsArray(GateRef glue, GateRef object, GateRef elementsArray);
|
||||
inline GateRef GetPropertiesArray(GateRef object);
|
||||
GateRef GetSetterFromAccessor(GateRef accessor);
|
||||
GateRef GetElementsArray(GateRef object);
|
||||
void SetElementsArray(GateRef glue, GateRef object, GateRef elementsArray);
|
||||
GateRef GetPropertiesArray(GateRef object);
|
||||
// SetProperties in js_object.h
|
||||
inline void SetPropertiesArray(GateRef glue, GateRef object, GateRef propsArray);
|
||||
inline GateRef GetLengthOfTaggedArray(GateRef array);
|
||||
void SetPropertiesArray(GateRef glue, GateRef object, GateRef propsArray);
|
||||
GateRef GetLengthOfTaggedArray(GateRef array);
|
||||
// object operation
|
||||
inline GateRef IsJSHClass(GateRef obj);
|
||||
inline GateRef LoadHClass(GateRef object);
|
||||
inline void StoreHClass(GateRef glue, GateRef object, GateRef hclass);
|
||||
GateRef IsJSHClass(GateRef obj);
|
||||
GateRef LoadHClass(GateRef object);
|
||||
void StoreHClass(GateRef glue, GateRef object, GateRef hclass);
|
||||
void CopyAllHClass(GateRef glue, GateRef dstHClass, GateRef scrHClass);
|
||||
inline GateRef GetObjectType(GateRef hClass);
|
||||
inline GateRef GetGeneratorObjectResumeMode(GateRef obj);
|
||||
inline GateRef IsDictionaryMode(GateRef object);
|
||||
inline GateRef IsDictionaryModeByHClass(GateRef hClass);
|
||||
inline GateRef IsDictionaryElement(GateRef hClass);
|
||||
inline GateRef NotBuiltinsConstructor(GateRef object);
|
||||
inline GateRef IsClassConstructor(GateRef object);
|
||||
inline GateRef IsClassPrototype(GateRef object);
|
||||
inline GateRef IsExtensible(GateRef object);
|
||||
inline GateRef IsEcmaObject(GateRef obj);
|
||||
inline GateRef IsSymbol(GateRef obj);
|
||||
inline GateRef IsString(GateRef obj);
|
||||
inline GateRef IsJsProxy(GateRef obj);
|
||||
inline GateRef IsJSFunctionBase(GateRef obj);
|
||||
inline GateRef IsJsArray(GateRef obj);
|
||||
inline GateRef IsJSObject(GateRef obj);
|
||||
inline GateRef IsWritable(GateRef attr);
|
||||
inline GateRef IsAccessor(GateRef attr);
|
||||
inline GateRef IsInlinedProperty(GateRef attr);
|
||||
inline GateRef IsField(GateRef attr);
|
||||
inline GateRef IsNonExist(GateRef attr);
|
||||
inline GateRef HandlerBaseIsAccessor(GateRef attr);
|
||||
inline GateRef HandlerBaseIsJSArray(GateRef attr);
|
||||
inline GateRef HandlerBaseIsInlinedProperty(GateRef attr);
|
||||
inline GateRef HandlerBaseGetOffset(GateRef attr);
|
||||
inline GateRef IsInvalidPropertyBox(GateRef obj);
|
||||
inline GateRef GetValueFromPropertyBox(GateRef obj);
|
||||
inline void SetValueToPropertyBox(GateRef glue, GateRef obj, GateRef value);
|
||||
inline GateRef GetTransitionFromHClass(GateRef obj);
|
||||
inline GateRef GetTransitionHandlerInfo(GateRef obj);
|
||||
inline GateRef IsInternalAccessor(GateRef attr);
|
||||
inline GateRef GetProtoCell(GateRef object);
|
||||
inline GateRef GetPrototypeHandlerHolder(GateRef object);
|
||||
inline GateRef GetPrototypeHandlerHandlerInfo(GateRef object);
|
||||
inline GateRef GetHasChanged(GateRef object);
|
||||
inline GateRef HclassIsPrototypeHandler(GateRef hclass);
|
||||
inline GateRef HclassIsTransitionHandler(GateRef hclass);
|
||||
inline GateRef HclassIsPropertyBox(GateRef hclass);
|
||||
inline GateRef PropAttrGetOffset(GateRef attr);
|
||||
GateRef GetObjectType(GateRef hClass);
|
||||
GateRef GetGeneratorObjectResumeMode(GateRef obj);
|
||||
GateRef IsDictionaryMode(GateRef object);
|
||||
GateRef IsDictionaryModeByHClass(GateRef hClass);
|
||||
GateRef IsDictionaryElement(GateRef hClass);
|
||||
GateRef NotBuiltinsConstructor(GateRef object);
|
||||
GateRef IsClassConstructor(GateRef object);
|
||||
GateRef IsClassPrototype(GateRef object);
|
||||
GateRef IsExtensible(GateRef object);
|
||||
GateRef IsEcmaObject(GateRef obj);
|
||||
GateRef IsSymbol(GateRef obj);
|
||||
GateRef IsString(GateRef obj);
|
||||
GateRef IsJsProxy(GateRef obj);
|
||||
GateRef IsJSFunctionBase(GateRef obj);
|
||||
GateRef IsJsArray(GateRef obj);
|
||||
GateRef IsJSObject(GateRef obj);
|
||||
GateRef IsWritable(GateRef attr);
|
||||
GateRef IsAccessor(GateRef attr);
|
||||
GateRef IsInlinedProperty(GateRef attr);
|
||||
GateRef IsField(GateRef attr);
|
||||
GateRef IsNonExist(GateRef attr);
|
||||
GateRef HandlerBaseIsAccessor(GateRef attr);
|
||||
GateRef HandlerBaseIsJSArray(GateRef attr);
|
||||
GateRef HandlerBaseIsInlinedProperty(GateRef attr);
|
||||
GateRef HandlerBaseGetOffset(GateRef attr);
|
||||
GateRef IsInvalidPropertyBox(GateRef obj);
|
||||
GateRef GetValueFromPropertyBox(GateRef obj);
|
||||
void SetValueToPropertyBox(GateRef glue, GateRef obj, GateRef value);
|
||||
GateRef GetTransitionFromHClass(GateRef obj);
|
||||
GateRef GetTransitionHandlerInfo(GateRef obj);
|
||||
GateRef IsInternalAccessor(GateRef attr);
|
||||
GateRef GetProtoCell(GateRef object);
|
||||
GateRef GetPrototypeHandlerHolder(GateRef object);
|
||||
GateRef GetPrototypeHandlerHandlerInfo(GateRef object);
|
||||
GateRef GetHasChanged(GateRef object);
|
||||
GateRef HclassIsPrototypeHandler(GateRef hclass);
|
||||
GateRef HclassIsTransitionHandler(GateRef hclass);
|
||||
GateRef HclassIsPropertyBox(GateRef hclass);
|
||||
GateRef PropAttrGetOffset(GateRef attr);
|
||||
// SetDictionaryOrder func in property_attribute.h
|
||||
inline GateRef SetDictionaryOrderFieldInPropAttr(GateRef attr, GateRef value);
|
||||
inline GateRef GetPrototypeFromHClass(GateRef hClass);
|
||||
inline GateRef GetLayoutFromHClass(GateRef hClass);
|
||||
inline GateRef GetBitFieldFromHClass(GateRef hClass);
|
||||
inline GateRef SetBitFieldToHClass(GateRef glue, GateRef hClass, GateRef bitfield);
|
||||
inline GateRef SetPrototypeToHClass(VariableType type, GateRef glue, GateRef hClass, GateRef proto);
|
||||
inline GateRef SetProtoChangeDetailsToHClass(VariableType type, GateRef glue, GateRef hClass,
|
||||
GateRef SetDictionaryOrderFieldInPropAttr(GateRef attr, GateRef value);
|
||||
GateRef GetPrototypeFromHClass(GateRef hClass);
|
||||
GateRef GetLayoutFromHClass(GateRef hClass);
|
||||
GateRef GetBitFieldFromHClass(GateRef hClass);
|
||||
GateRef SetBitFieldToHClass(GateRef glue, GateRef hClass, GateRef bitfield);
|
||||
GateRef SetPrototypeToHClass(VariableType type, GateRef glue, GateRef hClass, GateRef proto);
|
||||
GateRef SetProtoChangeDetailsToHClass(VariableType type, GateRef glue, GateRef hClass,
|
||||
GateRef protoChange);
|
||||
inline GateRef SetLayoutToHClass(VariableType type, GateRef glue, GateRef hClass, GateRef attr);
|
||||
inline GateRef SetEnumCacheToHClass(VariableType type, GateRef glue, GateRef hClass, GateRef key);
|
||||
inline GateRef SetTransitionsToHClass(VariableType type, GateRef glue, GateRef hClass, GateRef transition);
|
||||
inline void SetIsProtoTypeToHClass(GateRef glue, GateRef hClass, GateRef value);
|
||||
inline GateRef IsProtoTypeHClass(GateRef hClass);
|
||||
inline void SetPropertyInlinedProps(GateRef glue, GateRef obj, GateRef hClass,
|
||||
GateRef value, GateRef attrOffset, VariableType type = VariableType::JS_ANY());
|
||||
GateRef SetLayoutToHClass(VariableType type, GateRef glue, GateRef hClass, GateRef attr);
|
||||
GateRef SetEnumCacheToHClass(VariableType type, GateRef glue, GateRef hClass, GateRef key);
|
||||
GateRef SetTransitionsToHClass(VariableType type, GateRef glue, GateRef hClass, GateRef transition);
|
||||
void SetIsProtoTypeToHClass(GateRef glue, GateRef hClass, GateRef value);
|
||||
GateRef IsProtoTypeHClass(GateRef hClass);
|
||||
void SetPropertyInlinedProps(GateRef glue, GateRef obj, GateRef hClass,
|
||||
GateRef value, GateRef attrOffset, VariableType type = VariableType::JS_ANY());
|
||||
|
||||
inline void IncNumberOfProps(GateRef glue, GateRef hClass);
|
||||
inline GateRef GetNumberOfPropsFromHClass(GateRef hClass);
|
||||
inline void SetNumberOfPropsToHClass(GateRef glue, GateRef hClass, GateRef value);
|
||||
inline GateRef GetObjectSizeFromHClass(GateRef hClass);
|
||||
inline GateRef GetInlinedPropsStartFromHClass(GateRef hClass);
|
||||
inline GateRef GetInlinedPropertiesFromHClass(GateRef hClass);
|
||||
void IncNumberOfProps(GateRef glue, GateRef hClass);
|
||||
GateRef GetNumberOfPropsFromHClass(GateRef hClass);
|
||||
void SetNumberOfPropsToHClass(GateRef glue, GateRef hClass, GateRef value);
|
||||
GateRef GetObjectSizeFromHClass(GateRef hClass);
|
||||
GateRef GetInlinedPropsStartFromHClass(GateRef hClass);
|
||||
GateRef GetInlinedPropertiesFromHClass(GateRef hClass);
|
||||
void ThrowTypeAndReturn(GateRef glue, int messageId, GateRef val);
|
||||
inline GateRef GetValueFromTaggedArray(VariableType returnType, GateRef elements, GateRef index);
|
||||
inline void SetValueToTaggedArray(VariableType valType, GateRef glue, GateRef array, GateRef index, GateRef val);
|
||||
inline void UpdateValueAndAttributes(GateRef glue, GateRef elements, GateRef index, GateRef value, GateRef attr);
|
||||
inline GateRef IsSpecialIndexedObj(GateRef jsType);
|
||||
inline GateRef IsSpecialContainer(GateRef jsType);
|
||||
inline GateRef IsAccessorInternal(GateRef value);
|
||||
template<typename DictionaryT = NameDictionary>
|
||||
GateRef GetValueFromTaggedArray(VariableType returnType, GateRef elements, GateRef index);
|
||||
void SetValueToTaggedArray(VariableType valType, GateRef glue, GateRef array, GateRef index, GateRef val);
|
||||
void UpdateValueAndAttributes(GateRef glue, GateRef elements, GateRef index, GateRef value, GateRef attr);
|
||||
GateRef IsSpecialIndexedObj(GateRef jsType);
|
||||
GateRef IsSpecialContainer(GateRef jsType);
|
||||
GateRef IsAccessorInternal(GateRef value);
|
||||
template<typename DictionaryT>
|
||||
GateRef GetAttributesFromDictionary(GateRef elements, GateRef entry);
|
||||
template<typename DictionaryT = NameDictionary>
|
||||
template<typename DictionaryT>
|
||||
GateRef GetValueFromDictionary(VariableType returnType, GateRef elements, GateRef entry);
|
||||
template<typename DictionaryT = NameDictionary>
|
||||
template<typename DictionaryT>
|
||||
GateRef GetKeyFromDictionary(VariableType returnType, GateRef elements, GateRef entry);
|
||||
inline GateRef GetPropAttrFromLayoutInfo(GateRef layout, GateRef entry);
|
||||
inline GateRef GetPropertiesAddrFromLayoutInfo(GateRef layout);
|
||||
inline GateRef GetPropertyMetaDataFromAttr(GateRef attr);
|
||||
inline GateRef GetKeyFromLayoutInfo(GateRef layout, GateRef entry);
|
||||
GateRef GetPropAttrFromLayoutInfo(GateRef layout, GateRef entry);
|
||||
GateRef GetPropertiesAddrFromLayoutInfo(GateRef layout);
|
||||
GateRef GetPropertyMetaDataFromAttr(GateRef attr);
|
||||
GateRef GetKeyFromLayoutInfo(GateRef layout, GateRef entry);
|
||||
GateRef FindElementWithCache(GateRef glue, GateRef layoutInfo, GateRef hClass,
|
||||
GateRef key, GateRef propsNum);
|
||||
GateRef FindElementFromNumberDictionary(GateRef glue, GateRef elements, GateRef index);
|
||||
@ -694,43 +680,43 @@ public:
|
||||
GateRef StoreGlobal(GateRef glue, GateRef value, GateRef cell);
|
||||
void JSHClassAddProperty(GateRef glue, GateRef receiver, GateRef key, GateRef attr);
|
||||
void NotifyHClassChanged(GateRef glue, GateRef oldHClass, GateRef newHClass);
|
||||
inline GateRef TaggedCastToInt64(GateRef x);
|
||||
inline GateRef TaggedCastToInt32(GateRef x);
|
||||
inline GateRef TaggedCastToDouble(GateRef x);
|
||||
inline GateRef TaggedCastToWeakReferentUnChecked(GateRef x);
|
||||
inline GateRef ChangeInt32ToFloat64(GateRef x);
|
||||
inline GateRef ChangeFloat64ToInt32(GateRef x);
|
||||
inline GateRef ChangeTaggedPointerToInt64(GateRef x);
|
||||
inline GateRef ChangeInt64ToTagged(GateRef x);
|
||||
inline GateRef CastInt64ToFloat64(GateRef x);
|
||||
inline GateRef SExtInt32ToInt64(GateRef x);
|
||||
inline GateRef SExtInt1ToInt64(GateRef x);
|
||||
inline GateRef SExtInt1ToInt32(GateRef x);
|
||||
inline GateRef ZExtInt8ToInt16(GateRef x);
|
||||
inline GateRef ZExtInt32ToInt64(GateRef x);
|
||||
inline GateRef ZExtInt1ToInt64(GateRef x);
|
||||
inline GateRef ZExtInt1ToInt32(GateRef x);
|
||||
inline GateRef ZExtInt8ToInt32(GateRef x);
|
||||
inline GateRef ZExtInt8ToInt64(GateRef x);
|
||||
inline GateRef ZExtInt8ToPtr(GateRef x);
|
||||
inline GateRef ZExtInt16ToPtr(GateRef x);
|
||||
inline GateRef SExtInt32ToPtr(GateRef x);
|
||||
inline GateRef ZExtInt16ToInt32(GateRef x);
|
||||
inline GateRef ZExtInt16ToInt64(GateRef x);
|
||||
inline GateRef TruncInt64ToInt32(GateRef x);
|
||||
inline GateRef TruncPtrToInt32(GateRef x);
|
||||
inline GateRef TruncInt64ToInt1(GateRef x);
|
||||
inline GateRef TruncInt32ToInt1(GateRef x);
|
||||
inline GateRef GetGlobalConstantAddr(GateRef index);
|
||||
inline GateRef GetGlobalConstantString(ConstantIndex index);
|
||||
inline GateRef IsCallable(GateRef obj);
|
||||
inline GateRef GetOffsetFieldInPropAttr(GateRef attr);
|
||||
inline GateRef SetOffsetFieldInPropAttr(GateRef attr, GateRef value);
|
||||
inline GateRef SetIsInlinePropsFieldInPropAttr(GateRef attr, GateRef value);
|
||||
inline void SetHasConstructorToHClass(GateRef glue, GateRef hClass, GateRef value);
|
||||
inline void UpdateValueInDict(GateRef glue, GateRef elements, GateRef index, GateRef value);
|
||||
inline GateRef GetBitMask(GateRef bitoffset);
|
||||
inline GateRef IntptrEuqal(GateRef x, GateRef y);
|
||||
GateRef TaggedCastToInt64(GateRef x);
|
||||
GateRef TaggedCastToInt32(GateRef x);
|
||||
GateRef TaggedCastToDouble(GateRef x);
|
||||
GateRef TaggedCastToWeakReferentUnChecked(GateRef x);
|
||||
GateRef ChangeInt32ToFloat64(GateRef x);
|
||||
GateRef ChangeFloat64ToInt32(GateRef x);
|
||||
GateRef ChangeTaggedPointerToInt64(GateRef x);
|
||||
GateRef ChangeInt64ToTagged(GateRef x);
|
||||
GateRef CastInt64ToFloat64(GateRef x);
|
||||
GateRef SExtInt32ToInt64(GateRef x);
|
||||
GateRef SExtInt1ToInt64(GateRef x);
|
||||
GateRef SExtInt1ToInt32(GateRef x);
|
||||
GateRef ZExtInt8ToInt16(GateRef x);
|
||||
GateRef ZExtInt32ToInt64(GateRef x);
|
||||
GateRef ZExtInt1ToInt64(GateRef x);
|
||||
GateRef ZExtInt1ToInt32(GateRef x);
|
||||
GateRef ZExtInt8ToInt32(GateRef x);
|
||||
GateRef ZExtInt8ToInt64(GateRef x);
|
||||
GateRef ZExtInt8ToPtr(GateRef x);
|
||||
GateRef ZExtInt16ToPtr(GateRef x);
|
||||
GateRef SExtInt32ToPtr(GateRef x);
|
||||
GateRef ZExtInt16ToInt32(GateRef x);
|
||||
GateRef ZExtInt16ToInt64(GateRef x);
|
||||
GateRef TruncInt64ToInt32(GateRef x);
|
||||
GateRef TruncPtrToInt32(GateRef x);
|
||||
GateRef TruncInt64ToInt1(GateRef x);
|
||||
GateRef TruncInt32ToInt1(GateRef x);
|
||||
GateRef GetGlobalConstantAddr(GateRef index);
|
||||
GateRef GetGlobalConstantString(ConstantIndex index);
|
||||
GateRef IsCallable(GateRef obj);
|
||||
GateRef GetOffsetFieldInPropAttr(GateRef attr);
|
||||
GateRef SetOffsetFieldInPropAttr(GateRef attr, GateRef value);
|
||||
GateRef SetIsInlinePropsFieldInPropAttr(GateRef attr, GateRef value);
|
||||
void SetHasConstructorToHClass(GateRef glue, GateRef hClass, GateRef value);
|
||||
void UpdateValueInDict(GateRef glue, GateRef elements, GateRef index, GateRef value);
|
||||
GateRef GetBitMask(GateRef bitoffset);
|
||||
GateRef IntptrEuqal(GateRef x, GateRef y);
|
||||
void SetValueWithBarrier(GateRef glue, GateRef obj, GateRef offset, GateRef value);
|
||||
GateRef GetPropertyByIndex(GateRef glue, GateRef receiver, GateRef index);
|
||||
GateRef GetPropertyByName(GateRef glue, GateRef receiver, GateRef key);
|
||||
@ -740,19 +726,19 @@ public:
|
||||
|
||||
GateRef SetPropertyByNameWithOwn(GateRef glue, GateRef receiver, GateRef key,
|
||||
GateRef value); // Do not crawl the prototype chain
|
||||
inline GateRef GetParentEnv(GateRef object);
|
||||
inline GateRef GetPropertiesFromLexicalEnv(GateRef object, GateRef index);
|
||||
inline void SetPropertiesToLexicalEnv(GateRef glue, GateRef object, GateRef index, GateRef value);
|
||||
inline GateRef GetFunctionBitFieldFromJSFunction(GateRef object);
|
||||
inline GateRef GetHomeObjectFromJSFunction(GateRef object);
|
||||
inline void SetLexicalEnvToFunction(GateRef glue, GateRef object, GateRef lexicalEnv);
|
||||
inline GateRef GetGlobalObject(GateRef glue);
|
||||
inline GateRef GetEntryIndexOfGlobalDictionary(GateRef entry);
|
||||
inline GateRef GetBoxFromGlobalDictionary(GateRef object, GateRef entry);
|
||||
inline GateRef GetValueFromGlobalDictionary(GateRef object, GateRef entry);
|
||||
inline GateRef GetPropertiesFromJSObject(GateRef object);
|
||||
GateRef GetParentEnv(GateRef object);
|
||||
GateRef GetPropertiesFromLexicalEnv(GateRef object, GateRef index);
|
||||
void SetPropertiesToLexicalEnv(GateRef glue, GateRef object, GateRef index, GateRef value);
|
||||
GateRef GetFunctionBitFieldFromJSFunction(GateRef object);
|
||||
GateRef GetHomeObjectFromJSFunction(GateRef object);
|
||||
void SetLexicalEnvToFunction(GateRef glue, GateRef object, GateRef lexicalEnv);
|
||||
GateRef GetGlobalObject(GateRef glue);
|
||||
GateRef GetEntryIndexOfGlobalDictionary(GateRef entry);
|
||||
GateRef GetBoxFromGlobalDictionary(GateRef object, GateRef entry);
|
||||
GateRef GetValueFromGlobalDictionary(GateRef object, GateRef entry);
|
||||
GateRef GetPropertiesFromJSObject(GateRef object);
|
||||
template<OpCode::Op Op, MachineType Type>
|
||||
inline GateRef BinaryOp(GateRef x, GateRef y);
|
||||
GateRef BinaryOp(GateRef x, GateRef y);
|
||||
GateRef GetGlobalOwnProperty(GateRef glue, GateRef receiver, GateRef key);
|
||||
// fast path
|
||||
GateRef FastEqual(GateRef left, GateRef right);
|
||||
|
@ -1,67 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ECMASCRIPT_COMPILER_STUB_AOT_COMPILER_H
|
||||
#define ECMASCRIPT_COMPILER_STUB_AOT_COMPILER_H
|
||||
|
||||
#include "ecmascript/js_thread.h"
|
||||
#include "ecmascript/stub_module.h"
|
||||
|
||||
namespace panda::ecmascript::kungfu {
|
||||
class Stub;
|
||||
class StubAotCompiler {
|
||||
public:
|
||||
StubAotCompiler()
|
||||
{
|
||||
for (int i = 0; i < ALL_STUB_MAXCOUNT; i++) {
|
||||
stubs_[i] = nullptr;
|
||||
}
|
||||
}
|
||||
~StubAotCompiler()
|
||||
{
|
||||
for (int i = 0; i < ALL_STUB_MAXCOUNT; i++) {
|
||||
stubs_[i] = nullptr;
|
||||
}
|
||||
}
|
||||
void BuildStubModuleAndSave(const std::string &triple, panda::ecmascript::StubModule *module,
|
||||
const std::string &filename);
|
||||
void SetStub(int index, Stub *stub)
|
||||
{
|
||||
stubs_[index] = stub;
|
||||
}
|
||||
|
||||
std::vector<int> GetStubIndices()
|
||||
{
|
||||
std::vector<int> result;
|
||||
uint32_t i;
|
||||
for (i = 0; i < FAST_STUB_MAXCOUNT; i++) {
|
||||
if (stubs_[i] != nullptr) {
|
||||
result.push_back(i);
|
||||
}
|
||||
}
|
||||
// for interpreter stub
|
||||
for (; i < ALL_STUB_MAXCOUNT; i++) {
|
||||
if (stubs_[i] != nullptr) {
|
||||
result.push_back(CallStubId::NAME_BytecodeHandler);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private:
|
||||
std::array<Stub *, ALL_STUB_MAXCOUNT> stubs_;
|
||||
};
|
||||
} // namespace panda::ecmascript::kungfu
|
||||
#endif // ECMASCRIPT_COMPILER_STUB_AOT_COMPILER_H
|
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "stub_aot_compiler.h"
|
||||
#include "stub_compiler.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
@ -80,7 +80,7 @@ public:
|
||||
{
|
||||
llvmImpl_ = std::make_unique<LLVMIRGeneratorImpl>(module);
|
||||
}
|
||||
bool Run(StubPassData *data, int index)
|
||||
bool Run(StubPassData *data, size_t index)
|
||||
{
|
||||
auto stubModule = data->GetStubModule();
|
||||
CreateCodeGen(stubModule);
|
||||
@ -89,30 +89,33 @@ public:
|
||||
return true;
|
||||
}
|
||||
private:
|
||||
std::unique_ptr<CodeGeneratorImpl> llvmImpl_{nullptr};
|
||||
std::unique_ptr<CodeGeneratorImpl> llvmImpl_ {nullptr};
|
||||
};
|
||||
|
||||
void StubAotCompiler::BuildStubModuleAndSave(const std::string &triple, panda::ecmascript::StubModule *module,
|
||||
const std::string &filename)
|
||||
void StubCompiler::BuildStubModuleAndSave(const std::string &triple, const std::string &filename)
|
||||
{
|
||||
LLVMStubModule stubModule("fast_stubs", triple);
|
||||
std::vector<int> stubSet = GetStubIndices();
|
||||
stubModule.Initialize(stubSet);
|
||||
for (int i = 0; i < ALL_STUB_MAXCOUNT; i++) {
|
||||
auto stub = stubs_[i];
|
||||
if (stub != nullptr) {
|
||||
StubPassData data(stub, &stubModule);
|
||||
PassRunner<StubPassData> pipeline(&data);
|
||||
pipeline.RunPass<StubBuildCircuitPass>();
|
||||
pipeline.RunPass<VerifierPass>();
|
||||
pipeline.RunPass<SchedulingPass>();
|
||||
pipeline.RunPass<StubLLVMIRGenPass>(i);
|
||||
LLVMStubModule stubModule("stubs", triple);
|
||||
stubModule.Initialize();
|
||||
auto callSigns = stubModule.GetCSigns();
|
||||
for (size_t i = 0; i < callSigns.size(); i++) {
|
||||
Circuit circuit;
|
||||
if (!callSigns[i]->HasConstructor()) {
|
||||
continue;
|
||||
}
|
||||
Stub* stub = static_cast<Stub*>(callSigns[i]->GetConstructor()(reinterpret_cast<void*>(&circuit)));
|
||||
StubPassData data(stub, &stubModule);
|
||||
PassRunner<StubPassData> pipeline(&data);
|
||||
pipeline.RunPass<StubBuildCircuitPass>();
|
||||
pipeline.RunPass<VerifierPass>();
|
||||
pipeline.RunPass<SchedulingPass>();
|
||||
pipeline.RunPass<StubLLVMIRGenPass>(i);
|
||||
delete stub;
|
||||
}
|
||||
|
||||
LLVMModuleAssembler assembler(&stubModule);
|
||||
assembler.AssembleModule();
|
||||
assembler.AssembleStubModule(module);
|
||||
panda::ecmascript::StubModule module;
|
||||
assembler.AssembleStubModule(&module);
|
||||
|
||||
auto codeSize = assembler.GetCodeSize();
|
||||
panda::ecmascript::MachineCode *code = reinterpret_cast<panda::ecmascript::MachineCode *>(
|
||||
@ -121,8 +124,8 @@ void StubAotCompiler::BuildStubModuleAndSave(const std::string &triple, panda::e
|
||||
|
||||
assembler.CopyAssemblerToCode(code);
|
||||
|
||||
module->SetCode(code);
|
||||
module->Save(filename);
|
||||
module.SetCode(code);
|
||||
module.Save(filename);
|
||||
|
||||
delete[] code;
|
||||
}
|
||||
@ -154,19 +157,11 @@ int main(const int argc, const char **argv)
|
||||
std::string tripleString = stubOptions.GetTargetTriple();
|
||||
std::string moduleFilename = stubOptions.GetStubOutputFile();
|
||||
std::string compiledStubList = stubOptions.GetCompiledStubs();
|
||||
panda::ecmascript::kungfu::StubAotCompiler moduleBuilder;
|
||||
#define SET_STUB_TO_MODULE(name, counter) \
|
||||
panda::ecmascript::kungfu::Circuit name##Circuit; \
|
||||
panda::ecmascript::kungfu::name##Stub name##Stub(& name##Circuit); \
|
||||
if (compiledStubList.compare("All") == 0 || compiledStubList.find(#name) != std::string::npos) { \
|
||||
moduleBuilder.SetStub(STUB_ID(name), &name##Stub); \
|
||||
}
|
||||
FAST_STUB_LIST(SET_STUB_TO_MODULE)
|
||||
#if ECMASCRIPT_COMPILE_INTERPRETER_ASM
|
||||
INTERPRETER_STUB_LIST(SET_STUB_TO_MODULE)
|
||||
#endif
|
||||
panda::ecmascript::StubModule stubModule;
|
||||
moduleBuilder.BuildStubModuleAndSave(tripleString, &stubModule, moduleFilename);
|
||||
panda::ecmascript::kungfu::BytecodeStubCSigns::Initialize();
|
||||
panda::ecmascript::kungfu::CommonStubCSigns::Initialize();
|
||||
panda::ecmascript::kungfu::RuntimeStubCSigns::Initialize();
|
||||
panda::ecmascript::kungfu::StubCompiler compiler;
|
||||
compiler.BuildStubModuleAndSave(tripleString, moduleFilename);
|
||||
std::cout << "BuildStubModuleAndSave success" << std::endl;
|
||||
return 0;
|
||||
}
|
32
ecmascript/compiler/stub_compiler.h
Normal file
32
ecmascript/compiler/stub_compiler.h
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ECMASCRIPT_COMPILER_STUB_COMPILER_H
|
||||
#define ECMASCRIPT_COMPILER_STUB_COMPILER_H
|
||||
|
||||
#include "ecmascript/stub_module.h"
|
||||
|
||||
namespace panda::ecmascript::kungfu {
|
||||
class Stub;
|
||||
class StubCompiler {
|
||||
public:
|
||||
StubCompiler() = default;
|
||||
|
||||
~StubCompiler() = default;
|
||||
|
||||
void BuildStubModuleAndSave(const std::string &triple, const std::string &filename);
|
||||
};
|
||||
} // namespace panda::ecmascript::kungfu
|
||||
#endif // ECMASCRIPT_COMPILER_STUB_COMPILER_H
|
@ -24,7 +24,7 @@
|
||||
#include "ecmascript/compiler/llvm_ir_builder.h"
|
||||
#include "ecmascript/compiler/llvm/llvm_stackmap_parser.h"
|
||||
#include "ecmascript/compiler/scheduler.h"
|
||||
#include "ecmascript/compiler/stub_descriptor.h"
|
||||
#include "ecmascript/compiler/call_signature.h"
|
||||
#include "ecmascript/compiler/verifier.h"
|
||||
#include "ecmascript/ecma_vm.h"
|
||||
#include "ecmascript/interpreter/fast_runtime_stub-inl.h"
|
||||
@ -48,12 +48,10 @@ public:
|
||||
void SetUp() override
|
||||
{
|
||||
TestHelper::CreateEcmaVMWithScope(instance, thread, scope);
|
||||
std::vector<int> stubSet = {
|
||||
#define DEF_FAST_STUB(name, counter) FAST_STUB_ID(name),
|
||||
FAST_STUB_LIST_BASE(DEF_FAST_STUB)
|
||||
#undef DEF_FAST_STUB
|
||||
};
|
||||
stubModule.Initialize(stubSet);
|
||||
BytecodeStubCSigns::Initialize();
|
||||
CommonStubCSigns::Initialize();
|
||||
RuntimeStubCSigns::Initialize();
|
||||
stubModule.Initialize();
|
||||
}
|
||||
|
||||
void TearDown() override
|
||||
@ -90,7 +88,7 @@ public:
|
||||
HWTEST_F_L0(StubTest, FastAddTest)
|
||||
{
|
||||
auto module = stubModule.GetModule();
|
||||
auto function = stubModule.GetStubFunction(FAST_STUB_ID(FastAdd));
|
||||
auto function = stubModule.GetFunction(CommonStubCSigns::FastAdd);
|
||||
Circuit netOfGates;
|
||||
FastAddStub optimizer(&netOfGates);
|
||||
optimizer.GenerateCircuit(stubModule.GetCompilationConfig());
|
||||
@ -133,7 +131,7 @@ HWTEST_F_L0(StubTest, FastAddTest)
|
||||
HWTEST_F_L0(StubTest, FastSubTest)
|
||||
{
|
||||
auto module = stubModule.GetModule();
|
||||
auto function = stubModule.GetStubFunction(FAST_STUB_ID(FastSub));
|
||||
auto function = stubModule.GetFunction(CommonStubCSigns::FastSub);
|
||||
Circuit netOfGates;
|
||||
FastSubStub optimizer(&netOfGates);
|
||||
optimizer.GenerateCircuit(stubModule.GetCompilationConfig());
|
||||
@ -169,7 +167,7 @@ HWTEST_F_L0(StubTest, FastSubTest)
|
||||
HWTEST_F_L0(StubTest, FastMulTest)
|
||||
{
|
||||
auto module = stubModule.GetModule();
|
||||
auto function = stubModule.GetStubFunction(FAST_STUB_ID(FastMul));
|
||||
auto function = stubModule.GetFunction(CommonStubCSigns::FastMul);
|
||||
Circuit netOfGates;
|
||||
FastMulStub optimizer(&netOfGates);
|
||||
optimizer.GenerateCircuit(stubModule.GetCompilationConfig());
|
||||
@ -237,7 +235,7 @@ HWTEST_F_L0(StubTest, FastMulTest)
|
||||
HWTEST_F_L0(StubTest, FastDivTest)
|
||||
{
|
||||
auto module = stubModule.GetModule();
|
||||
auto function = stubModule.GetStubFunction(FAST_STUB_ID(FastDiv));
|
||||
auto function = stubModule.GetFunction(CommonStubCSigns::FastDiv);
|
||||
Circuit netOfGates;
|
||||
FastDivStub optimizer(&netOfGates);
|
||||
optimizer.GenerateCircuit(stubModule.GetCompilationConfig());
|
||||
@ -288,7 +286,7 @@ HWTEST_F_L0(StubTest, FastDivTest)
|
||||
HWTEST_F_L0(StubTest, FastModTest)
|
||||
{
|
||||
auto module = stubModule.GetModule();
|
||||
auto function = stubModule.GetStubFunction(FAST_STUB_ID(FastMod));
|
||||
auto function = stubModule.GetFunction(CommonStubCSigns::FastMod);
|
||||
Circuit netOfGates;
|
||||
FastModStub optimizer(&netOfGates);
|
||||
optimizer.GenerateCircuit(stubModule.GetCompilationConfig());
|
||||
@ -355,7 +353,7 @@ HWTEST_F_L0(StubTest, FastModTest)
|
||||
HWTEST_F_L0(StubTest, TryLoadICByName)
|
||||
{
|
||||
auto module = stubModule.GetModule();
|
||||
auto findFunction = stubModule.GetStubFunction(FAST_STUB_ID(TryLoadICByName));
|
||||
auto findFunction = stubModule.GetFunction(CommonStubCSigns::TryLoadICByName);
|
||||
Circuit netOfGates;
|
||||
TryLoadICByNameStub optimizer(&netOfGates);
|
||||
optimizer.GenerateCircuit(stubModule.GetCompilationConfig());
|
||||
@ -371,7 +369,7 @@ HWTEST_F_L0(StubTest, TryLoadICByName)
|
||||
HWTEST_F_L0(StubTest, TryLoadICByValue)
|
||||
{
|
||||
auto module = stubModule.GetModule();
|
||||
auto findFunction = stubModule.GetStubFunction(FAST_STUB_ID(TryLoadICByValue));
|
||||
auto findFunction = stubModule.GetFunction(CommonStubCSigns::TryLoadICByValue);
|
||||
Circuit netOfGates;
|
||||
TryLoadICByValueStub optimizer(&netOfGates);
|
||||
optimizer.GenerateCircuit(stubModule.GetCompilationConfig());
|
||||
@ -387,7 +385,7 @@ HWTEST_F_L0(StubTest, TryLoadICByValue)
|
||||
HWTEST_F_L0(StubTest, TryStoreICByName)
|
||||
{
|
||||
auto module = stubModule.GetModule();
|
||||
auto findFunction = stubModule.GetStubFunction(FAST_STUB_ID(TryStoreICByName));
|
||||
auto findFunction = stubModule.GetFunction(CommonStubCSigns::TryStoreICByName);
|
||||
Circuit netOfGates;
|
||||
TryStoreICByNameStub optimizer(&netOfGates);
|
||||
optimizer.GenerateCircuit(stubModule.GetCompilationConfig());
|
||||
@ -403,7 +401,7 @@ HWTEST_F_L0(StubTest, TryStoreICByName)
|
||||
HWTEST_F_L0(StubTest, TryStoreICByValue)
|
||||
{
|
||||
auto module = stubModule.GetModule();
|
||||
auto findFunction = stubModule.GetStubFunction(FAST_STUB_ID(TryStoreICByValue));
|
||||
auto findFunction = stubModule.GetFunction(CommonStubCSigns::TryStoreICByValue);
|
||||
Circuit netOfGates;
|
||||
TryStoreICByValueStub optimizer(&netOfGates);
|
||||
optimizer.GenerateCircuit(stubModule.GetCompilationConfig());
|
||||
@ -744,7 +742,6 @@ HWTEST_F_L0(StubTest, Prologue)
|
||||
assembler.Run();
|
||||
auto engine = assembler.GetEngine();
|
||||
uint64_t mainCode = LLVMGetFunctionAddress(engine, "main");
|
||||
assembler.Disassemble();
|
||||
auto mainFunc = reinterpret_cast<int64_t (*)(int64_t, int64_t)>(mainCode);
|
||||
int64_t result = mainFunc(1, 2);
|
||||
EXPECT_EQ(result, 3);
|
||||
@ -818,7 +815,6 @@ HWTEST_F_L0(StubTest, CEntryFp)
|
||||
auto engine = assembler.GetEngine();
|
||||
uint64_t nativeCode = LLVMGetFunctionAddress(engine, "main");
|
||||
std::cout << std::endl << " nativeCode : " << nativeCode << std::endl;
|
||||
assembler.Disassemble();
|
||||
struct ThreadTy parameters = {0x0, 0x0};
|
||||
|
||||
auto mainFunc = reinterpret_cast<int64_t (*)(struct ThreadTy *)>(nativeCode);
|
||||
@ -860,7 +856,6 @@ HWTEST_F_L0(StubTest, LoadGCIRTest)
|
||||
uint8_t *ptr = assembler.GetStackMapsSection();
|
||||
LLVMStackMapParser::GetInstance().CalculateStackMap(ptr);
|
||||
|
||||
assembler.Disassemble();
|
||||
int value = reinterpret_cast<int (*)()>(mainPtr)();
|
||||
std::cout << " value:" << value << std::endl;
|
||||
}
|
||||
@ -902,7 +897,7 @@ void DoSafepoint()
|
||||
HWTEST_F_L0(StubTest, GetPropertyByIndexStub)
|
||||
{
|
||||
auto module = stubModule.GetModule();
|
||||
auto function = stubModule.GetStubFunction(FAST_STUB_ID(GetPropertyByIndex));
|
||||
auto function = stubModule.GetFunction(CommonStubCSigns::GetPropertyByIndex);
|
||||
Circuit netOfGates;
|
||||
GetPropertyByIndexStub optimizer(&netOfGates);
|
||||
optimizer.GenerateCircuit(stubModule.GetCompilationConfig());
|
||||
@ -921,7 +916,6 @@ HWTEST_F_L0(StubTest, GetPropertyByIndexStub)
|
||||
int y = 10;
|
||||
FastRuntimeStub::SetOwnElement(thread, obj.GetTaggedValue(), 1, JSTaggedValue(x));
|
||||
FastRuntimeStub::SetOwnElement(thread, obj.GetTaggedValue(), 10250, JSTaggedValue(y));
|
||||
assembler.Disassemble();
|
||||
JSTaggedValue resVal = getpropertyByIndex(thread->GetGlueAddr(), obj.GetTaggedValue(), 1);
|
||||
EXPECT_EQ(resVal.GetNumber(), x);
|
||||
resVal = getpropertyByIndex(thread->GetGlueAddr(), obj.GetTaggedValue(), 10250);
|
||||
@ -932,7 +926,7 @@ HWTEST_F_L0(StubTest, GetPropertyByIndexStub)
|
||||
HWTEST_F_L0(StubTest, SetPropertyByIndexStub)
|
||||
{
|
||||
auto module = stubModule.GetModule();
|
||||
auto function = stubModule.GetStubFunction(FAST_STUB_ID(SetPropertyByIndex));
|
||||
auto function = stubModule.GetFunction(CommonStubCSigns::SetPropertyByIndex);
|
||||
Circuit netOfGates;
|
||||
SetPropertyByIndexStub optimizer(&netOfGates);
|
||||
optimizer.GenerateCircuit(stubModule.GetCompilationConfig());
|
||||
@ -949,7 +943,6 @@ HWTEST_F_L0(StubTest, SetPropertyByIndexStub)
|
||||
reinterpret_cast<uintptr_t>(assembler.GetFuncPtrFromCompiledModule(function)));
|
||||
auto *factory = JSThread::Cast(thread)->GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSArray> array = factory->NewJSArray();
|
||||
assembler.Disassemble();
|
||||
// set value to array
|
||||
array->SetArrayLength(thread, 20);
|
||||
for (int i = 0; i < 20; i++) {
|
||||
@ -966,7 +959,7 @@ HWTEST_F_L0(StubTest, SetPropertyByIndexStub)
|
||||
HWTEST_F_L0(StubTest, GetPropertyByNameStub)
|
||||
{
|
||||
auto module = stubModule.GetModule();
|
||||
auto function = stubModule.GetStubFunction(FAST_STUB_ID(GetPropertyByName));
|
||||
auto function = stubModule.GetFunction(CommonStubCSigns::GetPropertyByName);
|
||||
Circuit netOfGates;
|
||||
GetPropertyByNameStub optimizer(&netOfGates);
|
||||
optimizer.GenerateCircuit(stubModule.GetCompilationConfig());
|
||||
@ -989,7 +982,6 @@ HWTEST_F_L0(StubTest, GetPropertyByNameStub)
|
||||
JSHandle<JSTaggedValue> strBig(factory->NewFromCanBeCompressString("biggest"));
|
||||
FastRuntimeStub::SetPropertyByName(thread, obj.GetTaggedValue(), strA.GetTaggedValue(), JSTaggedValue(x));
|
||||
FastRuntimeStub::SetPropertyByName(thread, obj.GetTaggedValue(), strBig.GetTaggedValue(), JSTaggedValue(y));
|
||||
assembler.Disassemble();
|
||||
JSTaggedValue resVal = getPropertyByNamePtr(thread->GetGlueAddr(), obj.GetTaggedValue().GetRawData(),
|
||||
strA.GetTaggedValue().GetRawData());
|
||||
EXPECT_EQ(resVal.GetNumber(), x);
|
||||
@ -1002,7 +994,7 @@ HWTEST_F_L0(StubTest, GetPropertyByNameStub)
|
||||
HWTEST_F_L0(StubTest, SetPropertyByNameStub)
|
||||
{
|
||||
auto module = stubModule.GetModule();
|
||||
auto function = stubModule.GetStubFunction(FAST_STUB_ID(SetPropertyByName));
|
||||
auto function = stubModule.GetFunction(CommonStubCSigns::SetPropertyByName);
|
||||
Circuit netOfGates;
|
||||
SetPropertyByNameStub optimizer(&netOfGates);
|
||||
optimizer.GenerateCircuit(stubModule.GetCompilationConfig());
|
||||
@ -1013,7 +1005,6 @@ HWTEST_F_L0(StubTest, SetPropertyByNameStub)
|
||||
llvmBuilder.Build();
|
||||
LLVMAssembler assembler(module);
|
||||
assembler.Run();
|
||||
assembler.Disassemble();
|
||||
auto *setPropertyByName = reinterpret_cast<JSTaggedValue (*)(uintptr_t, JSTaggedValue,
|
||||
JSTaggedValue, JSTaggedValue, bool)>
|
||||
(reinterpret_cast<uintptr_t>(assembler.GetFuncPtrFromCompiledModule(function)));
|
||||
@ -1035,7 +1026,7 @@ HWTEST_F_L0(StubTest, SetPropertyByNameStub)
|
||||
HWTEST_F_L0(StubTest, GetPropertyByValueStub)
|
||||
{
|
||||
auto module = stubModule.GetModule();
|
||||
LLVMValueRef getPropertyByIndexfunction = stubModule.GetStubFunction(FAST_STUB_ID(GetPropertyByIndex));
|
||||
LLVMValueRef getPropertyByIndexfunction = stubModule.GetFunction(CommonStubCSigns::GetPropertyByIndex);
|
||||
Circuit netOfGates2;
|
||||
GetPropertyByIndexStub getPropertyByIndexStub(&netOfGates2);
|
||||
getPropertyByIndexStub.GenerateCircuit(stubModule.GetCompilationConfig());
|
||||
@ -1045,7 +1036,7 @@ HWTEST_F_L0(StubTest, GetPropertyByValueStub)
|
||||
stubModule.GetCompilationConfig());
|
||||
llvmBuilder2.Build();
|
||||
|
||||
LLVMValueRef getPropertyByNamefunction = stubModule.GetStubFunction(FAST_STUB_ID(GetPropertyByName));
|
||||
LLVMValueRef getPropertyByNamefunction = stubModule.GetFunction(CommonStubCSigns::GetPropertyByName);
|
||||
Circuit netOfGates1;
|
||||
GetPropertyByNameStub getPropertyByNameStub(&netOfGates1);
|
||||
getPropertyByNameStub.GenerateCircuit(stubModule.GetCompilationConfig());
|
||||
@ -1056,7 +1047,7 @@ HWTEST_F_L0(StubTest, GetPropertyByValueStub)
|
||||
stubModule.GetCompilationConfig());
|
||||
llvmBuilder1.Build();
|
||||
|
||||
LLVMValueRef function = stubModule.GetStubFunction(FAST_STUB_ID(GetPropertyByValue));
|
||||
LLVMValueRef function = stubModule.GetFunction(CommonStubCSigns::GetPropertyByValue);
|
||||
Circuit netOfGates;
|
||||
GetPropertyByValueStub optimizer(&netOfGates);
|
||||
optimizer.GenerateCircuit(stubModule.GetCompilationConfig());
|
||||
@ -1077,8 +1068,8 @@ HWTEST_F_L0(StubTest, GetPropertyByValueStub)
|
||||
auto *getpropertyByIndexPtr = reinterpret_cast<JSTaggedValue (*)(uintptr_t, JSTaggedValue, uint32_t)>(
|
||||
reinterpret_cast<uintptr_t>(assembler.GetFuncPtrFromCompiledModule(getPropertyByIndexfunction)));
|
||||
|
||||
thread->SetFastStubEntry(FAST_STUB_ID(GetPropertyByIndex), reinterpret_cast<uintptr_t>(getpropertyByIndexPtr));
|
||||
thread->SetFastStubEntry(FAST_STUB_ID(GetPropertyByName), reinterpret_cast<uintptr_t>(getPropertyByNamePtr));
|
||||
thread->SetFastStubEntry(CommonStubCSigns::GetPropertyByIndex, reinterpret_cast<uintptr_t>(getpropertyByIndexPtr));
|
||||
thread->SetFastStubEntry(CommonStubCSigns::GetPropertyByName, reinterpret_cast<uintptr_t>(getPropertyByNamePtr));
|
||||
auto *factory = JSThread::Cast(thread)->GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSObject> obj = factory->NewEmptyJSObject();
|
||||
int x = 213;
|
||||
@ -1093,8 +1084,6 @@ HWTEST_F_L0(StubTest, GetPropertyByValueStub)
|
||||
|
||||
FastRuntimeStub::SetPropertyByName(thread, obj.GetTaggedValue(), strA.GetTaggedValue(), JSTaggedValue(x));
|
||||
FastRuntimeStub::SetPropertyByName(thread, obj.GetTaggedValue(), strBig.GetTaggedValue(), JSTaggedValue(y));
|
||||
assembler.Disassemble();
|
||||
|
||||
JSTaggedValue resVal1 = getPropertyByNamePtr(thread->GetGlueAddr(), obj.GetTaggedValue().GetRawData(),
|
||||
strA.GetTaggedValue().GetRawData());
|
||||
EXPECT_EQ(resVal1.GetNumber(), x);
|
||||
@ -1124,7 +1113,7 @@ HWTEST_F_L0(StubTest, GetPropertyByValueStub)
|
||||
HWTEST_F_L0(StubTest, FastTypeOfTest)
|
||||
{
|
||||
auto module = stubModule.GetModule();
|
||||
auto function = stubModule.GetStubFunction(FAST_STUB_ID(FastTypeOf));
|
||||
auto function = stubModule.GetFunction(CommonStubCSigns::FastTypeOf);
|
||||
Circuit netOfGates;
|
||||
FastTypeOfStub optimizer(&netOfGates);
|
||||
optimizer.GenerateCircuit(stubModule.GetCompilationConfig());
|
||||
@ -1227,7 +1216,7 @@ HWTEST_F_L0(StubTest, FastTypeOfTest)
|
||||
HWTEST_F_L0(StubTest, FastEqualTest)
|
||||
{
|
||||
auto module = stubModule.GetModule();
|
||||
auto function = stubModule.GetStubFunction(FAST_STUB_ID(FastEqual));
|
||||
auto function = stubModule.GetFunction(CommonStubCSigns::FastEqual);
|
||||
Circuit netOfGates;
|
||||
FastEqualStub optimizer(&netOfGates);
|
||||
optimizer.GenerateCircuit(stubModule.GetCompilationConfig());
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "ecmascript/dfx/hprof/heap_snapshot_json_serializer.h"
|
||||
#include "ecmascript/dfx/hprof/heap_tracker.h"
|
||||
#include "ecmascript/ecma_macros.h"
|
||||
#include "ecmascript/ecma_vm.h"
|
||||
#include "ecmascript/mem/c_containers.h"
|
||||
#include "ecmascript/mem/heap.h"
|
||||
#include "os/mem.h"
|
||||
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ECMASCRIPT_HANDLE_SCOPE_INL_H
|
||||
#define ECMASCRIPT_HANDLE_SCOPE_INL_H
|
||||
|
||||
#include "ecmascript/ecma_handle_scope.h"
|
||||
#include "ecmascript/js_thread.h"
|
||||
|
||||
namespace panda::ecmascript {
|
||||
inline EcmaHandleScope::EcmaHandleScope(JSThread *thread)
|
||||
: thread_(thread), prevNext_(thread->handleScopeStorageNext_), prevEnd_(thread->handleScopeStorageEnd_),
|
||||
prevHandleStorageIndex_(thread->currentHandleStorageIndex_)
|
||||
{
|
||||
thread->HandleScopeCountAdd();
|
||||
}
|
||||
|
||||
inline EcmaHandleScope::~EcmaHandleScope()
|
||||
{
|
||||
thread_->HandleScopeCountDec();
|
||||
thread_->handleScopeStorageNext_ = prevNext_;
|
||||
if (thread_->handleScopeStorageEnd_ != prevEnd_) {
|
||||
thread_->handleScopeStorageEnd_ = prevEnd_;
|
||||
thread_->ShrinkHandleStorage(prevHandleStorageIndex_);
|
||||
}
|
||||
}
|
||||
|
||||
uintptr_t EcmaHandleScope::NewHandle(JSThread *thread, JSTaggedType value)
|
||||
{
|
||||
// Each Handle must be managed by HandleScope, otherwise it may cause Handle leakage.
|
||||
ASSERT(thread->handleScopeCount_ > 0);
|
||||
auto result = thread->handleScopeStorageNext_;
|
||||
if (result == thread->handleScopeStorageEnd_) {
|
||||
result = reinterpret_cast<JSTaggedType *>(thread->ExpandHandleStorage());
|
||||
}
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
|
||||
thread->handleScopeStorageNext_ = result + 1;
|
||||
*result = value;
|
||||
return reinterpret_cast<uintptr_t>(result);
|
||||
}
|
||||
} // namespace panda::ecmascript
|
||||
#endif // ECMASCRIPT_HANDLE_SCOPE_INL_H
|
@ -17,21 +17,44 @@
|
||||
#define ECMASCRIPT_HANDLE_SCOPE_H
|
||||
|
||||
#include "ecmascript/js_tagged_value.h"
|
||||
|
||||
#include "ecmascript/js_thread.h"
|
||||
namespace panda::ecmascript {
|
||||
class JSThread;
|
||||
|
||||
/*
|
||||
* Handles are only valid within a HandleScope. When a handle is created for an object a cell is allocated in the
|
||||
* current HandleScope.
|
||||
*/
|
||||
class EcmaHandleScope {
|
||||
public:
|
||||
inline explicit EcmaHandleScope(JSThread *thread);
|
||||
inline explicit EcmaHandleScope(JSThread *thread) :
|
||||
thread_(thread), prevNext_(thread->handleScopeStorageNext_), prevEnd_(thread->handleScopeStorageEnd_),
|
||||
prevHandleStorageIndex_(thread->currentHandleStorageIndex_)
|
||||
{
|
||||
thread->HandleScopeCountAdd();
|
||||
}
|
||||
|
||||
inline ~EcmaHandleScope();
|
||||
inline ~EcmaHandleScope()
|
||||
{
|
||||
thread_->HandleScopeCountDec();
|
||||
thread_->handleScopeStorageNext_ = prevNext_;
|
||||
if (thread_->handleScopeStorageEnd_ != prevEnd_) {
|
||||
thread_->handleScopeStorageEnd_ = prevEnd_;
|
||||
thread_->ShrinkHandleStorage(prevHandleStorageIndex_);
|
||||
}
|
||||
}
|
||||
|
||||
static inline uintptr_t PUBLIC_API NewHandle(JSThread *thread, JSTaggedType value);
|
||||
static inline uintptr_t PUBLIC_API NewHandle(JSThread *thread, JSTaggedType value)
|
||||
{
|
||||
// Each Handle must be managed by HandleScope, otherwise it may cause Handle leakage.
|
||||
ASSERT(thread->handleScopeCount_ > 0);
|
||||
auto result = thread->handleScopeStorageNext_;
|
||||
if (result == thread->handleScopeStorageEnd_) {
|
||||
result = reinterpret_cast<JSTaggedType *>(thread->ExpandHandleStorage());
|
||||
}
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
|
||||
thread->handleScopeStorageNext_ = result + 1;
|
||||
*result = value;
|
||||
return reinterpret_cast<uintptr_t>(result);
|
||||
}
|
||||
|
||||
JSThread *GetThread() const
|
||||
{
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "ecmascript/ecma_language_context.h"
|
||||
|
||||
#include "ecmascript/ecma_exceptions.h"
|
||||
#include "ecmascript/ecma_vm.h"
|
||||
#include "ecmascript/interpreter/frame_handler.h"
|
||||
#include "ecmascript/jspandafile/ecma_class_linker_extension.h"
|
||||
#include "ecmascript/js_method.h"
|
||||
|
@ -17,12 +17,6 @@
|
||||
#define ECMASCRIPT_ECMA_MACROS_H
|
||||
|
||||
#include "ecmascript/common.h"
|
||||
#include "ecmascript/ecma_vm.h"
|
||||
#include "ecmascript/js_tagged_value.h"
|
||||
#include "ecmascript/js_thread.h"
|
||||
#include "ecmascript/mem/barriers-inl.h"
|
||||
#include "ecmascript/mem/slots.h"
|
||||
#include "utils/logger.h"
|
||||
|
||||
#if !defined(PANDA_TARGET_LINUX) && defined(IS_PUBLIC_VERSION) && defined(ENABLE_BYTRACE)
|
||||
#include "bytrace.h"
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "ecmascript/ecma_macros.h"
|
||||
#include "ecmascript/js_tagged_value.h"
|
||||
#include "ecmascript/mem/tagged_object.h"
|
||||
#include "ecmascript/mem/barriers.h"
|
||||
|
||||
namespace panda {
|
||||
namespace ecmascript {
|
||||
|
@ -18,6 +18,10 @@
|
||||
#include "ecmascript/base/string_helper.h"
|
||||
#include "ecmascript/builtins.h"
|
||||
#include "ecmascript/builtins/builtins_regexp.h"
|
||||
#include "ecmascript/compiler/fast_stub.h"
|
||||
#include "ecmascript/compiler/interpreter_stub.h"
|
||||
#include "ecmascript/compiler/rt_call_signature.h"
|
||||
#include "ecmascript/compiler/call_signature.h"
|
||||
#if defined(ECMASCRIPT_SUPPORT_CPUPROFILER)
|
||||
#include "ecmascript/dfx/cpu_profiler/cpu_profiler.h"
|
||||
#endif
|
||||
@ -47,7 +51,7 @@
|
||||
#include "ecmascript/regexp/regexp_parser_cache.h"
|
||||
#include "ecmascript/runtime_call_id.h"
|
||||
#ifndef PANDA_TARGET_WINDOWS
|
||||
#include "ecmascript/trampoline/runtime_trampolines.h"
|
||||
#include "ecmascript/stubs/runtime_stubs.h"
|
||||
#endif
|
||||
#include "ecmascript/snapshot/mem/slot_bit.h"
|
||||
#include "ecmascript/snapshot/mem/snapshot.h"
|
||||
@ -144,9 +148,8 @@ bool EcmaVM::Initialize()
|
||||
ECMA_BYTRACE_NAME(BYTRACE_TAG_ARK, "EcmaVM::Initialize");
|
||||
Platform::GetCurrentPlatform()->Initialize();
|
||||
#ifndef PANDA_TARGET_WINDOWS
|
||||
RuntimeTrampolines::InitializeRuntimeTrampolines(thread_);
|
||||
RuntimeStubs::Initialize(thread_);
|
||||
#endif
|
||||
|
||||
auto globalConst = const_cast<GlobalEnvConstants *>(thread_->GlobalConstants());
|
||||
regExpParserCache_ = new RegExpParserCache();
|
||||
heap_ = new Heap(this);
|
||||
@ -205,7 +208,6 @@ bool EcmaVM::Initialize()
|
||||
LOG_ECMA(FATAL) << "Don't support snapshot now.";
|
||||
#endif
|
||||
}
|
||||
|
||||
thread_->SetGlobalObject(GetGlobalEnv()->GetGlobalObject());
|
||||
moduleManager_ = new ModuleManager(this);
|
||||
tsLoader_ = new TSLoader(this);
|
||||
@ -240,7 +242,7 @@ void EcmaVM::InitializeEcmaScriptRunStat()
|
||||
MEM_ALLOCATE_AND_GC_LIST(MEM_ALLOCATE_AND_GC_NAME)
|
||||
#undef MEM_ALLOCATE_AND_GC_NAME
|
||||
#define DEF_RUNTIME_ID(name, c) "Runtime::" #name,
|
||||
RUNTIME_CALL_LIST(DEF_RUNTIME_ID)
|
||||
RUNTIME_STUB_WITH_GC_LIST(DEF_RUNTIME_ID)
|
||||
#undef DEF_RUNTIME_ID
|
||||
};
|
||||
static_assert(sizeof(runtimeCallerNames) == sizeof(const char *) * ecmascript::RUNTIME_CALLER_NUMBER,
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
#include "ecmascript/base/config.h"
|
||||
#include "ecmascript/ecma_string_table.h"
|
||||
#include "ecmascript/global_handle_collection.h"
|
||||
#include "ecmascript/js_handle.h"
|
||||
#include "ecmascript/js_method.h"
|
||||
#include "ecmascript/js_runtime_options.h"
|
||||
|
@ -19,6 +19,8 @@
|
||||
#include "ecmascript/ecma_macros.h"
|
||||
#include "ecmascript/js_hclass.h"
|
||||
#include "ecmascript/js_tagged_value.h"
|
||||
#include "ecmascript/mem/object_xray.h"
|
||||
#include "ecmascript/mem/slots.h"
|
||||
#include "ecmascript/property_attributes.h"
|
||||
|
||||
namespace panda {
|
||||
|
@ -657,7 +657,7 @@ bool FastRuntimeStub::FastSetPropertyByIndex(JSThread *thread, JSTaggedValue rec
|
||||
{
|
||||
INTERPRETER_TRACE(thread, FastSetPropertyByIndex);
|
||||
#ifdef ECMASCRIPT_ENABLE_STUB_AOT1
|
||||
auto stubAddr = thread->GetFastStubEntry(FAST_STUB_ID(SetPropertyByIndex));
|
||||
auto stubAddr = thread->GetFastStubEntry(CommonStubCSigns::SetPropertyByIndex);
|
||||
typedef JSTaggedValue (*PFSetPropertyByIndex)(uintptr_t, JSTaggedValue, uint32_t, JSTaggedValue);
|
||||
auto setPropertyByIndex = reinterpret_cast<PFSetPropertyByIndex>(stubAddr);
|
||||
JSTaggedValue result = setPropertyByIndex(thread->GetGlueAddr(), receiver, index, value);
|
||||
@ -696,7 +696,7 @@ JSTaggedValue FastRuntimeStub::FastGetPropertyByName(JSThread *thread, JSTaggedV
|
||||
receiver = receiverHandler.GetTaggedValue();
|
||||
}
|
||||
#ifdef ECMASCRIPT_ENABLE_STUB_AOT1
|
||||
auto stubAddr = thread->GetFastStubEntry(FAST_STUB_ID(GetPropertyByName));
|
||||
auto stubAddr = thread->GetFastStubEntry(CommonStubCSigns::GetPropertyByName);
|
||||
typedef JSTaggedValue (*PFGetPropertyByName)(uintptr_t, JSTaggedValue, JSTaggedValue);
|
||||
auto getPropertyByNamePtr = reinterpret_cast<PFGetPropertyByName>(stubAddr);
|
||||
JSTaggedValue result = getPropertyByNamePtr(thread->GetGlueAddr(), receiver, key);
|
||||
@ -716,7 +716,7 @@ JSTaggedValue FastRuntimeStub::FastGetPropertyByValue(JSThread *thread, JSTagged
|
||||
{
|
||||
INTERPRETER_TRACE(thread, FastGetPropertyByValue);
|
||||
#ifdef ECMASCRIPT_ENABLE_STUB_AOT1
|
||||
auto stubAddr = thread->GetFastStubEntry(FAST_STUB_ID(GetPropertyByValue));
|
||||
auto stubAddr = thread->GetFastStubEntry(CommonStubCSigns::GetPropertyByValue);
|
||||
typedef JSTaggedValue (*PFGetPropertyByValue)(uintptr_t, JSTaggedValue, JSTaggedValue);
|
||||
auto getPropertyByValuePtr = reinterpret_cast<PFGetPropertyByValue>(stubAddr);
|
||||
JSTaggedValue result = getPropertyByValuePtr(thread->GetGlueAddr(), receiver, key);
|
||||
@ -737,7 +737,7 @@ JSTaggedValue FastRuntimeStub::FastGetPropertyByIndex(JSThread *thread, JSTagged
|
||||
{
|
||||
INTERPRETER_TRACE(thread, FastGetPropertyByIndex);
|
||||
#ifdef ECMASCRIPT_ENABLE_STUB_AOT1
|
||||
auto stubAddr = thread->GetFastStubEntry(FAST_STUB_ID(GetPropertyByIndex));
|
||||
auto stubAddr = thread->GetFastStubEntry(CommonStubCSigns::GetPropertyByIndex);
|
||||
typedef JSTaggedValue (*PFGetPropertyByIndex)(uintptr_t, JSTaggedValue, uint32_t);
|
||||
auto getPropertyByIndex = reinterpret_cast<PFGetPropertyByIndex>(stubAddr);
|
||||
JSTaggedValue result = getPropertyByIndex(thread->GetGlueAddr(), receiver, index);
|
||||
|
@ -335,8 +335,10 @@ void FrameIterator::Iterate(const RootVisitor &v0, const RootRangeVisitor &v1) c
|
||||
} else {
|
||||
ASSERT(type == FrameType::OPTIMIZED_LEAVE_FRAME || type == FrameType::ASM_LEAVE_FRAME);
|
||||
OptimizedLeaveFrame *frame = OptimizedLeaveFrame::GetFrameFromSp(current);
|
||||
OptimizedLeaveFrameHandler(reinterpret_cast<uintptr_t *>(current)).Iterate(v0,
|
||||
v1, derivedPointers, isVerifying);
|
||||
if (leaveFrame != current) { // avoid iterating from same leaveframe again
|
||||
OptimizedLeaveFrameHandler(reinterpret_cast<uintptr_t *>(current)).Iterate(v0,
|
||||
v1, derivedPointers, isVerifying);
|
||||
}
|
||||
// arm32, arm64 and x86_64 support stub and aot, when aot/stub call runtime, generate Optimized
|
||||
// Leave Frame.
|
||||
current = reinterpret_cast<JSTaggedType *>(frame->callsiteFp);
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "libpandafile/method_data_accessor.h"
|
||||
|
||||
namespace panda::ecmascript {
|
||||
using CommonStubCSigns = kungfu::CommonStubCSigns;
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wvoid-ptr-dereference"
|
||||
@ -527,16 +528,12 @@ JSTaggedValue EcmaInterpreter::Execute(JSThread *thread, const CallParams& param
|
||||
<< std::hex << reinterpret_cast<uintptr_t>(pc);
|
||||
|
||||
thread->GetEcmaVM()->GetNotificationManager()->MethodEntryEvent(thread, method);
|
||||
#if ECMASCRIPT_COMPILE_INTERPRETER_ASM
|
||||
AsmInterParsedOption asmInterOpt = thread->GetEcmaVM()->GetJSOptions().GetAsmInterParsedOption();
|
||||
if (asmInterOpt.enableAsm) {
|
||||
InterpreterAssembly::RunInternal(thread, ConstantPool::Cast(constpool.GetTaggedObject()), pc, newSp);
|
||||
} else {
|
||||
EcmaInterpreter::RunInternal(thread, ConstantPool::Cast(constpool.GetTaggedObject()), pc, newSp);
|
||||
}
|
||||
#else
|
||||
EcmaInterpreter::RunInternal(thread, ConstantPool::Cast(constpool.GetTaggedObject()), pc, newSp);
|
||||
#endif
|
||||
thread->GetEcmaVM()->GetNotificationManager()->MethodExitEvent(thread, method);
|
||||
|
||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||
@ -604,16 +601,12 @@ JSTaggedValue EcmaInterpreter::GeneratorReEnterInterpreter(JSThread *thread, JSH
|
||||
thread->SetCurrentSPFrame(newSp);
|
||||
|
||||
thread->GetEcmaVM()->GetNotificationManager()->MethodEntryEvent(thread, method);
|
||||
#if ECMASCRIPT_COMPILE_INTERPRETER_ASM
|
||||
AsmInterParsedOption asmInterOpt = thread->GetEcmaVM()->GetJSOptions().GetAsmInterParsedOption();
|
||||
if (asmInterOpt.enableAsm) {
|
||||
InterpreterAssembly::RunInternal(thread, ConstantPool::Cast(constpool.GetTaggedObject()), resumePc, newSp);
|
||||
} else {
|
||||
EcmaInterpreter::RunInternal(thread, ConstantPool::Cast(constpool.GetTaggedObject()), resumePc, newSp);
|
||||
}
|
||||
#else
|
||||
EcmaInterpreter::RunInternal(thread, ConstantPool::Cast(constpool.GetTaggedObject()), resumePc, newSp);
|
||||
#endif
|
||||
thread->GetEcmaVM()->GetNotificationManager()->MethodExitEvent(thread, method);
|
||||
|
||||
JSTaggedValue res = state->acc;
|
||||
@ -1055,7 +1048,7 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, ConstantPool
|
||||
if (!acc.IsUndefined()) {
|
||||
{
|
||||
[[maybe_unused]] EcmaHandleScope handleScope(thread);
|
||||
JSHandle<JSObject> error = factory->GetJSError(ErrorType::TYPE_ERROR,
|
||||
JSHandle<JSObject> error = factory->GetJSError(ErrorType::TYPE_ERROR,
|
||||
"Derived constructor must return object or undefined");
|
||||
thread->SetException(error.GetTaggedValue());
|
||||
}
|
||||
@ -1315,7 +1308,7 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, ConstantPool
|
||||
HANDLE_OPCODE(HANDLE_TYPEOFDYN_PREF) {
|
||||
LOG_INST() << "intrinsics::typeofdyn";
|
||||
#ifdef ECMASCRIPT_ENABLE_STUB_AOT
|
||||
auto stubAddr = thread->GetFastStubEntry(FAST_STUB_ID(FastTypeOf));
|
||||
auto stubAddr = thread->GetFastStubEntry(CommonStubCSigns::FastTypeOf);
|
||||
typedef JSTaggedType (*PFFastTypeOf)(uintptr_t, JSTaggedType);
|
||||
auto fastTypeOfPtr = reinterpret_cast<PFFastTypeOf>(stubAddr);
|
||||
JSTaggedValue res = JSTaggedValue(fastTypeOfPtr(thread->GetGlueAddr(), GET_ACC().GetRawData()));
|
||||
@ -1490,7 +1483,7 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, ConstantPool
|
||||
JSTaggedValue left = GET_VREG_VALUE(v0);
|
||||
JSTaggedValue right = acc;
|
||||
#ifdef ECMASCRIPT_ENABLE_STUB_AOT
|
||||
auto stubAddr = thread->GetFastStubEntry(FAST_STUB_ID(FastMul));
|
||||
auto stubAddr = thread->GetFastStubEntry(CommonStubCSigns::FastMul);
|
||||
typedef JSTaggedType (*PFFastMul)(JSTaggedType, JSTaggedType);
|
||||
auto fastMulPtr = reinterpret_cast<PFFastMul>(stubAddr);
|
||||
JSTaggedValue value = JSTaggedValue(fastMulPtr(left.GetRawData(), right.GetRawData()));
|
||||
@ -1535,7 +1528,7 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, ConstantPool
|
||||
JSTaggedValue right = GET_ACC();
|
||||
|
||||
#ifdef ECMASCRIPT_ENABLE_STUB_AOT
|
||||
auto stubAddr = thread->GetFastStubEntry(FAST_STUB_ID(FastMod));
|
||||
auto stubAddr = thread->GetFastStubEntry(CommonStubCSigns::FastMod);
|
||||
typedef JSTaggedType (*PFFastMod)(uintptr_t, JSTaggedType, JSTaggedType);
|
||||
auto fastModPtr = reinterpret_cast<PFFastMod>(stubAddr);
|
||||
JSTaggedValue res = JSTaggedValue(fastModPtr(thread->GetGlueAddr(), left.GetRawData(), right.GetRawData()));
|
||||
@ -1561,7 +1554,7 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, ConstantPool
|
||||
JSTaggedValue left = GET_VREG_VALUE(v0);
|
||||
JSTaggedValue right = acc;
|
||||
#ifdef ECMASCRIPT_ENABLE_STUB_AOT
|
||||
auto stubAddr = thread->GetFastStubEntry(FAST_STUB_ID(FastEqual));
|
||||
auto stubAddr = thread->GetFastStubEntry(CommonStubCSigns::FastEqual);
|
||||
typedef JSTaggedType (*PFFastEqual)(JSTaggedType, JSTaggedType);
|
||||
auto fastEqualPtr = reinterpret_cast<PFFastEqual>(stubAddr);
|
||||
JSTaggedValue res = JSTaggedValue(fastEqualPtr(left.GetRawData(), right.GetRawData()));
|
||||
@ -2503,7 +2496,7 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, ConstantPool
|
||||
// fast path
|
||||
SAVE_ACC();
|
||||
#ifdef ECMASCRIPT_ENABLE_STUB_AOT
|
||||
auto stubAddr = thread->GetFastStubEntry(FAST_STUB_ID(SetPropertyByNameWithOwn));
|
||||
auto stubAddr = thread->GetFastStubEntry(CommonStubCSigns::SetPropertyByNameWithOwn);
|
||||
typedef JSTaggedType (*PFSetPropertyByName)(uintptr_t, JSTaggedType, JSTaggedType, JSTaggedType);
|
||||
auto setPropertyByNamePtr = reinterpret_cast<PFSetPropertyByName>(stubAddr);
|
||||
JSTaggedValue res = JSTaggedValue(setPropertyByNamePtr(thread->GetGlueAddr(),
|
||||
@ -2854,7 +2847,7 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, ConstantPool
|
||||
// fast path
|
||||
if (LIKELY(receiver.IsHeapObject())) {
|
||||
#ifdef ECMASCRIPT_ENABLE_STUB_AOT
|
||||
auto stubAddr = thread->GetFastStubEntry(FAST_STUB_ID(GetPropertyByIndex));
|
||||
auto stubAddr = thread->GetFastStubEntry(CommonStubCSigns::GetPropertyByIndex);
|
||||
typedef JSTaggedType (*PFGetPropertyByIndex)(uintptr_t, JSTaggedType, uint32_t);
|
||||
auto getPropertyByIndex = reinterpret_cast<PFGetPropertyByIndex>(stubAddr);
|
||||
JSTaggedValue res = JSTaggedValue(getPropertyByIndex(thread->GetGlueAddr(), receiver.GetRawData(), idx));
|
||||
@ -2887,7 +2880,7 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, ConstantPool
|
||||
JSTaggedValue value = GET_ACC();
|
||||
// fast path
|
||||
#ifdef ECMASCRIPT_ENABLE_STUB_AOT
|
||||
auto stubAddr = thread->GetFastStubEntry(FAST_STUB_ID(SetPropertyByIndex));
|
||||
auto stubAddr = thread->GetFastStubEntry(CommonStubCSigns::SetPropertyByIndex);
|
||||
typedef JSTaggedType (*PFSetPropertyByIndex)(uintptr_t, JSTaggedType, uint32_t, JSTaggedType);
|
||||
auto setPropertyByIndex = reinterpret_cast<PFSetPropertyByIndex>(stubAddr);
|
||||
JSTaggedValue res = JSTaggedValue(setPropertyByIndex(thread->GetGlueAddr(),
|
||||
@ -2950,7 +2943,7 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, ConstantPool
|
||||
// fast path
|
||||
if (LIKELY(receiver.IsHeapObject())) {
|
||||
#ifdef ECMASCRIPT_ENABLE_STUB_AOT
|
||||
auto stubAddr = thread->GetFastStubEntry(FAST_STUB_ID(GetPropertyByValue));
|
||||
auto stubAddr = thread->GetFastStubEntry(CommonStubCSigns::GetPropertyByValue);
|
||||
typedef JSTaggedType (*PFGetPropertyByValue)(uintptr_t, JSTaggedType, JSTaggedType);
|
||||
auto getPropertyByValuePtr = reinterpret_cast<PFGetPropertyByValue>(stubAddr);
|
||||
JSTaggedValue res = JSTaggedValue(getPropertyByValuePtr(thread->GetGlueAddr(),
|
||||
@ -3252,7 +3245,7 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, ConstantPool
|
||||
// fast path
|
||||
SAVE_ACC();
|
||||
#ifdef ECMASCRIPT_ENABLE_STUB_AOT
|
||||
auto stubAddr = thread->GetFastStubEntry(FAST_STUB_ID(SetPropertyByNameWithOwn));
|
||||
auto stubAddr = thread->GetFastStubEntry(CommonStubCSigns::SetPropertyByNameWithOwn);
|
||||
typedef JSTaggedType (*PFSetPropertyByName)(uintptr_t, JSTaggedType, JSTaggedType, JSTaggedType);
|
||||
auto setPropertyByNamePtr = reinterpret_cast<PFSetPropertyByName>(stubAddr);
|
||||
JSTaggedValue res = JSTaggedValue(setPropertyByNamePtr(thread->GetGlueAddr(), receiver.GetRawData(),
|
||||
@ -3350,7 +3343,7 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, ConstantPool
|
||||
if (LIKELY(receiver.IsHeapObject())) {
|
||||
// fast path
|
||||
#ifdef ECMASCRIPT_ENABLE_STUB_AOT
|
||||
auto stubAddr = thread->GetFastStubEntry(FAST_STUB_ID(GetPropertyByName));
|
||||
auto stubAddr = thread->GetFastStubEntry(CommonStubCSigns::GetPropertyByName);
|
||||
typedef JSTaggedType (*PFGetPropertyByName)(uintptr_t, JSTaggedType, JSTaggedType);
|
||||
auto getPropertyByNamePtr = reinterpret_cast<PFGetPropertyByName>(stubAddr);
|
||||
JSTaggedValue res = JSTaggedValue(getPropertyByNamePtr(thread->GetGlueAddr(), receiver.GetRawData(),
|
||||
@ -3389,7 +3382,7 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, ConstantPool
|
||||
if (LIKELY(firstValue.IsHeapObject())) {
|
||||
JSTaggedValue secondValue = profileTypeArray->Get(slotId + 1);
|
||||
#ifdef ECMASCRIPT_ENABLE_STUB_AOT
|
||||
auto stubAddr = thread->GetFastStubEntry(FAST_STUB_ID(TryStoreICByName));
|
||||
auto stubAddr = thread->GetFastStubEntry(CommonStubCSigns::TryStoreICByName);
|
||||
typedef JSTaggedType (*PFTryStoreICByName)(uintptr_t,
|
||||
JSTaggedType, JSTaggedType, JSTaggedType, JSTaggedType);
|
||||
auto tryStoreICByNamePtr = reinterpret_cast<PFTryStoreICByName>(stubAddr);
|
||||
@ -3425,7 +3418,7 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, ConstantPool
|
||||
// fast path
|
||||
SAVE_ACC();
|
||||
#ifdef ECMASCRIPT_ENABLE_STUB_AOT
|
||||
auto stubAddr = thread->GetFastStubEntry(FAST_STUB_ID(SetPropertyByName));
|
||||
auto stubAddr = thread->GetFastStubEntry(CommonStubCSigns::SetPropertyByName);
|
||||
typedef JSTaggedType (*PFSetPropertyByName)(uintptr_t, JSTaggedType, JSTaggedType, JSTaggedType);
|
||||
auto setPropertyByNamePtr = reinterpret_cast<PFSetPropertyByName>(stubAddr);
|
||||
JSTaggedValue res = JSTaggedValue(setPropertyByNamePtr(thread->GetGlueAddr(),
|
||||
|
@ -35,8 +35,8 @@
|
||||
#include "libpandafile/file.h"
|
||||
#include "libpandafile/method_data_accessor.h"
|
||||
|
||||
#if ECMASCRIPT_COMPILE_INTERPRETER_ASM
|
||||
namespace panda::ecmascript {
|
||||
using panda::ecmascript::kungfu::CommonStubCSigns;
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wvoid-ptr-dereference"
|
||||
@ -421,7 +421,7 @@ void InterpreterAssembly::RunInternal(JSThread *thread, ConstantPool *constpool,
|
||||
auto hotnessCounter = static_cast<int32_t>(method->GetHotnessCounter());
|
||||
auto profileTypeInfo = JSFunction::Cast(state->function.GetTaggedObject())->GetProfileTypeInfo();
|
||||
|
||||
auto stubAddr = thread->GetFastStubEntry(FAST_STUB_ID(AsmInterpreterEntry));
|
||||
auto stubAddr = thread->GetFastStubEntry(CommonStubCSigns::AsmInterpreterEntry);
|
||||
AsmDispatchEntryPoint asmEntry = reinterpret_cast<AsmDispatchEntryPoint>(stubAddr);
|
||||
asmEntry(thread->GetGlueAddr(), pc, sp, JSTaggedValue(constpool), profileTypeInfo, acc, hotnessCounter);
|
||||
}
|
||||
@ -3835,4 +3835,3 @@ inline JSTaggedValue InterpreterAssembly::UpdateHotnessCounter(JSThread* thread,
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
} // namespace panda::ecmascript
|
||||
#endif // ECMASCRIPT_COMPILE_INTERPRETER_ASM
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "ecmascript/js_thread.h"
|
||||
#include "ecmascript/frames.h"
|
||||
|
||||
#if ECMASCRIPT_COMPILE_INTERPRETER_ASM
|
||||
namespace panda::ecmascript {
|
||||
using TaggedType = coretypes::TaggedType;
|
||||
using DispatchEntryPoint =
|
||||
@ -56,13 +55,13 @@ public:
|
||||
static void name(JSThread *thread, const uint8_t *pc, JSTaggedType *sp, \
|
||||
JSTaggedValue constpool, JSTaggedValue profileTypeInfo, \
|
||||
JSTaggedValue acc, int32_t hotnessCounter);
|
||||
ASM_INTERPRETER_ID_LIST(DEF_HANDLER)
|
||||
ASM_INTERPRETER_BC_STUB_ID_LIST(DEF_HANDLER)
|
||||
#undef DEF_HANDLER
|
||||
};
|
||||
|
||||
static std::array<DispatchEntryPoint, BCHandlers::MAX_BYTECODE_HANDLERS> asmDispatchTable {
|
||||
static std::array<DispatchEntryPoint, BCHandlers::BC_COUNT> asmDispatchTable {
|
||||
#define DEF_HANDLER(name, counter) InterpreterAssembly::name,
|
||||
ASM_INTERPRETER_ID_LIST(DEF_HANDLER)
|
||||
ASM_INTERPRETER_BC_STUB_ID_LIST(DEF_HANDLER)
|
||||
#undef DEF_HANDLER
|
||||
InterpreterAssembly::HandleOverflow,
|
||||
InterpreterAssembly::HandleOverflow,
|
||||
@ -169,5 +168,4 @@ static std::array<DispatchEntryPoint, BCHandlers::MAX_BYTECODE_HANDLERS> asmDisp
|
||||
InterpreterAssembly::HandleOverflow,
|
||||
};
|
||||
} // namespace panda::ecmascript
|
||||
#endif // ECMASCRIPT_COMPILE_INTERPRETER_ASM
|
||||
#endif // ECMASCRIPT_INTERPRETER_INTERPRETER_ASSEMBLY_64BIT_H
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include "ecmascript/global_env.h"
|
||||
#include "ecmascript/mem/c_string.h"
|
||||
#include "ecmascript/mem/barriers-inl.h"
|
||||
|
||||
namespace panda::ecmascript {
|
||||
// NOLINTNEXTLINE (readability-identifier-naming, fuchsia-statically-constructed-objects)
|
||||
|
@ -18,13 +18,13 @@
|
||||
|
||||
#include "ecmascript/accessor_data.h"
|
||||
#include "ecmascript/ecma_macros.h"
|
||||
#include "ecmascript/ecma_runtime_call_info.h"
|
||||
#include "ecmascript/js_object-inl.h"
|
||||
#include "ecmascript/lexical_env.h"
|
||||
|
||||
namespace panda::ecmascript {
|
||||
using panda::coretypes::DynClass;
|
||||
class JSThread;
|
||||
class EcmaRuntimeCallInfo;
|
||||
|
||||
class JSFunctionBase : public JSObject {
|
||||
public:
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
#include "ecmascript/ecma_handle_scope-inl.h"
|
||||
#include "ecmascript/ecma_handle_scope.h"
|
||||
#include "ecmascript/js_tagged_value.h"
|
||||
#include "handle_base.h"
|
||||
|
||||
@ -134,7 +134,7 @@ private:
|
||||
friend class GlobalEnv;
|
||||
friend class JSHandleTest;
|
||||
friend class GlobalHandleCollection;
|
||||
friend class RuntimeTrampolines;
|
||||
friend class RuntimeStubs;
|
||||
};
|
||||
|
||||
template <>
|
||||
|
@ -17,9 +17,12 @@
|
||||
#define ECMASCRIPT_JS_HCLASS_H
|
||||
|
||||
#include "ecmascript/ecma_macros.h"
|
||||
#include "ecmascript/js_tagged_value.h"
|
||||
#include "ecmascript/mem/tagged_object.h"
|
||||
#include "ecmascript/js_tagged_value.h"
|
||||
#include "ecmascript/property_attributes.h"
|
||||
#include "ecmascript/mem/barriers.h"
|
||||
#include "ecmascript/mem/object_xray.h"
|
||||
#include "ecmascript/mem/slots.h"
|
||||
#include "include/hclass.h"
|
||||
#include "utils/bit_field.h"
|
||||
|
||||
@ -1043,7 +1046,7 @@ public:
|
||||
}
|
||||
inline void SetHasConstructor(bool value)
|
||||
{
|
||||
TaggedType newVal = HasConstructorBits::Update(GetBitField(), value);
|
||||
coretypes::TaggedType newVal = HasConstructorBits::Update(GetBitField(), value);
|
||||
SetBitField(newVal);
|
||||
}
|
||||
inline bool HasConstructor() const
|
||||
@ -1184,7 +1187,7 @@ private:
|
||||
{
|
||||
return reinterpret_cast<uint32_t *>(ToUintPtr(this) + BIT_FIELD_OFFSET);
|
||||
}
|
||||
friend class RuntimeTrampolines;
|
||||
friend class RuntimeStubs;
|
||||
};
|
||||
static_assert(JSHClass::BIT_FIELD_OFFSET % static_cast<uint8_t>(MemAlignment::MEM_ALIGN_OBJECT) == 0);
|
||||
} // namespace panda::ecmascript
|
||||
|
@ -19,11 +19,11 @@
|
||||
#include <vector>
|
||||
|
||||
#include "ecmascript/ecma_macros.h"
|
||||
#include "ecmascript/ecma_runtime_call_info.h"
|
||||
#include "ecmascript/ecma_string.h"
|
||||
#include "ecmascript/ic/property_box.h"
|
||||
#include "ecmascript/js_handle.h"
|
||||
#include "ecmascript/js_hclass.h"
|
||||
#include "ecmascript/js_method.h"
|
||||
#include "ecmascript/js_native_pointer.h"
|
||||
#include "ecmascript/js_tagged_value.h"
|
||||
#include "ecmascript/mem/object_xray.h"
|
||||
@ -35,15 +35,12 @@
|
||||
namespace panda {
|
||||
namespace ecmascript {
|
||||
class ObjectOperator;
|
||||
|
||||
class JSFunction;
|
||||
class AccessorData;
|
||||
class JSArray;
|
||||
|
||||
class JSForInIterator;
|
||||
|
||||
class LexicalEnv;
|
||||
|
||||
class GlobalEnv;
|
||||
// Integrity level for objects
|
||||
enum IntegrityLevel { SEALED, FROZEN };
|
||||
|
||||
@ -610,7 +607,7 @@ private:
|
||||
friend class StoreICRuntime;
|
||||
friend class FastRuntimeStub;
|
||||
friend class ICRuntimeStub;
|
||||
friend class RuntimeTrampolines;
|
||||
friend class RuntimeStubs;
|
||||
|
||||
static bool AddElementInternal(
|
||||
JSThread *thread, const JSHandle<JSObject> &receiver, uint32_t index, const JSHandle<JSTaggedValue> &value,
|
||||
|
@ -260,7 +260,7 @@ public:
|
||||
std::string enableAsm = vec[0];
|
||||
asmInterParsedOption_.enableAsm = (enableAsm == "1") ? true : false;
|
||||
}
|
||||
|
||||
|
||||
// asm interpreter handle disable range
|
||||
if (vec.size() > 1) {
|
||||
std::string handleDisableRange = vec[1];
|
||||
@ -269,8 +269,7 @@ public:
|
||||
std::string strStart = handleDisableRange.substr(0, pos);
|
||||
std::string strEnd = handleDisableRange.substr(pos + 1);
|
||||
asmInterParsedOption_.handleStart = strStart.empty() ? 0 : std::stoi(strStart);
|
||||
asmInterParsedOption_.handleEnd = strEnd.empty() ?
|
||||
kungfu::InterpreterStubId::ExceptionHandlerId : std::stoi(strEnd);
|
||||
asmInterParsedOption_.handleEnd = strEnd.empty() ? kungfu::BYTECODE_STUB_END_ID : std::stoi(strEnd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "ecmascript/base/number_helper.h"
|
||||
|
||||
#include "ecmascript/ecma_macros.h"
|
||||
#include "ecmascript/ecma_vm.h"
|
||||
#include "ecmascript/js_hclass.h"
|
||||
#include "ecmascript/js_tagged_value.h"
|
||||
#include "ecmascript/object_factory.h"
|
||||
|
@ -24,6 +24,8 @@
|
||||
#include "include/panda_vm.h"
|
||||
|
||||
namespace panda::ecmascript {
|
||||
using CommonStubCSigns = panda::ecmascript::kungfu::CommonStubCSigns;
|
||||
using BytecodeStubCSigns = panda::ecmascript::kungfu::BytecodeStubCSigns;
|
||||
// static
|
||||
JSThread *JSThread::Create(Runtime *runtime, PandaVM *vm)
|
||||
{
|
||||
@ -238,33 +240,33 @@ void JSThread::LoadStubModule(const char *moduleFile)
|
||||
StubModule stubModule;
|
||||
std::string fileName(moduleFile);
|
||||
stubModule.Load(this, fileName);
|
||||
for (size_t i = 0; i < kungfu::FAST_STUB_MAXCOUNT; i++) {
|
||||
glueData_.stubEntries_.Set(i, stubModule.GetStubEntry(i));
|
||||
}
|
||||
#if ECMASCRIPT_COMPILE_INTERPRETER_ASM
|
||||
for (size_t i = 0; i < BCHandlers::MAX_BYTECODE_HANDLERS; i++) {
|
||||
glueData_.bcHandlers_.Set(i, stubModule.GetStubEntry(kungfu::StubId::STUB_SingleStepDebugging));
|
||||
}
|
||||
#define DEF_STUB(name, counter) \
|
||||
glueData_.bcHandlers_.Set(kungfu::InterpreterStubId::name##Id, \
|
||||
stubModule.GetStubEntry(kungfu::StubId::STUB_##name));
|
||||
INTERPRETER_STUB_LIST(DEF_STUB)
|
||||
#define UNDEF_STUB(name, counter) \
|
||||
glueData_.bcHandlers_.Set(kungfu::InterpreterStubId::name##Id, \
|
||||
stubModule.GetStubEntry(kungfu::StubId::STUB_SingleStepDebugging));
|
||||
INTERPRETER_IGNORE_STUB_LIST(UNDEF_STUB)
|
||||
#undef DEF_STUB
|
||||
#undef UNDEF_STUB
|
||||
AsmInterParsedOption asmInterOpt = GetEcmaVM()->GetJSOptions().GetAsmInterParsedOption();
|
||||
if (asmInterOpt.handleStart >= 0 && asmInterOpt.handleStart < kungfu::InterpreterStubId::INTERPRETER_STUB_MAXCOUNT
|
||||
&& asmInterOpt.handleEnd >= 0 && asmInterOpt.handleEnd < kungfu::InterpreterStubId::INTERPRETER_STUB_MAXCOUNT
|
||||
&& asmInterOpt.handleStart <= asmInterOpt.handleEnd) {
|
||||
for (int i = asmInterOpt.handleStart; i <= asmInterOpt.handleEnd; i++) {
|
||||
glueData_.bcHandlers_.Set(i, stubModule.GetStubEntry(kungfu::StubId::STUB_SingleStepDebugging));
|
||||
|
||||
auto stubs = stubModule.GetStubs();
|
||||
for (size_t i = 0; i < stubs.size(); i++) {
|
||||
auto des = stubs[i];
|
||||
if (des.IsCommonStub()) {
|
||||
glueData_.stubEntries_.Set(des.indexInKind_, des.codeAddr_);
|
||||
} else if (des.IsBCHandler()) {
|
||||
glueData_.bcHandlers_.Set(des.indexInKind_, des.codeAddr_);
|
||||
} else {
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
auto defaultBCHandlerDes = stubs[CommonStubCSigns::SingleStepDebugging];
|
||||
ASSERT(defaultBCHandlerDes.IsBCHandler());
|
||||
glueData_.bcHandlers_.SetUnsupportedBCHandlers(defaultBCHandlerDes.codeAddr_);
|
||||
#define UNDEF_STUB(name, counter) \
|
||||
glueData_.bcHandlers_.Set(BytecodeStubCSigns::ID_##name, defaultBCHandlerDes.codeAddr_);
|
||||
INTERPRETER_IGNORED_BC_STUB_LIST(UNDEF_STUB)
|
||||
#undef UNDEF_STUB
|
||||
AsmInterParsedOption asmInterOpt = GetEcmaVM()->GetJSOptions().GetAsmInterParsedOption();
|
||||
if (asmInterOpt.handleStart >= 0 && asmInterOpt.handleStart < kungfu::BytecodeStubCSigns::NUM_OF_ALL_STUBS
|
||||
&& asmInterOpt.handleEnd >= 0 && asmInterOpt.handleEnd < kungfu::BytecodeStubCSigns::NUM_OF_ALL_STUBS
|
||||
&& asmInterOpt.handleStart <= asmInterOpt.handleEnd) {
|
||||
for (size_t i = asmInterOpt.handleStart; i <= asmInterOpt.handleEnd; i++) {
|
||||
glueData_.bcHandlers_.Set(i, defaultBCHandlerDes.codeAddr_);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NDEBUG
|
||||
kungfu::LLVMStackMapParser::GetInstance().Print();
|
||||
#endif
|
||||
|
@ -18,15 +18,17 @@
|
||||
|
||||
#include "include/managed_thread.h"
|
||||
#include "ecmascript/base/aligned_struct.h"
|
||||
#include "ecmascript/compiler/fast_stub_define.h"
|
||||
#include "ecmascript/compiler/fast_stub.h"
|
||||
#include "ecmascript/compiler/interpreter_stub.h"
|
||||
#include "ecmascript/compiler/rt_call_signature.h"
|
||||
#include "ecmascript/dfx/vm_thread_control.h"
|
||||
#include "ecmascript/ecma_global_storage.h"
|
||||
#include "ecmascript/frames.h"
|
||||
#include "ecmascript/global_env_constants.h"
|
||||
#include "ecmascript/mem/object_xray.h"
|
||||
#include "ecmascript/trampoline/runtime_define.h"
|
||||
|
||||
namespace panda::ecmascript {
|
||||
class EcmaHandleScope;
|
||||
class EcmaVM;
|
||||
class HeapRegionAllocator;
|
||||
class InternalCallParams;
|
||||
@ -39,18 +41,30 @@ enum class MarkStatus : uint8_t {
|
||||
};
|
||||
|
||||
struct BCHandlers {
|
||||
static constexpr size_t MAX_BYTECODE_HANDLERS = 0x100;
|
||||
Address handlers_[MAX_BYTECODE_HANDLERS];
|
||||
static constexpr size_t BC_HANDER_COUNT = kungfu::BytecodeStubCSigns::NUM_OF_ALL_STUBS;
|
||||
// The number of bytecodes.
|
||||
static constexpr size_t BC_COUNT = 0x100;
|
||||
static_assert(BC_HANDER_COUNT <= BC_COUNT);
|
||||
Address handlers_[BC_COUNT] = {0};
|
||||
|
||||
static constexpr size_t SizeArch32 = sizeof(uint32_t) * MAX_BYTECODE_HANDLERS;
|
||||
static constexpr size_t SizeArch64 = sizeof(uint64_t) * MAX_BYTECODE_HANDLERS;
|
||||
static constexpr size_t SizeArch32 = sizeof(uint32_t) * BC_COUNT;
|
||||
static constexpr size_t SizeArch64 = sizeof(uint64_t) * BC_COUNT;
|
||||
|
||||
void Set(size_t index, Address addr)
|
||||
{
|
||||
assert(index < MAX_BYTECODE_HANDLERS);
|
||||
assert(index < BC_COUNT);
|
||||
handlers_[index] = addr;
|
||||
}
|
||||
|
||||
void SetUnsupportedBCHandlers(Address addr)
|
||||
{
|
||||
for (size_t i = 0; i < BC_COUNT; i++) {
|
||||
if (handlers_[i] == 0) {
|
||||
handlers_[i] = addr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Address* GetAddr()
|
||||
{
|
||||
return reinterpret_cast<Address*>(handlers_);
|
||||
@ -59,35 +73,36 @@ struct BCHandlers {
|
||||
STATIC_ASSERT_EQ_ARCH(sizeof(BCHandlers), BCHandlers::SizeArch32, BCHandlers::SizeArch64);
|
||||
|
||||
struct RTInterfaces {
|
||||
static constexpr size_t MAX_RUNTIME_FUNCTIONS = RuntimeTrampolineId::RUNTIME_CALL_MAX_ID;
|
||||
Address interfaces_[MAX_RUNTIME_FUNCTIONS];
|
||||
static constexpr size_t COUNT = kungfu::RuntimeStubCSigns::NUM_OF_STUBS;
|
||||
Address interfaces_[COUNT];
|
||||
|
||||
static constexpr size_t SizeArch32 = sizeof(uint32_t) * MAX_RUNTIME_FUNCTIONS;
|
||||
static constexpr size_t SizeArch64 = sizeof(uint64_t) * MAX_RUNTIME_FUNCTIONS;
|
||||
static constexpr size_t SizeArch32 = sizeof(uint32_t) * COUNT;
|
||||
static constexpr size_t SizeArch64 = sizeof(uint64_t) * COUNT;
|
||||
|
||||
void Set(size_t index, Address addr)
|
||||
{
|
||||
assert(index < MAX_RUNTIME_FUNCTIONS);
|
||||
assert(index < COUNT);
|
||||
interfaces_[index] = addr;
|
||||
}
|
||||
};
|
||||
STATIC_ASSERT_EQ_ARCH(sizeof(RTInterfaces), RTInterfaces::SizeArch32, RTInterfaces::SizeArch64);
|
||||
|
||||
struct StubEntries {
|
||||
Address entries_[kungfu::FAST_STUB_MAXCOUNT];
|
||||
static constexpr size_t COUNT = kungfu::CommonStubCSigns::NUM_OF_STUBS;
|
||||
Address entries_[COUNT];
|
||||
|
||||
static constexpr size_t SizeArch32 = sizeof(uint32_t) * kungfu::FAST_STUB_MAXCOUNT;
|
||||
static constexpr size_t SizeArch64 = sizeof(uint64_t) * kungfu::FAST_STUB_MAXCOUNT;
|
||||
static constexpr size_t SizeArch32 = sizeof(uint32_t) * COUNT;
|
||||
static constexpr size_t SizeArch64 = sizeof(uint64_t) * COUNT;
|
||||
|
||||
void Set(size_t index, Address addr)
|
||||
{
|
||||
assert(index < kungfu::FAST_STUB_MAXCOUNT);
|
||||
assert(index < COUNT);
|
||||
entries_[index] = addr;
|
||||
}
|
||||
|
||||
Address Get(size_t index)
|
||||
{
|
||||
assert(index < kungfu::FAST_STUB_MAXCOUNT);
|
||||
assert(index < COUNT);
|
||||
return entries_[index];
|
||||
}
|
||||
};
|
||||
@ -237,7 +252,7 @@ public:
|
||||
|
||||
void SetRuntimeFunction(size_t id, Address addr)
|
||||
{
|
||||
ASSERT(id < RuntimeTrampolineId::RUNTIME_CALL_MAX_ID);
|
||||
ASSERT(id < kungfu::RuntimeStubCSigns::NUM_OF_STUBS);
|
||||
glueData_.rtInterfaces_.Set(id, addr);
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ int Main(const int argc, const char **argv)
|
||||
EcmaVM *vm = EcmaVM::Cast(runtime->GetPandaVM());
|
||||
|
||||
LocalScope scope(vm);
|
||||
std::string entry = entrypoint.GetValue();
|
||||
std::string entry = entrypoint.GetValue();
|
||||
|
||||
arg_list_t fileNames = files.GetValue();
|
||||
for (const auto &fileName : fileNames) {
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include "ecmascript/jspandafile/ecma_class_linker_extension.h"
|
||||
#include "ecmascript/ecma_string.h"
|
||||
#include "ecmascript/ecma_vm.h"
|
||||
#include "include/class_linker-inl.h"
|
||||
#include "include/coretypes/class.h"
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#ifndef ECMASCRIPT_MEM_BARRIERS_H
|
||||
#define ECMASCRIPT_MEM_BARRIERS_H
|
||||
|
||||
#include "ecmascript/common.h"
|
||||
#include "ecmascript/mem/mark_word.h"
|
||||
|
||||
namespace panda::ecmascript {
|
||||
@ -38,7 +39,7 @@ public:
|
||||
}
|
||||
|
||||
template<bool need_write_barrier = true>
|
||||
static inline void SetDynObject(const JSThread *thread, void *obj, size_t offset, JSTaggedType value);
|
||||
static void SetDynObject(const JSThread *thread, void *obj, size_t offset, JSTaggedType value);
|
||||
|
||||
template<class T>
|
||||
static inline T GetDynValue(const void *obj, size_t offset)
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "ecmascript/mem/remembered_set.h"
|
||||
#include "ecmascript/mem/sparse_space.h"
|
||||
#include "ecmascript/mem/tagged_object.h"
|
||||
#include "ecmascript/mem/barriers-inl.h"
|
||||
|
||||
namespace panda::ecmascript {
|
||||
template<class Callback>
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "ecmascript/ecma_macros.h"
|
||||
#include "ecmascript/js_tagged_value.h"
|
||||
#include "ecmascript/mem/tagged_object.h"
|
||||
#include "ecmascript/mem/barriers.h"
|
||||
|
||||
namespace panda {
|
||||
namespace ecmascript {
|
||||
|
@ -24,12 +24,7 @@
|
||||
#include "ecmascript/mem/space.h"
|
||||
|
||||
namespace panda::ecmascript {
|
||||
inline void Region::SetSpace(Space *space)
|
||||
{
|
||||
space_ = space;
|
||||
}
|
||||
|
||||
RememberedSet *Region::CreateRememberedSet()
|
||||
inline RememberedSet *Region::CreateRememberedSet()
|
||||
{
|
||||
auto setSize = RememberedSet::GetSizeInByte(GetCapacity());
|
||||
auto setAddr = const_cast<NativeAreaAllocator *>(heap_->GetNativeAreaAllocator())->Allocate(setSize);
|
||||
@ -39,7 +34,7 @@ RememberedSet *Region::CreateRememberedSet()
|
||||
return ret;
|
||||
}
|
||||
|
||||
RememberedSet *Region::GetOrCreateCrossRegionRememberedSet()
|
||||
inline RememberedSet *Region::GetOrCreateCrossRegionRememberedSet()
|
||||
{
|
||||
if (UNLIKELY(crossRegionSet_ == nullptr)) {
|
||||
os::memory::LockHolder lock(lock_);
|
||||
@ -50,7 +45,7 @@ RememberedSet *Region::GetOrCreateCrossRegionRememberedSet()
|
||||
return crossRegionSet_;
|
||||
}
|
||||
|
||||
RememberedSet *Region::GetOrCreateOldToNewRememberedSet()
|
||||
inline RememberedSet *Region::GetOrCreateOldToNewRememberedSet()
|
||||
{
|
||||
if (UNLIKELY(oldToNewSet_ == nullptr)) {
|
||||
os::memory::LockHolder lock(lock_);
|
||||
@ -61,36 +56,36 @@ RememberedSet *Region::GetOrCreateOldToNewRememberedSet()
|
||||
return oldToNewSet_;
|
||||
}
|
||||
|
||||
void Region::InsertCrossRegionRememberedSet(uintptr_t addr)
|
||||
inline void Region::InsertCrossRegionRememberedSet(uintptr_t addr)
|
||||
{
|
||||
auto set = GetOrCreateCrossRegionRememberedSet();
|
||||
set->Insert(addr);
|
||||
}
|
||||
|
||||
void Region::AtomicInsertCrossRegionRememberedSet(uintptr_t addr)
|
||||
inline void Region::AtomicInsertCrossRegionRememberedSet(uintptr_t addr)
|
||||
{
|
||||
auto set = GetOrCreateCrossRegionRememberedSet();
|
||||
set->AtomicInsert(addr);
|
||||
}
|
||||
|
||||
void Region::InsertOldToNewRememberedSet(uintptr_t addr)
|
||||
inline void Region::InsertOldToNewRememberedSet(uintptr_t addr)
|
||||
{
|
||||
auto set = GetOrCreateOldToNewRememberedSet();
|
||||
set->Insert(addr);
|
||||
}
|
||||
|
||||
void Region::AtomicInsertOldToNewRememberedSet(uintptr_t addr)
|
||||
inline void Region::AtomicInsertOldToNewRememberedSet(uintptr_t addr)
|
||||
{
|
||||
auto set = GetOrCreateOldToNewRememberedSet();
|
||||
set->AtomicInsert(addr);
|
||||
}
|
||||
|
||||
WorkerHelper *Region::GetWorkList() const
|
||||
inline WorkerHelper *Region::GetWorkList() const
|
||||
{
|
||||
return heap_->GetWorkList();
|
||||
}
|
||||
|
||||
void Region::DeleteMarkBitmap()
|
||||
inline void Region::DeleteMarkBitmap()
|
||||
{
|
||||
if (markBitmap_ != nullptr) {
|
||||
auto size = RangeBitmap::GetBitMapSizeInByte(GetCapacity());
|
||||
@ -101,7 +96,7 @@ void Region::DeleteMarkBitmap()
|
||||
}
|
||||
}
|
||||
|
||||
void Region::DeleteCrossRegionRememberedSet()
|
||||
inline void Region::DeleteCrossRegionRememberedSet()
|
||||
{
|
||||
if (crossRegionSet_ != nullptr) {
|
||||
auto size = RememberedSet::GetSizeInByte(GetCapacity());
|
||||
@ -112,7 +107,7 @@ void Region::DeleteCrossRegionRememberedSet()
|
||||
}
|
||||
}
|
||||
|
||||
void Region::DeleteOldToNewRememberedSet()
|
||||
inline void Region::DeleteOldToNewRememberedSet()
|
||||
{
|
||||
if (oldToNewSet_ != nullptr) {
|
||||
auto size = RememberedSet::GetSizeInByte(GetCapacity());
|
||||
@ -123,21 +118,21 @@ void Region::DeleteOldToNewRememberedSet()
|
||||
}
|
||||
}
|
||||
|
||||
void Region::ClearMarkBitmap()
|
||||
inline void Region::ClearMarkBitmap()
|
||||
{
|
||||
if (markBitmap_ != nullptr) {
|
||||
markBitmap_->ClearAllBits();
|
||||
}
|
||||
}
|
||||
|
||||
void Region::ClearCrossRegionRememberedSet()
|
||||
inline void Region::ClearCrossRegionRememberedSet()
|
||||
{
|
||||
if (crossRegionSet_ != nullptr) {
|
||||
crossRegionSet_->ClearAllBits();
|
||||
}
|
||||
}
|
||||
|
||||
bool Region::IsMarking() const
|
||||
inline bool Region::IsMarking() const
|
||||
{
|
||||
return !heap_->GetJSThread()->IsReadyToMark();
|
||||
}
|
||||
|
@ -118,7 +118,10 @@ public:
|
||||
return end_ - begin_;
|
||||
}
|
||||
|
||||
inline void SetSpace(Space *space);
|
||||
inline void SetSpace(Space *space)
|
||||
{
|
||||
space_ = space;
|
||||
}
|
||||
|
||||
Heap *GetHeap() const
|
||||
{
|
||||
@ -237,18 +240,18 @@ public:
|
||||
ret->ClearAllBits();
|
||||
return ret;
|
||||
}
|
||||
inline RememberedSet *CreateRememberedSet();
|
||||
inline RememberedSet *GetOrCreateCrossRegionRememberedSet();
|
||||
inline RememberedSet *GetOrCreateOldToNewRememberedSet();
|
||||
inline void DeleteMarkBitmap();
|
||||
inline void DeleteCrossRegionRememberedSet();
|
||||
inline void DeleteOldToNewRememberedSet();
|
||||
inline void ClearMarkBitmap();
|
||||
inline void ClearCrossRegionRememberedSet();
|
||||
inline void InsertCrossRegionRememberedSet(uintptr_t addr);
|
||||
inline void AtomicInsertCrossRegionRememberedSet(uintptr_t addr);
|
||||
inline void InsertOldToNewRememberedSet(uintptr_t addr);
|
||||
inline void AtomicInsertOldToNewRememberedSet(uintptr_t addr);
|
||||
RememberedSet *CreateRememberedSet();
|
||||
RememberedSet *GetOrCreateCrossRegionRememberedSet();
|
||||
RememberedSet *GetOrCreateOldToNewRememberedSet();
|
||||
void DeleteMarkBitmap();
|
||||
void DeleteCrossRegionRememberedSet();
|
||||
void DeleteOldToNewRememberedSet();
|
||||
void ClearMarkBitmap();
|
||||
void ClearCrossRegionRememberedSet();
|
||||
void InsertCrossRegionRememberedSet(uintptr_t addr);
|
||||
void AtomicInsertCrossRegionRememberedSet(uintptr_t addr);
|
||||
void InsertOldToNewRememberedSet(uintptr_t addr);
|
||||
void AtomicInsertOldToNewRememberedSet(uintptr_t addr);
|
||||
|
||||
uintptr_t GetAllocateBase() const
|
||||
{
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "ecmascript/mem/tagged_object.h"
|
||||
|
||||
#include <atomic>
|
||||
#include "ecmascript/ecma_vm.h"
|
||||
#include "ecmascript/js_hclass.h"
|
||||
#include "ecmascript/js_handle.h"
|
||||
#include "heap.h"
|
||||
|
@ -26,7 +26,7 @@ static std::array<std::string, MessageString::MAX_MESSAGE_COUNT> g_messageString
|
||||
#undef DEF_COMMON_MESSAGE
|
||||
#define DEF_ASM_INTERPRETER_STUB_MESSAGE(name, count) #name,
|
||||
INTERPRETER_STUB_HELPER_LIST(DEF_ASM_INTERPRETER_STUB_MESSAGE)
|
||||
ASM_INTERPRETER_STUB_LIST(DEF_ASM_INTERPRETER_STUB_MESSAGE, DEF_ASM_INTERPRETER_STUB_MESSAGE,
|
||||
ASM_INTERPRETER_BC_STUB_LIST(DEF_ASM_INTERPRETER_STUB_MESSAGE, DEF_ASM_INTERPRETER_STUB_MESSAGE,
|
||||
DEF_ASM_INTERPRETER_STUB_MESSAGE)
|
||||
#undef DEF_ASM_INTERPRETER_STUB_MESSAGE
|
||||
};
|
||||
|
@ -17,8 +17,8 @@
|
||||
#define ECMASCRIPT_MESSAGE_STRING_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "ecmascript/compiler/interpreter_stub_define.h"
|
||||
#include "ecmascript/compiler/fast_stub.h"
|
||||
#include "ecmascript/compiler/interpreter_stub.h"
|
||||
|
||||
namespace panda::ecmascript {
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
||||
@ -38,7 +38,7 @@ public:
|
||||
#define DEF_MESSAGE_ID(name, string) Message_##name,
|
||||
COMMON_MESSAGE_STRING_LIST(DEF_MESSAGE_ID)
|
||||
INTERPRETER_STUB_HELPER_LIST(DEF_MESSAGE_ID)
|
||||
ASM_INTERPRETER_STUB_LIST(DEF_MESSAGE_ID, DEF_MESSAGE_ID, DEF_MESSAGE_ID)
|
||||
ASM_INTERPRETER_BC_STUB_LIST(DEF_MESSAGE_ID, DEF_MESSAGE_ID, DEF_MESSAGE_ID)
|
||||
#undef DEF_MESSAGE_ID
|
||||
MAX_MESSAGE_COUNT
|
||||
};
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "ecmascript/lexical_env.h"
|
||||
#include "ecmascript/mem/heap-inl.h"
|
||||
#include "ecmascript/tagged_array-inl.h"
|
||||
#include "ecmascript/mem/barriers-inl.h"
|
||||
|
||||
namespace panda::ecmascript {
|
||||
EcmaString *ObjectFactory::AllocNonMovableStringObject(size_t size)
|
||||
|
@ -26,9 +26,11 @@
|
||||
#include "ecmascript/mem/heap_region_allocator.h"
|
||||
#include "ecmascript/mem/machine_code.h"
|
||||
#include "ecmascript/mem/native_area_allocator.h"
|
||||
#include "ecmascript/mem/space.h"
|
||||
#include "ecmascript/tagged_array.h"
|
||||
|
||||
namespace panda::ecmascript {
|
||||
class JSMethod;
|
||||
class JSObject;
|
||||
class JSArray;
|
||||
class JSSymbol;
|
||||
@ -482,7 +484,7 @@ private:
|
||||
friend class JsVerificationTest;
|
||||
friend class PandaFileTranslator;
|
||||
friend class LiteralDataExtractor;
|
||||
friend class RuntimeTrampolines;
|
||||
friend class RuntimeStubs;
|
||||
friend class ClassInfoExtractor;
|
||||
friend class TSObjectType;
|
||||
friend class ModuleDataExtractor;
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#include "ecmascript/base/config.h"
|
||||
#include "ecmascript/dfx/vmstat/runtime_stat.h"
|
||||
#include "ecmascript/trampoline/runtime_define.h"
|
||||
#include "ecmascript/stubs/runtime_stubs.h"
|
||||
|
||||
namespace panda::ecmascript {
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
||||
@ -633,7 +633,7 @@ enum EcmaRuntimeCallerId {
|
||||
ABSTRACT_OPERATION_LIST(ABSTRACT_OPERATION_ID)
|
||||
MEM_ALLOCATE_AND_GC_LIST(MEM_ALLOCATE_AND_GC_ID)
|
||||
#define DEF_RUNTIME_ID(name, c) RUNTIME_CALL_ID_##name,
|
||||
RUNTIME_CALL_LIST(DEF_RUNTIME_ID)
|
||||
RUNTIME_STUB_WITH_GC_LIST(DEF_RUNTIME_ID)
|
||||
#undef DEF_RUNTIME_ID
|
||||
RUNTIME_CALLER_NUMBER,
|
||||
};
|
||||
|
@ -22,17 +22,16 @@ void StubModule::Save(const std::string &filename)
|
||||
{
|
||||
if (code_ != nullptr) {
|
||||
std::ofstream modulefile(filename.c_str(), std::ofstream::binary);
|
||||
SetStubNum(stubEntries_.size());
|
||||
/* write stub entries offset */
|
||||
modulefile.write(reinterpret_cast<char *>(stubEntries_.data()),
|
||||
sizeof(uint64_t) * (kungfu::ALL_STUB_MAXCOUNT));
|
||||
modulefile.write(reinterpret_cast<char *>(&stubNum_), sizeof(uint64_t));
|
||||
modulefile.write(reinterpret_cast<char *>(stubEntries_.data()), sizeof(StubDes) * stubNum_);
|
||||
int codeSize = code_->GetInstructionSizeInBytes();
|
||||
/* write host code section start addr */
|
||||
modulefile.write(reinterpret_cast<char *>(&hostCodeSectionAddr_), sizeof(hostCodeSectionAddr_));
|
||||
/* write stackmap offset */
|
||||
int stackmapOffset = sizeof(uintptr_t) * (kungfu::ALL_STUB_MAXCOUNT) + 2 * sizeof(int)
|
||||
+ codeSize;
|
||||
modulefile.write(reinterpret_cast<char *>(&stackmapOffset),
|
||||
sizeof(int));
|
||||
int stackmapOffset = sizeof(uintptr_t) * stubNum_ + 2 * sizeof(int) + codeSize;
|
||||
modulefile.write(reinterpret_cast<char *>(&stackmapOffset), sizeof(int));
|
||||
/* write code length & code buff */
|
||||
modulefile.write(reinterpret_cast<char *>(&codeSize), sizeof(codeSize));
|
||||
modulefile.write(reinterpret_cast<char *>(code_->GetDataOffsetAddress()), codeSize);
|
||||
@ -54,8 +53,9 @@ void StubModule::Load(JSThread *thread, const std::string &filename)
|
||||
// then MachineCode will support movable, code is saved to MachineCode and stackmap is saved
|
||||
// to different heap which will be freed when stackmap is parsed by EcmaVM is started.
|
||||
std::ifstream modulefile(filename.c_str(), std::ofstream::binary);
|
||||
modulefile.read(reinterpret_cast<char *>(stubEntries_.data()),
|
||||
sizeof(uint64_t) * (kungfu::ALL_STUB_MAXCOUNT));
|
||||
modulefile.read(reinterpret_cast<char *>(&stubNum_), sizeof(uint64_t));
|
||||
stubEntries_.resize(stubNum_);
|
||||
modulefile.read(reinterpret_cast<char *>(stubEntries_.data()), sizeof(StubDes) * stubNum_);
|
||||
/* read host code section start addr */
|
||||
modulefile.read(reinterpret_cast<char *>(&hostCodeSectionAddr_), sizeof(hostCodeSectionAddr_));
|
||||
int stackmapOffset;
|
||||
@ -77,6 +77,9 @@ void StubModule::Load(JSThread *thread, const std::string &filename)
|
||||
kungfu::LLVMStackMapParser::GetInstance().CalculateStackMap(std::move(stackmapPtr),
|
||||
hostCodeSectionAddr_, devicesCodeSectionAddr_);
|
||||
}
|
||||
for (size_t i = 0; i < stubEntries_.size(); i++) {
|
||||
stubEntries_[i].codeAddr_ += code_->GetDataOffsetAddress();
|
||||
}
|
||||
modulefile.close();
|
||||
}
|
||||
} // namespace panda::ecmascript
|
||||
|
@ -17,16 +17,40 @@
|
||||
#define ECMASCRIPT_STUB_MODULE_H
|
||||
|
||||
#include "ecmascript/common.h"
|
||||
#include "ecmascript/compiler/call_signature.h"
|
||||
#include "ecmascript/js_thread.h"
|
||||
#include "ecmascript/mem/machine_code.h"
|
||||
#include "libpandabase/macros.h"
|
||||
|
||||
namespace panda::ecmascript {
|
||||
using panda::ecmascript::kungfu::CallSignature;
|
||||
class PUBLIC_API StubModule {
|
||||
public:
|
||||
uint64_t GetStubEntry(int index)
|
||||
struct StubDes {
|
||||
CallSignature::TargetKind kind_;
|
||||
uint32_t indexInKind_;
|
||||
uint64_t codeAddr_;
|
||||
bool IsStub() const
|
||||
{
|
||||
return kungfu::CallSignature::TargetKind::STUB_BEGIN <= kind_ &&
|
||||
kind_ < kungfu::CallSignature::TargetKind::STUB_END;
|
||||
}
|
||||
|
||||
bool IsBCHandler() const
|
||||
{
|
||||
return kungfu::CallSignature::TargetKind::BCHANDLER_BEGIN <= kind_ &&
|
||||
kind_ < kungfu::CallSignature::TargetKind::BCHANDLER_END;
|
||||
}
|
||||
|
||||
bool IsCommonStub() const
|
||||
{
|
||||
return (kind_ == kungfu::CallSignature::TargetKind::COMMON_STUB);
|
||||
}
|
||||
};
|
||||
|
||||
const StubDes& GetStubDes(int index) const
|
||||
{
|
||||
return code_->GetDataOffsetAddress() + stubEntries_[index];
|
||||
return stubEntries_[index];
|
||||
}
|
||||
void Save(const std::string &filename);
|
||||
void Load(JSThread *thread, const std::string &filename);
|
||||
@ -45,9 +69,23 @@ public:
|
||||
return codePtr_;
|
||||
}
|
||||
|
||||
void SetStubEntry(int index, uint64_t offset)
|
||||
uint64_t GetStubNum() const
|
||||
{
|
||||
stubEntries_[index] = offset;
|
||||
return stubNum_;
|
||||
}
|
||||
|
||||
void SetStubNum(uint64_t n)
|
||||
{
|
||||
stubNum_ = n;
|
||||
}
|
||||
|
||||
void AddStubEntry(CallSignature::TargetKind kind, int indexInKind, uint64_t offset)
|
||||
{
|
||||
StubDes des;
|
||||
des.kind_ = kind;
|
||||
des.indexInKind_ = indexInKind;
|
||||
des.codeAddr_ = offset;
|
||||
stubEntries_.emplace_back(des);
|
||||
}
|
||||
void SetHostCodeSectionAddr(uint64_t addr)
|
||||
{
|
||||
@ -81,19 +119,23 @@ public:
|
||||
{
|
||||
stackMapSize_ = len;
|
||||
}
|
||||
|
||||
int GetStackMapSize() const
|
||||
{
|
||||
return stackMapSize_;
|
||||
}
|
||||
const std::vector<StubDes>& GetStubs() const
|
||||
{
|
||||
return stubEntries_;
|
||||
}
|
||||
|
||||
private:
|
||||
std::array<uint64_t, kungfu::ALL_STUB_MAXCOUNT> stubEntries_ {-1};
|
||||
uint64_t hostCodeSectionAddr_ {0};
|
||||
uint64_t stubNum_ {0};
|
||||
std::vector<StubDes> stubEntries_ {};
|
||||
uint64_t hostCodeSectionAddr_ {0};
|
||||
uint64_t devicesCodeSectionAddr_ {0};
|
||||
MachineCode *code_ {nullptr};
|
||||
uint64_t stackMapAddr_ {0};
|
||||
uint64_t codePtr_{0};
|
||||
uint64_t codePtr_ {0};
|
||||
int stackMapSize_ {0};
|
||||
};
|
||||
} // namespace panda::ecmascript
|
||||
|
@ -15,10 +15,11 @@
|
||||
|
||||
#ifndef ECMASCRIPT_RUNTIME_TRAMPOLINES_INL_H
|
||||
#define ECMASCRIPT_RUNTIME_TRAMPOLINES_INL_H
|
||||
#include "runtime_trampolines.h"
|
||||
#include "runtime_stubs.h"
|
||||
#include "ecmascript/builtins/builtins_regexp.h"
|
||||
#include "ecmascript/ic/profile_type_info.h"
|
||||
#include "ecmascript/internal_call_params.h"
|
||||
#include "ecmascript/interpreter/frame_handler.h"
|
||||
#include "ecmascript/interpreter/slow_runtime_helper.h"
|
||||
#include "ecmascript/global_dictionary-inl.h"
|
||||
#include "ecmascript/global_env.h"
|
||||
@ -33,7 +34,7 @@
|
||||
#include "ecmascript/template_string.h"
|
||||
|
||||
namespace panda::ecmascript {
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeIncDyn(JSThread *thread, const JSHandle<JSTaggedValue> &value)
|
||||
JSTaggedValue RuntimeStubs::RuntimeIncDyn(JSThread *thread, const JSHandle<JSTaggedValue> &value)
|
||||
{
|
||||
JSHandle<JSTaggedValue> inputVal(thread, JSTaggedValue::ToNumeric(thread, value));
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
@ -45,7 +46,7 @@ JSTaggedValue RuntimeTrampolines::RuntimeIncDyn(JSThread *thread, const JSHandle
|
||||
return JSTaggedValue(++number);
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeDecDyn(JSThread *thread, const JSHandle<JSTaggedValue> &value)
|
||||
JSTaggedValue RuntimeStubs::RuntimeDecDyn(JSThread *thread, const JSHandle<JSTaggedValue> &value)
|
||||
{
|
||||
JSHandle<JSTaggedValue> inputVal(thread, JSTaggedValue::ToNumeric(thread, value));
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
@ -57,8 +58,8 @@ JSTaggedValue RuntimeTrampolines::RuntimeDecDyn(JSThread *thread, const JSHandle
|
||||
return JSTaggedValue(--number);
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeExpDyn(JSThread *thread, const JSHandle<JSTaggedValue> &base,
|
||||
const JSHandle<JSTaggedValue> &exponent)
|
||||
JSTaggedValue RuntimeStubs::RuntimeExpDyn(JSThread *thread, const JSHandle<JSTaggedValue> &base,
|
||||
const JSHandle<JSTaggedValue> &exponent)
|
||||
{
|
||||
JSTaggedNumber baseNumber = JSTaggedValue::ToNumber(thread, base);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
@ -83,8 +84,8 @@ JSTaggedValue RuntimeTrampolines::RuntimeExpDyn(JSThread *thread, const JSHandle
|
||||
return JSTaggedValue(std::pow(doubleBase, doubleExponent));
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeIsInDyn(JSThread *thread, const JSHandle<JSTaggedValue> &prop,
|
||||
const JSHandle<JSTaggedValue> &obj)
|
||||
JSTaggedValue RuntimeStubs::RuntimeIsInDyn(JSThread *thread, const JSHandle<JSTaggedValue> &prop,
|
||||
const JSHandle<JSTaggedValue> &obj)
|
||||
{
|
||||
if (!obj->IsECMAObject()) {
|
||||
return RuntimeThrowTypeError(thread, "Cannot use 'in' operator in Non-Object");
|
||||
@ -96,15 +97,15 @@ JSTaggedValue RuntimeTrampolines::RuntimeIsInDyn(JSThread *thread, const JSHandl
|
||||
return JSTaggedValue(ret);
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeInstanceofDyn(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
|
||||
const JSHandle<JSTaggedValue> &target)
|
||||
JSTaggedValue RuntimeStubs::RuntimeInstanceofDyn(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
|
||||
const JSHandle<JSTaggedValue> &target)
|
||||
{
|
||||
bool ret = JSObject::InstanceOf(thread, obj, target);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
return JSTaggedValue(ret);
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeCreateGeneratorObj(JSThread *thread, const JSHandle<JSTaggedValue> &genFunc)
|
||||
JSTaggedValue RuntimeStubs::RuntimeCreateGeneratorObj(JSThread *thread, const JSHandle<JSTaggedValue> &genFunc)
|
||||
{
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSGeneratorObject> obj = factory->NewJSGeneratorObject(genFunc);
|
||||
@ -119,14 +120,14 @@ JSTaggedValue RuntimeTrampolines::RuntimeCreateGeneratorObj(JSThread *thread, co
|
||||
return obj.GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeGetTemplateObject(JSThread *thread, const JSHandle<JSTaggedValue> &literal)
|
||||
JSTaggedValue RuntimeStubs::RuntimeGetTemplateObject(JSThread *thread, const JSHandle<JSTaggedValue> &literal)
|
||||
{
|
||||
JSHandle<JSTaggedValue> templateObj = TemplateString::GetTemplateObject(thread, literal);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
return templateObj.GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeGetNextPropName(JSThread *thread, const JSHandle<JSTaggedValue> &iter)
|
||||
JSTaggedValue RuntimeStubs::RuntimeGetNextPropName(JSThread *thread, const JSHandle<JSTaggedValue> &iter)
|
||||
{
|
||||
ASSERT(iter->IsForinIterator());
|
||||
std::pair<JSTaggedValue, bool> res =
|
||||
@ -135,14 +136,14 @@ JSTaggedValue RuntimeTrampolines::RuntimeGetNextPropName(JSThread *thread, const
|
||||
return res.first;
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeIterNext(JSThread *thread, const JSHandle<JSTaggedValue> &iter)
|
||||
JSTaggedValue RuntimeStubs::RuntimeIterNext(JSThread *thread, const JSHandle<JSTaggedValue> &iter)
|
||||
{
|
||||
JSHandle<JSObject> resultObj = JSIterator::IteratorNext(thread, iter);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
return resultObj.GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeCloseIterator(JSThread *thread, const JSHandle<JSTaggedValue> &iter)
|
||||
JSTaggedValue RuntimeStubs::RuntimeCloseIterator(JSThread *thread, const JSHandle<JSTaggedValue> &iter)
|
||||
{
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
const GlobalEnvConstants *globalConst = thread->GlobalConstants();
|
||||
@ -162,9 +163,9 @@ JSTaggedValue RuntimeTrampolines::RuntimeCloseIterator(JSThread *thread, const J
|
||||
return result.GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeSuperCallSpread(JSThread *thread, const JSHandle<JSTaggedValue> &func,
|
||||
const JSHandle<JSTaggedValue> &newTarget,
|
||||
const JSHandle<JSTaggedValue> &array)
|
||||
JSTaggedValue RuntimeStubs::RuntimeSuperCallSpread(JSThread *thread, const JSHandle<JSTaggedValue> &func,
|
||||
const JSHandle<JSTaggedValue> &newTarget,
|
||||
const JSHandle<JSTaggedValue> &array)
|
||||
{
|
||||
InterpretedFrameHandler frameHandler(thread);
|
||||
|
||||
@ -181,8 +182,8 @@ JSTaggedValue RuntimeTrampolines::RuntimeSuperCallSpread(JSThread *thread, const
|
||||
return result;
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeDelObjProp(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
|
||||
const JSHandle<JSTaggedValue> &prop)
|
||||
JSTaggedValue RuntimeStubs::RuntimeDelObjProp(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
|
||||
const JSHandle<JSTaggedValue> &prop)
|
||||
{
|
||||
JSHandle<JSTaggedValue> jsObj(JSTaggedValue::ToObject(thread, obj));
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
@ -193,9 +194,9 @@ JSTaggedValue RuntimeTrampolines::RuntimeDelObjProp(JSThread *thread, const JSHa
|
||||
return JSTaggedValue(ret);
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeNewObjSpreadDyn(JSThread *thread, const JSHandle<JSTaggedValue> &func,
|
||||
const JSHandle<JSTaggedValue> &newTarget,
|
||||
const JSHandle<JSTaggedValue> &array)
|
||||
JSTaggedValue RuntimeStubs::RuntimeNewObjSpreadDyn(JSThread *thread, const JSHandle<JSTaggedValue> &func,
|
||||
const JSHandle<JSTaggedValue> &newTarget,
|
||||
const JSHandle<JSTaggedValue> &array)
|
||||
{
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
if (!array->IsJSArray()) {
|
||||
@ -215,8 +216,8 @@ JSTaggedValue RuntimeTrampolines::RuntimeNewObjSpreadDyn(JSThread *thread, const
|
||||
return tagged;
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeCreateIterResultObj(JSThread *thread, const JSHandle<JSTaggedValue> &value,
|
||||
JSTaggedValue flag)
|
||||
JSTaggedValue RuntimeStubs::RuntimeCreateIterResultObj(JSThread *thread, const JSHandle<JSTaggedValue> &value,
|
||||
JSTaggedValue flag)
|
||||
{
|
||||
ASSERT(flag.IsBoolean());
|
||||
bool done = flag.IsTrue();
|
||||
@ -225,9 +226,9 @@ JSTaggedValue RuntimeTrampolines::RuntimeCreateIterResultObj(JSThread *thread, c
|
||||
return iter.GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeAsyncFunctionAwaitUncaught(JSThread *thread,
|
||||
const JSHandle<JSTaggedValue> &asyncFuncObj,
|
||||
const JSHandle<JSTaggedValue> &value)
|
||||
JSTaggedValue RuntimeStubs::RuntimeAsyncFunctionAwaitUncaught(JSThread *thread,
|
||||
const JSHandle<JSTaggedValue> &asyncFuncObj,
|
||||
const JSHandle<JSTaggedValue> &value)
|
||||
{
|
||||
JSHandle<JSAsyncFuncObject> asyncFuncObjHandle(asyncFuncObj);
|
||||
JSAsyncFunction::AsyncFunctionAwait(thread, asyncFuncObjHandle, value);
|
||||
@ -237,7 +238,7 @@ JSTaggedValue RuntimeTrampolines::RuntimeAsyncFunctionAwaitUncaught(JSThread *th
|
||||
return promise.GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeAsyncFunctionResolveOrReject(JSThread *thread,
|
||||
JSTaggedValue RuntimeStubs::RuntimeAsyncFunctionResolveOrReject(JSThread *thread,
|
||||
const JSHandle<JSTaggedValue> &asyncFuncObj, const JSHandle<JSTaggedValue> &value, bool is_resolve)
|
||||
{
|
||||
JSHandle<JSAsyncFuncObject> asyncFuncObjHandle(asyncFuncObj);
|
||||
@ -261,8 +262,8 @@ JSTaggedValue RuntimeTrampolines::RuntimeAsyncFunctionResolveOrReject(JSThread *
|
||||
return promise.GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeCopyDataProperties(JSThread *thread, const JSHandle<JSTaggedValue> &dst,
|
||||
const JSHandle<JSTaggedValue> &src)
|
||||
JSTaggedValue RuntimeStubs::RuntimeCopyDataProperties(JSThread *thread, const JSHandle<JSTaggedValue> &dst,
|
||||
const JSHandle<JSTaggedValue> &src)
|
||||
{
|
||||
if (!src->IsNull() && !src->IsUndefined()) {
|
||||
JSHandle<TaggedArray> keys = JSTaggedValue::GetOwnPropertyKeys(thread, src);
|
||||
@ -285,8 +286,8 @@ JSTaggedValue RuntimeTrampolines::RuntimeCopyDataProperties(JSThread *thread, co
|
||||
return dst.GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeStArraySpread(JSThread *thread, const JSHandle<JSTaggedValue> &dst,
|
||||
JSTaggedValue index, const JSHandle<JSTaggedValue> &src)
|
||||
JSTaggedValue RuntimeStubs::RuntimeStArraySpread(JSThread *thread, const JSHandle<JSTaggedValue> &dst,
|
||||
JSTaggedValue index, const JSHandle<JSTaggedValue> &src)
|
||||
{
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
ASSERT(dst->IsJSArray() && !src->IsNull() && !src->IsUndefined());
|
||||
@ -340,8 +341,8 @@ JSTaggedValue RuntimeTrampolines::RuntimeStArraySpread(JSThread *thread, const J
|
||||
return indexHandle.GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeGetIteratorNext(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
|
||||
const JSHandle<JSTaggedValue> &method)
|
||||
JSTaggedValue RuntimeStubs::RuntimeGetIteratorNext(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
|
||||
const JSHandle<JSTaggedValue> &method)
|
||||
{
|
||||
ASSERT(obj->IsCallable());
|
||||
JSTaggedValue ret = JSFunction::Call(thread, method, obj, 0, nullptr);
|
||||
@ -352,8 +353,8 @@ JSTaggedValue RuntimeTrampolines::RuntimeGetIteratorNext(JSThread *thread, const
|
||||
return ret;
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeSetObjectWithProto(JSThread *thread, const JSHandle<JSTaggedValue> &proto,
|
||||
const JSHandle<JSObject> &obj)
|
||||
JSTaggedValue RuntimeStubs::RuntimeSetObjectWithProto(JSThread *thread, const JSHandle<JSTaggedValue> &proto,
|
||||
const JSHandle<JSObject> &obj)
|
||||
{
|
||||
if (!proto->IsECMAObject() && !proto->IsNull()) {
|
||||
return JSTaggedValue::False();
|
||||
@ -363,9 +364,9 @@ JSTaggedValue RuntimeTrampolines::RuntimeSetObjectWithProto(JSThread *thread, co
|
||||
return JSTaggedValue::True();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeLdObjByValue(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
|
||||
const JSHandle<JSTaggedValue> &prop, bool callGetter,
|
||||
JSTaggedValue receiver)
|
||||
JSTaggedValue RuntimeStubs::RuntimeLdObjByValue(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
|
||||
const JSHandle<JSTaggedValue> &prop, bool callGetter,
|
||||
JSTaggedValue receiver)
|
||||
{
|
||||
JSTaggedValue res;
|
||||
if (callGetter) {
|
||||
@ -379,9 +380,9 @@ JSTaggedValue RuntimeTrampolines::RuntimeLdObjByValue(JSThread *thread, const JS
|
||||
return res;
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeStObjByValue(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
|
||||
const JSHandle<JSTaggedValue> &prop,
|
||||
const JSHandle<JSTaggedValue> &value)
|
||||
JSTaggedValue RuntimeStubs::RuntimeStObjByValue(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
|
||||
const JSHandle<JSTaggedValue> &prop,
|
||||
const JSHandle<JSTaggedValue> &value)
|
||||
{
|
||||
JSHandle<JSTaggedValue> propKey(JSTaggedValue::ToPropertyKey(thread, prop));
|
||||
|
||||
@ -391,9 +392,9 @@ JSTaggedValue RuntimeTrampolines::RuntimeStObjByValue(JSThread *thread, const JS
|
||||
return JSTaggedValue::True();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeStOwnByValue(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
|
||||
const JSHandle<JSTaggedValue> &key,
|
||||
const JSHandle<JSTaggedValue> &value)
|
||||
JSTaggedValue RuntimeStubs::RuntimeStOwnByValue(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
|
||||
const JSHandle<JSTaggedValue> &key,
|
||||
const JSHandle<JSTaggedValue> &value)
|
||||
{
|
||||
const GlobalEnvConstants *globalConst = thread->GlobalConstants();
|
||||
|
||||
@ -414,8 +415,8 @@ JSTaggedValue RuntimeTrampolines::RuntimeStOwnByValue(JSThread *thread, const JS
|
||||
return JSTaggedValue::True();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeLdSuperByValue(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
|
||||
const JSHandle<JSTaggedValue> &key, JSTaggedValue thisFunc)
|
||||
JSTaggedValue RuntimeStubs::RuntimeLdSuperByValue(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
|
||||
const JSHandle<JSTaggedValue> &key, JSTaggedValue thisFunc)
|
||||
{
|
||||
ASSERT(thisFunc.IsJSFunction());
|
||||
// get Homeobject form function
|
||||
@ -435,9 +436,9 @@ JSTaggedValue RuntimeTrampolines::RuntimeLdSuperByValue(JSThread *thread, const
|
||||
return res;
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeStSuperByValue(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
|
||||
const JSHandle<JSTaggedValue> &key,
|
||||
const JSHandle<JSTaggedValue> &value, JSTaggedValue thisFunc)
|
||||
JSTaggedValue RuntimeStubs::RuntimeStSuperByValue(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
|
||||
const JSHandle<JSTaggedValue> &key,
|
||||
const JSHandle<JSTaggedValue> &value, JSTaggedValue thisFunc)
|
||||
{
|
||||
ASSERT(thisFunc.IsJSFunction());
|
||||
// get Homeobject form function
|
||||
@ -458,8 +459,8 @@ JSTaggedValue RuntimeTrampolines::RuntimeStSuperByValue(JSThread *thread, const
|
||||
return JSTaggedValue::True();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeLdObjByIndex(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
|
||||
uint32_t idx, bool callGetter, JSTaggedValue receiver)
|
||||
JSTaggedValue RuntimeStubs::RuntimeLdObjByIndex(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
|
||||
uint32_t idx, bool callGetter, JSTaggedValue receiver)
|
||||
{
|
||||
JSTaggedValue res;
|
||||
if (callGetter) {
|
||||
@ -471,17 +472,17 @@ JSTaggedValue RuntimeTrampolines::RuntimeLdObjByIndex(JSThread *thread, const JS
|
||||
return res;
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeStObjByIndex(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
|
||||
uint32_t idx, const JSHandle<JSTaggedValue> &value)
|
||||
JSTaggedValue RuntimeStubs::RuntimeStObjByIndex(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
|
||||
uint32_t idx, const JSHandle<JSTaggedValue> &value)
|
||||
{
|
||||
JSTaggedValue::SetProperty(thread, obj, idx, value, true);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
return JSTaggedValue::True();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeStOwnByIndex(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
|
||||
const JSHandle<JSTaggedValue> &idx,
|
||||
const JSHandle<JSTaggedValue> &value)
|
||||
JSTaggedValue RuntimeStubs::RuntimeStOwnByIndex(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
|
||||
const JSHandle<JSTaggedValue> &idx,
|
||||
const JSHandle<JSTaggedValue> &value)
|
||||
{
|
||||
// property in class is non-enumerable
|
||||
bool enumerable = !(obj->IsClassPrototype() || obj->IsClassConstructor());
|
||||
@ -494,8 +495,8 @@ JSTaggedValue RuntimeTrampolines::RuntimeStOwnByIndex(JSThread *thread, const JS
|
||||
return JSTaggedValue::True();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeStGlobalRecord(JSThread *thread, const JSHandle<JSTaggedValue> &prop,
|
||||
const JSHandle<JSTaggedValue> &value, bool isConst)
|
||||
JSTaggedValue RuntimeStubs::RuntimeStGlobalRecord(JSThread *thread, const JSHandle<JSTaggedValue> &prop,
|
||||
const JSHandle<JSTaggedValue> &value, bool isConst)
|
||||
{
|
||||
EcmaVM *vm = thread->GetEcmaVM();
|
||||
JSHandle<GlobalEnv> env = vm->GetGlobalEnv();
|
||||
@ -524,7 +525,7 @@ JSTaggedValue RuntimeTrampolines::RuntimeStGlobalRecord(JSThread *thread, const
|
||||
return JSTaggedValue::True();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeNegDyn(JSThread *thread, const JSHandle<JSTaggedValue> &value)
|
||||
JSTaggedValue RuntimeStubs::RuntimeNegDyn(JSThread *thread, const JSHandle<JSTaggedValue> &value)
|
||||
{
|
||||
JSHandle<JSTaggedValue> inputVal(thread, JSTaggedValue::ToNumeric(thread, value));
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
@ -546,7 +547,7 @@ JSTaggedValue RuntimeTrampolines::RuntimeNegDyn(JSThread *thread, const JSHandle
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeNotDyn(JSThread *thread, const JSHandle<JSTaggedValue> &value)
|
||||
JSTaggedValue RuntimeStubs::RuntimeNotDyn(JSThread *thread, const JSHandle<JSTaggedValue> &value)
|
||||
{
|
||||
JSHandle<JSTaggedValue> inputVal(thread, JSTaggedValue::ToNumeric(thread, value));
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
@ -558,11 +559,11 @@ JSTaggedValue RuntimeTrampolines::RuntimeNotDyn(JSThread *thread, const JSHandle
|
||||
return JSTaggedValue(~number); // NOLINT(hicpp-signed-bitwise)
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeResolveClass(JSThread *thread, const JSHandle<JSFunction> &ctor,
|
||||
const JSHandle<TaggedArray> &literal,
|
||||
const JSHandle<JSTaggedValue> &base,
|
||||
const JSHandle<JSTaggedValue> &lexenv,
|
||||
const JSHandle<ConstantPool> &constpool)
|
||||
JSTaggedValue RuntimeStubs::RuntimeResolveClass(JSThread *thread, const JSHandle<JSFunction> &ctor,
|
||||
const JSHandle<TaggedArray> &literal,
|
||||
const JSHandle<JSTaggedValue> &base,
|
||||
const JSHandle<JSTaggedValue> &lexenv,
|
||||
const JSHandle<ConstantPool> &constpool)
|
||||
{
|
||||
ASSERT(ctor.GetTaggedValue().IsClassConstructor());
|
||||
|
||||
@ -589,10 +590,10 @@ JSTaggedValue RuntimeTrampolines::RuntimeResolveClass(JSThread *thread, const JS
|
||||
return ctor.GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeCloneClassFromTemplate(JSThread *thread, const JSHandle<JSFunction> &ctor,
|
||||
const JSHandle<JSTaggedValue> &base,
|
||||
const JSHandle<JSTaggedValue> &lexenv,
|
||||
const JSHandle<JSTaggedValue> &constpool)
|
||||
JSTaggedValue RuntimeStubs::RuntimeCloneClassFromTemplate(JSThread *thread, const JSHandle<JSFunction> &ctor,
|
||||
const JSHandle<JSTaggedValue> &base,
|
||||
const JSHandle<JSTaggedValue> &lexenv,
|
||||
const JSHandle<JSTaggedValue> &constpool)
|
||||
{
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
const GlobalEnvConstants *globalConst = thread->GlobalConstants();
|
||||
@ -630,9 +631,9 @@ JSTaggedValue RuntimeTrampolines::RuntimeCloneClassFromTemplate(JSThread *thread
|
||||
return cloneClass.GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeSetClassInheritanceRelationship(JSThread *thread,
|
||||
const JSHandle<JSTaggedValue> &ctor,
|
||||
const JSHandle<JSTaggedValue> &base)
|
||||
JSTaggedValue RuntimeStubs::RuntimeSetClassInheritanceRelationship(JSThread *thread,
|
||||
const JSHandle<JSTaggedValue> &ctor,
|
||||
const JSHandle<JSTaggedValue> &base)
|
||||
{
|
||||
JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
|
||||
const GlobalEnvConstants *globalConst = thread->GlobalConstants();
|
||||
@ -682,8 +683,8 @@ JSTaggedValue RuntimeTrampolines::RuntimeSetClassInheritanceRelationship(JSThrea
|
||||
return JSTaggedValue::Undefined();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeSetClassConstructorLength(JSThread *thread, JSTaggedValue ctor,
|
||||
JSTaggedValue length)
|
||||
JSTaggedValue RuntimeStubs::RuntimeSetClassConstructorLength(JSThread *thread, JSTaggedValue ctor,
|
||||
JSTaggedValue length)
|
||||
{
|
||||
ASSERT(ctor.IsClassConstructor());
|
||||
|
||||
@ -697,8 +698,8 @@ JSTaggedValue RuntimeTrampolines::RuntimeSetClassConstructorLength(JSThread *thr
|
||||
return JSTaggedValue::Undefined();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeNotifyInlineCache(JSThread *thread, const JSHandle<JSFunction> &func,
|
||||
JSMethod *method)
|
||||
JSTaggedValue RuntimeStubs::RuntimeNotifyInlineCache(JSThread *thread, const JSHandle<JSFunction> &func,
|
||||
JSMethod *method)
|
||||
{
|
||||
uint32_t icSlotSize = method->GetSlotSize();
|
||||
if (icSlotSize > 0 && icSlotSize < ProfileTypeInfo::INVALID_SLOT_INDEX) {
|
||||
@ -711,9 +712,9 @@ JSTaggedValue RuntimeTrampolines::RuntimeNotifyInlineCache(JSThread *thread, con
|
||||
return JSTaggedValue::Undefined();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeStOwnByValueWithNameSet(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
|
||||
const JSHandle<JSTaggedValue> &key,
|
||||
const JSHandle<JSTaggedValue> &value)
|
||||
JSTaggedValue RuntimeStubs::RuntimeStOwnByValueWithNameSet(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
|
||||
const JSHandle<JSTaggedValue> &key,
|
||||
const JSHandle<JSTaggedValue> &value)
|
||||
{
|
||||
const GlobalEnvConstants *globalConst = thread->GlobalConstants();
|
||||
|
||||
@ -741,9 +742,9 @@ JSTaggedValue RuntimeTrampolines::RuntimeStOwnByValueWithNameSet(JSThread *threa
|
||||
return JSTaggedValue::True();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeStOwnByName(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
|
||||
const JSHandle<JSTaggedValue> &prop,
|
||||
const JSHandle<JSTaggedValue> &value)
|
||||
JSTaggedValue RuntimeStubs::RuntimeStOwnByName(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
|
||||
const JSHandle<JSTaggedValue> &prop,
|
||||
const JSHandle<JSTaggedValue> &value)
|
||||
{
|
||||
ASSERT(prop->IsStringOrSymbol());
|
||||
|
||||
@ -758,8 +759,8 @@ JSTaggedValue RuntimeTrampolines::RuntimeStOwnByName(JSThread *thread, const JSH
|
||||
return JSTaggedValue::True();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeSuspendGenerator(JSThread *thread, const JSHandle<JSTaggedValue> &genObj,
|
||||
const JSHandle<JSTaggedValue> &value)
|
||||
JSTaggedValue RuntimeStubs::RuntimeSuspendGenerator(JSThread *thread, const JSHandle<JSTaggedValue> &genObj,
|
||||
const JSHandle<JSTaggedValue> &value)
|
||||
{
|
||||
JSHandle<JSGeneratorObject> generatorObjectHandle(genObj);
|
||||
JSHandle<GeneratorContext> genContextHandle(thread, generatorObjectHandle->GetGeneratorContext());
|
||||
@ -776,17 +777,17 @@ JSTaggedValue RuntimeTrampolines::RuntimeSuspendGenerator(JSThread *thread, cons
|
||||
return generatorObjectHandle.GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeGetModuleNamespace(JSThread *thread, JSTaggedValue localName)
|
||||
JSTaggedValue RuntimeStubs::RuntimeGetModuleNamespace(JSThread *thread, JSTaggedValue localName)
|
||||
{
|
||||
return thread->GetEcmaVM()->GetModuleManager()->GetModuleNamespace(localName);
|
||||
}
|
||||
|
||||
void RuntimeTrampolines::RuntimeStModuleVar(JSThread *thread, JSTaggedValue key, JSTaggedValue value)
|
||||
void RuntimeStubs::RuntimeStModuleVar(JSThread *thread, JSTaggedValue key, JSTaggedValue value)
|
||||
{
|
||||
thread->GetEcmaVM()->GetModuleManager()->StoreModuleValue(key, value);
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeLdModuleVar(JSThread *thread, JSTaggedValue key, bool inner)
|
||||
JSTaggedValue RuntimeStubs::RuntimeLdModuleVar(JSThread *thread, JSTaggedValue key, bool inner)
|
||||
{
|
||||
if (inner) {
|
||||
JSTaggedValue moduleValue = thread->GetEcmaVM()->GetModuleManager()->GetModuleValueInner(key);
|
||||
@ -796,14 +797,14 @@ JSTaggedValue RuntimeTrampolines::RuntimeLdModuleVar(JSThread *thread, JSTaggedV
|
||||
return thread->GetEcmaVM()->GetModuleManager()->GetModuleValueOutter(key);
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeGetPropIterator(JSThread *thread, const JSHandle<JSTaggedValue> &value)
|
||||
JSTaggedValue RuntimeStubs::RuntimeGetPropIterator(JSThread *thread, const JSHandle<JSTaggedValue> &value)
|
||||
{
|
||||
JSHandle<JSForInIterator> iteratorHandle = JSObject::EnumerateObjectProperties(thread, value);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
return iteratorHandle.GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeAsyncFunctionEnter(JSThread *thread)
|
||||
JSTaggedValue RuntimeStubs::RuntimeAsyncFunctionEnter(JSThread *thread)
|
||||
{
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
// 1. create promise
|
||||
@ -829,7 +830,7 @@ JSTaggedValue RuntimeTrampolines::RuntimeAsyncFunctionEnter(JSThread *thread)
|
||||
return asyncFuncObj.GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeGetIterator(JSThread *thread, const JSHandle<JSTaggedValue> &obj)
|
||||
JSTaggedValue RuntimeStubs::RuntimeGetIterator(JSThread *thread, const JSHandle<JSTaggedValue> &obj)
|
||||
{
|
||||
EcmaVM *vm = thread->GetEcmaVM();
|
||||
JSHandle<GlobalEnv> env = vm->GetGlobalEnv();
|
||||
@ -847,24 +848,24 @@ JSTaggedValue RuntimeTrampolines::RuntimeGetIterator(JSThread *thread, const JSH
|
||||
return res;
|
||||
}
|
||||
|
||||
void RuntimeTrampolines::RuntimeThrowDyn(JSThread *thread, JSTaggedValue value)
|
||||
void RuntimeStubs::RuntimeThrowDyn(JSThread *thread, JSTaggedValue value)
|
||||
{
|
||||
thread->SetException(value);
|
||||
}
|
||||
|
||||
void RuntimeTrampolines::RuntimeThrowThrowNotExists(JSThread *thread)
|
||||
void RuntimeStubs::RuntimeThrowThrowNotExists(JSThread *thread)
|
||||
{
|
||||
THROW_TYPE_ERROR(thread, "Throw method is not defined");
|
||||
}
|
||||
|
||||
void RuntimeTrampolines::RuntimeThrowPatternNonCoercible(JSThread *thread)
|
||||
void RuntimeStubs::RuntimeThrowPatternNonCoercible(JSThread *thread)
|
||||
{
|
||||
JSHandle<EcmaString> msg(thread->GlobalConstants()->GetHandledObjNotCoercibleString());
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
THROW_NEW_ERROR_AND_RETURN(thread, factory->NewJSError(base::ErrorType::TYPE_ERROR, msg).GetTaggedValue());
|
||||
}
|
||||
|
||||
void RuntimeTrampolines::RuntimeThrowDeleteSuperProperty(JSThread *thread)
|
||||
void RuntimeStubs::RuntimeThrowDeleteSuperProperty(JSThread *thread)
|
||||
{
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<EcmaString> info = factory->NewFromCanBeCompressString("Can not delete super property");
|
||||
@ -872,7 +873,7 @@ void RuntimeTrampolines::RuntimeThrowDeleteSuperProperty(JSThread *thread)
|
||||
THROW_NEW_ERROR_AND_RETURN(thread, errorObj.GetTaggedValue());
|
||||
}
|
||||
|
||||
void RuntimeTrampolines::RuntimeThrowUndefinedIfHole(JSThread *thread, const JSHandle<EcmaString> &obj)
|
||||
void RuntimeStubs::RuntimeThrowUndefinedIfHole(JSThread *thread, const JSHandle<EcmaString> &obj)
|
||||
{
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<EcmaString> info = factory->NewFromCanBeCompressString(" is not initialized");
|
||||
@ -881,12 +882,12 @@ void RuntimeTrampolines::RuntimeThrowUndefinedIfHole(JSThread *thread, const JSH
|
||||
THROW_NEW_ERROR_AND_RETURN(thread, factory->NewJSError(base::ErrorType::REFERENCE_ERROR, msg).GetTaggedValue());
|
||||
}
|
||||
|
||||
void RuntimeTrampolines::RuntimeThrowIfNotObject(JSThread *thread)
|
||||
void RuntimeStubs::RuntimeThrowIfNotObject(JSThread *thread)
|
||||
{
|
||||
THROW_TYPE_ERROR(thread, "Inner return result is not object");
|
||||
}
|
||||
|
||||
void RuntimeTrampolines::RuntimeThrowConstAssignment(JSThread *thread, const JSHandle<EcmaString> &value)
|
||||
void RuntimeStubs::RuntimeThrowConstAssignment(JSThread *thread, const JSHandle<EcmaString> &value)
|
||||
{
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
|
||||
@ -896,7 +897,7 @@ void RuntimeTrampolines::RuntimeThrowConstAssignment(JSThread *thread, const JSH
|
||||
THROW_NEW_ERROR_AND_RETURN(thread, factory->NewJSError(base::ErrorType::TYPE_ERROR, msg).GetTaggedValue());
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeLdGlobalRecord(JSThread *thread, JSTaggedValue key)
|
||||
JSTaggedValue RuntimeStubs::RuntimeLdGlobalRecord(JSThread *thread, JSTaggedValue key)
|
||||
{
|
||||
EcmaVM *vm = thread->GetEcmaVM();
|
||||
JSHandle<GlobalEnv> env = vm->GetGlobalEnv();
|
||||
@ -908,8 +909,8 @@ JSTaggedValue RuntimeTrampolines::RuntimeLdGlobalRecord(JSThread *thread, JSTagg
|
||||
return JSTaggedValue::Undefined();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeTryLdGlobalByName(JSThread *thread, JSTaggedValue global,
|
||||
const JSHandle<JSTaggedValue> &prop)
|
||||
JSTaggedValue RuntimeStubs::RuntimeTryLdGlobalByName(JSThread *thread, JSTaggedValue global,
|
||||
const JSHandle<JSTaggedValue> &prop)
|
||||
{
|
||||
JSHandle<JSTaggedValue> obj(thread, global.GetTaggedObject()->GetClass()->GetPrototype());
|
||||
OperationResult res = JSTaggedValue::GetProperty(thread, obj, prop);
|
||||
@ -919,8 +920,8 @@ JSTaggedValue RuntimeTrampolines::RuntimeTryLdGlobalByName(JSThread *thread, JST
|
||||
return res.GetValue().GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeTryUpdateGlobalRecord(JSThread *thread, JSTaggedValue prop,
|
||||
JSTaggedValue value)
|
||||
JSTaggedValue RuntimeStubs::RuntimeTryUpdateGlobalRecord(JSThread *thread, JSTaggedValue prop,
|
||||
JSTaggedValue value)
|
||||
{
|
||||
EcmaVM *vm = thread->GetEcmaVM();
|
||||
JSHandle<GlobalEnv> env = vm->GetGlobalEnv();
|
||||
@ -938,8 +939,8 @@ JSTaggedValue RuntimeTrampolines::RuntimeTryUpdateGlobalRecord(JSThread *thread,
|
||||
return JSTaggedValue::True();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeThrowReferenceError(JSThread *thread, const JSHandle<JSTaggedValue> &prop,
|
||||
const char *desc)
|
||||
JSTaggedValue RuntimeStubs::RuntimeThrowReferenceError(JSThread *thread, const JSHandle<JSTaggedValue> &prop,
|
||||
const char *desc)
|
||||
{
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<EcmaString> propName = JSTaggedValue::ToString(thread, prop);
|
||||
@ -951,8 +952,8 @@ JSTaggedValue RuntimeTrampolines::RuntimeThrowReferenceError(JSThread *thread, c
|
||||
JSTaggedValue::Exception());
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeLdGlobalVar(JSThread *thread, JSTaggedValue global,
|
||||
const JSHandle<JSTaggedValue> &prop)
|
||||
JSTaggedValue RuntimeStubs::RuntimeLdGlobalVar(JSThread *thread, JSTaggedValue global,
|
||||
const JSHandle<JSTaggedValue> &prop)
|
||||
{
|
||||
JSHandle<JSTaggedValue> objHandle(thread, global.GetTaggedObject()->GetClass()->GetPrototype());
|
||||
OperationResult res = JSTaggedValue::GetProperty(thread, objHandle, prop);
|
||||
@ -960,8 +961,8 @@ JSTaggedValue RuntimeTrampolines::RuntimeLdGlobalVar(JSThread *thread, JSTaggedV
|
||||
return res.GetValue().GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeStGlobalVar(JSThread *thread, const JSHandle<JSTaggedValue> &prop,
|
||||
const JSHandle<JSTaggedValue> &value)
|
||||
JSTaggedValue RuntimeStubs::RuntimeStGlobalVar(JSThread *thread, const JSHandle<JSTaggedValue> &prop,
|
||||
const JSHandle<JSTaggedValue> &value)
|
||||
{
|
||||
JSHandle<JSTaggedValue> global(thread, thread->GetEcmaVM()->GetGlobalEnv()->GetGlobalObject());
|
||||
|
||||
@ -970,53 +971,53 @@ JSTaggedValue RuntimeTrampolines::RuntimeStGlobalVar(JSThread *thread, const JSH
|
||||
return JSTaggedValue::True();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeToNumber(JSThread *thread, const JSHandle<JSTaggedValue> &value)
|
||||
JSTaggedValue RuntimeStubs::RuntimeToNumber(JSThread *thread, const JSHandle<JSTaggedValue> &value)
|
||||
{
|
||||
return JSTaggedValue::ToNumeric(thread, value);
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeEqDyn(JSThread *thread, const JSHandle<JSTaggedValue> &left,
|
||||
const JSHandle<JSTaggedValue> &right)
|
||||
JSTaggedValue RuntimeStubs::RuntimeEqDyn(JSThread *thread, const JSHandle<JSTaggedValue> &left,
|
||||
const JSHandle<JSTaggedValue> &right)
|
||||
{
|
||||
bool ret = JSTaggedValue::Equal(thread, left, right);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
return (ret ? JSTaggedValue::True() : JSTaggedValue::False());
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeNotEqDyn(JSThread *thread, const JSHandle<JSTaggedValue> &left,
|
||||
const JSHandle<JSTaggedValue> &right)
|
||||
JSTaggedValue RuntimeStubs::RuntimeNotEqDyn(JSThread *thread, const JSHandle<JSTaggedValue> &left,
|
||||
const JSHandle<JSTaggedValue> &right)
|
||||
{
|
||||
bool ret = JSTaggedValue::Equal(thread, left, right);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
return (ret ? JSTaggedValue::False() : JSTaggedValue::True());
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeLessDyn(JSThread *thread, const JSHandle<JSTaggedValue> &left,
|
||||
const JSHandle<JSTaggedValue> &right)
|
||||
JSTaggedValue RuntimeStubs::RuntimeLessDyn(JSThread *thread, const JSHandle<JSTaggedValue> &left,
|
||||
const JSHandle<JSTaggedValue> &right)
|
||||
{
|
||||
bool ret = JSTaggedValue::Compare(thread, left, right) == ComparisonResult::LESS;
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
return (ret ? JSTaggedValue::True() : JSTaggedValue::False());
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeLessEqDyn(JSThread *thread, const JSHandle<JSTaggedValue> &left,
|
||||
const JSHandle<JSTaggedValue> &right)
|
||||
JSTaggedValue RuntimeStubs::RuntimeLessEqDyn(JSThread *thread, const JSHandle<JSTaggedValue> &left,
|
||||
const JSHandle<JSTaggedValue> &right)
|
||||
{
|
||||
bool ret = JSTaggedValue::Compare(thread, left, right) <= ComparisonResult::EQUAL;
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
return (ret ? JSTaggedValue::True() : JSTaggedValue::False());
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeGreaterDyn(JSThread *thread, const JSHandle<JSTaggedValue> &left,
|
||||
const JSHandle<JSTaggedValue> &right)
|
||||
JSTaggedValue RuntimeStubs::RuntimeGreaterDyn(JSThread *thread, const JSHandle<JSTaggedValue> &left,
|
||||
const JSHandle<JSTaggedValue> &right)
|
||||
{
|
||||
bool ret = JSTaggedValue::Compare(thread, left, right) == ComparisonResult::GREAT;
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
return (ret ? JSTaggedValue::True() : JSTaggedValue::False());
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeGreaterEqDyn(JSThread *thread, const JSHandle<JSTaggedValue> &left,
|
||||
const JSHandle<JSTaggedValue> &right)
|
||||
JSTaggedValue RuntimeStubs::RuntimeGreaterEqDyn(JSThread *thread, const JSHandle<JSTaggedValue> &left,
|
||||
const JSHandle<JSTaggedValue> &right)
|
||||
{
|
||||
ComparisonResult comparison = JSTaggedValue::Compare(thread, left, right);
|
||||
bool ret = (comparison == ComparisonResult::GREAT) || (comparison == ComparisonResult::EQUAL);
|
||||
@ -1024,8 +1025,8 @@ JSTaggedValue RuntimeTrampolines::RuntimeGreaterEqDyn(JSThread *thread, const JS
|
||||
return (ret ? JSTaggedValue::True() : JSTaggedValue::False());
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeAdd2Dyn(JSThread *thread, EcmaVM *ecma_vm, const JSHandle<JSTaggedValue> &left,
|
||||
const JSHandle<JSTaggedValue> &right)
|
||||
JSTaggedValue RuntimeStubs::RuntimeAdd2Dyn(JSThread *thread, EcmaVM *ecma_vm, const JSHandle<JSTaggedValue> &left,
|
||||
const JSHandle<JSTaggedValue> &right)
|
||||
{
|
||||
if (left->IsString() && right->IsString()) {
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
@ -1064,8 +1065,8 @@ JSTaggedValue RuntimeTrampolines::RuntimeAdd2Dyn(JSThread *thread, EcmaVM *ecma_
|
||||
return JSTaggedValue(a0Double + a1Double);
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeSub2Dyn(JSThread *thread, const JSHandle<JSTaggedValue> &left,
|
||||
const JSHandle<JSTaggedValue> &right)
|
||||
JSTaggedValue RuntimeStubs::RuntimeSub2Dyn(JSThread *thread, const JSHandle<JSTaggedValue> &left,
|
||||
const JSHandle<JSTaggedValue> &right)
|
||||
{
|
||||
JSHandle<JSTaggedValue> valLeft(thread, JSTaggedValue::ToNumeric(thread, left));
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
@ -1084,8 +1085,8 @@ JSTaggedValue RuntimeTrampolines::RuntimeSub2Dyn(JSThread *thread, const JSHandl
|
||||
return number0 - number1;
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeMul2Dyn(JSThread *thread, const JSHandle<JSTaggedValue> &left,
|
||||
const JSHandle<JSTaggedValue> &right)
|
||||
JSTaggedValue RuntimeStubs::RuntimeMul2Dyn(JSThread *thread, const JSHandle<JSTaggedValue> &left,
|
||||
const JSHandle<JSTaggedValue> &right)
|
||||
{
|
||||
JSHandle<JSTaggedValue> valLeft(thread, JSTaggedValue::ToNumeric(thread, left));
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
@ -1106,8 +1107,8 @@ JSTaggedValue RuntimeTrampolines::RuntimeMul2Dyn(JSThread *thread, const JSHandl
|
||||
return number0 * number1;
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeDiv2Dyn(JSThread *thread, const JSHandle<JSTaggedValue> &left,
|
||||
const JSHandle<JSTaggedValue> &right)
|
||||
JSTaggedValue RuntimeStubs::RuntimeDiv2Dyn(JSThread *thread, const JSHandle<JSTaggedValue> &left,
|
||||
const JSHandle<JSTaggedValue> &right)
|
||||
{
|
||||
JSHandle<JSTaggedValue> valLeft(thread, JSTaggedValue::ToNumeric(thread, left));
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
@ -1134,8 +1135,8 @@ JSTaggedValue RuntimeTrampolines::RuntimeDiv2Dyn(JSThread *thread, const JSHandl
|
||||
return JSTaggedValue(dLeft / dRight);
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeMod2Dyn(JSThread *thread, const JSHandle<JSTaggedValue> &left,
|
||||
const JSHandle<JSTaggedValue> &right)
|
||||
JSTaggedValue RuntimeStubs::RuntimeMod2Dyn(JSThread *thread, const JSHandle<JSTaggedValue> &left,
|
||||
const JSHandle<JSTaggedValue> &right)
|
||||
{
|
||||
JSHandle<JSTaggedValue> valLeft(thread, JSTaggedValue::ToNumeric(thread, left));
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
@ -1163,24 +1164,24 @@ JSTaggedValue RuntimeTrampolines::RuntimeMod2Dyn(JSThread *thread, const JSHandl
|
||||
return JSTaggedValue(std::fmod(dLeft, dRight));
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeCreateEmptyObject(JSThread *thread, ObjectFactory *factory,
|
||||
JSHandle<GlobalEnv> globalEnv)
|
||||
JSTaggedValue RuntimeStubs::RuntimeCreateEmptyObject(JSThread *thread, ObjectFactory *factory,
|
||||
JSHandle<GlobalEnv> globalEnv)
|
||||
{
|
||||
JSHandle<JSFunction> builtinObj(globalEnv->GetObjectFunction());
|
||||
JSHandle<JSObject> obj = factory->NewJSObjectByConstructor(builtinObj, JSHandle<JSTaggedValue>(builtinObj));
|
||||
return obj.GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeCreateEmptyArray(JSThread *thread, ObjectFactory *factory,
|
||||
JSHandle<GlobalEnv> globalEnv)
|
||||
JSTaggedValue RuntimeStubs::RuntimeCreateEmptyArray(JSThread *thread, ObjectFactory *factory,
|
||||
JSHandle<GlobalEnv> globalEnv)
|
||||
{
|
||||
JSHandle<JSFunction> builtinObj(globalEnv->GetArrayFunction());
|
||||
JSHandle<JSObject> arr = factory->NewJSObjectByConstructor(builtinObj, JSHandle<JSTaggedValue>(builtinObj));
|
||||
return arr.GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeGetUnmapedArgs(JSThread *thread, JSTaggedType *sp, uint32_t actualNumArgs,
|
||||
uint32_t startIdx)
|
||||
JSTaggedValue RuntimeStubs::RuntimeGetUnmapedArgs(JSThread *thread, JSTaggedType *sp, uint32_t actualNumArgs,
|
||||
uint32_t startIdx)
|
||||
{
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<GlobalEnv> globalEnv = thread->GetEcmaVM()->GetGlobalEnv();
|
||||
@ -1226,8 +1227,8 @@ JSTaggedValue RuntimeTrampolines::RuntimeGetUnmapedArgs(JSThread *thread, JSTagg
|
||||
return obj.GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeCopyRestArgs(JSThread *thread, JSTaggedType *sp, uint32_t restNumArgs,
|
||||
uint32_t startIdx)
|
||||
JSTaggedValue RuntimeStubs::RuntimeCopyRestArgs(JSThread *thread, JSTaggedType *sp, uint32_t restNumArgs,
|
||||
uint32_t startIdx)
|
||||
{
|
||||
JSHandle<JSTaggedValue> restArray = JSArray::ArrayCreate(thread, JSTaggedNumber(restNumArgs));
|
||||
|
||||
@ -1241,8 +1242,8 @@ JSTaggedValue RuntimeTrampolines::RuntimeCopyRestArgs(JSThread *thread, JSTagged
|
||||
return restArray.GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeCreateArrayWithBuffer(JSThread *thread, ObjectFactory *factory,
|
||||
const JSHandle<JSTaggedValue> &literal)
|
||||
JSTaggedValue RuntimeStubs::RuntimeCreateArrayWithBuffer(JSThread *thread, ObjectFactory *factory,
|
||||
const JSHandle<JSTaggedValue> &literal)
|
||||
{
|
||||
JSHandle<JSArray> array(literal);
|
||||
JSHandle<JSArray> arrLiteral = factory->CloneArrayLiteral(array);
|
||||
@ -1251,8 +1252,8 @@ JSTaggedValue RuntimeTrampolines::RuntimeCreateArrayWithBuffer(JSThread *thread,
|
||||
return arrLiteral.GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeCreateObjectWithBuffer(JSThread *thread, ObjectFactory *factory,
|
||||
const JSHandle<JSObject> &literal)
|
||||
JSTaggedValue RuntimeStubs::RuntimeCreateObjectWithBuffer(JSThread *thread, ObjectFactory *factory,
|
||||
const JSHandle<JSObject> &literal)
|
||||
{
|
||||
JSHandle<JSObject> objLiteral = factory->CloneObjectLiteral(literal);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
@ -1260,7 +1261,7 @@ JSTaggedValue RuntimeTrampolines::RuntimeCreateObjectWithBuffer(JSThread *thread
|
||||
return objLiteral.GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeNewLexicalEnvDyn(JSThread *thread, uint16_t numVars)
|
||||
JSTaggedValue RuntimeStubs::RuntimeNewLexicalEnvDyn(JSThread *thread, uint16_t numVars)
|
||||
{
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<LexicalEnv> newEnv = factory->NewLexicalEnv(numVars);
|
||||
@ -1272,9 +1273,8 @@ JSTaggedValue RuntimeTrampolines::RuntimeNewLexicalEnvDyn(JSThread *thread, uint
|
||||
return newEnv.GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeNewObjDynRange(JSThread *thread, const JSHandle<JSTaggedValue> &func,
|
||||
const JSHandle<JSTaggedValue> &newTarget, uint16_t firstArgIdx,
|
||||
uint16_t length)
|
||||
JSTaggedValue RuntimeStubs::RuntimeNewObjDynRange(JSThread *thread, const JSHandle<JSTaggedValue> &func,
|
||||
const JSHandle<JSTaggedValue> &newTarget, uint16_t firstArgIdx, uint16_t length)
|
||||
{
|
||||
JSHandle<JSTaggedValue> preArgs(thread, JSTaggedValue::Undefined());
|
||||
auto tagged = SlowRuntimeHelper::Construct(thread, func, newTarget, preArgs, length, firstArgIdx);
|
||||
@ -1282,7 +1282,7 @@ JSTaggedValue RuntimeTrampolines::RuntimeNewObjDynRange(JSThread *thread, const
|
||||
return tagged;
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeDefinefuncDyn(JSThread *thread, JSFunction *func)
|
||||
JSTaggedValue RuntimeStubs::RuntimeDefinefuncDyn(JSThread *thread, JSFunction *func)
|
||||
{
|
||||
auto method = func->GetCallTarget();
|
||||
|
||||
@ -1294,15 +1294,15 @@ JSTaggedValue RuntimeTrampolines::RuntimeDefinefuncDyn(JSThread *thread, JSFunct
|
||||
return jsFunc.GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeCreateRegExpWithLiteral(JSThread *thread,
|
||||
const JSHandle<JSTaggedValue> &pattern, uint8_t flags)
|
||||
JSTaggedValue RuntimeStubs::RuntimeCreateRegExpWithLiteral(JSThread *thread,
|
||||
const JSHandle<JSTaggedValue> &pattern, uint8_t flags)
|
||||
{
|
||||
JSHandle<JSTaggedValue> flagsHandle(thread, JSTaggedValue(flags));
|
||||
return builtins::BuiltinsRegExp::RegExpCreate(thread, pattern, flagsHandle);
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeThrowIfSuperNotCorrectCall(JSThread *thread, uint16_t index,
|
||||
JSTaggedValue thisValue)
|
||||
JSTaggedValue RuntimeStubs::RuntimeThrowIfSuperNotCorrectCall(JSThread *thread, uint16_t index,
|
||||
JSTaggedValue thisValue)
|
||||
{
|
||||
if (index == 0 && (thisValue.IsUndefined() || thisValue.IsHole())) {
|
||||
return RuntimeThrowReferenceError(thread, JSHandle<JSTaggedValue>(thread, JSTaggedValue::Undefined()),
|
||||
@ -1315,10 +1315,10 @@ JSTaggedValue RuntimeTrampolines::RuntimeThrowIfSuperNotCorrectCall(JSThread *th
|
||||
return JSTaggedValue::True();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeCreateObjectHavingMethod(JSThread *thread, ObjectFactory *factory,
|
||||
const JSHandle<JSObject> &literal,
|
||||
const JSHandle<JSTaggedValue> &env,
|
||||
const JSHandle<JSTaggedValue> &constpool)
|
||||
JSTaggedValue RuntimeStubs::RuntimeCreateObjectHavingMethod(JSThread *thread, ObjectFactory *factory,
|
||||
const JSHandle<JSObject> &literal,
|
||||
const JSHandle<JSTaggedValue> &env,
|
||||
const JSHandle<JSTaggedValue> &constpool)
|
||||
{
|
||||
JSHandle<JSObject> objLiteral = factory->CloneObjectLiteral(literal, env, constpool);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
@ -1326,9 +1326,9 @@ JSTaggedValue RuntimeTrampolines::RuntimeCreateObjectHavingMethod(JSThread *thre
|
||||
return objLiteral.GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeCreateObjectWithExcludedKeys(JSThread *thread, uint16_t numKeys,
|
||||
const JSHandle<JSTaggedValue> &objVal,
|
||||
uint16_t firstArgRegIdx)
|
||||
JSTaggedValue RuntimeStubs::RuntimeCreateObjectWithExcludedKeys(JSThread *thread, uint16_t numKeys,
|
||||
const JSHandle<JSTaggedValue> &objVal,
|
||||
uint16_t firstArgRegIdx)
|
||||
{
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
|
||||
@ -1377,7 +1377,7 @@ JSTaggedValue RuntimeTrampolines::RuntimeCreateObjectWithExcludedKeys(JSThread *
|
||||
return restObj.GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeDefineNCFuncDyn(JSThread *thread, JSFunction *func)
|
||||
JSTaggedValue RuntimeStubs::RuntimeDefineNCFuncDyn(JSThread *thread, JSFunction *func)
|
||||
{
|
||||
auto method = func->GetCallTarget();
|
||||
|
||||
@ -1389,7 +1389,7 @@ JSTaggedValue RuntimeTrampolines::RuntimeDefineNCFuncDyn(JSThread *thread, JSFun
|
||||
return jsFunc.GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeDefineGeneratorFunc(JSThread *thread, JSFunction *func)
|
||||
JSTaggedValue RuntimeStubs::RuntimeDefineGeneratorFunc(JSThread *thread, JSFunction *func)
|
||||
{
|
||||
auto method = func->GetCallTarget();
|
||||
|
||||
@ -1411,7 +1411,7 @@ JSTaggedValue RuntimeTrampolines::RuntimeDefineGeneratorFunc(JSThread *thread, J
|
||||
return jsFunc.GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeDefineAsyncFunc(JSThread *thread, JSFunction *func)
|
||||
JSTaggedValue RuntimeStubs::RuntimeDefineAsyncFunc(JSThread *thread, JSFunction *func)
|
||||
{
|
||||
auto method = func->GetCallTarget();
|
||||
|
||||
@ -1423,8 +1423,8 @@ JSTaggedValue RuntimeTrampolines::RuntimeDefineAsyncFunc(JSThread *thread, JSFun
|
||||
return jsFunc.GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeDefineMethod(JSThread *thread, JSFunction *func,
|
||||
const JSHandle<JSTaggedValue> &homeObject)
|
||||
JSTaggedValue RuntimeStubs::RuntimeDefineMethod(JSThread *thread, JSFunction *func,
|
||||
const JSHandle<JSTaggedValue> &homeObject)
|
||||
{
|
||||
ASSERT(homeObject->IsECMAObject());
|
||||
auto method = func->GetCallTarget();
|
||||
@ -1438,9 +1438,9 @@ JSTaggedValue RuntimeTrampolines::RuntimeDefineMethod(JSThread *thread, JSFuncti
|
||||
return jsFunc.GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeCallSpreadDyn(JSThread *thread, const JSHandle<JSTaggedValue> &func,
|
||||
const JSHandle<JSTaggedValue> &obj,
|
||||
const JSHandle<JSTaggedValue> &array)
|
||||
JSTaggedValue RuntimeStubs::RuntimeCallSpreadDyn(JSThread *thread, const JSHandle<JSTaggedValue> &func,
|
||||
const JSHandle<JSTaggedValue> &obj,
|
||||
const JSHandle<JSTaggedValue> &array)
|
||||
{
|
||||
if ((!obj->IsUndefined() && !obj->IsECMAObject()) || !func->IsJSFunction() || !array->IsJSArray()) {
|
||||
THROW_TYPE_ERROR_AND_RETURN(thread, "cannot Callspread", JSTaggedValue::Exception());
|
||||
@ -1456,10 +1456,10 @@ JSTaggedValue RuntimeTrampolines::RuntimeCallSpreadDyn(JSThread *thread, const J
|
||||
return res;
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeDefineGetterSetterByValue(JSThread *thread, const JSHandle<JSObject> &obj,
|
||||
const JSHandle<JSTaggedValue> &prop,
|
||||
const JSHandle<JSTaggedValue> &getter,
|
||||
const JSHandle<JSTaggedValue> &setter, bool flag)
|
||||
JSTaggedValue RuntimeStubs::RuntimeDefineGetterSetterByValue(JSThread *thread, const JSHandle<JSObject> &obj,
|
||||
const JSHandle<JSTaggedValue> &prop,
|
||||
const JSHandle<JSTaggedValue> &getter,
|
||||
const JSHandle<JSTaggedValue> &setter, bool flag)
|
||||
{
|
||||
JSHandle<JSTaggedValue> propKey = JSTaggedValue::ToPropertyKey(thread, prop);
|
||||
|
||||
@ -1508,9 +1508,9 @@ JSTaggedValue RuntimeTrampolines::RuntimeDefineGetterSetterByValue(JSThread *thr
|
||||
return obj.GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeSuperCall(JSThread *thread, const JSHandle<JSTaggedValue> &func,
|
||||
const JSHandle<JSTaggedValue> &newTarget, uint16_t firstVRegIdx,
|
||||
uint16_t length)
|
||||
JSTaggedValue RuntimeStubs::RuntimeSuperCall(JSThread *thread, const JSHandle<JSTaggedValue> &func,
|
||||
const JSHandle<JSTaggedValue> &newTarget, uint16_t firstVRegIdx,
|
||||
uint16_t length)
|
||||
{
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
InterpretedFrameHandler frameHandler(thread);
|
||||
@ -1530,13 +1530,13 @@ JSTaggedValue RuntimeTrampolines::RuntimeSuperCall(JSThread *thread, const JSHan
|
||||
return result;
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeThrowTypeError(JSThread *thread, const char *message)
|
||||
JSTaggedValue RuntimeStubs::RuntimeThrowTypeError(JSThread *thread, const char *message)
|
||||
{
|
||||
ASSERT_NO_ABRUPT_COMPLETION(thread);
|
||||
THROW_TYPE_ERROR_AND_RETURN(thread, message, JSTaggedValue::Exception());
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeGetCallSpreadArgs(JSThread *thread, JSTaggedValue array)
|
||||
JSTaggedValue RuntimeStubs::RuntimeGetCallSpreadArgs(JSThread *thread, JSTaggedValue array)
|
||||
{
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
|
||||
@ -1563,14 +1563,14 @@ JSTaggedValue RuntimeTrampolines::RuntimeGetCallSpreadArgs(JSThread *thread, JST
|
||||
return argv.GetTaggedValue();
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeTrampolines::RuntimeThrowSyntaxError(JSThread *thread, const char *message)
|
||||
JSTaggedValue RuntimeStubs::RuntimeThrowSyntaxError(JSThread *thread, const char *message)
|
||||
{
|
||||
ASSERT_NO_ABRUPT_COMPLETION(thread);
|
||||
THROW_SYNTAX_ERROR_AND_RETURN(thread, message, JSTaggedValue::Exception());
|
||||
}
|
||||
|
||||
JSTaggedType RuntimeTrampolines::RuntimeNativeCall(JSThread *thread, JSTaggedValue func, bool callThis,
|
||||
uint32_t actualNumArgs, std::vector<JSTaggedType> &actualArgs)
|
||||
JSTaggedType RuntimeStubs::RuntimeNativeCall(JSThread *thread, JSTaggedValue func, bool callThis,
|
||||
uint32_t actualNumArgs, std::vector<JSTaggedType> &actualArgs)
|
||||
{
|
||||
thread->CheckSafepoint();
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -15,32 +15,188 @@
|
||||
|
||||
#ifndef ECMASCRIPT_RUNTIME_TRAMPOLINES_NEW_H
|
||||
#define ECMASCRIPT_RUNTIME_TRAMPOLINES_NEW_H
|
||||
#include "ecmascript/compiler/call_signature.h"
|
||||
#include "ecmascript/ecma_macros.h"
|
||||
#include "ecmascript/interpreter/frame_handler.h"
|
||||
#include "ecmascript/js_thread.h"
|
||||
#include "ecmascript/trampoline/runtime_define.h"
|
||||
#include "ecmascript/js_tagged_value.h"
|
||||
#include "ecmascript/js_method.h"
|
||||
#include "ecmascript/mem/region.h"
|
||||
|
||||
namespace panda::ecmascript {
|
||||
extern "C" JSTaggedType RuntimeCallTrampolineAot(uintptr_t glue, uint64_t runtime_id,
|
||||
uint64_t argc, ...);
|
||||
extern "C" JSTaggedType RuntimeCallTrampolineInterpreterAsm(uintptr_t glue, uint64_t runtime_id,
|
||||
uint64_t argc, ...);
|
||||
class RuntimeTrampolines {
|
||||
public:
|
||||
static void InitializeRuntimeTrampolines(JSThread *thread)
|
||||
{
|
||||
#define DEF_RUNTIME_STUB(name, counter) RuntimeTrampolineId::RUNTIME_ID_##name
|
||||
#define INITIAL_RUNTIME_FUNCTIONS(name, count) \
|
||||
thread->SetRuntimeFunction(DEF_RUNTIME_STUB(name, count), reinterpret_cast<uintptr_t>(name));
|
||||
ALL_RUNTIME_CALL_LIST(INITIAL_RUNTIME_FUNCTIONS)
|
||||
#undef INITIAL_RUNTIME_FUNCTIONS
|
||||
#undef DEF_RUNTIME_STUB
|
||||
}
|
||||
using kungfu::CallSignature;
|
||||
class ConstantPool;
|
||||
class EcmaVM;
|
||||
class GlobalEnv;
|
||||
class JSthread;
|
||||
class JSFunction;
|
||||
class ObjectFactory;
|
||||
extern "C" JSTaggedType RuntimeCallTrampolineAot(uintptr_t glue, uint64_t runtime_id, uint64_t argc, ...);
|
||||
extern "C" JSTaggedType RuntimeCallTrampolineInterpreterAsm(uintptr_t glue, uint64_t runtime_id, uint64_t argc, ...);
|
||||
|
||||
#define DECLARE_RUNTIME_TRAMPOLINES(name, counter) \
|
||||
#define RUNTIME_STUB_WITHOUT_GC_LIST(V) \
|
||||
V(DebugPrint, 1) \
|
||||
V(InsertOldToNewRememberedSet, 3) \
|
||||
V(MarkingBarrier, 5) \
|
||||
V(DoubleToInt, 1) \
|
||||
V(RuntimeCallTrampolineAot, 3) \
|
||||
V(RuntimeCallTrampolineInterpreterAsm, 3)
|
||||
|
||||
#define RUNTIME_STUB_WITH_GC_LIST(V) \
|
||||
V(AddElementInternal, 5) \
|
||||
V(CallSetter, 5) \
|
||||
V(CallSetter2, 3) \
|
||||
V(CallGetter, 3) \
|
||||
V(CallGetter2, 4) \
|
||||
V(CallInternalGetter, 3) \
|
||||
V(ThrowTypeError, 2) \
|
||||
V(JSProxySetProperty, 6) \
|
||||
V(GetHash32, 2) \
|
||||
V(FindElementWithCache, 4) \
|
||||
V(StringGetHashCode, 1) \
|
||||
V(FloatMod, 2) \
|
||||
V(GetTaggedArrayPtrTest, 2) \
|
||||
V(NewInternalString, 2) \
|
||||
V(NewTaggedArray, 2) \
|
||||
V(CopyArray, 3) \
|
||||
V(NameDictPutIfAbsent, 7) \
|
||||
V(PropertiesSetValue, 6) \
|
||||
V(TaggedArraySetValue, 6) \
|
||||
V(NewEcmaDynClass, 4) \
|
||||
V(UpdateLayOutAndAddTransition, 5) \
|
||||
V(NoticeThroughChainAndRefreshUser, 3) \
|
||||
V(JumpToCInterpreter, 7) \
|
||||
V(StGlobalRecord, 4) \
|
||||
V(SetFunctionNameNoPrefix, 3) \
|
||||
V(StOwnByValueWithNameSet, 4) \
|
||||
V(StOwnByName, 4) \
|
||||
V(StOwnByNameWithNameSet, 7) \
|
||||
V(SuspendGenerator, 7) \
|
||||
V(UpFrame, 1) \
|
||||
V(NegDyn, 2) \
|
||||
V(NotDyn, 2) \
|
||||
V(IncDyn, 2) \
|
||||
V(DecDyn, 2) \
|
||||
V(ChangeUintAndIntShrToJSTaggedValue, 3) \
|
||||
V(ChangeUintAndIntShlToJSTaggedValue, 3) \
|
||||
V(ChangeTwoInt32AndToJSTaggedValue, 3) \
|
||||
V(ChangeTwoInt32XorToJSTaggedValue, 3) \
|
||||
V(ChangeTwoInt32OrToJSTaggedValue, 3) \
|
||||
V(ChangeTwoUint32AndToJSTaggedValue, 3) \
|
||||
V(ExpDyn, 3) \
|
||||
V(IsInDyn, 3) \
|
||||
V(InstanceOfDyn, 3) \
|
||||
V(FastStrictEqual, 2) \
|
||||
V(FastStrictNotEqual, 2) \
|
||||
V(CreateGeneratorObj, 2) \
|
||||
V(ThrowConstAssignment, 2) \
|
||||
V(GetTemplateObject, 2) \
|
||||
V(GetNextPropName, 2) \
|
||||
V(ThrowIfNotObject, 1) \
|
||||
V(IterNext, 2) \
|
||||
V(CloseIterator, 2) \
|
||||
V(CopyModule, 2) \
|
||||
V(SuperCallSpread, 4) \
|
||||
V(DelObjProp, 3) \
|
||||
V(NewObjSpreadDyn, 4) \
|
||||
V(CreateIterResultObj, 3) \
|
||||
V(AsyncFunctionAwaitUncaught, 3) \
|
||||
V(AsyncFunctionResolveOrReject, 4) \
|
||||
V(ThrowUndefinedIfHole, 2) \
|
||||
V(CopyDataProperties, 3) \
|
||||
V(StArraySpread, 4) \
|
||||
V(GetIteratorNext, 3) \
|
||||
V(SetObjectWithProto, 3) \
|
||||
V(LoadICByValue, 5) \
|
||||
V(StoreICByValue, 6) \
|
||||
V(StOwnByValue, 4) \
|
||||
V(LdSuperByValue, 4) \
|
||||
V(StSuperByValue, 5) \
|
||||
V(LdObjByIndex, 5) \
|
||||
V(StObjByIndex, 4) \
|
||||
V(StOwnByIndex, 4) \
|
||||
V(ResolveClass, 6) \
|
||||
V(CloneClassFromTemplate, 5) \
|
||||
V(SetClassConstructorLength, 3) \
|
||||
V(LoadICByName, 5) \
|
||||
V(StoreICByName, 6) \
|
||||
V(UpdateHotnessCounter, 2) \
|
||||
V(GetModuleNamespace, 2) \
|
||||
V(StModuleVar, 3) \
|
||||
V(LdModuleVar, 3) \
|
||||
V(ThrowDyn, 2) \
|
||||
V(GetPropIterator, 2) \
|
||||
V(AsyncFunctionEnter, 1) \
|
||||
V(GetIterator, 2) \
|
||||
V(ThrowThrowNotExists, 1) \
|
||||
V(ThrowPatternNonCoercible, 1) \
|
||||
V(ThrowDeleteSuperProperty, 1) \
|
||||
V(EqDyn, 3) \
|
||||
V(LdGlobalRecord, 2) \
|
||||
V(GetGlobalOwnProperty, 2) \
|
||||
V(TryLdGlobalByName, 2) \
|
||||
V(LoadMiss, 6) \
|
||||
V(StoreMiss, 7) \
|
||||
V(TryUpdateGlobalRecord, 3) \
|
||||
V(ThrowReferenceError, 2) \
|
||||
V(StGlobalVar, 3) \
|
||||
V(LdGlobalVar, 3) \
|
||||
V(ToNumber, 2) \
|
||||
V(ToBoolean, 1) \
|
||||
V(NotEqDyn, 3) \
|
||||
V(LessDyn, 3) \
|
||||
V(LessEqDyn, 3) \
|
||||
V(GreaterDyn, 3) \
|
||||
V(GreaterEqDyn, 3) \
|
||||
V(Add2Dyn, 3) \
|
||||
V(Sub2Dyn, 3) \
|
||||
V(Mul2Dyn, 3) \
|
||||
V(Div2Dyn, 3) \
|
||||
V(Mod2Dyn, 3) \
|
||||
V(GetLexicalEnv, 1) \
|
||||
V(LoadValueFromConstantStringTable, 2) \
|
||||
V(CreateEmptyObject, 1) \
|
||||
V(CreateEmptyArray, 1) \
|
||||
V(GetSymbolFunction, 1) \
|
||||
V(GetUnmapedArgs, 2) \
|
||||
V(CopyRestArgs, 3) \
|
||||
V(CreateArrayWithBuffer, 2) \
|
||||
V(CreateObjectWithBuffer, 2) \
|
||||
V(NewLexicalEnvDyn, 2) \
|
||||
V(NewObjDynRange, 5) \
|
||||
V(DefinefuncDyn, 2) \
|
||||
V(CreateRegExpWithLiteral, 3) \
|
||||
V(ThrowIfSuperNotCorrectCall, 3) \
|
||||
V(CreateObjectHavingMethod, 4) \
|
||||
V(CreateObjectWithExcludedKeys, 4) \
|
||||
V(DefineNCFuncDyn, 2) \
|
||||
V(DefineGeneratorFunc, 2) \
|
||||
V(DefineAsyncFunc, 2) \
|
||||
V(DefineMethod, 3) \
|
||||
V(SetNotCallableException, 0) \
|
||||
V(SetCallConstructorException, 0) \
|
||||
V(SetStackOverflowException, 0) \
|
||||
V(CallNative, 3) \
|
||||
V(CallSpreadDyn, 4) \
|
||||
V(DefineGetterSetterByValue, 6) \
|
||||
V(SuperCall, 5) \
|
||||
V(CallArg0Dyn, 2) \
|
||||
V(CallArg1Dyn, 3) \
|
||||
V(CallArgs2Dyn, 4) \
|
||||
V(CallArgs3Dyn, 5) \
|
||||
V(CallIThisRangeDyn, 3) \
|
||||
V(CallIRangeDyn, 2)
|
||||
|
||||
#define RUNTIME_STUB_LIST(V) \
|
||||
RUNTIME_STUB_WITHOUT_GC_LIST(V) \
|
||||
RUNTIME_STUB_WITH_GC_LIST(V)
|
||||
|
||||
class RuntimeStubs {
|
||||
public:
|
||||
static void Initialize(JSThread *thread);
|
||||
|
||||
#define DECLARE_RUNTIME_STUBS(name, counter) \
|
||||
static JSTaggedType name(uintptr_t argGlue, uint32_t argc, uintptr_t argv);
|
||||
RUNTIME_CALL_LIST(DECLARE_RUNTIME_TRAMPOLINES)
|
||||
#undef DECLARE_RUNTIME_TRAMPOLINES
|
||||
RUNTIME_STUB_WITH_GC_LIST(DECLARE_RUNTIME_STUBS)
|
||||
#undef DECLARE_RUNTIME_STUBS
|
||||
|
||||
static void DebugPrint(int fmtMessageId, ...);
|
||||
static void MarkingBarrier([[maybe_unused]]uintptr_t argGlue, uintptr_t slotAddr,
|
@ -18,10 +18,10 @@
|
||||
|
||||
#include "ecmascript/js_hclass.h"
|
||||
#include "ecmascript/js_tagged_value.h"
|
||||
#include "ecmascript/js_thread.h"
|
||||
|
||||
namespace panda::ecmascript {
|
||||
class ObjectFactory;
|
||||
class JSThread;
|
||||
|
||||
class TaggedArray : public TaggedObject {
|
||||
public:
|
||||
|
@ -1,194 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 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.
|
||||
*/
|
||||
|
||||
#ifndef ECMASCRIPT_TRAMPOLINE_RUNTIME_DEFINE_H
|
||||
#define ECMASCRIPT_TRAMPOLINE_RUNTIME_DEFINE_H
|
||||
|
||||
#include "ecmascript/base/config.h"
|
||||
|
||||
namespace panda::ecmascript {
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
||||
#define RUNTIME_CALL_LIST_BASE(V, I) \
|
||||
I(DebugPrint, 1) \
|
||||
I(InsertOldToNewRememberedSet, 3) \
|
||||
I(MarkingBarrier, 5) \
|
||||
I(DoubleToInt, 1) \
|
||||
I(RuntimeCallTrampolineAot, 3) \
|
||||
I(RuntimeCallTrampolineInterpreterAsm, 3)\
|
||||
V(AddElementInternal, 5) \
|
||||
V(CallSetter, 5) \
|
||||
V(CallSetter2, 3) \
|
||||
V(CallGetter, 3) \
|
||||
V(CallGetter2, 4) \
|
||||
V(CallInternalGetter, 3) \
|
||||
V(ThrowTypeError, 2) \
|
||||
V(JSProxySetProperty, 6) \
|
||||
V(GetHash32, 2) \
|
||||
V(FindElementWithCache, 4) \
|
||||
V(StringGetHashCode, 1) \
|
||||
V(FloatMod, 2) \
|
||||
V(GetTaggedArrayPtrTest, 2) \
|
||||
V(NewInternalString, 2) \
|
||||
V(NewTaggedArray, 2) \
|
||||
V(CopyArray, 3) \
|
||||
V(NameDictPutIfAbsent, 7) \
|
||||
V(PropertiesSetValue, 6) \
|
||||
V(TaggedArraySetValue, 6) \
|
||||
V(NewEcmaDynClass, 4) \
|
||||
V(UpdateLayOutAndAddTransition, 5) \
|
||||
V(NoticeThroughChainAndRefreshUser, 3) \
|
||||
V(JumpToCInterpreter, 7) \
|
||||
V(StGlobalRecord, 4) \
|
||||
V(SetFunctionNameNoPrefix, 3) \
|
||||
V(StOwnByValueWithNameSet, 4) \
|
||||
V(StOwnByName, 4) \
|
||||
V(StOwnByNameWithNameSet, 7) \
|
||||
V(SuspendGenerator, 7) \
|
||||
V(UpFrame, 1) \
|
||||
V(NegDyn, 2) \
|
||||
V(NotDyn, 2) \
|
||||
V(IncDyn, 2) \
|
||||
V(DecDyn, 2) \
|
||||
V(ChangeUintAndIntShrToJSTaggedValue, 3) \
|
||||
V(ChangeUintAndIntShlToJSTaggedValue, 3) \
|
||||
V(ChangeTwoInt32AndToJSTaggedValue, 3) \
|
||||
V(ChangeTwoInt32XorToJSTaggedValue, 3) \
|
||||
V(ChangeTwoInt32OrToJSTaggedValue, 3) \
|
||||
V(ChangeTwoUint32AndToJSTaggedValue, 3) \
|
||||
V(ExpDyn, 3) \
|
||||
V(IsInDyn, 3) \
|
||||
V(InstanceOfDyn, 3) \
|
||||
V(FastStrictEqual, 2) \
|
||||
V(FastStrictNotEqual, 2) \
|
||||
V(CreateGeneratorObj, 2) \
|
||||
V(ThrowConstAssignment, 2) \
|
||||
V(GetTemplateObject, 2) \
|
||||
V(GetNextPropName, 2) \
|
||||
V(ThrowIfNotObject, 1) \
|
||||
V(IterNext, 2) \
|
||||
V(CloseIterator, 2) \
|
||||
V(CopyModule, 2) \
|
||||
V(SuperCallSpread, 4) \
|
||||
V(DelObjProp, 3) \
|
||||
V(NewObjSpreadDyn, 4) \
|
||||
V(CreateIterResultObj, 3) \
|
||||
V(AsyncFunctionAwaitUncaught, 3) \
|
||||
V(AsyncFunctionResolveOrReject, 4) \
|
||||
V(ThrowUndefinedIfHole, 2) \
|
||||
V(CopyDataProperties, 3) \
|
||||
V(StArraySpread, 4) \
|
||||
V(GetIteratorNext, 3) \
|
||||
V(SetObjectWithProto, 3) \
|
||||
V(LoadICByValue, 5) \
|
||||
V(StoreICByValue, 6) \
|
||||
V(StOwnByValue, 4) \
|
||||
V(LdSuperByValue, 4) \
|
||||
V(StSuperByValue, 5) \
|
||||
V(LdObjByIndex, 5) \
|
||||
V(StObjByIndex, 4) \
|
||||
V(StOwnByIndex, 4) \
|
||||
V(ResolveClass, 6) \
|
||||
V(CloneClassFromTemplate, 5) \
|
||||
V(SetClassConstructorLength, 3) \
|
||||
V(LoadICByName, 5) \
|
||||
V(StoreICByName, 6) \
|
||||
V(UpdateHotnessCounter, 2) \
|
||||
V(GetModuleNamespace, 2) \
|
||||
V(StModuleVar, 3) \
|
||||
V(LdModuleVar, 3) \
|
||||
V(ThrowDyn, 2) \
|
||||
V(GetPropIterator, 2) \
|
||||
V(AsyncFunctionEnter, 1) \
|
||||
V(GetIterator, 2) \
|
||||
V(ThrowThrowNotExists, 1) \
|
||||
V(ThrowPatternNonCoercible, 1) \
|
||||
V(ThrowDeleteSuperProperty, 1) \
|
||||
V(EqDyn, 3) \
|
||||
V(LdGlobalRecord, 2) \
|
||||
V(GetGlobalOwnProperty, 2) \
|
||||
V(TryLdGlobalByName, 2) \
|
||||
V(LoadMiss, 6) \
|
||||
V(StoreMiss, 7) \
|
||||
V(TryUpdateGlobalRecord, 3) \
|
||||
V(ThrowReferenceError, 2) \
|
||||
V(StGlobalVar, 3) \
|
||||
V(LdGlobalVar, 3) \
|
||||
V(ToNumber, 2) \
|
||||
V(ToBoolean, 1) \
|
||||
V(NotEqDyn, 3) \
|
||||
V(LessDyn, 3) \
|
||||
V(LessEqDyn, 3) \
|
||||
V(GreaterDyn, 3) \
|
||||
V(GreaterEqDyn, 3) \
|
||||
V(Add2Dyn, 3) \
|
||||
V(Sub2Dyn, 3) \
|
||||
V(Mul2Dyn, 3) \
|
||||
V(Div2Dyn, 3) \
|
||||
V(Mod2Dyn, 3) \
|
||||
V(GetLexicalEnv, 1) \
|
||||
V(LoadValueFromConstantStringTable, 2) \
|
||||
V(CreateEmptyObject, 1) \
|
||||
V(CreateEmptyArray, 1) \
|
||||
V(GetSymbolFunction, 1) \
|
||||
V(GetUnmapedArgs, 2) \
|
||||
V(CopyRestArgs, 3) \
|
||||
V(CreateArrayWithBuffer, 2) \
|
||||
V(CreateObjectWithBuffer, 2) \
|
||||
V(NewLexicalEnvDyn, 2) \
|
||||
V(NewObjDynRange, 5) \
|
||||
V(DefinefuncDyn, 2) \
|
||||
V(CreateRegExpWithLiteral, 3) \
|
||||
V(ThrowIfSuperNotCorrectCall, 3) \
|
||||
V(CreateObjectHavingMethod, 4) \
|
||||
V(CreateObjectWithExcludedKeys, 4) \
|
||||
V(DefineNCFuncDyn, 2) \
|
||||
V(DefineGeneratorFunc, 2) \
|
||||
V(DefineAsyncFunc, 2) \
|
||||
V(DefineMethod, 3) \
|
||||
V(SetNotCallableException, 0) \
|
||||
V(SetCallConstructorException, 0) \
|
||||
V(SetStackOverflowException, 0) \
|
||||
V(CallNative, 3) \
|
||||
V(CallSpreadDyn, 4) \
|
||||
V(DefineGetterSetterByValue, 6) \
|
||||
V(SuperCall, 5) \
|
||||
V(CallArg0Dyn, 2) \
|
||||
V(CallArg1Dyn, 3) \
|
||||
V(CallArgs2Dyn, 4) \
|
||||
V(CallArgs3Dyn, 5) \
|
||||
V(CallIThisRangeDyn, 3) \
|
||||
V(CallIRangeDyn, 2)
|
||||
|
||||
#define IGNORE_RUNTIME(...)
|
||||
|
||||
#define RUNTIME_CALL_LIST(V) \
|
||||
RUNTIME_CALL_LIST_BASE(V, IGNORE_RUNTIME)
|
||||
|
||||
#define ALL_RUNTIME_CALL_LIST(V) \
|
||||
RUNTIME_CALL_LIST_BASE(V, V)
|
||||
|
||||
#define NO_GC_RUNTIME_CALL_LIST(V) \
|
||||
RUNTIME_CALL_LIST_BASE(IGNORE_RUNTIME, V)
|
||||
|
||||
enum RuntimeTrampolineId {
|
||||
#define DEF_RUNTIME_STUB(name, counter) RUNTIME_ID_##name,
|
||||
ALL_RUNTIME_CALL_LIST(DEF_RUNTIME_STUB)
|
||||
#undef DEF_RUNTIME_STUB
|
||||
RUNTIME_CALL_MAX_ID
|
||||
};
|
||||
|
||||
#define RUNTIME_CALL_ID(name) RuntimeTrampolineId::RUNTIME_ID_##name
|
||||
} // namespace panda::ecmascript
|
||||
#endif // ECMASCRIPT_TRAMPOLINE_RUNTIME_DEFINE_H
|
Loading…
Reference in New Issue
Block a user