2021-09-04 08:06:49 +00:00
|
|
|
/*
|
2022-05-13 07:42:19 +00:00
|
|
|
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
2021-09-04 08:06:49 +00:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2022-07-25 01:48:46 +00:00
|
|
|
#ifndef ECMASCRIPT_COMPILER_STUB_BUILDER_H
|
|
|
|
#define ECMASCRIPT_COMPILER_STUB_BUILDER_H
|
2021-09-04 08:06:49 +00:00
|
|
|
|
2022-11-08 09:05:30 +00:00
|
|
|
#include "ecmascript/base/config.h"
|
2022-07-25 01:48:46 +00:00
|
|
|
#include "ecmascript/compiler/call_signature.h"
|
2022-03-03 09:22:12 +00:00
|
|
|
#include "ecmascript/compiler/circuit_builder-inl.h"
|
2023-05-27 08:50:29 +00:00
|
|
|
#include "ecmascript/compiler/profiler_operation.h"
|
2022-03-01 08:31:08 +00:00
|
|
|
#include "ecmascript/compiler/variable_type.h"
|
2021-09-04 08:06:49 +00:00
|
|
|
|
2021-12-23 06:55:22 +00:00
|
|
|
namespace panda::ecmascript::kungfu {
|
2023-09-01 09:13:25 +00:00
|
|
|
struct StringInfoGateRef;
|
2021-10-08 06:45:08 +00:00
|
|
|
using namespace panda::ecmascript;
|
2021-09-04 08:06:49 +00:00
|
|
|
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
2022-05-10 12:52:16 +00:00
|
|
|
#define DEFVARIABLE(varname, type, val) Variable varname(GetEnvironment(), type, NextVariableId(), val)
|
2022-05-15 02:41:02 +00:00
|
|
|
|
2022-12-02 03:41:58 +00:00
|
|
|
#define SUBENTRY(messageId, condition) \
|
2022-12-02 08:00:17 +00:00
|
|
|
GateRef glueArg = PtrArgument(0); \
|
2022-12-02 03:41:58 +00:00
|
|
|
auto env = GetEnvironment(); \
|
|
|
|
Label subEntry(env); \
|
|
|
|
env->SubCfgEntry(&subEntry); \
|
2022-11-08 09:05:30 +00:00
|
|
|
Label nextLabel(env); \
|
2022-12-02 08:00:17 +00:00
|
|
|
Assert(messageId, __LINE__, glueArg, condition, &nextLabel); \
|
|
|
|
Bind(&nextLabel)
|
|
|
|
#define SUBENTRY_WITH_GLUE(messageId, condition, glueArg) \
|
|
|
|
auto env = GetEnvironment(); \
|
|
|
|
Label subEntry(env); \
|
|
|
|
env->SubCfgEntry(&subEntry); \
|
|
|
|
Label nextLabel(env); \
|
|
|
|
Assert(messageId, __LINE__, glueArg, condition, &nextLabel); \
|
2022-11-08 09:05:30 +00:00
|
|
|
Bind(&nextLabel)
|
2022-12-02 03:41:58 +00:00
|
|
|
|
|
|
|
#ifndef NDEBUG
|
|
|
|
#define ASM_ASSERT(messageId, condition) \
|
|
|
|
SUBENTRY(messageId, condition)
|
2022-12-02 08:00:17 +00:00
|
|
|
#define ASM_ASSERT_WITH_GLUE(messageId, condition, glue) \
|
|
|
|
SUBENTRY_WITH_GLUE(messageId, condition, glue)
|
2022-12-02 03:41:58 +00:00
|
|
|
#elif defined(ENABLE_ASM_ASSERT)
|
|
|
|
#define ASM_ASSERT(messageId, condition) \
|
|
|
|
SUBENTRY(messageId, condition)
|
2022-12-02 08:00:17 +00:00
|
|
|
#define ASM_ASSERT_WITH_GLUE(messageId, condition, glue) \
|
|
|
|
SUBENTRY_WITH_GLUE(messageId, condition, glue)
|
2022-11-08 09:05:30 +00:00
|
|
|
#else
|
|
|
|
#define ASM_ASSERT(messageId, ...) ((void)0)
|
2022-12-02 08:00:17 +00:00
|
|
|
#define ASM_ASSERT_WITH_GLUE(messageId, ...) ((void)0)
|
2022-11-08 09:05:30 +00:00
|
|
|
#endif
|
|
|
|
|
2022-12-02 03:41:58 +00:00
|
|
|
#ifndef NDEBUG
|
|
|
|
#define EXITENTRY() \
|
|
|
|
env->SubCfgExit()
|
|
|
|
#elif defined(ENABLE_ASM_ASSERT)
|
|
|
|
#define EXITENTRY() \
|
|
|
|
env->SubCfgExit()
|
|
|
|
#else
|
|
|
|
#define EXITENTRY() ((void)0)
|
|
|
|
#endif
|
|
|
|
|
2022-07-22 02:27:59 +00:00
|
|
|
class StubBuilder {
|
2021-09-04 08:06:49 +00:00
|
|
|
public:
|
2022-07-29 07:26:04 +00:00
|
|
|
explicit StubBuilder(StubBuilder *parent)
|
|
|
|
: callSignature_(parent->GetCallSignature()), env_(parent->GetEnvironment()) {}
|
2023-01-03 02:32:21 +00:00
|
|
|
StubBuilder(CallSignature *callSignature, Environment *env)
|
2022-07-25 01:48:46 +00:00
|
|
|
: callSignature_(callSignature), env_(env) {}
|
2022-11-08 08:42:34 +00:00
|
|
|
explicit StubBuilder(Environment *env)
|
|
|
|
: env_(env) {}
|
2022-07-22 02:27:59 +00:00
|
|
|
virtual ~StubBuilder() = default;
|
|
|
|
NO_MOVE_SEMANTIC(StubBuilder);
|
|
|
|
NO_COPY_SEMANTIC(StubBuilder);
|
2022-07-25 01:48:46 +00:00
|
|
|
virtual void GenerateCircuit() = 0;
|
|
|
|
Environment *GetEnvironment() const
|
2022-05-15 02:41:02 +00:00
|
|
|
{
|
2022-07-25 01:48:46 +00:00
|
|
|
return env_;
|
2021-09-04 08:06:49 +00:00
|
|
|
}
|
2022-07-21 01:51:36 +00:00
|
|
|
CallSignature *GetCallSignature() const
|
|
|
|
{
|
|
|
|
return callSignature_;
|
|
|
|
}
|
2021-12-17 09:18:10 +00:00
|
|
|
int NextVariableId()
|
2021-09-04 08:06:49 +00:00
|
|
|
{
|
2022-07-25 01:48:46 +00:00
|
|
|
return env_->NextVariableId();
|
2021-09-26 06:47:20 +00:00
|
|
|
}
|
2021-12-17 09:18:10 +00:00
|
|
|
// constant
|
2022-03-31 09:26:17 +00:00
|
|
|
GateRef Int8(int8_t value);
|
|
|
|
GateRef Int16(int16_t value);
|
|
|
|
GateRef Int32(int32_t value);
|
|
|
|
GateRef Int64(int64_t value);
|
2022-12-13 12:58:55 +00:00
|
|
|
GateRef StringPtr(const std::string &str);
|
2022-03-31 09:26:17 +00:00
|
|
|
GateRef IntPtr(int64_t value);
|
|
|
|
GateRef IntPtrSize();
|
|
|
|
GateRef RelocatableData(uint64_t value);
|
|
|
|
GateRef True();
|
|
|
|
GateRef False();
|
|
|
|
GateRef Boolean(bool value);
|
|
|
|
GateRef Double(double value);
|
2022-09-19 07:39:56 +00:00
|
|
|
GateRef Undefined();
|
|
|
|
GateRef Hole();
|
|
|
|
GateRef Null();
|
|
|
|
GateRef Exception();
|
2021-09-04 08:06:49 +00:00
|
|
|
// parameter
|
2022-03-16 10:12:15 +00:00
|
|
|
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);
|
2022-07-21 01:51:36 +00:00
|
|
|
GateRef TaggedPointerArgument(size_t index);
|
|
|
|
GateRef PtrArgument(size_t index);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef Float32Argument(size_t index);
|
|
|
|
GateRef Float64Argument(size_t index);
|
|
|
|
GateRef Alloca(int size);
|
2021-09-04 08:06:49 +00:00
|
|
|
// control flow
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef Return(GateRef value);
|
|
|
|
GateRef Return();
|
|
|
|
void Bind(Label *label);
|
2021-09-04 08:06:49 +00:00
|
|
|
void Jump(Label *label);
|
2021-12-17 09:18:10 +00:00
|
|
|
void Branch(GateRef condition, Label *trueLabel, Label *falseLabel);
|
2022-01-04 11:30:40 +00:00
|
|
|
void Switch(GateRef index, Label *defaultLabel, int64_t *keysValue, Label *keysLabel, int numberOfKeys);
|
2021-09-04 08:06:49 +00:00
|
|
|
void LoopBegin(Label *loopHead);
|
|
|
|
void LoopEnd(Label *loopHead);
|
|
|
|
// call operation
|
2022-05-15 02:41:02 +00:00
|
|
|
GateRef CallRuntime(GateRef glue, int index, const std::initializer_list<GateRef>& args);
|
Implement Proxy Lowering on x86
when function need call another js function, it will lowering to call "JSCall" trampoline function
JSCall trampoline function will check calltarget function, then correct the arguments, finally jump
the native or optimized code address of the target function.
JSCall(glue, argc, calltarget, ....)
then proxy call(glue, argc, callTarget, argv[])
if proxy->GetHandler is function
tail call JSCall(glue, argc, callTarget, argv); // consider performance
else
//Call(trap, handler, «target, thisArgument, argArray»)
call CreateArrayFromList(glue, argc, argv[]) ---> arrHandle // maybe trigger GC, construct OptimizedWithArgvLeaveFrame, visitor argv[0]..argv[argc-1]
call JSCall(glue, argc, method, argv[])
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I52T6B?from=project-issue
Signed-off-by: songzhengchao <songzhengchao@huawei.com>
Change-Id: I994aae1eb9cbf51982348ae6e203c24c326f617e
2022-04-14 13:54:03 +00:00
|
|
|
GateRef CallRuntime(GateRef glue, int index, GateRef argc, GateRef argv);
|
2022-05-15 02:41:02 +00:00
|
|
|
GateRef CallNGCRuntime(GateRef glue, int index, const std::initializer_list<GateRef>& args);
|
2023-05-18 11:13:51 +00:00
|
|
|
GateRef FastCallOptimized(GateRef glue, GateRef code, const std::initializer_list<GateRef>& args);
|
|
|
|
GateRef CallOptimized(GateRef glue, GateRef code, const std::initializer_list<GateRef>& args);
|
|
|
|
GateRef GetAotCodeAddr(GateRef method);
|
2022-05-15 02:41:02 +00:00
|
|
|
GateRef CallStub(GateRef glue, int index, const std::initializer_list<GateRef>& args);
|
2023-04-15 11:13:09 +00:00
|
|
|
GateRef CallBuiltinRuntime(GateRef glue, const std::initializer_list<GateRef>& args,
|
|
|
|
bool isNew = false, const char* comment = nullptr);
|
2022-03-16 10:12:15 +00:00
|
|
|
void DebugPrint(GateRef thread, std::initializer_list<GateRef> args);
|
2022-03-21 07:18:47 +00:00
|
|
|
void FatalPrint(GateRef thread, std::initializer_list<GateRef> args);
|
2021-09-04 08:06:49 +00:00
|
|
|
// memory
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef Load(VariableType type, GateRef base, GateRef offset);
|
|
|
|
GateRef Load(VariableType type, GateRef base);
|
2022-03-22 09:00:19 +00:00
|
|
|
void Store(VariableType type, GateRef glue, GateRef base, GateRef offset, GateRef value);
|
2021-09-04 08:06:49 +00:00
|
|
|
// arithmetic
|
2022-03-16 10:12:15 +00:00
|
|
|
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);
|
2022-04-21 12:08:23 +00:00
|
|
|
GateRef PtrAdd(GateRef x, GateRef y);
|
|
|
|
GateRef PtrSub(GateRef x, GateRef y);
|
2022-08-31 09:21:19 +00:00
|
|
|
GateRef PtrMul(GateRef x, GateRef y);
|
2022-03-16 10:12:15 +00:00
|
|
|
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 Int32Mod(GateRef x, GateRef y);
|
|
|
|
GateRef DoubleMod(GateRef x, GateRef y);
|
|
|
|
GateRef Int64Div(GateRef x, GateRef y);
|
|
|
|
GateRef IntPtrDiv(GateRef x, GateRef y);
|
2021-09-04 08:06:49 +00:00
|
|
|
// bit operation
|
2022-03-16 10:12:15 +00:00
|
|
|
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);
|
2022-08-19 07:23:06 +00:00
|
|
|
GateRef IntPtrNot(GateRef x);
|
2022-03-16 10:12:15 +00:00
|
|
|
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 IntPtrLSL(GateRef x, GateRef y);
|
|
|
|
GateRef Int8LSR(GateRef x, GateRef y);
|
2022-04-21 12:08:23 +00:00
|
|
|
GateRef Int32LSR(GateRef x, GateRef y);
|
|
|
|
GateRef Int64LSR(GateRef x, GateRef y);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef IntPtrLSR(GateRef x, GateRef y);
|
2022-03-21 12:06:33 +00:00
|
|
|
GateRef Int32ASR(GateRef x, GateRef y);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef TaggedIsInt(GateRef x);
|
|
|
|
GateRef TaggedIsDouble(GateRef x);
|
|
|
|
GateRef TaggedIsObject(GateRef x);
|
|
|
|
GateRef TaggedIsNumber(GateRef x);
|
2022-07-30 03:49:38 +00:00
|
|
|
GateRef TaggedIsNumeric(GateRef x);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef TaggedIsHole(GateRef x);
|
|
|
|
GateRef TaggedIsNotHole(GateRef x);
|
|
|
|
GateRef TaggedIsUndefined(GateRef x);
|
|
|
|
GateRef TaggedIsException(GateRef x);
|
|
|
|
GateRef TaggedIsSpecial(GateRef x);
|
|
|
|
GateRef TaggedIsHeapObject(GateRef x);
|
2022-10-24 11:32:00 +00:00
|
|
|
GateRef TaggedIsAccessor(GateRef x);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef ObjectAddressToRange(GateRef x);
|
2022-10-26 02:39:13 +00:00
|
|
|
GateRef InYoungGeneration(GateRef region);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef TaggedIsGeneratorObject(GateRef x);
|
2023-08-02 01:56:06 +00:00
|
|
|
GateRef TaggedIsJSArray(GateRef x);
|
2022-07-29 03:13:50 +00:00
|
|
|
GateRef TaggedIsAsyncGeneratorObject(GateRef x);
|
2023-04-23 09:42:26 +00:00
|
|
|
GateRef TaggedIsJSGlobalObject(GateRef x);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef TaggedIsWeak(GateRef x);
|
|
|
|
GateRef TaggedIsPrototypeHandler(GateRef x);
|
2023-01-13 10:19:25 +00:00
|
|
|
GateRef TaggedIsStoreTSHandler(GateRef x);
|
|
|
|
GateRef TaggedIsTransWithProtoHandler(GateRef x);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef TaggedIsTransitionHandler(GateRef x);
|
2021-12-17 09:18:10 +00:00
|
|
|
GateRef TaggedIsString(GateRef obj);
|
2022-08-11 03:18:30 +00:00
|
|
|
GateRef BothAreString(GateRef x, GateRef y);
|
2021-12-17 09:18:10 +00:00
|
|
|
GateRef TaggedIsStringOrSymbol(GateRef obj);
|
2023-09-01 08:58:58 +00:00
|
|
|
GateRef TaggedIsSymbol(GateRef obj);
|
2022-03-16 10:12:15 +00:00
|
|
|
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);
|
2023-04-23 09:42:26 +00:00
|
|
|
GateRef TaggedGetNumber(GateRef x);
|
2022-08-29 07:10:59 +00:00
|
|
|
GateRef Int8ToTaggedInt(GateRef x);
|
|
|
|
GateRef Int16ToTaggedInt(GateRef x);
|
|
|
|
GateRef IntToTaggedPtr(GateRef x);
|
|
|
|
GateRef IntToTaggedInt(GateRef x);
|
2022-12-02 08:00:17 +00:00
|
|
|
GateRef Int64ToTaggedInt(GateRef x);
|
2022-08-29 07:10:59 +00:00
|
|
|
GateRef DoubleToTaggedDoublePtr(GateRef x);
|
2023-07-12 10:42:42 +00:00
|
|
|
GateRef TaggedPtrToTaggedDoublePtr(GateRef x);
|
|
|
|
GateRef TaggedPtrToTaggedIntPtr(GateRef x);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef CastDoubleToInt64(GateRef x);
|
|
|
|
GateRef TaggedTrue();
|
|
|
|
GateRef TaggedFalse();
|
2023-08-09 00:48:55 +00:00
|
|
|
GateRef TaggedUndefined();
|
2021-09-04 08:06:49 +00:00
|
|
|
// compare operation
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef Int8Equal(GateRef x, GateRef y);
|
2022-08-31 09:21:19 +00:00
|
|
|
GateRef Equal(GateRef x, GateRef y);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef Int32Equal(GateRef x, GateRef y);
|
|
|
|
GateRef Int32NotEqual(GateRef x, GateRef y);
|
|
|
|
GateRef Int64Equal(GateRef x, GateRef y);
|
|
|
|
GateRef DoubleEqual(GateRef x, GateRef y);
|
2022-09-20 09:32:59 +00:00
|
|
|
GateRef DoubleNotEqual(GateRef x, GateRef y);
|
2022-03-16 10:12:15 +00:00
|
|
|
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);
|
2022-04-21 12:08:23 +00:00
|
|
|
GateRef Int32UnsignedGreaterThan(GateRef x, GateRef y);
|
|
|
|
GateRef Int32UnsignedLessThan(GateRef x, GateRef y);
|
|
|
|
GateRef Int32UnsignedGreaterThanOrEqual(GateRef x, GateRef y);
|
2023-08-24 12:18:58 +00:00
|
|
|
GateRef Int32UnsignedLessThanOrEqual(GateRef x, GateRef y);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef Int64GreaterThan(GateRef x, GateRef y);
|
|
|
|
GateRef Int64LessThan(GateRef x, GateRef y);
|
|
|
|
GateRef Int64LessThanOrEqual(GateRef x, GateRef y);
|
|
|
|
GateRef Int64GreaterThanOrEqual(GateRef x, GateRef y);
|
2022-04-21 12:08:23 +00:00
|
|
|
GateRef Int64UnsignedLessThanOrEqual(GateRef x, GateRef y);
|
2022-05-19 04:48:40 +00:00
|
|
|
GateRef IntPtrGreaterThan(GateRef x, GateRef y);
|
2021-09-04 08:06:49 +00:00
|
|
|
// cast operation
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef ChangeInt64ToIntPtr(GateRef val);
|
2022-10-26 02:22:15 +00:00
|
|
|
GateRef ZExtInt32ToPtr(GateRef val);
|
2022-06-10 07:35:16 +00:00
|
|
|
GateRef ChangeIntPtrToInt32(GateRef val);
|
2023-04-23 09:42:26 +00:00
|
|
|
GateRef ToLength(GateRef glue, GateRef target);
|
|
|
|
|
2021-09-04 08:06:49 +00:00
|
|
|
// math operation
|
2021-12-17 09:18:10 +00:00
|
|
|
GateRef Sqrt(GateRef x);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef GetSetterFromAccessor(GateRef accessor);
|
|
|
|
GateRef GetElementsArray(GateRef object);
|
2022-06-10 07:35:16 +00:00
|
|
|
void SetElementsArray(VariableType type, GateRef glue, GateRef object, GateRef elementsArray);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef GetPropertiesArray(GateRef object);
|
2021-12-17 09:18:10 +00:00
|
|
|
// SetProperties in js_object.h
|
2022-06-10 07:35:16 +00:00
|
|
|
void SetPropertiesArray(VariableType type, GateRef glue, GateRef object, GateRef propsArray);
|
|
|
|
void SetHash(GateRef glue, GateRef object, GateRef hash);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef GetLengthOfTaggedArray(GateRef array);
|
2021-09-04 08:06:49 +00:00
|
|
|
// object operation
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef IsJSHClass(GateRef obj);
|
|
|
|
GateRef LoadHClass(GateRef object);
|
2022-08-16 15:48:09 +00:00
|
|
|
void StoreHClass(GateRef glue, GateRef object, GateRef hClass);
|
2021-12-17 09:18:10 +00:00
|
|
|
void CopyAllHClass(GateRef glue, GateRef dstHClass, GateRef scrHClass);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef GetObjectType(GateRef hClass);
|
|
|
|
GateRef IsDictionaryMode(GateRef object);
|
|
|
|
GateRef IsDictionaryModeByHClass(GateRef hClass);
|
|
|
|
GateRef IsDictionaryElement(GateRef hClass);
|
2023-04-23 09:42:26 +00:00
|
|
|
GateRef IsStableElements(GateRef hClass);
|
2023-08-16 07:24:13 +00:00
|
|
|
GateRef HasConstructorByHClass(GateRef hClass);
|
|
|
|
GateRef HasConstructor(GateRef object);
|
2022-05-20 09:24:45 +00:00
|
|
|
GateRef IsClassConstructorFromBitField(GateRef bitfield);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef IsClassConstructor(GateRef object);
|
|
|
|
GateRef IsClassPrototype(GateRef object);
|
|
|
|
GateRef IsExtensible(GateRef object);
|
2022-06-08 03:57:26 +00:00
|
|
|
GateRef TaggedObjectIsEcmaObject(GateRef obj);
|
2022-08-08 13:05:10 +00:00
|
|
|
GateRef IsEcmaObject(GateRef obj);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef IsSymbol(GateRef obj);
|
|
|
|
GateRef IsString(GateRef obj);
|
2022-10-23 15:17:44 +00:00
|
|
|
GateRef IsLineString(GateRef obj);
|
2023-09-01 09:13:25 +00:00
|
|
|
GateRef IsSlicedString(GateRef obj);
|
2023-05-08 09:07:03 +00:00
|
|
|
GateRef IsConstantString(GateRef obj);
|
2022-10-23 15:17:44 +00:00
|
|
|
GateRef IsTreeString(GateRef obj);
|
|
|
|
GateRef TreeStringIsFlat(GateRef string);
|
2022-04-28 01:16:30 +00:00
|
|
|
GateRef TaggedIsBigInt(GateRef obj);
|
2023-02-02 11:25:01 +00:00
|
|
|
GateRef TaggedIsPropertyBox(GateRef obj);
|
2022-07-30 03:49:38 +00:00
|
|
|
GateRef TaggedObjectIsBigInt(GateRef obj);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef IsJsProxy(GateRef obj);
|
|
|
|
GateRef IsJSFunctionBase(GateRef obj);
|
2022-04-26 01:06:56 +00:00
|
|
|
GateRef IsConstructor(GateRef object);
|
|
|
|
GateRef IsBase(GateRef func);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef IsJsArray(GateRef obj);
|
2023-01-03 08:02:17 +00:00
|
|
|
GateRef IsByteArray(GateRef obj);
|
2022-10-26 02:39:13 +00:00
|
|
|
GateRef IsJsCOWArray(GateRef obj);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef IsJSObject(GateRef obj);
|
|
|
|
GateRef IsWritable(GateRef attr);
|
|
|
|
GateRef IsAccessor(GateRef attr);
|
|
|
|
GateRef IsInlinedProperty(GateRef attr);
|
|
|
|
GateRef IsField(GateRef attr);
|
2023-09-16 10:26:11 +00:00
|
|
|
GateRef IsElement(GateRef attr);
|
|
|
|
GateRef IsStringElement(GateRef attr);
|
|
|
|
GateRef IsStringLength(GateRef attr);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef IsNonExist(GateRef attr);
|
2022-10-13 06:44:04 +00:00
|
|
|
GateRef IsJSAPIVector(GateRef attr);
|
2022-10-24 13:04:12 +00:00
|
|
|
GateRef IsJSAPIStack(GateRef obj);
|
|
|
|
GateRef IsJSAPIPlainArray(GateRef obj);
|
|
|
|
GateRef IsJSAPIQueue(GateRef obj);
|
|
|
|
GateRef IsJSAPIDeque(GateRef obj);
|
2022-10-28 08:12:17 +00:00
|
|
|
GateRef IsJSAPILightWeightMap(GateRef obj);
|
|
|
|
GateRef IsJSAPILightWeightSet(GateRef obj);
|
|
|
|
GateRef IsLinkedNode(GateRef obj);
|
|
|
|
GateRef IsJSAPIHashMap(GateRef obj);
|
|
|
|
GateRef IsJSAPIHashSet(GateRef obj);
|
|
|
|
GateRef IsJSAPILinkedList(GateRef obj);
|
|
|
|
GateRef IsJSAPIList(GateRef obj);
|
2022-10-26 08:06:06 +00:00
|
|
|
GateRef IsJSAPIArrayList(GateRef obj);
|
2023-08-22 12:20:46 +00:00
|
|
|
GateRef IsJSObjectType(GateRef obj, JSType jsType);
|
2022-10-13 06:44:04 +00:00
|
|
|
GateRef GetTarget(GateRef proxyObj);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef HandlerBaseIsAccessor(GateRef attr);
|
|
|
|
GateRef HandlerBaseIsJSArray(GateRef attr);
|
|
|
|
GateRef HandlerBaseIsInlinedProperty(GateRef attr);
|
|
|
|
GateRef HandlerBaseGetOffset(GateRef attr);
|
2023-05-15 08:48:14 +00:00
|
|
|
GateRef HandlerBaseGetAttrIndex(GateRef attr);
|
2023-07-12 10:42:42 +00:00
|
|
|
GateRef HandlerBaseGetRep(GateRef attr);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef IsInvalidPropertyBox(GateRef obj);
|
|
|
|
GateRef GetValueFromPropertyBox(GateRef obj);
|
|
|
|
void SetValueToPropertyBox(GateRef glue, GateRef obj, GateRef value);
|
2023-01-13 10:19:25 +00:00
|
|
|
GateRef GetTransitionHClass(GateRef obj);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef GetTransitionHandlerInfo(GateRef obj);
|
2023-01-13 10:19:25 +00:00
|
|
|
GateRef GetTransWithProtoHClass(GateRef obj);
|
|
|
|
GateRef GetTransWithProtoHandlerInfo(GateRef obj);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef IsInternalAccessor(GateRef attr);
|
|
|
|
GateRef GetProtoCell(GateRef object);
|
|
|
|
GateRef GetPrototypeHandlerHolder(GateRef object);
|
|
|
|
GateRef GetPrototypeHandlerHandlerInfo(GateRef object);
|
2023-01-13 10:19:25 +00:00
|
|
|
GateRef GetStoreTSHandlerHolder(GateRef object);
|
|
|
|
GateRef GetStoreTSHandlerHandlerInfo(GateRef object);
|
2022-09-22 11:49:34 +00:00
|
|
|
GateRef GetPrototype(GateRef glue, GateRef object);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef GetHasChanged(GateRef object);
|
2022-08-16 15:48:09 +00:00
|
|
|
GateRef HclassIsPrototypeHandler(GateRef hClass);
|
|
|
|
GateRef HclassIsTransitionHandler(GateRef hClass);
|
|
|
|
GateRef HclassIsPropertyBox(GateRef hClass);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef PropAttrGetOffset(GateRef attr);
|
2023-07-20 12:43:23 +00:00
|
|
|
GateRef InstanceOf(GateRef glue, GateRef object, GateRef target, GateRef profileTypeInfo, GateRef slotId,
|
|
|
|
ProfileOperation callback);
|
2022-09-22 11:49:34 +00:00
|
|
|
GateRef OrdinaryHasInstance(GateRef glue, GateRef target, GateRef obj);
|
2023-01-10 08:27:07 +00:00
|
|
|
void TryFastHasInstance(GateRef glue, GateRef instof, GateRef target, GateRef object, Label *fastPath,
|
2023-07-20 12:43:23 +00:00
|
|
|
Label *exit, Variable *result, ProfileOperation callback);
|
2022-09-22 11:49:34 +00:00
|
|
|
GateRef SameValue(GateRef glue, GateRef left, GateRef right);
|
2023-09-01 08:58:58 +00:00
|
|
|
GateRef SameValueZero(GateRef glue, GateRef left, GateRef right);
|
2023-04-23 09:42:26 +00:00
|
|
|
GateRef HasStableElements(GateRef glue, GateRef obj);
|
|
|
|
GateRef IsStableJSArguments(GateRef glue, GateRef obj);
|
|
|
|
GateRef IsStableJSArray(GateRef glue, GateRef obj);
|
|
|
|
GateRef IsTypedArray(GateRef obj);
|
|
|
|
GateRef IsStableArguments(GateRef hClass);
|
|
|
|
GateRef IsStableArray(GateRef hClass);
|
2023-05-04 12:27:33 +00:00
|
|
|
GateRef GetProfileTypeInfo(GateRef jsFunc);
|
|
|
|
GateRef UpdateProfileTypeInfo(GateRef glue, GateRef jsFunc);
|
2021-10-28 07:06:25 +00:00
|
|
|
// SetDictionaryOrder func in property_attribute.h
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef SetDictionaryOrderFieldInPropAttr(GateRef attr, GateRef value);
|
|
|
|
GateRef GetPrototypeFromHClass(GateRef hClass);
|
|
|
|
GateRef GetLayoutFromHClass(GateRef hClass);
|
|
|
|
GateRef GetBitFieldFromHClass(GateRef hClass);
|
2022-04-06 09:02:18 +00:00
|
|
|
GateRef GetLengthFromString(GateRef value);
|
2022-04-28 01:16:30 +00:00
|
|
|
GateRef GetHashcodeFromString(GateRef glue, GateRef value);
|
2022-10-23 15:17:44 +00:00
|
|
|
GateRef TryGetHashcodeFromString(GateRef string);
|
|
|
|
GateRef GetFirstFromTreeString(GateRef string);
|
|
|
|
GateRef GetSecondFromTreeString(GateRef string);
|
2023-07-12 10:42:42 +00:00
|
|
|
GateRef GetIsAllTaggedPropFromHClass(GateRef hclass);
|
2022-03-21 03:38:21 +00:00
|
|
|
void SetBitFieldToHClass(GateRef glue, GateRef hClass, GateRef bitfield);
|
2023-07-12 10:42:42 +00:00
|
|
|
void SetIsAllTaggedProp(GateRef glue, GateRef hclass, GateRef hasRep);
|
2022-03-21 03:38:21 +00:00
|
|
|
void SetPrototypeToHClass(VariableType type, GateRef glue, GateRef hClass, GateRef proto);
|
|
|
|
void SetProtoChangeDetailsToHClass(VariableType type, GateRef glue, GateRef hClass,
|
2022-08-08 13:05:10 +00:00
|
|
|
GateRef protoChange);
|
2022-03-21 03:38:21 +00:00
|
|
|
void SetLayoutToHClass(VariableType type, GateRef glue, GateRef hClass, GateRef attr);
|
2023-05-27 08:50:29 +00:00
|
|
|
void SetHClassTypeIDToHClass(GateRef glue, GateRef hClass, GateRef id);
|
2022-03-21 03:38:21 +00:00
|
|
|
void SetEnumCacheToHClass(VariableType type, GateRef glue, GateRef hClass, GateRef key);
|
|
|
|
void SetTransitionsToHClass(VariableType type, GateRef glue, GateRef hClass, GateRef transition);
|
2022-03-16 10:12:15 +00:00
|
|
|
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());
|
2022-08-10 04:07:46 +00:00
|
|
|
GateRef GetPropertyInlinedProps(GateRef obj, GateRef hClass,
|
2022-09-19 07:39:56 +00:00
|
|
|
GateRef index);
|
2023-07-12 10:42:42 +00:00
|
|
|
GateRef GetInlinedPropOffsetFromHClass(GateRef hclass, GateRef attrOffset);
|
2021-12-17 09:18:10 +00:00
|
|
|
|
2022-03-16 10:12:15 +00:00
|
|
|
void IncNumberOfProps(GateRef glue, GateRef hClass);
|
|
|
|
GateRef GetNumberOfPropsFromHClass(GateRef hClass);
|
2023-02-06 04:41:21 +00:00
|
|
|
GateRef IsTSHClass(GateRef hClass);
|
2022-03-16 10:12:15 +00:00
|
|
|
void SetNumberOfPropsToHClass(GateRef glue, GateRef hClass, GateRef value);
|
2023-08-02 01:56:06 +00:00
|
|
|
GateRef GetElementsKindFromHClass(GateRef hClass);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef GetObjectSizeFromHClass(GateRef hClass);
|
|
|
|
GateRef GetInlinedPropsStartFromHClass(GateRef hClass);
|
|
|
|
GateRef GetInlinedPropertiesFromHClass(GateRef hClass);
|
2021-12-17 09:18:10 +00:00
|
|
|
void ThrowTypeAndReturn(GateRef glue, int messageId, GateRef val);
|
2022-09-19 07:39:56 +00:00
|
|
|
GateRef GetValueFromTaggedArray(GateRef elements, GateRef index);
|
2023-07-12 10:42:42 +00:00
|
|
|
void SetValueToTaggedArrayWithAttr(
|
|
|
|
GateRef glue, GateRef array, GateRef index, GateRef key, GateRef val, GateRef attr);
|
|
|
|
void SetValueToTaggedArrayWithRep(
|
|
|
|
GateRef glue, GateRef array, GateRef index, GateRef val, GateRef rep, Label *repChange);
|
2022-03-16 10:12:15 +00:00
|
|
|
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>
|
2021-12-17 09:18:10 +00:00
|
|
|
GateRef GetAttributesFromDictionary(GateRef elements, GateRef entry);
|
2022-03-16 10:12:15 +00:00
|
|
|
template<typename DictionaryT>
|
2022-09-19 07:39:56 +00:00
|
|
|
GateRef GetValueFromDictionary(GateRef elements, GateRef entry);
|
2022-03-16 10:12:15 +00:00
|
|
|
template<typename DictionaryT>
|
2022-09-19 07:39:56 +00:00
|
|
|
GateRef GetKeyFromDictionary(GateRef elements, GateRef entry);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef GetPropAttrFromLayoutInfo(GateRef layout, GateRef entry);
|
2023-05-27 08:50:29 +00:00
|
|
|
void SetPropAttrToLayoutInfo(GateRef glue, GateRef layout, GateRef entry, GateRef attr);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef GetPropertiesAddrFromLayoutInfo(GateRef layout);
|
|
|
|
GateRef GetPropertyMetaDataFromAttr(GateRef attr);
|
|
|
|
GateRef GetKeyFromLayoutInfo(GateRef layout, GateRef entry);
|
2021-12-17 09:18:10 +00:00
|
|
|
GateRef FindElementWithCache(GateRef glue, GateRef layoutInfo, GateRef hClass,
|
|
|
|
GateRef key, GateRef propsNum);
|
2022-02-19 02:09:52 +00:00
|
|
|
GateRef FindElementFromNumberDictionary(GateRef glue, GateRef elements, GateRef index);
|
2021-12-17 09:18:10 +00:00
|
|
|
GateRef FindEntryFromNameDictionary(GateRef glue, GateRef elements, GateRef key);
|
|
|
|
GateRef IsMatchInTransitionDictionary(GateRef element, GateRef key, GateRef metaData, GateRef attr);
|
|
|
|
GateRef FindEntryFromTransitionDictionary(GateRef glue, GateRef elements, GateRef key, GateRef metaData);
|
2022-09-19 07:39:56 +00:00
|
|
|
GateRef JSObjectGetProperty(GateRef obj, GateRef hClass, GateRef propAttr);
|
2023-07-12 10:42:42 +00:00
|
|
|
void JSObjectSetProperty(GateRef glue, GateRef obj, GateRef hClass, GateRef attr, GateRef key, GateRef value);
|
2021-12-17 09:18:10 +00:00
|
|
|
GateRef ShouldCallSetter(GateRef receiver, GateRef holder, GateRef accessor, GateRef attr);
|
2023-07-20 12:43:23 +00:00
|
|
|
GateRef CallSetterHelper(GateRef glue, GateRef holder, GateRef accessor, GateRef value, ProfileOperation callback);
|
2021-12-17 09:18:10 +00:00
|
|
|
GateRef SetHasConstructorCondition(GateRef glue, GateRef receiver, GateRef key);
|
2023-05-15 08:48:14 +00:00
|
|
|
GateRef AddPropertyByName(GateRef glue, GateRef receiver, GateRef key, GateRef value, GateRef propertyAttributes,
|
|
|
|
ProfileOperation callback);
|
2021-12-17 09:18:10 +00:00
|
|
|
GateRef IsUtf16String(GateRef string);
|
|
|
|
GateRef IsUtf8String(GateRef string);
|
|
|
|
GateRef IsInternalString(GateRef string);
|
|
|
|
GateRef IsDigit(GateRef ch);
|
2022-10-23 15:17:44 +00:00
|
|
|
GateRef StringToElementIndex(GateRef glue, GateRef string);
|
2023-09-08 08:41:09 +00:00
|
|
|
GateRef ComputeNonInlinedFastPropsCapacity(GateRef oldLength, GateRef maxNonInlinedFastPropsCapacity);
|
2022-08-16 15:48:09 +00:00
|
|
|
GateRef FindTransitions(GateRef glue, GateRef receiver, GateRef hClass, GateRef key, GateRef attr);
|
2023-07-12 10:42:42 +00:00
|
|
|
void TransitionForRepChange(GateRef glue, GateRef receiver, GateRef key, GateRef attr);
|
2023-08-02 01:56:06 +00:00
|
|
|
void TransitToElementsKind(GateRef glue, GateRef receiver, GateRef value, GateRef kind);
|
2021-12-17 09:18:10 +00:00
|
|
|
GateRef TaggedToRepresentation(GateRef value);
|
2023-08-02 01:56:06 +00:00
|
|
|
GateRef TaggedToElementKind(GateRef value);
|
2022-10-24 11:32:00 +00:00
|
|
|
GateRef LdGlobalRecord(GateRef glue, GateRef key);
|
2021-12-17 09:18:10 +00:00
|
|
|
GateRef LoadFromField(GateRef receiver, GateRef handlerInfo);
|
|
|
|
GateRef LoadGlobal(GateRef cell);
|
2023-08-02 01:56:06 +00:00
|
|
|
GateRef LoadElement(GateRef glue, GateRef receiver, GateRef key, ProfileOperation callback);
|
2023-09-16 10:26:11 +00:00
|
|
|
GateRef LoadStringElement(GateRef glue, GateRef receiver, GateRef key);
|
2021-12-17 09:18:10 +00:00
|
|
|
GateRef TryToElementsIndex(GateRef glue, GateRef key);
|
2022-08-16 15:48:09 +00:00
|
|
|
GateRef CheckPolyHClass(GateRef cachedValue, GateRef hClass);
|
2023-07-20 12:43:23 +00:00
|
|
|
GateRef LoadICWithHandler(
|
|
|
|
GateRef glue, GateRef receiver, GateRef holder, GateRef handler, ProfileOperation callback);
|
2021-12-17 09:18:10 +00:00
|
|
|
GateRef StoreICWithHandler(GateRef glue, GateRef receiver, GateRef holder,
|
2023-05-27 08:50:29 +00:00
|
|
|
GateRef value, GateRef handler, ProfileOperation callback = ProfileOperation());
|
2021-12-17 09:18:10 +00:00
|
|
|
GateRef ICStoreElement(GateRef glue, GateRef receiver, GateRef key,
|
2023-08-02 01:56:06 +00:00
|
|
|
GateRef value, GateRef handlerInfo, ProfileOperation callback);
|
2021-12-17 09:18:10 +00:00
|
|
|
GateRef GetArrayLength(GateRef object);
|
2023-09-14 12:57:24 +00:00
|
|
|
GateRef DoubleToInt(GateRef glue, GateRef x, size_t bits = base::INT32_BITS);
|
2023-07-12 10:42:42 +00:00
|
|
|
GateRef StoreField(GateRef glue, GateRef receiver, GateRef value, GateRef handler, ProfileOperation callback);
|
|
|
|
GateRef StoreWithTransition(GateRef glue, GateRef receiver, GateRef value, GateRef handler,
|
2023-05-15 08:48:14 +00:00
|
|
|
ProfileOperation callback, bool withPrototype = false);
|
2021-12-17 09:18:10 +00:00
|
|
|
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);
|
2022-09-27 08:05:20 +00:00
|
|
|
GateRef GetInt64OfTInt(GateRef x);
|
|
|
|
GateRef GetInt32OfTInt(GateRef x);
|
2023-07-12 10:42:42 +00:00
|
|
|
GateRef GetDoubleOfTInt(GateRef x);
|
2022-09-27 08:05:20 +00:00
|
|
|
GateRef GetDoubleOfTDouble(GateRef x);
|
2022-12-02 03:12:46 +00:00
|
|
|
GateRef GetDoubleOfTNumber(GateRef x);
|
2022-08-31 09:21:19 +00:00
|
|
|
GateRef LoadObjectFromWeakRef(GateRef x);
|
2023-01-03 08:02:17 +00:00
|
|
|
GateRef ExtFloat32ToDouble(GateRef x);
|
|
|
|
GateRef ChangeInt32ToFloat32(GateRef x);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef ChangeInt32ToFloat64(GateRef x);
|
2022-03-21 02:09:13 +00:00
|
|
|
GateRef ChangeUInt32ToFloat64(GateRef x);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef ChangeFloat64ToInt32(GateRef x);
|
2022-08-29 07:10:59 +00:00
|
|
|
GateRef Int64ToTaggedPtr(GateRef x);
|
2022-10-26 02:22:15 +00:00
|
|
|
GateRef TruncInt16ToInt8(GateRef x);
|
2023-09-14 11:06:01 +00:00
|
|
|
GateRef TruncInt32ToInt16(GateRef x);
|
|
|
|
GateRef TruncInt32ToInt8(GateRef x);
|
2023-01-03 08:02:17 +00:00
|
|
|
GateRef CastInt32ToFloat32(GateRef x);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef CastInt64ToFloat64(GateRef x);
|
|
|
|
GateRef SExtInt32ToInt64(GateRef x);
|
2022-06-28 08:16:35 +00:00
|
|
|
GateRef SExtInt16ToInt64(GateRef x);
|
2023-01-03 08:02:17 +00:00
|
|
|
GateRef SExtInt16ToInt32(GateRef x);
|
2022-06-28 08:16:35 +00:00
|
|
|
GateRef SExtInt8ToInt64(GateRef x);
|
2023-01-03 08:02:17 +00:00
|
|
|
GateRef SExtInt8ToInt32(GateRef x);
|
2022-03-16 10:12:15 +00:00
|
|
|
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);
|
2022-05-20 09:24:45 +00:00
|
|
|
GateRef IsCallableFromBitField(GateRef bitfield);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef IsCallable(GateRef obj);
|
|
|
|
GateRef GetOffsetFieldInPropAttr(GateRef attr);
|
|
|
|
GateRef SetOffsetFieldInPropAttr(GateRef attr, GateRef value);
|
|
|
|
GateRef SetIsInlinePropsFieldInPropAttr(GateRef attr, GateRef value);
|
2023-05-15 08:48:14 +00:00
|
|
|
GateRef SetTrackTypeInPropAttr(GateRef attr, GateRef type);
|
|
|
|
GateRef GetTrackTypeInPropAttr(GateRef attr);
|
2023-07-12 10:42:42 +00:00
|
|
|
GateRef GetRepInPropAttr(GateRef attr);
|
|
|
|
GateRef IsIntRepInPropAttr(GateRef attr);
|
|
|
|
GateRef IsDoubleRepInPropAttr(GateRef attr);
|
|
|
|
GateRef SetTaggedRepInPropAttr(GateRef attr);
|
2022-03-16 10:12:15 +00:00
|
|
|
void SetHasConstructorToHClass(GateRef glue, GateRef hClass, GateRef value);
|
|
|
|
void UpdateValueInDict(GateRef glue, GateRef elements, GateRef index, GateRef value);
|
|
|
|
GateRef GetBitMask(GateRef bitoffset);
|
2022-05-19 04:48:40 +00:00
|
|
|
GateRef IntPtrEuqal(GateRef x, GateRef y);
|
2023-07-12 10:42:42 +00:00
|
|
|
void SetValueWithAttr(GateRef glue, GateRef obj, GateRef offset, GateRef key, GateRef value, GateRef attr);
|
|
|
|
void SetValueWithRep(GateRef glue, GateRef obj, GateRef offset, GateRef value, GateRef rep, Label *repChange);
|
2021-12-17 09:18:10 +00:00
|
|
|
void SetValueWithBarrier(GateRef glue, GateRef obj, GateRef offset, GateRef value);
|
2023-07-20 12:43:23 +00:00
|
|
|
GateRef GetPropertyByIndex(GateRef glue, GateRef receiver, GateRef index, ProfileOperation callback);
|
|
|
|
GateRef GetPropertyByName(GateRef glue, GateRef receiver, GateRef key, ProfileOperation callback);
|
|
|
|
GateRef FastGetPropertyByName(GateRef glue, GateRef obj, GateRef key, ProfileOperation callback);
|
|
|
|
GateRef FastGetPropertyByIndex(GateRef glue, GateRef obj, GateRef index, ProfileOperation callback);
|
|
|
|
GateRef GetPropertyByValue(GateRef glue, GateRef receiver, GateRef keyValue, ProfileOperation callback);
|
2023-08-02 01:56:06 +00:00
|
|
|
GateRef SetPropertyByIndex(
|
|
|
|
GateRef glue, GateRef receiver, GateRef index, GateRef value, bool useOwn, ProfileOperation callback);
|
2021-12-17 09:18:10 +00:00
|
|
|
GateRef SetPropertyByName(GateRef glue, GateRef receiver, GateRef key,
|
2023-05-27 08:50:29 +00:00
|
|
|
GateRef value, bool useOwn, ProfileOperation callback = ProfileOperation()); // Crawl prototype chain
|
2023-05-15 08:48:14 +00:00
|
|
|
GateRef SetPropertyByValue(GateRef glue, GateRef receiver, GateRef key, GateRef value, bool useOwn,
|
2023-05-27 08:50:29 +00:00
|
|
|
ProfileOperation callback = ProfileOperation());
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef GetParentEnv(GateRef object);
|
|
|
|
GateRef GetPropertiesFromLexicalEnv(GateRef object, GateRef index);
|
|
|
|
void SetPropertiesToLexicalEnv(GateRef glue, GateRef object, GateRef index, GateRef value);
|
|
|
|
GateRef GetHomeObjectFromJSFunction(GateRef object);
|
2022-03-23 11:41:22 +00:00
|
|
|
GateRef GetCallFieldFromMethod(GateRef method);
|
2022-08-04 06:58:57 +00:00
|
|
|
inline GateRef GetBuiltinId(GateRef method);
|
2022-03-16 10:12:15 +00:00
|
|
|
void SetLexicalEnvToFunction(GateRef glue, GateRef object, GateRef lexicalEnv);
|
|
|
|
GateRef GetGlobalObject(GateRef glue);
|
2023-03-02 12:09:04 +00:00
|
|
|
GateRef GetMethodFromFunction(GateRef function);
|
|
|
|
GateRef GetModuleFromFunction(GateRef function);
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef GetEntryIndexOfGlobalDictionary(GateRef entry);
|
|
|
|
GateRef GetBoxFromGlobalDictionary(GateRef object, GateRef entry);
|
|
|
|
GateRef GetValueFromGlobalDictionary(GateRef object, GateRef entry);
|
|
|
|
GateRef GetPropertiesFromJSObject(GateRef object);
|
2022-11-29 09:25:20 +00:00
|
|
|
template<OpCode Op, MachineType Type>
|
2022-03-16 10:12:15 +00:00
|
|
|
GateRef BinaryOp(GateRef x, GateRef y);
|
2023-07-18 08:19:49 +00:00
|
|
|
template<OpCode Op, MachineType Type>
|
|
|
|
GateRef BinaryOpWithOverflow(GateRef x, GateRef y);
|
2023-07-20 12:43:23 +00:00
|
|
|
GateRef GetGlobalOwnProperty(GateRef glue, GateRef receiver, GateRef key, ProfileOperation callback);
|
2022-10-24 11:32:00 +00:00
|
|
|
|
|
|
|
inline GateRef GetObjectFromConstPool(GateRef constpool, GateRef index);
|
2023-07-25 11:50:37 +00:00
|
|
|
GateRef GetConstPoolFromFunction(GateRef jsFunc);
|
2022-10-24 11:32:00 +00:00
|
|
|
GateRef GetStringFromConstPool(GateRef glue, GateRef constpool, GateRef index);
|
2022-11-01 12:42:20 +00:00
|
|
|
GateRef GetMethodFromConstPool(GateRef glue, GateRef constpool, GateRef index);
|
|
|
|
GateRef GetArrayLiteralFromConstPool(GateRef glue, GateRef constpool, GateRef index, GateRef module);
|
|
|
|
GateRef GetObjectLiteralFromConstPool(GateRef glue, GateRef constpool, GateRef index, GateRef module);
|
2022-12-02 08:00:17 +00:00
|
|
|
void SetExtensibleToBitfield(GateRef glue, GateRef obj, bool isExtensible);
|
2022-10-24 11:32:00 +00:00
|
|
|
|
2022-02-19 02:09:52 +00:00
|
|
|
// fast path
|
2023-09-04 07:19:05 +00:00
|
|
|
GateRef FastEqual(GateRef glue, GateRef left, GateRef right, ProfileOperation callback);
|
2023-03-08 07:05:35 +00:00
|
|
|
GateRef FastStrictEqual(GateRef glue, GateRef left, GateRef right, ProfileOperation callback);
|
2022-09-22 11:49:34 +00:00
|
|
|
GateRef FastStringEqual(GateRef glue, GateRef left, GateRef right);
|
2023-03-08 07:05:35 +00:00
|
|
|
GateRef FastMod(GateRef gule, GateRef left, GateRef right, ProfileOperation callback);
|
2022-03-14 03:50:02 +00:00
|
|
|
GateRef FastTypeOf(GateRef left, GateRef right);
|
2023-03-08 07:05:35 +00:00
|
|
|
GateRef FastMul(GateRef left, GateRef right, ProfileOperation callback);
|
|
|
|
GateRef FastDiv(GateRef left, GateRef right, ProfileOperation callback);
|
|
|
|
GateRef FastAdd(GateRef left, GateRef right, ProfileOperation callback);
|
|
|
|
GateRef FastSub(GateRef left, GateRef right, ProfileOperation callback);
|
2022-04-06 09:02:18 +00:00
|
|
|
GateRef FastToBoolean(GateRef value);
|
2021-10-15 02:20:54 +00:00
|
|
|
|
2022-01-04 11:30:40 +00:00
|
|
|
// Add SpecialContainer
|
|
|
|
GateRef GetContainerProperty(GateRef glue, GateRef receiver, GateRef index, GateRef jsType);
|
2022-05-23 01:49:27 +00:00
|
|
|
GateRef JSAPIContainerGet(GateRef glue, GateRef receiver, GateRef index);
|
2022-04-08 05:26:13 +00:00
|
|
|
|
|
|
|
// Exception handle
|
2022-05-20 09:24:45 +00:00
|
|
|
GateRef HasPendingException(GateRef glue);
|
2022-04-08 05:26:13 +00:00
|
|
|
void ReturnExceptionIfAbruptCompletion(GateRef glue);
|
|
|
|
|
|
|
|
// method operator
|
|
|
|
GateRef IsJSFunction(GateRef obj);
|
|
|
|
GateRef IsBoundFunction(GateRef obj);
|
|
|
|
GateRef GetMethodFromJSFunction(GateRef jsfunc);
|
|
|
|
GateRef IsNativeMethod(GateRef method);
|
2023-06-01 11:50:59 +00:00
|
|
|
GateRef IsOptimizedWithBitField(GateRef bitfield);
|
|
|
|
GateRef CanFastCallWithBitField(GateRef bitfield);
|
2022-04-08 05:26:13 +00:00
|
|
|
GateRef GetExpectedNumOfArgs(GateRef method);
|
2023-01-07 07:57:32 +00:00
|
|
|
GateRef GetMethod(GateRef glue, GateRef obj, GateRef key, GateRef profileTypeInfo, GateRef slotId);
|
Implement Proxy Lowering on x86
when function need call another js function, it will lowering to call "JSCall" trampoline function
JSCall trampoline function will check calltarget function, then correct the arguments, finally jump
the native or optimized code address of the target function.
JSCall(glue, argc, calltarget, ....)
then proxy call(glue, argc, callTarget, argv[])
if proxy->GetHandler is function
tail call JSCall(glue, argc, callTarget, argv); // consider performance
else
//Call(trap, handler, «target, thisArgument, argArray»)
call CreateArrayFromList(glue, argc, argv[]) ---> arrHandle // maybe trigger GC, construct OptimizedWithArgvLeaveFrame, visitor argv[0]..argv[argc-1]
call JSCall(glue, argc, method, argv[])
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I52T6B?from=project-issue
Signed-off-by: songzhengchao <songzhengchao@huawei.com>
Change-Id: I994aae1eb9cbf51982348ae6e203c24c326f617e
2022-04-14 13:54:03 +00:00
|
|
|
// proxy operator
|
|
|
|
GateRef GetMethodFromJSProxy(GateRef proxy);
|
|
|
|
GateRef GetHandlerFromJSProxy(GateRef proxy);
|
|
|
|
GateRef GetTargetFromJSProxy(GateRef proxy);
|
2023-01-17 09:16:29 +00:00
|
|
|
inline void SetHotnessCounter(GateRef glue, GateRef method, GateRef value);
|
|
|
|
inline void SaveHotnessCounterIfNeeded(GateRef glue, GateRef sp, GateRef hotnessCounter, JSCallMode mode);
|
2022-04-20 08:56:34 +00:00
|
|
|
inline void SavePcIfNeeded(GateRef glue);
|
2022-08-29 12:21:59 +00:00
|
|
|
inline void SaveJumpSizeIfNeeded(GateRef glue, GateRef jumpSize);
|
2022-05-19 04:48:40 +00:00
|
|
|
inline GateRef ComputeTaggedArraySize(GateRef length);
|
|
|
|
inline GateRef GetGlobalConstantValue(
|
|
|
|
VariableType type, GateRef glue, ConstantIndex index);
|
2022-07-22 08:50:08 +00:00
|
|
|
inline GateRef GetGlobalEnvValue(VariableType type, GateRef env, size_t index);
|
2023-07-20 12:43:23 +00:00
|
|
|
GateRef CallGetterHelper(
|
|
|
|
GateRef glue, GateRef receiver, GateRef holder, GateRef accessor, ProfileOperation callback);
|
2022-06-30 02:22:52 +00:00
|
|
|
GateRef ConstructorCheck(GateRef glue, GateRef ctor, GateRef outPut, GateRef thisObj);
|
2023-01-17 09:16:29 +00:00
|
|
|
GateRef JSCallDispatch(GateRef glue, GateRef func, GateRef actualNumArgs, GateRef jumpSize, GateRef hotnessCounter,
|
2023-05-27 08:50:29 +00:00
|
|
|
JSCallMode mode, std::initializer_list<GateRef> args,
|
2023-07-20 12:43:23 +00:00
|
|
|
ProfileOperation callback = ProfileOperation());
|
2022-06-10 07:33:31 +00:00
|
|
|
GateRef IsFastTypeArray(GateRef jsType);
|
|
|
|
GateRef GetTypeArrayPropertyByName(GateRef glue, GateRef receiver, GateRef holder, GateRef key, GateRef jsType);
|
|
|
|
GateRef SetTypeArrayPropertyByName(GateRef glue, GateRef receiver, GateRef holder, GateRef key, GateRef value,
|
|
|
|
GateRef jsType);
|
2022-11-28 08:16:35 +00:00
|
|
|
GateRef TryStringOrSymbolToElementIndex(GateRef glue, GateRef key);
|
2022-08-04 06:58:57 +00:00
|
|
|
inline GateRef DispatchBuiltins(GateRef glue, GateRef builtinsId, const std::initializer_list<GateRef>& args);
|
2022-11-28 08:13:42 +00:00
|
|
|
inline GateRef DispatchBuiltinsWithArgv(GateRef glue, GateRef builtinsId,
|
|
|
|
const std::initializer_list<GateRef>& args);
|
2022-08-19 07:23:06 +00:00
|
|
|
GateRef ComputeSizeUtf8(GateRef length);
|
|
|
|
GateRef ComputeSizeUtf16(GateRef length);
|
|
|
|
GateRef AlignUp(GateRef x, GateRef alignment);
|
2022-10-18 12:59:34 +00:00
|
|
|
void CallFastPath(GateRef glue, GateRef nativeCode, GateRef func, GateRef thisValue, GateRef actualNumArgs,
|
|
|
|
GateRef callField, GateRef method, Label* notFastBuiltins, Label* exit, Variable* result,
|
|
|
|
std::initializer_list<GateRef> args, JSCallMode mode);
|
2022-08-19 07:23:06 +00:00
|
|
|
inline void SetLength(GateRef glue, GateRef str, GateRef length, bool compressed);
|
2023-09-01 09:13:25 +00:00
|
|
|
inline void SetLength(GateRef glue, GateRef str, GateRef length, GateRef isCompressed);
|
2022-08-19 07:23:06 +00:00
|
|
|
inline void SetRawHashcode(GateRef glue, GateRef str, GateRef rawHashcode);
|
2022-11-08 09:05:30 +00:00
|
|
|
void Assert(int messageId, int line, GateRef glue, GateRef condition, Label *nextLabel);
|
2022-10-23 15:17:44 +00:00
|
|
|
|
2023-09-01 09:13:25 +00:00
|
|
|
GateRef GetNormalStringData(const StringInfoGateRef &stringInfoGate);
|
2023-05-08 09:07:03 +00:00
|
|
|
|
2022-12-13 12:58:55 +00:00
|
|
|
void Comment(GateRef glue, const std::string &str);
|
2023-03-16 01:33:07 +00:00
|
|
|
GateRef ToNumber(GateRef glue, GateRef tagged);
|
2023-06-06 09:13:57 +00:00
|
|
|
inline GateRef LoadObjectFromConstPool(GateRef jsFunc, GateRef index);
|
2023-08-02 01:56:06 +00:00
|
|
|
inline GateRef LoadPfHeaderFromConstPool(GateRef jsFunc);
|
2023-08-08 12:27:55 +00:00
|
|
|
inline GateRef LoadHCIndexFromConstPool(GateRef jsFunc, GateRef traceId);
|
2023-09-01 08:58:58 +00:00
|
|
|
|
|
|
|
GateRef RemoveTaggedWeakTag(GateRef weak);
|
2021-09-04 08:06:49 +00:00
|
|
|
private:
|
2022-03-21 12:06:33 +00:00
|
|
|
using BinaryOperation = std::function<GateRef(Environment*, GateRef, GateRef)>;
|
2023-04-12 07:26:21 +00:00
|
|
|
GateRef ChangeTaggedPointerToInt64(GateRef x);
|
2022-11-29 09:25:20 +00:00
|
|
|
template<OpCode Op>
|
2023-03-08 07:05:35 +00:00
|
|
|
GateRef FastAddSubAndMul(GateRef left, GateRef right, ProfileOperation callback);
|
2023-06-09 10:17:20 +00:00
|
|
|
GateRef FastIntDiv(GateRef left, GateRef right, Label *bailout, ProfileOperation callback);
|
2022-03-21 12:06:33 +00:00
|
|
|
GateRef FastBinaryOp(GateRef left, GateRef right,
|
2023-03-08 07:05:35 +00:00
|
|
|
const BinaryOperation& intOp, const BinaryOperation& floatOp, ProfileOperation callback);
|
2022-07-21 01:51:36 +00:00
|
|
|
void InitializeArguments();
|
2022-11-25 07:22:42 +00:00
|
|
|
CallSignature *callSignature_ {nullptr};
|
2022-07-25 01:48:46 +00:00
|
|
|
Environment *env_;
|
2021-09-04 08:06:49 +00:00
|
|
|
};
|
2021-12-23 06:55:22 +00:00
|
|
|
} // namespace panda::ecmascript::kungfu
|
2022-07-25 01:48:46 +00:00
|
|
|
#endif // ECMASCRIPT_COMPILER_STUB_BUILDER_H
|