mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-10-07 16:13:49 +00:00
3b0042fb03
1、Number+String opt 2、ParseInt opt 3、DefineProperty PGO profile 4、Fix localeCompare aot bug Issue: #I9SMUV Change-Id: If52452584a67a4191a9c99c91be2c81fff5ac228 Signed-off-by: yingguofeng@huawei.com <yingguofeng@huawei.com>
137 lines
7.1 KiB
C++
137 lines
7.1 KiB
C++
/*
|
|
* Copyright (c) 2023 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_BUILTIN_INLINE_H
|
|
#define ECMASCRIPT_COMPILER_BUILTIN_INLINE_H
|
|
|
|
#include "ecmascript/compiler/builtins/builtins_call_signature.h"
|
|
#include "ecmascript/compiler/circuit_builder.h"
|
|
#include "ecmascript/compiler/gate_accessor.h"
|
|
#include "ecmascript/compiler/graph_linearizer.h"
|
|
#include "ecmascript/compiler/pass_manager.h"
|
|
#include "ecmascript/compiler/share_gate_meta_data.h"
|
|
#include "ecmascript/compiler/type_info_accessors.h"
|
|
#include "ecmascript/js_dataview.h"
|
|
|
|
namespace panda::ecmascript::kungfu {
|
|
class NativeInlineLowering {
|
|
public:
|
|
explicit NativeInlineLowering(Circuit *circuit, CompilationConfig* cmpCfg, PassContext *ctx, bool enableLog,
|
|
const std::string& name, Chunk *chunk)
|
|
: circuit_(circuit),
|
|
builder_(circuit, cmpCfg),
|
|
acc_(circuit),
|
|
glue_(acc_.GetGlueFromArgList()),
|
|
enableLog_(enableLog),
|
|
methodName_(name),
|
|
nocheck_(ctx->GetCompilationEnv()->GetJSOptions().IsCompilerNoCheck()),
|
|
traceInline_(ctx->GetCompilationEnv()->GetJSOptions().GetTraceInline()),
|
|
compilationEnv_(ctx->GetCompilationEnv()),
|
|
chunk_(chunk) {}
|
|
~NativeInlineLowering() = default;
|
|
void RunNativeInlineLowering();
|
|
|
|
private:
|
|
std::optional<std::pair<size_t, bool>> GetCallInfo(GateRef gate);
|
|
void TryInlineStringFromCharCode(GateRef gate, size_t argc, bool skipThis);
|
|
void TryInlineStringSubstring(GateRef gate, size_t argc, bool skipThis);
|
|
void TryInlineStringSubStr(GateRef gate, size_t argc, bool skipThis);
|
|
void TryInlineStringSlice(GateRef gate, size_t argc, bool skipThis);
|
|
void TryInlineNumberIsFinite(GateRef gate, size_t argc, bool skipThis);
|
|
void TryInlineNumberIsInteger(GateRef gate, size_t argc, bool skipThis);
|
|
void TryInlineNumberIsNaN(GateRef gate, size_t argc, bool skipThis);
|
|
void TryInlineNumberParseFloat(GateRef gate, size_t argc, bool skipThis);
|
|
void TryInlineNumberParseInt(GateRef gate, size_t argc, bool skipThis);
|
|
void TryInlineNumberIsSafeInteger(GateRef gate, size_t argc, bool skipThis);
|
|
void TryInlineTypedArrayIteratorBuiltin(GateRef gate, BuiltinsStubCSigns::ID id,
|
|
const GateMetaData* op, bool skipThis);
|
|
void TryInlineMathUnaryBuiltin(GateRef gate, size_t argc, BuiltinsStubCSigns::ID id, const GateMetaData* op,
|
|
bool skipThis);
|
|
void TryInlineMathBinaryBuiltin(GateRef gate, size_t argc, BuiltinsStubCSigns::ID id, const GateMetaData* op,
|
|
bool skipThis);
|
|
void TryInlineMathImulBuiltin(GateRef gate, size_t argc, BuiltinsStubCSigns::ID id, const GateMetaData* op,
|
|
bool skipThis);
|
|
void TryInlineGlobalFiniteBuiltin(GateRef gate, size_t argc, BuiltinsStubCSigns::ID id, const GateMetaData* op,
|
|
bool skipThis);
|
|
void TryInlineGlobalNanBuiltin(GateRef gate, size_t argc, BuiltinsStubCSigns::ID id, const GateMetaData* op,
|
|
bool skipThis);
|
|
void TryInlineMathMinMaxBuiltin(GateRef gate, size_t argc, BuiltinsStubCSigns::ID id, const GateMetaData* op,
|
|
double defaultValue, bool skipThis);
|
|
void TryInlineMathAbsBuiltin(GateRef gate, size_t argc, bool skipThis);
|
|
void TryInlineMathClz32Builtin(GateRef gate, size_t argc, bool skipThis);
|
|
void TryInlineArrayBufferIsView(GateRef gate, size_t argc, BuiltinsStubCSigns::ID id, bool skipThis);
|
|
void TryInlineBigIntAsIntN(GateRef gate, size_t argc, BuiltinsStubCSigns::ID id, bool skipThis);
|
|
void TryInlineDataViewGet(GateRef gate, size_t argc, BuiltinsStubCSigns::ID id);
|
|
void TryInlineDataViewSet(GateRef gate, size_t argc, BuiltinsStubCSigns::ID id);
|
|
void InlineStubBuiltin(GateRef gate, size_t builtinArgc, size_t realArgc, BuiltinsStubCSigns::ID id,
|
|
const GateMetaData* op, bool skipThis);
|
|
void TryInlineDateGetTime(GateRef gate, size_t argc, bool skipThis);
|
|
void TryInlineWhitoutParamBuiltin(GateRef gate, size_t argc, BuiltinsStubCSigns::ID id,
|
|
const GateMetaData* op, bool skipThis);
|
|
void TryInlineObjectIs(GateRef gate, size_t argc, BuiltinsStubCSigns::ID id, bool skipThis);
|
|
void TryInlineObjectGetPrototypeOf(GateRef gate, size_t argc, BuiltinsStubCSigns::ID id, bool skipThis);
|
|
void TryInlineObjectGetProto(GateRef gate, size_t argc, BuiltinsStubCSigns::ID id, bool skipThis);
|
|
void TryInlineObjectCreate(GateRef gate, size_t argc, BuiltinsStubCSigns::ID id, bool skipThis);
|
|
void TryInlineObjectIsPrototypeOf(GateRef gate, size_t argc, BuiltinsStubCSigns::ID id, bool skipThis);
|
|
void TryInlineObjectHasOwnProperty(GateRef gate, size_t argc, BuiltinsStubCSigns::ID id, bool skipThis);
|
|
void TryInlineReflectGetPrototypeOf(GateRef gate, size_t argc, BuiltinsStubCSigns::ID id, bool skipThis);
|
|
void TryInlineReflectGet(GateRef gate, size_t argc, BuiltinsStubCSigns::ID id, bool skipThis);
|
|
void TryInlineReflectHas(GateRef gate, size_t argc, BuiltinsStubCSigns::ID id, bool skipThis);
|
|
void TryInlineReflectConstruct(GateRef gate, size_t argc, BuiltinsStubCSigns::ID id, bool skipThis);
|
|
void TryInlineReflectApply(GateRef gate, size_t argc, BuiltinsStubCSigns::ID id, bool skipThis);
|
|
void TryInlineFunctionPrototypeApply(GateRef gate, size_t argc, BuiltinsStubCSigns::ID id, bool skipThis);
|
|
void TryInlineFunctionPrototypeBind(GateRef gate, size_t argc, BuiltinsStubCSigns::ID id, bool skipThis);
|
|
void TryInlineFunctionPrototypeCall(GateRef gate, size_t argc, BuiltinsStubCSigns::ID id, bool skipThis);
|
|
void TryInlineFunctionPrototypeHasInstance(GateRef gate, size_t argc, BuiltinsStubCSigns::ID id, bool skipThis);
|
|
|
|
void TryInlineBigIntConstructor(GateRef gate, size_t argc, bool skipThis);
|
|
void ReplaceGateWithPendingException(GateRef hirGate, GateRef value);
|
|
void AddTraceLogs(GateRef gate, BuiltinsStubCSigns::ID id);
|
|
|
|
bool EnableLog() const
|
|
{
|
|
return enableLog_;
|
|
}
|
|
|
|
const std::string& GetMethodName() const
|
|
{
|
|
return methodName_;
|
|
}
|
|
|
|
bool Uncheck() const
|
|
{
|
|
return nocheck_;
|
|
}
|
|
|
|
bool EnableTrace() const
|
|
{
|
|
return traceInline_;
|
|
}
|
|
|
|
private:
|
|
Circuit *circuit_ {nullptr};
|
|
CircuitBuilder builder_;
|
|
GateAccessor acc_;
|
|
GateRef glue_;
|
|
bool enableLog_;
|
|
std::string methodName_;
|
|
bool nocheck_;
|
|
bool traceInline_;
|
|
const CompilationEnv *compilationEnv_ {nullptr};
|
|
Chunk* chunk_ {nullptr};
|
|
};
|
|
}
|
|
#endif // ECMASCRIPT_COMPILER_BUILTIN_INLINE_H
|