Commit Graph

53 Commits

Author SHA1 Message Date
huoqingyi 1da170f1bd Add Type Infer Test Case
Description:
1.Add type infer test cases for bitwise_op, callfunctions, ldobjbyvalue and logic_op

Issue:
https://gitee.com/openharmony/ark_js_runtime/issues/I5B78L

Signed-off-by: huoqingyi <huoqingyi@huawei.com>
Change-Id: I486f6f91a32e1c7caa2446b12b8e6b33db8d47fe
2022-06-13 09:38:51 +08:00
xujie 6430e8f31e TSAOT Exception Handler
1. Throw JS exception in tsaot
2. Print bcoffset when occur JS exception

issue: https://gitee.com/openharmony/ark_js_runtime/issues/I5AMHL

Signed-off-by: xujie <xujie101@huawei.com>
Change-Id: I046d76c092a399354ddcdedd859f0c1e622387c2
2022-06-11 16:36:16 +08:00
ding 8bfd16debf Refactor GateType
1.Change the implementation of gateType from enum to class.
2.Add some base type opeartions between GateType and GlobalTSTypeRef to simplify the code.
3.Delete class GateTypeCoder
4.Extract GlobalTSTypeRef as an independent file.

issue:https://gitee.com/openharmony/ark_js_runtime/issues/I5A893

Signed-off-by: ding <dingding5@huawei.com>
Change-Id: I3d80595ebccc9ac942af9b9bcc67c0974bb9b712
2022-06-09 17:32:43 +08:00
ding 3ea50b760d AOT compiler supports file without type info
Add judement in DecodeTSTypes and GetGateType, to support compiling js
files in AOT.

Add pf_ as a member of BytecodeCircuitBuilder.

issue:https://gitee.com/openharmony/ark_js_runtime/issues/I5AZJV

Signed-off-by: ding <dingding5@huawei.com>
Change-Id: Ia16039e0ba455c6618fec3691c3089067a508373
2022-06-07 14:21:04 +08:00
ding b34b0a3e40 Refactor TS Types
1.Re-write union type mechanism, store gt in components.
2.Refactor module tabale, now builtins type table and global infer table set in fixed index of 0 and 1.
3.Integrate some interfaces and logic.

Signed-off-by: ding <dingding5@huawei.com>
Change-Id: Ie709705798b21206f1f272fc5cacafb3781ed940
2022-05-31 20:08:49 +08:00
huoqingyi 837f960832 add type infer for more bytecodes
Change-Id: I2f25d587bd8309199480add290105b8f08dd04a3
Signed-off-by: huoqingyi <huoqingyi@huawei.com>
2022-05-30 21:06:45 +08:00
openharmony_ci 5d799e4dd0 !1196 type infer
Merge pull request !1196 from hongtao/refctTypeInfer
2022-05-25 14:32:31 +00:00
taohong 4801aaebb1 refactor type infer
Signed-off-by: taohong <hongtao11@huawei.com>
Change-Id: I7805340a5b85a552a5da3d397e502838e9d8a3d9
2022-05-25 17:39:41 +08:00
hjzhangcm 947da5b3a8 fix codex warning
Signed-off-by: hjzhangcm <zhanghaijun20@huawei.com>
Change-Id: I35a91de086b443e976116a6dd5955da244a8d144
2022-05-25 09:09:14 +08:00
openharmony_ci 75a72d0ac3 !1370 fix codex warning file
Merge pull request !1370 from hjzhangcm/master
2022-05-22 01:12:24 +00:00
wupengyong 7c650ba015 reason:performance optimization
description:optimize taggedvalue encode
issue:https://gitee.com/openharmony/ark_js_runtime/issues/I55ZVP?from=project-issue

Signed-off-by: wupengyong <wupengyong@huawei.com>
Change-Id: I747a60f5ea7348d3b0cfc041a3b010c52b1517c0
2022-05-21 09:33:44 +08:00
hjzhangcm 80a36dff6b fix codex warning
Signed-off-by: hjzhangcm <zhanghaijun20@huawei.com>
2022-05-20 18:57:39 +08:00
ding 36a1c21412 Fix aot newobjdynrange, Add relevant testcase, Some aot Refactor
1.Fix aot newobjdynrange by call JSFunction::Construct.

2.Add native new test case(new non-native constructor depends on
`defineclass`).

3.Add StackAssertScope in debug mode.

4.Delete retired `call` code in runtime_stubs.

5.Refactor GetArg from macros to inline function in RuntimeStubs.

Signed-off-by: ding <dingding5@huawei.com>
Change-Id: Ic89b98af11f2e2fc97aaeba1704d27a95d2c0c7b
2022-05-17 15:49:53 +08:00
huoqingyi 3f88728fa9 add loop_begin blocks to bytecode_circuit_builder
Change-Id: I214016bf617f16a1cac4157612d595852c0d88a7
Signed-off-by: huoqingyi <huoqingyi@huawei.com>
2022-05-16 22:57:05 +08:00
xujie 8bf3c232f0 Code Rectification of Aot Lowering
1. The unified callruntime parameter type is tagged.
2. Remove the glue parameter contained in callruntime.
3. Add Ldbigint support in bytecode circuitbuilder.

issue:https://gitee.com/openharmony/ark_js_runtime/issues/I5640U

Signed-off-by: xujie <xujie101@huawei.com>
Change-Id: If6fb9047dcb6f109e7c2e379415a968d438cb3ff
2022-05-06 17:24:11 +08:00
lifansheng 295d5db32b issue:I55TH8
modify JSTaggedValue which disconnect TaggedValue inheritance

Signed-off-by: lifansheng <lifansheng1@huawei.com>
Change-Id: I13b990baf5284e58e83ab6b14847df076f42bed8
2022-05-05 16:54:26 +08:00
lijincheng da747b6123 Aot Test Case and Fix bugs in Lowering
1.Add aot test case: CreateEmptyArray and CreateEmptyObject and add them to Aot UT-Test.
2.fix "thisobj and input args" bug of callIThisRangeDyn.
3.Update LowerLdGlobalVar and LowerLdObjByName in lowering.
4.fix "callruntime" bug in lowering of LowerStObjByIndex.

issue:https://gitee.com/openharmony/ark_js_runtime/issues/I550RE

Signed-off-by: lijincheng <lijincheng13@huawei.com>
2022-04-28 14:15:11 +08:00
openharmony_ci de8dd32c29 !1093 Delete useless code dependencies.
Merge pull request !1093 from yingguofeng/mmap
2022-04-24 16:26:56 +00:00
yingguofeng@huawei.com 6c5808fc28 Delete useless code dependencies
To reduce 'libark_ jsruntime.so' ROM size, delete useless code dependencies.

https://gitee.com/openharmony/ark_js_runtime/issues/I541H4?from=project-issue

Profit: libark_jsruntime.so size reduce from 3455(kb) to 2001(kb)

Change-Id: Ie7430fca6f539c9baff1f4aae7942da6fc9ef135
Signed-off-by: yingguofeng@huawei.com <yingguofeng@huawei.com>
2022-04-24 18:02:32 +08:00
songzhengchao 0e00e78a2d Bytecode_circuit_builder SUB2DYN_PREF_V8 bug fix
1 add ts_sub test
2 modify int to taggedvalue

issue:https://gitee.com/openharmony/ark_js_runtime/issues/I53EX6

Signed-off-by: songzhengchao <songzhengchao@huawei.com>
Change-Id: Idc51011528bd34c29faf0ffbb36cd225b2b91302
2022-04-24 15:14:09 +08:00
xiongluo 771d51b546 refactor jsMethod
1. Move necessary fileds in jsMethod
2. Make jsMethod inherit aligned struct
3. Change some function names for easy reading

Signed-off-by: xiongluo <xiongluo@huawei.com>
2022-04-20 23:17:00 -10:00
zhaozhibo 504820705d Merge branch 'master' of gitee.com:openharmony/ark_js_runtime into master 2022-04-17 07:24:50 +00:00
zhaozhibo 398ac87a36 fix codeDex warning(3)
Signed-off-by: zhaozhibo <zhaozhibo3@huawei.com>
2022-04-17 15:23:43 +08:00
xujie cf0becfdba Add Slowpath Aot Lowering
Aot lowering for AsyncFunctionEnter, TypeOfDyn, ResumeGenerator,
GetResumeMode, DefineNCFuncDyn, DefineMethod

issue: https://gitee.com/openharmony/ark_js_runtime/issues/I52PWZ

Signed-off-by: xujie <xujie101@huawei.com>
Change-Id: I5b32726d41580bcb0d7baa9bed6b3941fef23384
2022-04-16 17:35:30 +08:00
luochuhao 08b2c27a2a Add lowering of define function dyn.
Issue: https://gitee.com/openharmony/ark_js_runtime/issues/I52KRX
Signed-off-by: luochuhao <luochuhao@huawei.com>
Change-Id: I3a798b2c4be13bf12eb77806d5a32dc5e83a7416
2022-04-16 14:48:10 +08:00
Hailiang Hu 55d0b3b9a1 AOT Slowpath Refactor
Rename C_VALUE to NJS_VALUE, simplify using of RTSTUB_ID in
GetValueFromConstStringTable, rename LowerHirToMir to
ReplaceHirToSubCfg.

Issue: #I5311R

Signed-off-by: Hailiang Hu <allenpas@huawei.com>
Change-Id: Ib9b8ea04b090c21569e1bffa2b63dd0ebf843ef1
2022-04-16 10:40:07 +08:00
lijincheng 249e7bd21f Bugfix in Aot
1.Fix bugs found in AOT Running Debug
2.Change GetObjectFromConstPool to " callRuntime LoadValueFromConstantStringTable "
   in lowering for getting correct string in constpool when in-value-gate in irbuilder is "StringId"

issue:https://gitee.com/openharmony/ark_js_runtime/issues/I52SFH

Signed-off-by: lijincheng <lijincheng13@huawei.com>
2022-04-15 14:31:41 +08:00
ding d8f0399789 Control whether to print compiler logs through JSRuntime Options
Add option log-compiled-methods to print the compiler(both stub and aot) in units of methods.

Add class CompilerLog.

Refactor some compiler logs.

Unie the log invoked way(COMPILER_LOG or COMPILER_OPTIONAL_LOG).

Signed-off-by: ding <dingding5@huawei.com>
Change-Id: I43ce61d0ba9d453713ab3e6349d07f6d9cde3e5e
2022-04-14 16:14:34 +08:00
zhaozhibo 71f2d7e0eb Merge branch 'master' of gitee.com:openharmony/ark_js_runtime into master 2022-04-14 02:57:27 +00:00
zhaozhibo a57029dc79 fix codeDex warning.
Signed-off-by: zhaozhibo <zhaozhibo3@huawei.com>
2022-04-14 10:56:51 +08:00
getingke ef35c0cad8 Lowering these call opcode of bytecode:
CALLARG0DYN_PREF_V8
CALLARG1DYN_PREF_V8_V8
CALLARGS2DYN_PREF_V8_V8_V8
CALLARGS3DYN_PREF_V8_V8_V8_V8
CALLITHISRANGEDYN_PREF_IMM16_V8
CALLIRANGEDYN_PREF_IMM16_V8

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

https://gitee.com/openharmony/ark_js_runtime/issues/I52KN7?from=project-issue

Signed-off-by: getingke <getingke@huawei.com>
Change-Id: I6be3f130b211ca7c51a557f9ace4bd20d46c4d04
2022-04-13 19:25:06 +08:00
openharmony_ci e6c071f69a !964 Add Slowpath Lowering
Merge pull request !964 from huoqingyi/slowlowering
2022-04-13 06:35:46 +00:00
huoqingyi 059d3e7ab6 Add Aot SlowpathLowering
Change-Id: Ie2399770c5e2d3b38b40a4b50d4ff57d23d6d1b4
Signed-off-by: huoqingyi <huoqingyi@huawei.com>
2022-04-12 21:38:05 +08:00
openharmony_ci 7c000a7499 !973 fix codeDex warning
Merge pull request !973 from zhaozhibo/master
2022-04-12 08:41:37 +00:00
zhaozhibo aaf776aab5 fix code warning for codeDex
Signed-off-by: zhaozhibo <zhaozhibo3@huawei.com>
2022-04-12 14:27:50 +08:00
wanyanglan 6ec13ebf1f Aot Lowering
lowering LDSUPERBYVALUE_PREF_V8_V8, STSUPERBYVALUE_PREF_V8_V8,
TRYSTGLOBALBYNAME_PREF_ID32, STCONSTTOGLOBALRECORD_PREF_ID32,
LDFUNCTION_PREF

issue:https://gitee.com/openharmony/ark_js_runtime/issues/I51U5A

Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I3bff9dda0bd4455fdf9348f47586f1097287c0e2
2022-04-11 09:14:11 +08:00
Hailiang Hu c071531719 Add AOT Slowpath Lowering
Lowering for NEWLEXENVDYN, NEWLEXENVWITHNAMEDYN, POPLEXENVDYN.

Issue: I51VGS

Signed-off-by: Hailiang Hu <allenpas@huawei.com>
Change-Id: I001c7bd23c03d2dbc0a1647a652c289204a8dc92
2022-04-09 19:35:17 +08:00
lijincheng 98e9ee462d Aot Lowering
1.lower GETNEXTPROPNAME_PREF_V8, COPYDATAPROPERTIES_PREF_V8_V8, CREATEOBJECTWITHEXCLUDEDKEYS_PREF_IMM16_V8_V8
      CREATEREGEXPWITHLITERAL_PREF_ID32_IMM8, STOWNBYVALUE_PREF_V8_V8, STOWNBYINDEX_PREF_V8_IMM32, STOWNBYNAME_PREF_ID32_V8
      DEFINEGENERATORFUNC_PREF_ID16_IMM16_V8, DEFINEASYNCFUNC_PREF_ID16_IMM16_V8, COPYMODULE_PREF_V8

2.move CompilationConfig to CircuitBuilder. Enable aot's ability to identify platform differences.

issue:https://gitee.com/openharmony/ark_js_runtime/issues/I50KAB

Signed-off-by: lijincheng <lijincheng13@huawei.com>
2022-04-07 10:30:33 +08:00
wanyanglan 6f99c9a3f6 Aot Lowering
lower NEWOBJDYNRANGE_PREF_IMM16_V8, JEQZ_IMM8, JEQZ_IMM16, JNEZ_IMM8, JNEZ_IMM16

issue:https://gitee.com/openharmony/ark_js_runtime/issues/I515NO

Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: Ia8ebbb51f39cce5b3be69c1a39aa39a0cd74ad81
2022-04-06 17:29:14 +08:00
luochuhao bef0e1d1fd Adaptation for aot framework helloworld test.
Issue: https://gitee.com/openharmony/ark_js_runtime/issues/I4ZL8V
Signed-off-by: luochuhao <luochuhao@huawei.com>
Change-Id: I32bf175d4aea43dab2d408ea0347a14a4b5903cb
2022-04-02 15:29:44 +08:00
wengchangcheng 4f169b31a5 add -Werror -Wextra gn flag for 'compiler'
1. ignore llvm warning
2. fix warning of compiler module

issue: https://gitee.com/openharmony/ark_js_runtime/issues/I4ZHER

Signed-off-by: wengchangcheng <wengchangcheng@huawei.com>
Change-Id: I09774e431743a26ea366ed28e3276ff027ae0d31
2022-03-25 15:31:59 +08:00
wanyanglan b6e56d3c3f Clean Code For CodeHub Issues
Modified file permissions, word spelling errors, and
programming specifications suggesting EXPECT_EQ instead
of EXPECT_TRUE

issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4YXK3

Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I00eb9be48d481ce2bdaa4a621246ff6c405abecf
2022-03-22 11:34:13 +08:00
xujie 71bf2ff5c5 Add AOT call lowering and refactor trampoline function
lowering HIR related to call, including CallArg0Dyn, CallArg1Dyn, CallArgs2Dyn, CallArgs3Dyn,
CallIThisRangeDyn, CallSpreadDyn,CallIRangeDyn. Currently only native call are supported.
Inline slowpath function in trampoline file.

issue: https://gitee.com/openharmony/ark_js_runtime/issues/I4X6S1

Signed-off-by: xujie <xujie101@huawei.com>
Change-Id: I4525f62c5b9307adb5cf323352695e4db98fae1b
2022-03-16 15:38:07 +08:00
wanyanglan fd4c928922 Add information such as instruction immediate, method_id, string_id, etc.
The lowering slow path requires not only the vreg information of the
instruction, but also other information such as string id, method id, etc.

For each bytecode instruction, collect the various information stored in
the instruction, and use the information as the input of the gate, and
in the lowering stage, take out the required information from the gate.

issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WQR5

Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I42ef36554b0b88ce3e1cd0f593e8ce9e924b83e0
2022-03-15 11:02:40 +08:00
y00576111 a1796a573e EcmaScript Standard Module Implementation
Delete the existing module implementation and
re implement the module function according to the ECMA 2018 specification

issue: #I4NZQT [https://gitee.com/openharmony/ark_ts2abc/issues/I4NZQT]

Signed-off-by: y00576111 <yaojian16@huawei.com>
Change-Id: I8d381db7f8bf2f3d6b2a5c21cbc3cbab1aef0b9b
2022-03-10 19:10:42 +08:00
wanyanglan 4f42916899 circuit gate fill in the specific ts type
The type of the circuit gate of the current ts aot is JS_ANY, which does
not bring the data type of the ts itself. It is necessary to fill in the
type information of the ts with the gate to facilitate the type derivation.

issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4WLE8

Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I5c72e3a918650840847fc965eafbb13b9475acd2
2022-03-07 19:54:28 +08:00
wanyanglan 37d1f2b515 Aot lowering
lowering  LDLEXENVDYN_PREF, LDA_STR_ID32, STGLOBALVAR_PREF_ID32 and
TRYLDGLOBALBYNAME_PREF_ID32

issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4UAZJ?from=project-issue

Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: Icd7538c2187257099e846761426f07a1996f77c5
2022-03-03 19:57:10 +08:00
xujie fb4de0245a Implement frame of generic lowering(HIR To MIR)
Replace all JS_BYTECODE in HIR. In order to simplify the code
implementation, no type judgment is made on the input, and the
slowpath is directly implemented by calling the trampoline function
without affecting the original function. For complex function
implementation, directly encapsulate the entire interpreted code as
a trampoline function.

Signed-off-by: xujie <xujie101@huawei.com>
Change-Id: Icd24f7cebb496e4376170784ce1e2e2ef1a7ee71
2022-02-16 09:21:41 +08:00
wanyanglan 7750051d88 Refactoring HIR IF_EXCEPTION and bytecode ldai fdai instructions
The exception object is passed directly as a value inside the IR
will cause acc to generate many phi nodes (other vreg rarely generate
phi nodes when exceptions are handled). The current modification
is to add a GET_EXCEPTION directive (placed at the beginning of
the catch part) to indicate that the exception object is read after
an exception occurs, in this case lowering is simpler and does not
need to consider different value outputs, the logic is more concise
and the number of code instructions is reduced.
Replace ladi and fdai HIR with MIR: these two instructions to get
the immediate number, do not need to use HIR to handle, this will
increase the number of HIR instructions, simplify lowering.

issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4T6HX

Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I751677e11b50976af4e2fc5a6cac4457fa9a44df
2022-02-11 16:24:43 +08:00
songzhengchao 2f2525b90f implement machineType INT* FLOAT* rename to I* and F*
current machineType INT * FLOAT* confuse people to associate UINT*.
the INT* is simlar with LLVM IR too
we reanme  machineType INT* FLOAT* rename to I* and F*

issue: https://gitee.com/openharmony/ark_js_runtime/issues/I4SC94

Signed-off-by: songzhengchao <songzhengchao@huawei.com>
Change-Id: Ie188e07039cd9f26aed436ce96618ea4143fccd6
2022-02-10 15:51:18 +08:00