14514f5e3Sopenharmony_ci/* 24514f5e3Sopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd. 34514f5e3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 44514f5e3Sopenharmony_ci * you may not use this file except in compliance with the License. 54514f5e3Sopenharmony_ci * You may obtain a copy of the License at 64514f5e3Sopenharmony_ci * 74514f5e3Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 84514f5e3Sopenharmony_ci * 94514f5e3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 104514f5e3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 114514f5e3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 124514f5e3Sopenharmony_ci * See the License for the specific language governing permissions and 134514f5e3Sopenharmony_ci * limitations under the License. 144514f5e3Sopenharmony_ci */ 154514f5e3Sopenharmony_ci 164514f5e3Sopenharmony_ci#include "ecmascript/compiler/common_stubs.h" 174514f5e3Sopenharmony_ci 184514f5e3Sopenharmony_ci#include "ecmascript/base/number_helper.h" 194514f5e3Sopenharmony_ci#include "ecmascript/compiler/access_object_stub_builder.h" 204514f5e3Sopenharmony_ci#include "ecmascript/compiler/builtins/builtins_string_stub_builder.h" 214514f5e3Sopenharmony_ci#include "ecmascript/compiler/builtins/linked_hashtable_stub_builder.h" 224514f5e3Sopenharmony_ci#include "ecmascript/compiler/codegen/llvm/llvm_ir_builder.h" 234514f5e3Sopenharmony_ci#include "ecmascript/compiler/interpreter_stub.h" 244514f5e3Sopenharmony_ci#include "ecmascript/compiler/new_object_stub_builder.h" 254514f5e3Sopenharmony_ci#include "ecmascript/compiler/operations_stub_builder.h" 264514f5e3Sopenharmony_ci#include "ecmascript/compiler/stub_builder-inl.h" 274514f5e3Sopenharmony_ci#include "ecmascript/compiler/variable_type.h" 284514f5e3Sopenharmony_ci#include "ecmascript/js_array.h" 294514f5e3Sopenharmony_ci#include "ecmascript/js_map.h" 304514f5e3Sopenharmony_ci#include "ecmascript/js_map_iterator.h" 314514f5e3Sopenharmony_ci#include "ecmascript/js_set.h" 324514f5e3Sopenharmony_ci#include "ecmascript/js_set_iterator.h" 334514f5e3Sopenharmony_ci#include "ecmascript/linked_hash_table.h" 344514f5e3Sopenharmony_ci#include "ecmascript/message_string.h" 354514f5e3Sopenharmony_ci#include "ecmascript/tagged_hash_table.h" 364514f5e3Sopenharmony_ci 374514f5e3Sopenharmony_cinamespace panda::ecmascript::kungfu { 384514f5e3Sopenharmony_ciusing namespace panda::ecmascript; 394514f5e3Sopenharmony_ci 404514f5e3Sopenharmony_civoid AddStubBuilder::GenerateCircuit() 414514f5e3Sopenharmony_ci{ 424514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 434514f5e3Sopenharmony_ci GateRef x = TaggedArgument(1); 444514f5e3Sopenharmony_ci GateRef y = TaggedArgument(2); 454514f5e3Sopenharmony_ci OperationsStubBuilder operationBuilder(this); 464514f5e3Sopenharmony_ci Return(operationBuilder.Add(glue, x, y)); 474514f5e3Sopenharmony_ci} 484514f5e3Sopenharmony_ci 494514f5e3Sopenharmony_civoid SubStubBuilder::GenerateCircuit() 504514f5e3Sopenharmony_ci{ 514514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 524514f5e3Sopenharmony_ci GateRef x = TaggedArgument(1); 534514f5e3Sopenharmony_ci GateRef y = TaggedArgument(2); 544514f5e3Sopenharmony_ci OperationsStubBuilder operationBuilder(this); 554514f5e3Sopenharmony_ci Return(operationBuilder.Sub(glue, x, y)); 564514f5e3Sopenharmony_ci} 574514f5e3Sopenharmony_ci 584514f5e3Sopenharmony_civoid DefineFieldStubBuilder::GenerateCircuit() 594514f5e3Sopenharmony_ci{ 604514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 614514f5e3Sopenharmony_ci GateRef receiver = TaggedArgument(1); 624514f5e3Sopenharmony_ci GateRef propKey = TaggedArgument(2); // 2: 3rd argument 634514f5e3Sopenharmony_ci GateRef acc = TaggedArgument(3); // 3: 4th argument 644514f5e3Sopenharmony_ci Return(DefineField(glue, receiver, propKey, acc)); 654514f5e3Sopenharmony_ci} 664514f5e3Sopenharmony_ci 674514f5e3Sopenharmony_civoid DefinefuncStubBuilder::GenerateCircuit() 684514f5e3Sopenharmony_ci{ 694514f5e3Sopenharmony_ci auto env = GetEnvironment(); 704514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 714514f5e3Sopenharmony_ci GateRef jsFunc = TaggedArgument(1); 724514f5e3Sopenharmony_ci GateRef methodId = Int32Argument(2); // 2: 3rd argument 734514f5e3Sopenharmony_ci GateRef length = Int32Argument(3); // 3: 4th argument 744514f5e3Sopenharmony_ci GateRef lexEnv = TaggedArgument(4); // 4: 5th argument 754514f5e3Sopenharmony_ci GateRef slotId = Int32Argument(5); // 5: 6th argument 764514f5e3Sopenharmony_ci 774514f5e3Sopenharmony_ci DEFVARIABLE(result, VariableType::JS_ANY(), Undefined()); 784514f5e3Sopenharmony_ci Label exit(env); 794514f5e3Sopenharmony_ci Label failed(env); 804514f5e3Sopenharmony_ci NewObjectStubBuilder newBuilder(this); 814514f5e3Sopenharmony_ci newBuilder.NewJSFunction(glue, jsFunc, methodId, length, lexEnv, &result, &exit, &failed, slotId); 824514f5e3Sopenharmony_ci Bind(&failed); 834514f5e3Sopenharmony_ci { 844514f5e3Sopenharmony_ci result = Exception(); 854514f5e3Sopenharmony_ci Jump(&exit); 864514f5e3Sopenharmony_ci } 874514f5e3Sopenharmony_ci Bind(&exit); 884514f5e3Sopenharmony_ci Return(*result); 894514f5e3Sopenharmony_ci} 904514f5e3Sopenharmony_ci 914514f5e3Sopenharmony_civoid ConvertCharToInt32StubBuilder::GenerateCircuit() 924514f5e3Sopenharmony_ci{ 934514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 944514f5e3Sopenharmony_ci GateRef charCode = Int32Argument(1); 954514f5e3Sopenharmony_ci BuiltinsStringStubBuilder builder(this); 964514f5e3Sopenharmony_ci // char to string 974514f5e3Sopenharmony_ci GateRef result = builder.CreateStringBySingleCharCode(glue, charCode); 984514f5e3Sopenharmony_ci // string to number 994514f5e3Sopenharmony_ci result = CallNGCRuntime(glue, RTSTUB_ID(StringToNumber), {result, Int32(0)}, charCode); 1004514f5e3Sopenharmony_ci // get int from number 1014514f5e3Sopenharmony_ci result = NumberGetInt(glue, result); 1024514f5e3Sopenharmony_ci Return(result); 1034514f5e3Sopenharmony_ci} 1044514f5e3Sopenharmony_ci 1054514f5e3Sopenharmony_civoid ConvertCharToDoubleStubBuilder::GenerateCircuit() 1064514f5e3Sopenharmony_ci{ 1074514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 1084514f5e3Sopenharmony_ci GateRef charCode = Int32Argument(1); 1094514f5e3Sopenharmony_ci BuiltinsStringStubBuilder builder(this); 1104514f5e3Sopenharmony_ci // char to string 1114514f5e3Sopenharmony_ci GateRef result = builder.CreateStringBySingleCharCode(glue, charCode); 1124514f5e3Sopenharmony_ci // string to number 1134514f5e3Sopenharmony_ci result = CallNGCRuntime(glue, RTSTUB_ID(StringToNumber), {result, Int32(0)}, charCode); 1144514f5e3Sopenharmony_ci // get double from number 1154514f5e3Sopenharmony_ci result = GetDoubleOfTNumber(result); 1164514f5e3Sopenharmony_ci Return(result); 1174514f5e3Sopenharmony_ci} 1184514f5e3Sopenharmony_ci 1194514f5e3Sopenharmony_civoid MulStubBuilder::GenerateCircuit() 1204514f5e3Sopenharmony_ci{ 1214514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 1224514f5e3Sopenharmony_ci GateRef x = TaggedArgument(1); 1234514f5e3Sopenharmony_ci GateRef y = TaggedArgument(2); 1244514f5e3Sopenharmony_ci OperationsStubBuilder operationBuilder(this); 1254514f5e3Sopenharmony_ci Return(operationBuilder.Mul(glue, x, y)); 1264514f5e3Sopenharmony_ci} 1274514f5e3Sopenharmony_ci 1284514f5e3Sopenharmony_civoid DivStubBuilder::GenerateCircuit() 1294514f5e3Sopenharmony_ci{ 1304514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 1314514f5e3Sopenharmony_ci GateRef x = TaggedArgument(1); 1324514f5e3Sopenharmony_ci GateRef y = TaggedArgument(2); 1334514f5e3Sopenharmony_ci OperationsStubBuilder operationBuilder(this); 1344514f5e3Sopenharmony_ci Return(operationBuilder.Div(glue, x, y)); 1354514f5e3Sopenharmony_ci} 1364514f5e3Sopenharmony_ci 1374514f5e3Sopenharmony_civoid ModStubBuilder::GenerateCircuit() 1384514f5e3Sopenharmony_ci{ 1394514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 1404514f5e3Sopenharmony_ci GateRef x = TaggedArgument(1); 1414514f5e3Sopenharmony_ci GateRef y = TaggedArgument(2); // 2: 3rd argument 1424514f5e3Sopenharmony_ci OperationsStubBuilder operationBuilder(this); 1434514f5e3Sopenharmony_ci Return(operationBuilder.Mod(glue, x, y)); 1444514f5e3Sopenharmony_ci} 1454514f5e3Sopenharmony_ci 1464514f5e3Sopenharmony_civoid TypeOfStubBuilder::GenerateCircuit() 1474514f5e3Sopenharmony_ci{ 1484514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 1494514f5e3Sopenharmony_ci GateRef obj = TaggedArgument(1); 1504514f5e3Sopenharmony_ci Return(FastTypeOf(glue, obj)); 1514514f5e3Sopenharmony_ci} 1524514f5e3Sopenharmony_ci 1534514f5e3Sopenharmony_civoid EqualStubBuilder::GenerateCircuit() 1544514f5e3Sopenharmony_ci{ 1554514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 1564514f5e3Sopenharmony_ci GateRef x = TaggedArgument(1); 1574514f5e3Sopenharmony_ci GateRef y = TaggedArgument(2); // 2: 3rd argument 1584514f5e3Sopenharmony_ci OperationsStubBuilder operationBuilder(this); 1594514f5e3Sopenharmony_ci Return(operationBuilder.Equal(glue, x, y)); 1604514f5e3Sopenharmony_ci} 1614514f5e3Sopenharmony_ci 1624514f5e3Sopenharmony_civoid NotEqualStubBuilder::GenerateCircuit() 1634514f5e3Sopenharmony_ci{ 1644514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 1654514f5e3Sopenharmony_ci GateRef x = TaggedArgument(1); 1664514f5e3Sopenharmony_ci GateRef y = TaggedArgument(2); // 2: 3rd argument 1674514f5e3Sopenharmony_ci OperationsStubBuilder operationBuilder(this); 1684514f5e3Sopenharmony_ci Return(operationBuilder.NotEqual(glue, x, y)); 1694514f5e3Sopenharmony_ci} 1704514f5e3Sopenharmony_ci 1714514f5e3Sopenharmony_civoid StrictEqualStubBuilder::GenerateCircuit() 1724514f5e3Sopenharmony_ci{ 1734514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 1744514f5e3Sopenharmony_ci GateRef x = TaggedArgument(1); 1754514f5e3Sopenharmony_ci GateRef y = TaggedArgument(2); // 2: 3rd argument 1764514f5e3Sopenharmony_ci OperationsStubBuilder operationBuilder(this); 1774514f5e3Sopenharmony_ci Return(operationBuilder.StrictEqual(glue, x, y)); 1784514f5e3Sopenharmony_ci} 1794514f5e3Sopenharmony_ci 1804514f5e3Sopenharmony_civoid StrictNotEqualStubBuilder::GenerateCircuit() 1814514f5e3Sopenharmony_ci{ 1824514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 1834514f5e3Sopenharmony_ci GateRef x = TaggedArgument(1); 1844514f5e3Sopenharmony_ci GateRef y = TaggedArgument(2); // 2: 3rd argument 1854514f5e3Sopenharmony_ci OperationsStubBuilder operationBuilder(this); 1864514f5e3Sopenharmony_ci Return(operationBuilder.StrictNotEqual(glue, x, y)); 1874514f5e3Sopenharmony_ci} 1884514f5e3Sopenharmony_ci 1894514f5e3Sopenharmony_civoid LessStubBuilder::GenerateCircuit() 1904514f5e3Sopenharmony_ci{ 1914514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 1924514f5e3Sopenharmony_ci GateRef x = TaggedArgument(1); 1934514f5e3Sopenharmony_ci GateRef y = TaggedArgument(2); // 2: 3rd argument 1944514f5e3Sopenharmony_ci OperationsStubBuilder operationBuilder(this); 1954514f5e3Sopenharmony_ci Return(operationBuilder.Less(glue, x, y)); 1964514f5e3Sopenharmony_ci} 1974514f5e3Sopenharmony_ci 1984514f5e3Sopenharmony_civoid LessEqStubBuilder::GenerateCircuit() 1994514f5e3Sopenharmony_ci{ 2004514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 2014514f5e3Sopenharmony_ci GateRef x = TaggedArgument(1); 2024514f5e3Sopenharmony_ci GateRef y = TaggedArgument(2); // 2: 3rd argument 2034514f5e3Sopenharmony_ci OperationsStubBuilder operationBuilder(this); 2044514f5e3Sopenharmony_ci Return(operationBuilder.LessEq(glue, x, y)); 2054514f5e3Sopenharmony_ci} 2064514f5e3Sopenharmony_ci 2074514f5e3Sopenharmony_civoid GreaterStubBuilder::GenerateCircuit() 2084514f5e3Sopenharmony_ci{ 2094514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 2104514f5e3Sopenharmony_ci GateRef x = TaggedArgument(1); 2114514f5e3Sopenharmony_ci GateRef y = TaggedArgument(2); // 2: 3rd argument 2124514f5e3Sopenharmony_ci OperationsStubBuilder operationBuilder(this); 2134514f5e3Sopenharmony_ci Return(operationBuilder.Greater(glue, x, y)); 2144514f5e3Sopenharmony_ci} 2154514f5e3Sopenharmony_ci 2164514f5e3Sopenharmony_civoid GreaterEqStubBuilder::GenerateCircuit() 2174514f5e3Sopenharmony_ci{ 2184514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 2194514f5e3Sopenharmony_ci GateRef x = TaggedArgument(1); 2204514f5e3Sopenharmony_ci GateRef y = TaggedArgument(2); // 2: 3rd argument 2214514f5e3Sopenharmony_ci OperationsStubBuilder operationBuilder(this); 2224514f5e3Sopenharmony_ci Return(operationBuilder.GreaterEq(glue, x, y)); 2234514f5e3Sopenharmony_ci} 2244514f5e3Sopenharmony_ci 2254514f5e3Sopenharmony_civoid ShlStubBuilder::GenerateCircuit() 2264514f5e3Sopenharmony_ci{ 2274514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 2284514f5e3Sopenharmony_ci GateRef x = TaggedArgument(1); 2294514f5e3Sopenharmony_ci GateRef y = TaggedArgument(2); // 2: 3rd argument 2304514f5e3Sopenharmony_ci OperationsStubBuilder operationBuilder(this); 2314514f5e3Sopenharmony_ci Return(operationBuilder.Shl(glue, x, y)); 2324514f5e3Sopenharmony_ci} 2334514f5e3Sopenharmony_ci 2344514f5e3Sopenharmony_civoid ShrStubBuilder::GenerateCircuit() 2354514f5e3Sopenharmony_ci{ 2364514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 2374514f5e3Sopenharmony_ci GateRef x = TaggedArgument(1); 2384514f5e3Sopenharmony_ci GateRef y = TaggedArgument(2); // 2: 3rd argument 2394514f5e3Sopenharmony_ci OperationsStubBuilder operationBuilder(this); 2404514f5e3Sopenharmony_ci Return(operationBuilder.Shr(glue, x, y)); 2414514f5e3Sopenharmony_ci} 2424514f5e3Sopenharmony_ci 2434514f5e3Sopenharmony_civoid AshrStubBuilder::GenerateCircuit() 2444514f5e3Sopenharmony_ci{ 2454514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 2464514f5e3Sopenharmony_ci GateRef x = TaggedArgument(1); 2474514f5e3Sopenharmony_ci GateRef y = TaggedArgument(2); // 2: 3rd argument 2484514f5e3Sopenharmony_ci OperationsStubBuilder operationBuilder(this); 2494514f5e3Sopenharmony_ci Return(operationBuilder.Ashr(glue, x, y)); 2504514f5e3Sopenharmony_ci} 2514514f5e3Sopenharmony_ci 2524514f5e3Sopenharmony_civoid AndStubBuilder::GenerateCircuit() 2534514f5e3Sopenharmony_ci{ 2544514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 2554514f5e3Sopenharmony_ci GateRef x = TaggedArgument(1); 2564514f5e3Sopenharmony_ci GateRef y = TaggedArgument(2); // 2: 3rd argument 2574514f5e3Sopenharmony_ci OperationsStubBuilder operationBuilder(this); 2584514f5e3Sopenharmony_ci Return(operationBuilder.And(glue, x, y)); 2594514f5e3Sopenharmony_ci} 2604514f5e3Sopenharmony_ci 2614514f5e3Sopenharmony_civoid OrStubBuilder::GenerateCircuit() 2624514f5e3Sopenharmony_ci{ 2634514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 2644514f5e3Sopenharmony_ci GateRef x = TaggedArgument(1); 2654514f5e3Sopenharmony_ci GateRef y = TaggedArgument(2); // 2: 3rd argument 2664514f5e3Sopenharmony_ci OperationsStubBuilder operationBuilder(this); 2674514f5e3Sopenharmony_ci Return(operationBuilder.Or(glue, x, y)); 2684514f5e3Sopenharmony_ci} 2694514f5e3Sopenharmony_ci 2704514f5e3Sopenharmony_civoid XorStubBuilder::GenerateCircuit() 2714514f5e3Sopenharmony_ci{ 2724514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 2734514f5e3Sopenharmony_ci GateRef x = TaggedArgument(1); 2744514f5e3Sopenharmony_ci GateRef y = TaggedArgument(2); // 2: 3rd argument 2754514f5e3Sopenharmony_ci OperationsStubBuilder operationBuilder(this); 2764514f5e3Sopenharmony_ci Return(operationBuilder.Xor(glue, x, y)); 2774514f5e3Sopenharmony_ci} 2784514f5e3Sopenharmony_ci 2794514f5e3Sopenharmony_civoid InstanceofStubBuilder::GenerateCircuit() 2804514f5e3Sopenharmony_ci{ 2814514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 2824514f5e3Sopenharmony_ci GateRef object = TaggedArgument(1); 2834514f5e3Sopenharmony_ci GateRef target = TaggedArgument(2); // 2: 3rd argument 2844514f5e3Sopenharmony_ci GateRef jsFunc = TaggedArgument(3); // 3 : 4th para 2854514f5e3Sopenharmony_ci GateRef slotId = Int32Argument(4); // 4 : 5th pars 2864514f5e3Sopenharmony_ci GateRef profileTypeInfo = UpdateProfileTypeInfo(glue, jsFunc); 2874514f5e3Sopenharmony_ci Return(InstanceOf(glue, object, target, profileTypeInfo, slotId, ProfileOperation())); 2884514f5e3Sopenharmony_ci} 2894514f5e3Sopenharmony_ci 2904514f5e3Sopenharmony_civoid IncStubBuilder::GenerateCircuit() 2914514f5e3Sopenharmony_ci{ 2924514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 2934514f5e3Sopenharmony_ci GateRef x = TaggedArgument(1); 2944514f5e3Sopenharmony_ci OperationsStubBuilder operationBuilder(this); 2954514f5e3Sopenharmony_ci Return(operationBuilder.Inc(glue, x)); 2964514f5e3Sopenharmony_ci} 2974514f5e3Sopenharmony_ci 2984514f5e3Sopenharmony_civoid DecStubBuilder::GenerateCircuit() 2994514f5e3Sopenharmony_ci{ 3004514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 3014514f5e3Sopenharmony_ci GateRef x = TaggedArgument(1); 3024514f5e3Sopenharmony_ci OperationsStubBuilder operationBuilder(this); 3034514f5e3Sopenharmony_ci Return(operationBuilder.Dec(glue, x)); 3044514f5e3Sopenharmony_ci} 3054514f5e3Sopenharmony_ci 3064514f5e3Sopenharmony_civoid NegStubBuilder::GenerateCircuit() 3074514f5e3Sopenharmony_ci{ 3084514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 3094514f5e3Sopenharmony_ci GateRef x = TaggedArgument(1); 3104514f5e3Sopenharmony_ci OperationsStubBuilder operationBuilder(this); 3114514f5e3Sopenharmony_ci Return(operationBuilder.Neg(glue, x)); 3124514f5e3Sopenharmony_ci} 3134514f5e3Sopenharmony_ci 3144514f5e3Sopenharmony_civoid NotStubBuilder::GenerateCircuit() 3154514f5e3Sopenharmony_ci{ 3164514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 3174514f5e3Sopenharmony_ci GateRef x = TaggedArgument(1); 3184514f5e3Sopenharmony_ci OperationsStubBuilder operationBuilder(this); 3194514f5e3Sopenharmony_ci Return(operationBuilder.Not(glue, x)); 3204514f5e3Sopenharmony_ci} 3214514f5e3Sopenharmony_ci 3224514f5e3Sopenharmony_civoid ToBooleanTrueStubBuilder::GenerateCircuit() 3234514f5e3Sopenharmony_ci{ 3244514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 3254514f5e3Sopenharmony_ci (void)glue; 3264514f5e3Sopenharmony_ci GateRef x = TaggedArgument(1); 3274514f5e3Sopenharmony_ci Return(FastToBoolean(x, true)); 3284514f5e3Sopenharmony_ci} 3294514f5e3Sopenharmony_ci 3304514f5e3Sopenharmony_civoid ToBooleanFalseStubBuilder::GenerateCircuit() 3314514f5e3Sopenharmony_ci{ 3324514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 3334514f5e3Sopenharmony_ci (void)glue; 3344514f5e3Sopenharmony_ci GateRef x = TaggedArgument(1); 3354514f5e3Sopenharmony_ci Return(FastToBoolean(x, false)); 3364514f5e3Sopenharmony_ci} 3374514f5e3Sopenharmony_ci 3384514f5e3Sopenharmony_civoid NewLexicalEnvStubBuilder::GenerateCircuit() 3394514f5e3Sopenharmony_ci{ 3404514f5e3Sopenharmony_ci auto env = GetEnvironment(); 3414514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 3424514f5e3Sopenharmony_ci GateRef parent = TaggedArgument(1); 3434514f5e3Sopenharmony_ci GateRef numVars = Int32Argument(2); /* 2 : 3rd parameter is index */ 3444514f5e3Sopenharmony_ci 3454514f5e3Sopenharmony_ci DEFVARIABLE(result, VariableType::JS_ANY(), Hole()); 3464514f5e3Sopenharmony_ci NewObjectStubBuilder newBuilder(this); 3474514f5e3Sopenharmony_ci newBuilder.SetParameters(glue, 0); 3484514f5e3Sopenharmony_ci Label afterNew(env); 3494514f5e3Sopenharmony_ci newBuilder.NewLexicalEnv(&result, &afterNew, numVars, parent); 3504514f5e3Sopenharmony_ci Bind(&afterNew); 3514514f5e3Sopenharmony_ci Return(*result); 3524514f5e3Sopenharmony_ci} 3534514f5e3Sopenharmony_ci 3544514f5e3Sopenharmony_civoid CopyRestArgsStubBuilder::GenerateCircuit() 3554514f5e3Sopenharmony_ci{ 3564514f5e3Sopenharmony_ci DEFVARIABLE(arrayObj, VariableType::JS_ANY(), Undefined()); 3574514f5e3Sopenharmony_ci DEFVARIABLE(argv, VariableType::NATIVE_POINTER(), PtrArgument(1)); 3584514f5e3Sopenharmony_ci DEFVARIABLE(i, VariableType::INT32(), Int32(0)); 3594514f5e3Sopenharmony_ci DEFVARIABLE(actualRestNum, VariableType::INT32(), Int32(0)); 3604514f5e3Sopenharmony_ci auto env = GetEnvironment(); 3614514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 3624514f5e3Sopenharmony_ci GateRef startIdx = Int32Argument(2); /* 2 : 3rd parameter is startIdx */ 3634514f5e3Sopenharmony_ci GateRef numArgs = Int32Argument(3); /* 3 : 4th parameter is numArgs */ 3644514f5e3Sopenharmony_ci GateRef argvTaggedArray = TaggedArgument(4); /* 4 : 5th parameter is argvTaggedArray */ 3654514f5e3Sopenharmony_ci 3664514f5e3Sopenharmony_ci Label numArgsGreater(env); 3674514f5e3Sopenharmony_ci Label numArgsNotGreater(env); 3684514f5e3Sopenharmony_ci Label afterCreateArrayObj(env); 3694514f5e3Sopenharmony_ci 3704514f5e3Sopenharmony_ci GateRef actualArgc = Int32Sub(numArgs, Int32(NUM_MANDATORY_JSFUNC_ARGS)); 3714514f5e3Sopenharmony_ci // 1. Calculate actual rest num. 3724514f5e3Sopenharmony_ci BRANCH(Int32UnsignedGreaterThan(actualArgc, startIdx), &numArgsGreater, &numArgsNotGreater); 3734514f5e3Sopenharmony_ci Bind(&numArgsGreater); 3744514f5e3Sopenharmony_ci { 3754514f5e3Sopenharmony_ci actualRestNum = Int32Sub(actualArgc, startIdx); 3764514f5e3Sopenharmony_ci Jump(&numArgsNotGreater); 3774514f5e3Sopenharmony_ci } 3784514f5e3Sopenharmony_ci Bind(&numArgsNotGreater); 3794514f5e3Sopenharmony_ci // 2. Construct RestArguments object. 3804514f5e3Sopenharmony_ci NewObjectStubBuilder newBuilder(this); 3814514f5e3Sopenharmony_ci newBuilder.SetParameters(glue, 0); 3824514f5e3Sopenharmony_ci GateRef intialHClass = GetGlobalConstantValue(VariableType::JS_ANY(), glue, 3834514f5e3Sopenharmony_ci ConstantIndex::ELEMENT_HOLE_TAGGED_HCLASS_INDEX); 3844514f5e3Sopenharmony_ci arrayObj = newBuilder.NewJSArrayWithSize(intialHClass, *actualRestNum); 3854514f5e3Sopenharmony_ci 3864514f5e3Sopenharmony_ci GateRef args = GetArgumentsElements(glue, argvTaggedArray, *argv); 3874514f5e3Sopenharmony_ci newBuilder.AssignRestArg(&arrayObj, &afterCreateArrayObj, args, startIdx, *actualRestNum, intialHClass); 3884514f5e3Sopenharmony_ci Bind(&afterCreateArrayObj); 3894514f5e3Sopenharmony_ci Return(*arrayObj); 3904514f5e3Sopenharmony_ci} 3914514f5e3Sopenharmony_ci 3924514f5e3Sopenharmony_civoid GetUnmappedArgsStubBuilder::GenerateCircuit() 3934514f5e3Sopenharmony_ci{ 3944514f5e3Sopenharmony_ci auto env = GetEnvironment(); 3954514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 3964514f5e3Sopenharmony_ci GateRef numArgs = Int32Argument(2); /* 2 : 3rd parameter is numArgs */ 3974514f5e3Sopenharmony_ci GateRef argvTaggedArray = TaggedArgument(3); /* 3 : 4th parameter is argvTaggedArray */ 3984514f5e3Sopenharmony_ci 3994514f5e3Sopenharmony_ci DEFVARIABLE(argumentsList, VariableType::JS_ANY(), Hole()); 4004514f5e3Sopenharmony_ci DEFVARIABLE(argumentsObj, VariableType::JS_ANY(), Hole()); 4014514f5e3Sopenharmony_ci DEFVARIABLE(argv, VariableType::NATIVE_POINTER(), PtrArgument(1)); 4024514f5e3Sopenharmony_ci Label afterArgumentsList(env); 4034514f5e3Sopenharmony_ci Label newArgumentsObj(env); 4044514f5e3Sopenharmony_ci Label exit(env); 4054514f5e3Sopenharmony_ci 4064514f5e3Sopenharmony_ci GateRef actualArgc = Int32Sub(numArgs, Int32(NUM_MANDATORY_JSFUNC_ARGS)); 4074514f5e3Sopenharmony_ci GateRef startIdx = Int32(0); 4084514f5e3Sopenharmony_ci NewObjectStubBuilder newBuilder(this); 4094514f5e3Sopenharmony_ci newBuilder.SetParameters(glue, 0); 4104514f5e3Sopenharmony_ci 4114514f5e3Sopenharmony_ci Label fillArguments(env); 4124514f5e3Sopenharmony_ci Label argumentsException(env); 4134514f5e3Sopenharmony_ci GateRef argumentsListObj = newBuilder.NewArgumentsListObj(actualArgc); 4144514f5e3Sopenharmony_ci argumentsList.WriteVariable(argumentsListObj); 4154514f5e3Sopenharmony_ci Branch(TaggedIsException(*argumentsList), &argumentsException, &fillArguments); 4164514f5e3Sopenharmony_ci Bind(&argumentsException); 4174514f5e3Sopenharmony_ci argumentsObj.WriteVariable(*argumentsList); 4184514f5e3Sopenharmony_ci Jump(&exit); 4194514f5e3Sopenharmony_ci Bind(&fillArguments); 4204514f5e3Sopenharmony_ci 4214514f5e3Sopenharmony_ci GateRef args = GetArgumentsElements(glue, argvTaggedArray, *argv); 4224514f5e3Sopenharmony_ci newBuilder.FillArgumentsList(*argumentsList, args, startIdx, actualArgc); 4234514f5e3Sopenharmony_ci newBuilder.NewArgumentsObj(&argumentsObj, &exit, *argumentsList, actualArgc); 4244514f5e3Sopenharmony_ci Bind(&exit); 4254514f5e3Sopenharmony_ci Return(*argumentsObj); 4264514f5e3Sopenharmony_ci} 4274514f5e3Sopenharmony_ci 4284514f5e3Sopenharmony_civoid GetCallSpreadArgsStubBuilder::GenerateCircuit() 4294514f5e3Sopenharmony_ci{ 4304514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 4314514f5e3Sopenharmony_ci GateRef array = TaggedArgument(1); 4324514f5e3Sopenharmony_ci Return(GetCallSpreadArgs(glue, array, ProfileOperation())); 4334514f5e3Sopenharmony_ci} 4344514f5e3Sopenharmony_ci 4354514f5e3Sopenharmony_civoid GetPropertyByIndexStubBuilder::GenerateCircuit() 4364514f5e3Sopenharmony_ci{ 4374514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 4384514f5e3Sopenharmony_ci GateRef receiver = TaggedArgument(1); 4394514f5e3Sopenharmony_ci GateRef index = Int32Argument(2); /* 2 : 3rd parameter is index */ 4404514f5e3Sopenharmony_ci Return(GetPropertyByIndex(glue, receiver, index, ProfileOperation())); 4414514f5e3Sopenharmony_ci} 4424514f5e3Sopenharmony_ci 4434514f5e3Sopenharmony_civoid SetPropertyByIndexStubBuilder::GenerateCircuit() 4444514f5e3Sopenharmony_ci{ 4454514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 4464514f5e3Sopenharmony_ci GateRef receiver = TaggedArgument(1); 4474514f5e3Sopenharmony_ci GateRef index = Int32Argument(2); /* 2 : 3rd parameter is index */ 4484514f5e3Sopenharmony_ci GateRef value = TaggedArgument(3); /* 3 : 4th parameter is value */ 4494514f5e3Sopenharmony_ci Return(SetPropertyByIndex(glue, receiver, index, value, false)); 4504514f5e3Sopenharmony_ci} 4514514f5e3Sopenharmony_ci 4524514f5e3Sopenharmony_civoid SetPropertyByIndexWithOwnStubBuilder::GenerateCircuit() 4534514f5e3Sopenharmony_ci{ 4544514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 4554514f5e3Sopenharmony_ci GateRef receiver = TaggedArgument(1); 4564514f5e3Sopenharmony_ci GateRef index = Int32Argument(2); /* 2 : 3rd parameter is index */ 4574514f5e3Sopenharmony_ci GateRef value = TaggedArgument(3); /* 3 : 4th parameter is value */ 4584514f5e3Sopenharmony_ci Return(SetPropertyByIndex(glue, receiver, index, value, true)); 4594514f5e3Sopenharmony_ci} 4604514f5e3Sopenharmony_ci 4614514f5e3Sopenharmony_civoid GetPropertyByNameStubBuilder::GenerateCircuit() 4624514f5e3Sopenharmony_ci{ 4634514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 4644514f5e3Sopenharmony_ci GateRef receiver = TaggedArgument(1); 4654514f5e3Sopenharmony_ci GateRef id = Int64Argument(2); // 2 : 3rd para 4664514f5e3Sopenharmony_ci GateRef jsFunc = TaggedArgument(3); // 3 : 4th para 4674514f5e3Sopenharmony_ci GateRef slotId = Int32Argument(4); // 4 : 5th para 4684514f5e3Sopenharmony_ci AccessObjectStubBuilder builder(this, jsFunc); 4694514f5e3Sopenharmony_ci StringIdInfo info(0, 0, StringIdInfo::Offset::INVALID, StringIdInfo::Length::INVALID); 4704514f5e3Sopenharmony_ci GateRef profileTypeInfo = UpdateProfileTypeInfo(glue, jsFunc); 4714514f5e3Sopenharmony_ci Return(builder.LoadObjByName(glue, receiver, id, info, profileTypeInfo, slotId, ProfileOperation())); 4724514f5e3Sopenharmony_ci} 4734514f5e3Sopenharmony_ci 4744514f5e3Sopenharmony_civoid DeprecatedGetPropertyByNameStubBuilder::GenerateCircuit() 4754514f5e3Sopenharmony_ci{ 4764514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 4774514f5e3Sopenharmony_ci GateRef receiver = TaggedArgument(1); 4784514f5e3Sopenharmony_ci GateRef key = TaggedPointerArgument(2); // 2 : 3rd para 4794514f5e3Sopenharmony_ci AccessObjectStubBuilder builder(this); 4804514f5e3Sopenharmony_ci Return(builder.DeprecatedLoadObjByName(glue, receiver, key)); 4814514f5e3Sopenharmony_ci} 4824514f5e3Sopenharmony_ci 4834514f5e3Sopenharmony_civoid SetPropertyByNameStubBuilder::GenerateCircuit() 4844514f5e3Sopenharmony_ci{ 4854514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 4864514f5e3Sopenharmony_ci GateRef receiver = TaggedArgument(1); 4874514f5e3Sopenharmony_ci GateRef id = Int64Argument(2); // 2 : 3rd para 4884514f5e3Sopenharmony_ci GateRef value = TaggedPointerArgument(3); // 3 : 4th para 4894514f5e3Sopenharmony_ci GateRef jsFunc = TaggedArgument(4); // 4 : 5th para 4904514f5e3Sopenharmony_ci GateRef slotId = Int32Argument(5); // 5 : 6th para 4914514f5e3Sopenharmony_ci AccessObjectStubBuilder builder(this, jsFunc); 4924514f5e3Sopenharmony_ci StringIdInfo info(0, 0, StringIdInfo::Offset::INVALID, StringIdInfo::Length::INVALID); 4934514f5e3Sopenharmony_ci GateRef profileTypeInfo = UpdateProfileTypeInfo(glue, jsFunc); 4944514f5e3Sopenharmony_ci Return(builder.StoreObjByName(glue, receiver, id, info, value, profileTypeInfo, slotId, ProfileOperation())); 4954514f5e3Sopenharmony_ci} 4964514f5e3Sopenharmony_ci 4974514f5e3Sopenharmony_civoid DeprecatedSetPropertyByNameStubBuilder::GenerateCircuit() 4984514f5e3Sopenharmony_ci{ 4994514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 5004514f5e3Sopenharmony_ci GateRef receiver = TaggedArgument(1); 5014514f5e3Sopenharmony_ci GateRef key = TaggedArgument(2); // 2 : 3rd para 5024514f5e3Sopenharmony_ci GateRef value = TaggedArgument(3); // 3 : 4th para 5034514f5e3Sopenharmony_ci Return(SetPropertyByName(glue, receiver, key, value, false, True())); 5044514f5e3Sopenharmony_ci} 5054514f5e3Sopenharmony_ci 5064514f5e3Sopenharmony_civoid SetPropertyByNameWithOwnStubBuilder::GenerateCircuit() 5074514f5e3Sopenharmony_ci{ 5084514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 5094514f5e3Sopenharmony_ci GateRef receiver = TaggedArgument(1); 5104514f5e3Sopenharmony_ci GateRef key = TaggedArgument(2); // 2 : 3rd para 5114514f5e3Sopenharmony_ci GateRef value = TaggedArgument(3); // 3 : 4th para 5124514f5e3Sopenharmony_ci Return(SetPropertyByName(glue, receiver, key, value, true, True())); 5134514f5e3Sopenharmony_ci} 5144514f5e3Sopenharmony_ci 5154514f5e3Sopenharmony_civoid GetPropertyByValueStubBuilder::GenerateCircuit() 5164514f5e3Sopenharmony_ci{ 5174514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 5184514f5e3Sopenharmony_ci GateRef receiver = TaggedArgument(1); 5194514f5e3Sopenharmony_ci GateRef key = TaggedArgument(2); // 2 : 3rd para 5204514f5e3Sopenharmony_ci GateRef jsFunc = TaggedArgument(3); // 3 : 4th para 5214514f5e3Sopenharmony_ci GateRef slotId = Int32Argument(4); // 4 : 5th para 5224514f5e3Sopenharmony_ci AccessObjectStubBuilder builder(this); 5234514f5e3Sopenharmony_ci GateRef profileTypeInfo = UpdateProfileTypeInfo(glue, jsFunc); 5244514f5e3Sopenharmony_ci Return(builder.LoadObjByValue(glue, receiver, key, profileTypeInfo, slotId)); 5254514f5e3Sopenharmony_ci} 5264514f5e3Sopenharmony_ci 5274514f5e3Sopenharmony_civoid DeprecatedGetPropertyByValueStubBuilder::GenerateCircuit() 5284514f5e3Sopenharmony_ci{ 5294514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 5304514f5e3Sopenharmony_ci GateRef receiver = TaggedArgument(1); 5314514f5e3Sopenharmony_ci GateRef key = TaggedArgument(2); // 2 : 3rd para 5324514f5e3Sopenharmony_ci Return(GetPropertyByValue(glue, receiver, key, ProfileOperation())); 5334514f5e3Sopenharmony_ci} 5344514f5e3Sopenharmony_ci 5354514f5e3Sopenharmony_civoid SetPropertyByValueStubBuilder::GenerateCircuit() 5364514f5e3Sopenharmony_ci{ 5374514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 5384514f5e3Sopenharmony_ci GateRef receiver = TaggedArgument(1); 5394514f5e3Sopenharmony_ci GateRef key = TaggedArgument(2); // 2 : 3rd para 5404514f5e3Sopenharmony_ci GateRef value = TaggedArgument(3); // 3 : 4th para 5414514f5e3Sopenharmony_ci GateRef jsFunc = TaggedArgument(4); // 4 : 5th para 5424514f5e3Sopenharmony_ci GateRef slotId = Int32Argument(5); // 5 : 6th para 5434514f5e3Sopenharmony_ci AccessObjectStubBuilder builder(this); 5444514f5e3Sopenharmony_ci GateRef profileTypeInfo = UpdateProfileTypeInfo(glue, jsFunc); 5454514f5e3Sopenharmony_ci Return(builder.StoreObjByValue(glue, receiver, key, value, profileTypeInfo, slotId)); 5464514f5e3Sopenharmony_ci} 5474514f5e3Sopenharmony_ci 5484514f5e3Sopenharmony_civoid DeprecatedSetPropertyByValueStubBuilder::GenerateCircuit() 5494514f5e3Sopenharmony_ci{ 5504514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 5514514f5e3Sopenharmony_ci GateRef receiver = TaggedArgument(1); 5524514f5e3Sopenharmony_ci GateRef key = TaggedArgument(2); /* 2 : 3rd parameter is key */ 5534514f5e3Sopenharmony_ci GateRef value = TaggedArgument(3); /* 3 : 4th parameter is value */ 5544514f5e3Sopenharmony_ci Return(SetPropertyByValue(glue, receiver, key, value, false)); 5554514f5e3Sopenharmony_ci} 5564514f5e3Sopenharmony_ci 5574514f5e3Sopenharmony_civoid SetPropertyByValueWithOwnStubBuilder::GenerateCircuit() 5584514f5e3Sopenharmony_ci{ 5594514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 5604514f5e3Sopenharmony_ci GateRef receiver = TaggedArgument(1); 5614514f5e3Sopenharmony_ci GateRef key = TaggedArgument(2); /* 2 : 3rd parameter is key */ 5624514f5e3Sopenharmony_ci GateRef value = TaggedArgument(3); /* 3 : 4th parameter is value */ 5634514f5e3Sopenharmony_ci Return(SetPropertyByValue(glue, receiver, key, value, true)); 5644514f5e3Sopenharmony_ci} 5654514f5e3Sopenharmony_ci 5664514f5e3Sopenharmony_civoid StOwnByIndexStubBuilder::GenerateCircuit() 5674514f5e3Sopenharmony_ci{ 5684514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 5694514f5e3Sopenharmony_ci GateRef receiver = TaggedArgument(1); 5704514f5e3Sopenharmony_ci GateRef index = Int32Argument(2); /* 2 : 3rd parameter is index */ 5714514f5e3Sopenharmony_ci GateRef value = TaggedArgument(3); /* 3 : 4th parameter is value */ 5724514f5e3Sopenharmony_ci AccessObjectStubBuilder builder(this); 5734514f5e3Sopenharmony_ci Return(builder.StOwnByIndex(glue, receiver, index, value)); 5744514f5e3Sopenharmony_ci} 5754514f5e3Sopenharmony_ci 5764514f5e3Sopenharmony_civoid StOwnByValueStubBuilder::GenerateCircuit() 5774514f5e3Sopenharmony_ci{ 5784514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 5794514f5e3Sopenharmony_ci GateRef receiver = TaggedArgument(1); 5804514f5e3Sopenharmony_ci GateRef key = TaggedArgument(2); /* 2 : 3rd parameter is key */ 5814514f5e3Sopenharmony_ci GateRef value = TaggedArgument(3); /* 3 : 4th parameter is value */ 5824514f5e3Sopenharmony_ci AccessObjectStubBuilder builder(this); 5834514f5e3Sopenharmony_ci Return(builder.StOwnByValue(glue, receiver, key, value)); 5844514f5e3Sopenharmony_ci} 5854514f5e3Sopenharmony_ci 5864514f5e3Sopenharmony_civoid StOwnByNameStubBuilder::GenerateCircuit() 5874514f5e3Sopenharmony_ci{ 5884514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 5894514f5e3Sopenharmony_ci GateRef receiver = TaggedArgument(1); 5904514f5e3Sopenharmony_ci GateRef key = TaggedArgument(2); // 2 : 3rd para 5914514f5e3Sopenharmony_ci GateRef value = TaggedArgument(3); // 3 : 4th para 5924514f5e3Sopenharmony_ci AccessObjectStubBuilder builder(this); 5934514f5e3Sopenharmony_ci Return(builder.StOwnByName(glue, receiver, key, value)); 5944514f5e3Sopenharmony_ci} 5954514f5e3Sopenharmony_ci 5964514f5e3Sopenharmony_civoid StOwnByValueWithNameSetStubBuilder::GenerateCircuit() 5974514f5e3Sopenharmony_ci{ 5984514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 5994514f5e3Sopenharmony_ci GateRef receiver = TaggedArgument(1); 6004514f5e3Sopenharmony_ci GateRef key = TaggedArgument(2); /* 2 : 3rd parameter is key */ 6014514f5e3Sopenharmony_ci GateRef value = TaggedArgument(3); /* 3 : 4th parameter is value */ 6024514f5e3Sopenharmony_ci AccessObjectStubBuilder builder(this); 6034514f5e3Sopenharmony_ci Return(builder.StOwnByValueWithNameSet(glue, receiver, key, value)); 6044514f5e3Sopenharmony_ci} 6054514f5e3Sopenharmony_ci 6064514f5e3Sopenharmony_civoid StOwnByNameWithNameSetStubBuilder::GenerateCircuit() 6074514f5e3Sopenharmony_ci{ 6084514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 6094514f5e3Sopenharmony_ci GateRef receiver = TaggedArgument(1); 6104514f5e3Sopenharmony_ci GateRef key = TaggedArgument(2); // 2 : 3rd para 6114514f5e3Sopenharmony_ci GateRef value = TaggedArgument(3); // 3 : 4th para 6124514f5e3Sopenharmony_ci AccessObjectStubBuilder builder(this); 6134514f5e3Sopenharmony_ci Return(builder.StOwnByNameWithNameSet(glue, receiver, key, value)); 6144514f5e3Sopenharmony_ci} 6154514f5e3Sopenharmony_ci 6164514f5e3Sopenharmony_civoid LdObjByIndexStubBuilder::GenerateCircuit() 6174514f5e3Sopenharmony_ci{ 6184514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 6194514f5e3Sopenharmony_ci GateRef receiver = TaggedArgument(1); 6204514f5e3Sopenharmony_ci GateRef index = Int32Argument(2); /* 2 : 3rd parameter is index */ 6214514f5e3Sopenharmony_ci AccessObjectStubBuilder builder(this); 6224514f5e3Sopenharmony_ci Return(builder.LdObjByIndex(glue, receiver, index)); 6234514f5e3Sopenharmony_ci} 6244514f5e3Sopenharmony_ci 6254514f5e3Sopenharmony_civoid StObjByIndexStubBuilder::GenerateCircuit() 6264514f5e3Sopenharmony_ci{ 6274514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 6284514f5e3Sopenharmony_ci GateRef receiver = TaggedArgument(1); 6294514f5e3Sopenharmony_ci GateRef index = Int32Argument(2); /* 2 : 3rd parameter is index */ 6304514f5e3Sopenharmony_ci GateRef value = TaggedArgument(3); /* 3 : 4th parameter is value */ 6314514f5e3Sopenharmony_ci AccessObjectStubBuilder builder(this); 6324514f5e3Sopenharmony_ci Return(builder.StObjByIndex(glue, receiver, index, value)); 6334514f5e3Sopenharmony_ci} 6344514f5e3Sopenharmony_ci 6354514f5e3Sopenharmony_civoid TryLdGlobalByNameStubBuilder::GenerateCircuit() 6364514f5e3Sopenharmony_ci{ 6374514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 6384514f5e3Sopenharmony_ci GateRef id = Int64Argument(1); 6394514f5e3Sopenharmony_ci GateRef jsFunc = TaggedArgument(2); // 2 : 3th para 6404514f5e3Sopenharmony_ci GateRef slotId = Int32Argument(3); // 3 : 4th para 6414514f5e3Sopenharmony_ci AccessObjectStubBuilder builder(this, jsFunc); 6424514f5e3Sopenharmony_ci StringIdInfo info(0, 0, StringIdInfo::Offset::INVALID, StringIdInfo::Length::INVALID); 6434514f5e3Sopenharmony_ci GateRef profileTypeInfo = UpdateProfileTypeInfo(glue, jsFunc); 6444514f5e3Sopenharmony_ci Return(builder.TryLoadGlobalByName(glue, id, info, profileTypeInfo, slotId, ProfileOperation())); 6454514f5e3Sopenharmony_ci} 6464514f5e3Sopenharmony_ci 6474514f5e3Sopenharmony_civoid TryStGlobalByNameStubBuilder::GenerateCircuit() 6484514f5e3Sopenharmony_ci{ 6494514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 6504514f5e3Sopenharmony_ci GateRef id = Int64Argument(1); 6514514f5e3Sopenharmony_ci GateRef value = TaggedArgument(2); // 2 : 3rd para 6524514f5e3Sopenharmony_ci GateRef jsFunc = TaggedArgument(3); // 3 : 4th para 6534514f5e3Sopenharmony_ci GateRef slotId = Int32Argument(4); // 4: 5th para 6544514f5e3Sopenharmony_ci AccessObjectStubBuilder builder(this, jsFunc); 6554514f5e3Sopenharmony_ci StringIdInfo info(0, 0, StringIdInfo::Offset::INVALID, StringIdInfo::Length::INVALID); 6564514f5e3Sopenharmony_ci GateRef profileTypeInfo = UpdateProfileTypeInfo(glue, jsFunc); 6574514f5e3Sopenharmony_ci Return(builder.TryStoreGlobalByName(glue, id, info, value, profileTypeInfo, slotId, ProfileOperation())); 6584514f5e3Sopenharmony_ci} 6594514f5e3Sopenharmony_ci 6604514f5e3Sopenharmony_civoid LdGlobalVarStubBuilder::GenerateCircuit() 6614514f5e3Sopenharmony_ci{ 6624514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 6634514f5e3Sopenharmony_ci GateRef id = Int64Argument(1); 6644514f5e3Sopenharmony_ci GateRef jsFunc = TaggedArgument(2); // 2 : 3th para 6654514f5e3Sopenharmony_ci GateRef slotId = Int32Argument(3); // 3 : 4th para 6664514f5e3Sopenharmony_ci AccessObjectStubBuilder builder(this, jsFunc); 6674514f5e3Sopenharmony_ci StringIdInfo info(0, 0, StringIdInfo::Offset::INVALID, StringIdInfo::Length::INVALID); 6684514f5e3Sopenharmony_ci GateRef profileTypeInfo = UpdateProfileTypeInfo(glue, jsFunc); 6694514f5e3Sopenharmony_ci Return(builder.LoadGlobalVar(glue, id, info, profileTypeInfo, slotId, ProfileOperation())); 6704514f5e3Sopenharmony_ci} 6714514f5e3Sopenharmony_ci 6724514f5e3Sopenharmony_civoid StGlobalVarStubBuilder::GenerateCircuit() 6734514f5e3Sopenharmony_ci{ 6744514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 6754514f5e3Sopenharmony_ci GateRef id = Int64Argument(1); 6764514f5e3Sopenharmony_ci GateRef value = TaggedArgument(2); // 2 : 3rd para 6774514f5e3Sopenharmony_ci GateRef jsFunc = TaggedArgument(3); // 3 : 4th para 6784514f5e3Sopenharmony_ci GateRef slotId = Int32Argument(4); // 4: 5th para 6794514f5e3Sopenharmony_ci AccessObjectStubBuilder builder(this, jsFunc); 6804514f5e3Sopenharmony_ci StringIdInfo info(0, 0, StringIdInfo::Offset::INVALID, StringIdInfo::Length::INVALID); 6814514f5e3Sopenharmony_ci GateRef profileTypeInfo = UpdateProfileTypeInfo(glue, jsFunc); 6824514f5e3Sopenharmony_ci Return(builder.StoreGlobalVar(glue, id, info, value, profileTypeInfo, slotId)); 6834514f5e3Sopenharmony_ci} 6844514f5e3Sopenharmony_ci 6854514f5e3Sopenharmony_civoid TryLoadICByNameStubBuilder::GenerateCircuit() 6864514f5e3Sopenharmony_ci{ 6874514f5e3Sopenharmony_ci auto env = GetEnvironment(); 6884514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 6894514f5e3Sopenharmony_ci GateRef receiver = TaggedArgument(1); 6904514f5e3Sopenharmony_ci GateRef firstValue = TaggedArgument(2); /* 2 : 3rd parameter is value */ 6914514f5e3Sopenharmony_ci GateRef secondValue = TaggedArgument(3); /* 3 : 4th parameter is value */ 6924514f5e3Sopenharmony_ci 6934514f5e3Sopenharmony_ci Label receiverIsHeapObject(env); 6944514f5e3Sopenharmony_ci Label receiverNotHeapObject(env); 6954514f5e3Sopenharmony_ci Label hclassEqualFirstValue(env); 6964514f5e3Sopenharmony_ci Label hclassNotEqualFirstValue(env); 6974514f5e3Sopenharmony_ci Label cachedHandlerNotHole(env); 6984514f5e3Sopenharmony_ci BRANCH(TaggedIsHeapObject(receiver), &receiverIsHeapObject, &receiverNotHeapObject); 6994514f5e3Sopenharmony_ci Bind(&receiverIsHeapObject); 7004514f5e3Sopenharmony_ci { 7014514f5e3Sopenharmony_ci GateRef hclass = LoadHClass(receiver); 7024514f5e3Sopenharmony_ci BRANCH(Equal(LoadObjectFromWeakRef(firstValue), hclass), 7034514f5e3Sopenharmony_ci &hclassEqualFirstValue, 7044514f5e3Sopenharmony_ci &hclassNotEqualFirstValue); 7054514f5e3Sopenharmony_ci Bind(&hclassEqualFirstValue); 7064514f5e3Sopenharmony_ci { 7074514f5e3Sopenharmony_ci Return(LoadICWithHandler(glue, receiver, receiver, secondValue, ProfileOperation())); 7084514f5e3Sopenharmony_ci } 7094514f5e3Sopenharmony_ci Bind(&hclassNotEqualFirstValue); 7104514f5e3Sopenharmony_ci { 7114514f5e3Sopenharmony_ci GateRef cachedHandler = CheckPolyHClass(firstValue, hclass); 7124514f5e3Sopenharmony_ci BRANCH(TaggedIsHole(cachedHandler), &receiverNotHeapObject, &cachedHandlerNotHole); 7134514f5e3Sopenharmony_ci Bind(&cachedHandlerNotHole); 7144514f5e3Sopenharmony_ci { 7154514f5e3Sopenharmony_ci Return(LoadICWithHandler(glue, receiver, receiver, cachedHandler, ProfileOperation())); 7164514f5e3Sopenharmony_ci } 7174514f5e3Sopenharmony_ci } 7184514f5e3Sopenharmony_ci } 7194514f5e3Sopenharmony_ci Bind(&receiverNotHeapObject); 7204514f5e3Sopenharmony_ci { 7214514f5e3Sopenharmony_ci Return(Hole()); 7224514f5e3Sopenharmony_ci } 7234514f5e3Sopenharmony_ci} 7244514f5e3Sopenharmony_ci 7254514f5e3Sopenharmony_civoid TryLoadICByValueStubBuilder::GenerateCircuit() 7264514f5e3Sopenharmony_ci{ 7274514f5e3Sopenharmony_ci auto env = GetEnvironment(); 7284514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 7294514f5e3Sopenharmony_ci GateRef receiver = TaggedArgument(1); 7304514f5e3Sopenharmony_ci GateRef key = TaggedArgument(2); /* 2 : 3rd parameter is value */ 7314514f5e3Sopenharmony_ci GateRef firstValue = TaggedArgument(3); /* 3 : 4th parameter is value */ 7324514f5e3Sopenharmony_ci GateRef secondValue = TaggedArgument(4); /* 4 : 5th parameter is value */ 7334514f5e3Sopenharmony_ci 7344514f5e3Sopenharmony_ci Label receiverIsHeapObject(env); 7354514f5e3Sopenharmony_ci Label receiverNotHeapObject(env); 7364514f5e3Sopenharmony_ci Label hclassEqualFirstValue(env); 7374514f5e3Sopenharmony_ci Label hclassNotEqualFirstValue(env); 7384514f5e3Sopenharmony_ci Label firstValueEqualKey(env); 7394514f5e3Sopenharmony_ci Label cachedHandlerNotHole(env); 7404514f5e3Sopenharmony_ci BRANCH(TaggedIsHeapObject(receiver), &receiverIsHeapObject, &receiverNotHeapObject); 7414514f5e3Sopenharmony_ci Bind(&receiverIsHeapObject); 7424514f5e3Sopenharmony_ci { 7434514f5e3Sopenharmony_ci GateRef hclass = LoadHClass(receiver); 7444514f5e3Sopenharmony_ci BRANCH(Equal(LoadObjectFromWeakRef(firstValue), hclass), 7454514f5e3Sopenharmony_ci &hclassEqualFirstValue, 7464514f5e3Sopenharmony_ci &hclassNotEqualFirstValue); 7474514f5e3Sopenharmony_ci Bind(&hclassEqualFirstValue); 7484514f5e3Sopenharmony_ci Return(LoadElement(glue, receiver, key)); 7494514f5e3Sopenharmony_ci Bind(&hclassNotEqualFirstValue); 7504514f5e3Sopenharmony_ci { 7514514f5e3Sopenharmony_ci BRANCH(Int64Equal(firstValue, key), &firstValueEqualKey, &receiverNotHeapObject); 7524514f5e3Sopenharmony_ci Bind(&firstValueEqualKey); 7534514f5e3Sopenharmony_ci { 7544514f5e3Sopenharmony_ci auto cachedHandler = CheckPolyHClass(secondValue, hclass); 7554514f5e3Sopenharmony_ci BRANCH(TaggedIsHole(cachedHandler), &receiverNotHeapObject, &cachedHandlerNotHole); 7564514f5e3Sopenharmony_ci Bind(&cachedHandlerNotHole); 7574514f5e3Sopenharmony_ci Return(LoadICWithHandler(glue, receiver, receiver, cachedHandler, ProfileOperation())); 7584514f5e3Sopenharmony_ci } 7594514f5e3Sopenharmony_ci } 7604514f5e3Sopenharmony_ci } 7614514f5e3Sopenharmony_ci Bind(&receiverNotHeapObject); 7624514f5e3Sopenharmony_ci Return(Hole()); 7634514f5e3Sopenharmony_ci} 7644514f5e3Sopenharmony_ci 7654514f5e3Sopenharmony_civoid TryStoreICByNameStubBuilder::GenerateCircuit() 7664514f5e3Sopenharmony_ci{ 7674514f5e3Sopenharmony_ci auto env = GetEnvironment(); 7684514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 7694514f5e3Sopenharmony_ci GateRef receiver = TaggedArgument(1); 7704514f5e3Sopenharmony_ci GateRef firstValue = TaggedArgument(2); /* 2 : 3rd parameter is value */ 7714514f5e3Sopenharmony_ci GateRef secondValue = TaggedArgument(3); /* 3 : 4th parameter is value */ 7724514f5e3Sopenharmony_ci GateRef value = TaggedArgument(4); /* 4 : 5th parameter is value */ 7734514f5e3Sopenharmony_ci Label receiverIsHeapObject(env); 7744514f5e3Sopenharmony_ci Label receiverNotHeapObject(env); 7754514f5e3Sopenharmony_ci Label hclassEqualFirstValue(env); 7764514f5e3Sopenharmony_ci Label hclassNotEqualFirstValue(env); 7774514f5e3Sopenharmony_ci Label cachedHandlerNotHole(env); 7784514f5e3Sopenharmony_ci BRANCH(TaggedIsHeapObject(receiver), &receiverIsHeapObject, &receiverNotHeapObject); 7794514f5e3Sopenharmony_ci Bind(&receiverIsHeapObject); 7804514f5e3Sopenharmony_ci { 7814514f5e3Sopenharmony_ci GateRef hclass = LoadHClass(receiver); 7824514f5e3Sopenharmony_ci BRANCH(Equal(LoadObjectFromWeakRef(firstValue), hclass), 7834514f5e3Sopenharmony_ci &hclassEqualFirstValue, 7844514f5e3Sopenharmony_ci &hclassNotEqualFirstValue); 7854514f5e3Sopenharmony_ci Bind(&hclassEqualFirstValue); 7864514f5e3Sopenharmony_ci { 7874514f5e3Sopenharmony_ci Return(StoreICWithHandler(glue, receiver, receiver, value, secondValue)); 7884514f5e3Sopenharmony_ci } 7894514f5e3Sopenharmony_ci Bind(&hclassNotEqualFirstValue); 7904514f5e3Sopenharmony_ci { 7914514f5e3Sopenharmony_ci GateRef cachedHandler = CheckPolyHClass(firstValue, hclass); 7924514f5e3Sopenharmony_ci BRANCH(TaggedIsHole(cachedHandler), &receiverNotHeapObject, &cachedHandlerNotHole); 7934514f5e3Sopenharmony_ci Bind(&cachedHandlerNotHole); 7944514f5e3Sopenharmony_ci { 7954514f5e3Sopenharmony_ci Return(StoreICWithHandler(glue, receiver, receiver, value, cachedHandler)); 7964514f5e3Sopenharmony_ci } 7974514f5e3Sopenharmony_ci } 7984514f5e3Sopenharmony_ci } 7994514f5e3Sopenharmony_ci Bind(&receiverNotHeapObject); 8004514f5e3Sopenharmony_ci Return(Hole()); 8014514f5e3Sopenharmony_ci} 8024514f5e3Sopenharmony_ci 8034514f5e3Sopenharmony_civoid TryStoreICByValueStubBuilder::GenerateCircuit() 8044514f5e3Sopenharmony_ci{ 8054514f5e3Sopenharmony_ci auto env = GetEnvironment(); 8064514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 8074514f5e3Sopenharmony_ci GateRef receiver = TaggedArgument(1); 8084514f5e3Sopenharmony_ci GateRef key = TaggedArgument(2); /* 2 : 3rd parameter is value */ 8094514f5e3Sopenharmony_ci GateRef firstValue = TaggedArgument(3); /* 3 : 4th parameter is value */ 8104514f5e3Sopenharmony_ci GateRef secondValue = TaggedArgument(4); /* 4 : 5th parameter is value */ 8114514f5e3Sopenharmony_ci GateRef value = TaggedArgument(5); /* 5 : 6th parameter is value */ 8124514f5e3Sopenharmony_ci Label receiverIsHeapObject(env); 8134514f5e3Sopenharmony_ci Label receiverNotHeapObject(env); 8144514f5e3Sopenharmony_ci Label hclassEqualFirstValue(env); 8154514f5e3Sopenharmony_ci Label hclassNotEqualFirstValue(env); 8164514f5e3Sopenharmony_ci Label firstValueEqualKey(env); 8174514f5e3Sopenharmony_ci Label cachedHandlerNotHole(env); 8184514f5e3Sopenharmony_ci BRANCH(TaggedIsHeapObject(receiver), &receiverIsHeapObject, &receiverNotHeapObject); 8194514f5e3Sopenharmony_ci Bind(&receiverIsHeapObject); 8204514f5e3Sopenharmony_ci { 8214514f5e3Sopenharmony_ci GateRef hclass = LoadHClass(receiver); 8224514f5e3Sopenharmony_ci BRANCH(Equal(LoadObjectFromWeakRef(firstValue), hclass), 8234514f5e3Sopenharmony_ci &hclassEqualFirstValue, 8244514f5e3Sopenharmony_ci &hclassNotEqualFirstValue); 8254514f5e3Sopenharmony_ci Bind(&hclassEqualFirstValue); 8264514f5e3Sopenharmony_ci Return(ICStoreElement(glue, receiver, key, value, secondValue)); 8274514f5e3Sopenharmony_ci Bind(&hclassNotEqualFirstValue); 8284514f5e3Sopenharmony_ci { 8294514f5e3Sopenharmony_ci BRANCH(Int64Equal(firstValue, key), &firstValueEqualKey, &receiverNotHeapObject); 8304514f5e3Sopenharmony_ci Bind(&firstValueEqualKey); 8314514f5e3Sopenharmony_ci { 8324514f5e3Sopenharmony_ci GateRef cachedHandler = CheckPolyHClass(secondValue, hclass); 8334514f5e3Sopenharmony_ci BRANCH(TaggedIsHole(cachedHandler), &receiverNotHeapObject, &cachedHandlerNotHole); 8344514f5e3Sopenharmony_ci Bind(&cachedHandlerNotHole); 8354514f5e3Sopenharmony_ci Return(StoreICWithHandler(glue, receiver, receiver, value, cachedHandler)); 8364514f5e3Sopenharmony_ci } 8374514f5e3Sopenharmony_ci } 8384514f5e3Sopenharmony_ci } 8394514f5e3Sopenharmony_ci Bind(&receiverNotHeapObject); 8404514f5e3Sopenharmony_ci Return(Hole()); 8414514f5e3Sopenharmony_ci} 8424514f5e3Sopenharmony_ci 8434514f5e3Sopenharmony_civoid SetValueWithBarrierStubBuilder::GenerateCircuit() 8444514f5e3Sopenharmony_ci{ 8454514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 8464514f5e3Sopenharmony_ci GateRef obj = TaggedArgument(1); 8474514f5e3Sopenharmony_ci GateRef offset = PtrArgument(2); // 2 : 3rd para 8484514f5e3Sopenharmony_ci GateRef value = TaggedArgument(3); // 3 : 4th para 8494514f5e3Sopenharmony_ci SetValueWithBarrier(glue, obj, offset, value); 8504514f5e3Sopenharmony_ci Return(); 8514514f5e3Sopenharmony_ci} 8524514f5e3Sopenharmony_ci 8534514f5e3Sopenharmony_civoid SetNonSValueWithBarrierStubBuilder::GenerateCircuit() 8544514f5e3Sopenharmony_ci{ 8554514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 8564514f5e3Sopenharmony_ci GateRef obj = TaggedArgument(1); 8574514f5e3Sopenharmony_ci GateRef offset = PtrArgument(2); // 2 : 3rd para 8584514f5e3Sopenharmony_ci GateRef value = TaggedArgument(3); // 3 : 4th para 8594514f5e3Sopenharmony_ci SetValueWithBarrier(glue, obj, offset, value, false, MemoryAttribute::NON_SHARE); 8604514f5e3Sopenharmony_ci Return(); 8614514f5e3Sopenharmony_ci} 8624514f5e3Sopenharmony_ci 8634514f5e3Sopenharmony_civoid SetValueWithEdenBarrierStubBuilder::GenerateCircuit() 8644514f5e3Sopenharmony_ci{ 8654514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 8664514f5e3Sopenharmony_ci GateRef obj = TaggedArgument(1); 8674514f5e3Sopenharmony_ci GateRef offset = PtrArgument(2); // 2 : 3rd para 8684514f5e3Sopenharmony_ci GateRef value = TaggedArgument(3); // 3 : 4th para 8694514f5e3Sopenharmony_ci SetValueWithBarrier(glue, obj, offset, value, true); 8704514f5e3Sopenharmony_ci Return(); 8714514f5e3Sopenharmony_ci} 8724514f5e3Sopenharmony_ci 8734514f5e3Sopenharmony_civoid SetNonSValueWithEdenBarrierStubBuilder::GenerateCircuit() 8744514f5e3Sopenharmony_ci{ 8754514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 8764514f5e3Sopenharmony_ci GateRef obj = TaggedArgument(1); 8774514f5e3Sopenharmony_ci GateRef offset = PtrArgument(2); // 2 : 3rd para 8784514f5e3Sopenharmony_ci GateRef value = TaggedArgument(3); // 3 : 4th para 8794514f5e3Sopenharmony_ci SetValueWithBarrier(glue, obj, offset, value, true, MemoryAttribute::NON_SHARE); 8804514f5e3Sopenharmony_ci Return(); 8814514f5e3Sopenharmony_ci} 8824514f5e3Sopenharmony_ci 8834514f5e3Sopenharmony_civoid SetSValueWithBarrierStubBuilder::GenerateCircuit() 8844514f5e3Sopenharmony_ci{ 8854514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 8864514f5e3Sopenharmony_ci GateRef obj = TaggedArgument(1); 8874514f5e3Sopenharmony_ci GateRef offset = PtrArgument(2); // 2 : 3rd para 8884514f5e3Sopenharmony_ci GateRef value = TaggedArgument(3); // 3 : 4th para 8894514f5e3Sopenharmony_ci SetValueWithBarrier(glue, obj, offset, value, false, MemoryAttribute::SHARED); 8904514f5e3Sopenharmony_ci Return(); 8914514f5e3Sopenharmony_ci} 8924514f5e3Sopenharmony_ci 8934514f5e3Sopenharmony_civoid VerifyBarrierStubBuilder::GenerateCircuit() 8944514f5e3Sopenharmony_ci{ 8954514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 8964514f5e3Sopenharmony_ci GateRef obj = TaggedArgument(1); 8974514f5e3Sopenharmony_ci GateRef offset = PtrArgument(2); // 2 : 3rd para 8984514f5e3Sopenharmony_ci GateRef value = TaggedArgument(3); // 3 : 4th para 8994514f5e3Sopenharmony_ci VerifyBarrier(glue, obj, offset, value); 9004514f5e3Sopenharmony_ci Return(); 9014514f5e3Sopenharmony_ci} 9024514f5e3Sopenharmony_ci 9034514f5e3Sopenharmony_civoid NewThisObjectCheckedStubBuilder::GenerateCircuit() 9044514f5e3Sopenharmony_ci{ 9054514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 9064514f5e3Sopenharmony_ci GateRef ctor = TaggedArgument(1); 9074514f5e3Sopenharmony_ci NewObjectStubBuilder newBuilder(this); 9084514f5e3Sopenharmony_ci Return(newBuilder.NewThisObjectChecked(glue, ctor)); 9094514f5e3Sopenharmony_ci} 9104514f5e3Sopenharmony_ci 9114514f5e3Sopenharmony_civoid ConstructorCheckStubBuilder::GenerateCircuit() 9124514f5e3Sopenharmony_ci{ 9134514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 9144514f5e3Sopenharmony_ci GateRef ctor = TaggedArgument(1); 9154514f5e3Sopenharmony_ci GateRef value = TaggedArgument(2); // 2 : 3rd para 9164514f5e3Sopenharmony_ci GateRef thisObj = TaggedArgument(3); // 3 : 4th para 9174514f5e3Sopenharmony_ci Return(ConstructorCheck(glue, ctor, value, thisObj)); 9184514f5e3Sopenharmony_ci} 9194514f5e3Sopenharmony_ci 9204514f5e3Sopenharmony_civoid CreateEmptyArrayStubBuilder::GenerateCircuit() 9214514f5e3Sopenharmony_ci{ 9224514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 9234514f5e3Sopenharmony_ci NewObjectStubBuilder newBuilder(this); 9244514f5e3Sopenharmony_ci Return(newBuilder.CreateEmptyArray(glue)); 9254514f5e3Sopenharmony_ci} 9264514f5e3Sopenharmony_ci 9274514f5e3Sopenharmony_civoid CreateArrayWithBufferStubBuilder::GenerateCircuit() 9284514f5e3Sopenharmony_ci{ 9294514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 9304514f5e3Sopenharmony_ci GateRef index = Int32Argument(1); 9314514f5e3Sopenharmony_ci GateRef jsFunc = TaggedArgument(2); // 2 : 3rd para 9324514f5e3Sopenharmony_ci GateRef slotId = Int32Argument(5); // 5 : 6th para 9334514f5e3Sopenharmony_ci NewObjectStubBuilder newBuilder(this); 9344514f5e3Sopenharmony_ci Return(newBuilder.CreateArrayWithBuffer( 9354514f5e3Sopenharmony_ci glue, index, jsFunc, { IntPtr(0), 0, true }, Undefined(), slotId, ProfileOperation())); 9364514f5e3Sopenharmony_ci} 9374514f5e3Sopenharmony_ci 9384514f5e3Sopenharmony_civoid NewJSObjectStubBuilder::GenerateCircuit() 9394514f5e3Sopenharmony_ci{ 9404514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 9414514f5e3Sopenharmony_ci GateRef ctor = TaggedArgument(1); 9424514f5e3Sopenharmony_ci NewObjectStubBuilder newBuilder(this); 9434514f5e3Sopenharmony_ci Return(newBuilder.FastNewThisObject(glue, ctor)); 9444514f5e3Sopenharmony_ci} 9454514f5e3Sopenharmony_ci 9464514f5e3Sopenharmony_civoid JsBoundCallInternalStubBuilder::GenerateCircuit() 9474514f5e3Sopenharmony_ci{ 9484514f5e3Sopenharmony_ci auto env = GetEnvironment(); 9494514f5e3Sopenharmony_ci Label exit(env); 9504514f5e3Sopenharmony_ci Label fastCall(env); 9514514f5e3Sopenharmony_ci Label notFastCall(env); 9524514f5e3Sopenharmony_ci Label methodIsFastCall(env); 9534514f5e3Sopenharmony_ci Label fastCallBridge(env); 9544514f5e3Sopenharmony_ci Label slowCall(env); 9554514f5e3Sopenharmony_ci Label slowCallBridge(env); 9564514f5e3Sopenharmony_ci 9574514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 9584514f5e3Sopenharmony_ci GateRef argc = Int64Argument(1); 9594514f5e3Sopenharmony_ci GateRef func = TaggedPointerArgument(2); // callTarget 9604514f5e3Sopenharmony_ci GateRef argv = PtrArgument(3); 9614514f5e3Sopenharmony_ci GateRef thisValue = TaggedPointerArgument(4); // this 9624514f5e3Sopenharmony_ci GateRef newTarget = TaggedPointerArgument(5); // new target 9634514f5e3Sopenharmony_ci DEFVARIABLE(result, VariableType::JS_ANY(), Undefined()); 9644514f5e3Sopenharmony_ci GateRef method = GetMethodFromFunction(func); 9654514f5e3Sopenharmony_ci GateRef callfield = Load(VariableType::INT64(), method, IntPtr(Method::CALL_FIELD_OFFSET)); 9664514f5e3Sopenharmony_ci GateRef expectedNum = Int64And(Int64LSR(callfield, Int64(MethodLiteral::NumArgsBits::START_BIT)), 9674514f5e3Sopenharmony_ci Int64((1LU << MethodLiteral::NumArgsBits::SIZE) - 1)); 9684514f5e3Sopenharmony_ci GateRef expectedArgc = Int64Add(expectedNum, Int64(NUM_MANDATORY_JSFUNC_ARGS)); 9694514f5e3Sopenharmony_ci GateRef actualArgc = Int64Sub(argc, IntPtr(NUM_MANDATORY_JSFUNC_ARGS)); 9704514f5e3Sopenharmony_ci BRANCH(JudgeAotAndFastCall(func, CircuitBuilder::JudgeMethodType::HAS_AOT_FASTCALL), 9714514f5e3Sopenharmony_ci &methodIsFastCall, ¬FastCall); 9724514f5e3Sopenharmony_ci Bind(&methodIsFastCall); 9734514f5e3Sopenharmony_ci { 9744514f5e3Sopenharmony_ci BRANCH(Int64Equal(expectedArgc, argc), &fastCall, &fastCallBridge); 9754514f5e3Sopenharmony_ci Bind(&fastCall); 9764514f5e3Sopenharmony_ci { 9774514f5e3Sopenharmony_ci result = CallNGCRuntime(glue, RTSTUB_ID(JSFastCallWithArgV), 9784514f5e3Sopenharmony_ci { glue, func, thisValue, actualArgc, argv }); 9794514f5e3Sopenharmony_ci Jump(&exit); 9804514f5e3Sopenharmony_ci } 9814514f5e3Sopenharmony_ci Bind(&fastCallBridge); 9824514f5e3Sopenharmony_ci { 9834514f5e3Sopenharmony_ci result = CallNGCRuntime(glue, RTSTUB_ID(JSFastCallWithArgVAndPushArgv), 9844514f5e3Sopenharmony_ci { glue, func, thisValue, actualArgc, argv, expectedNum }); 9854514f5e3Sopenharmony_ci Jump(&exit); 9864514f5e3Sopenharmony_ci } 9874514f5e3Sopenharmony_ci } 9884514f5e3Sopenharmony_ci Bind(¬FastCall); 9894514f5e3Sopenharmony_ci { 9904514f5e3Sopenharmony_ci BRANCH(Int64Equal(expectedArgc, argc), &slowCall, &slowCallBridge); 9914514f5e3Sopenharmony_ci Bind(&slowCall); 9924514f5e3Sopenharmony_ci { 9934514f5e3Sopenharmony_ci result = CallNGCRuntime(glue, RTSTUB_ID(JSCallWithArgV), 9944514f5e3Sopenharmony_ci { glue, actualArgc, func, newTarget, thisValue, argv }); 9954514f5e3Sopenharmony_ci Jump(&exit); 9964514f5e3Sopenharmony_ci } 9974514f5e3Sopenharmony_ci Bind(&slowCallBridge); 9984514f5e3Sopenharmony_ci { 9994514f5e3Sopenharmony_ci result = CallNGCRuntime(glue, RTSTUB_ID(JSCallWithArgVAndPushArgv), 10004514f5e3Sopenharmony_ci { glue, actualArgc, func, newTarget, thisValue, argv }); 10014514f5e3Sopenharmony_ci Jump(&exit); 10024514f5e3Sopenharmony_ci } 10034514f5e3Sopenharmony_ci } 10044514f5e3Sopenharmony_ci Bind(&exit); 10054514f5e3Sopenharmony_ci Return(*result); 10064514f5e3Sopenharmony_ci} 10074514f5e3Sopenharmony_ci 10084514f5e3Sopenharmony_civoid GetSingleCharCodeByIndexStubBuilder::GenerateCircuit() 10094514f5e3Sopenharmony_ci{ 10104514f5e3Sopenharmony_ci GateRef str = TaggedArgument(1); 10114514f5e3Sopenharmony_ci GateRef index = Int32Argument(2); 10124514f5e3Sopenharmony_ci BuiltinsStringStubBuilder builder(this); 10134514f5e3Sopenharmony_ci GateRef result = builder.GetSingleCharCodeByIndex(str, index); 10144514f5e3Sopenharmony_ci Return(result); 10154514f5e3Sopenharmony_ci} 10164514f5e3Sopenharmony_ci 10174514f5e3Sopenharmony_civoid CreateStringBySingleCharCodeStubBuilder::GenerateCircuit() 10184514f5e3Sopenharmony_ci{ 10194514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 10204514f5e3Sopenharmony_ci GateRef charCode = Int32Argument(1); 10214514f5e3Sopenharmony_ci BuiltinsStringStubBuilder builder(this); 10224514f5e3Sopenharmony_ci GateRef result = builder.CreateStringBySingleCharCode(glue, charCode); 10234514f5e3Sopenharmony_ci Return(result); 10244514f5e3Sopenharmony_ci} 10254514f5e3Sopenharmony_ci 10264514f5e3Sopenharmony_civoid FastStringEqualStubBuilder::GenerateCircuit() 10274514f5e3Sopenharmony_ci{ 10284514f5e3Sopenharmony_ci auto env = GetEnvironment(); 10294514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 10304514f5e3Sopenharmony_ci GateRef str1 = TaggedArgument(1); 10314514f5e3Sopenharmony_ci GateRef str2 = Int32Argument(2); 10324514f5e3Sopenharmony_ci 10334514f5e3Sopenharmony_ci Label leftEqualRight(env); 10344514f5e3Sopenharmony_ci Label leftNotEqualRight(env); 10354514f5e3Sopenharmony_ci Label exit(env); 10364514f5e3Sopenharmony_ci DEFVARIABLE(result, VariableType::BOOL(), False()); 10374514f5e3Sopenharmony_ci BRANCH(Equal(str1, str2), &leftEqualRight, &leftNotEqualRight); 10384514f5e3Sopenharmony_ci Bind(&leftEqualRight); 10394514f5e3Sopenharmony_ci { 10404514f5e3Sopenharmony_ci result = True(); 10414514f5e3Sopenharmony_ci Jump(&exit); 10424514f5e3Sopenharmony_ci } 10434514f5e3Sopenharmony_ci Bind(&leftNotEqualRight); 10444514f5e3Sopenharmony_ci { 10454514f5e3Sopenharmony_ci result = FastStringEqual(glue, str1, str2); 10464514f5e3Sopenharmony_ci Jump(&exit); 10474514f5e3Sopenharmony_ci } 10484514f5e3Sopenharmony_ci Bind(&exit); 10494514f5e3Sopenharmony_ci Return(*result); 10504514f5e3Sopenharmony_ci} 10514514f5e3Sopenharmony_ci 10524514f5e3Sopenharmony_civoid FastStringAddStubBuilder::GenerateCircuit() 10534514f5e3Sopenharmony_ci{ 10544514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 10554514f5e3Sopenharmony_ci GateRef str1 = TaggedArgument(1); 10564514f5e3Sopenharmony_ci GateRef str2 = Int32Argument(2); 10574514f5e3Sopenharmony_ci 10584514f5e3Sopenharmony_ci BuiltinsStringStubBuilder builtinsStringStubBuilder(this); 10594514f5e3Sopenharmony_ci GateRef result = builtinsStringStubBuilder.StringConcat(glue, str1, str2); 10604514f5e3Sopenharmony_ci Return(result); 10614514f5e3Sopenharmony_ci} 10624514f5e3Sopenharmony_ci 10634514f5e3Sopenharmony_civoid DeleteObjectPropertyStubBuilder::GenerateCircuit() 10644514f5e3Sopenharmony_ci{ 10654514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 10664514f5e3Sopenharmony_ci GateRef object = TaggedArgument(1); 10674514f5e3Sopenharmony_ci GateRef prop = TaggedArgument(2); 10684514f5e3Sopenharmony_ci GateRef result = DeletePropertyOrThrow(glue, object, prop); 10694514f5e3Sopenharmony_ci Return(result); 10704514f5e3Sopenharmony_ci} 10714514f5e3Sopenharmony_ci 10724514f5e3Sopenharmony_civoid GetpropiteratorStubBuilder::GenerateCircuit() 10734514f5e3Sopenharmony_ci{ 10744514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 10754514f5e3Sopenharmony_ci GateRef object = TaggedArgument(1); 10764514f5e3Sopenharmony_ci NewObjectStubBuilder newBuilder(this); 10774514f5e3Sopenharmony_ci GateRef result = newBuilder.EnumerateObjectProperties(glue, object); 10784514f5e3Sopenharmony_ci Return(result); 10794514f5e3Sopenharmony_ci} 10804514f5e3Sopenharmony_ci 10814514f5e3Sopenharmony_civoid GetnextpropnameStubBuilder::GenerateCircuit() 10824514f5e3Sopenharmony_ci{ 10834514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 10844514f5e3Sopenharmony_ci GateRef iter = TaggedArgument(1); 10854514f5e3Sopenharmony_ci GateRef result = NextInternal(glue, iter); 10864514f5e3Sopenharmony_ci Return(result); 10874514f5e3Sopenharmony_ci} 10884514f5e3Sopenharmony_ci 10894514f5e3Sopenharmony_ci#define CREATE_ITERATOR_STUB_BUILDER(name, collection, iterationKind) \ 10904514f5e3Sopenharmony_civoid name##StubBuilder::GenerateCircuit() \ 10914514f5e3Sopenharmony_ci{ \ 10924514f5e3Sopenharmony_ci auto env = GetEnvironment(); \ 10934514f5e3Sopenharmony_ci Label exit(env); \ 10944514f5e3Sopenharmony_ci \ 10954514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); \ 10964514f5e3Sopenharmony_ci GateRef obj = TaggedArgument(1); \ 10974514f5e3Sopenharmony_ci DEFVARIABLE(result, VariableType::JS_ANY(), Undefined()); \ 10984514f5e3Sopenharmony_ci \ 10994514f5e3Sopenharmony_ci NewObjectStubBuilder newBuilder(this); \ 11004514f5e3Sopenharmony_ci newBuilder.SetGlue(glue); \ 11014514f5e3Sopenharmony_ci GateRef kind = Int32(static_cast<int32_t>(IterationKind::iterationKind)); \ 11024514f5e3Sopenharmony_ci newBuilder.CreateJSCollectionIterator<JS##collection##Iterator, JS##collection>(&result, &exit, obj, kind); \ 11034514f5e3Sopenharmony_ci Bind(&exit); \ 11044514f5e3Sopenharmony_ci Return(*result); \ 11054514f5e3Sopenharmony_ci} 11064514f5e3Sopenharmony_ci 11074514f5e3Sopenharmony_ciCREATE_ITERATOR_STUB_BUILDER(CreateJSSetIterator, Set, VALUE) 11084514f5e3Sopenharmony_ciCREATE_ITERATOR_STUB_BUILDER(JSSetEntries, Set, KEY_AND_VALUE) 11094514f5e3Sopenharmony_ciCREATE_ITERATOR_STUB_BUILDER(JSMapKeys, Map, KEY) 11104514f5e3Sopenharmony_ciCREATE_ITERATOR_STUB_BUILDER(JSMapValues, Map, VALUE) 11114514f5e3Sopenharmony_ciCREATE_ITERATOR_STUB_BUILDER(CreateJSMapIterator, Map, KEY_AND_VALUE) 11124514f5e3Sopenharmony_ci 11134514f5e3Sopenharmony_civoid StringIteratorNextStubBuilder::GenerateCircuit() 11144514f5e3Sopenharmony_ci{ 11154514f5e3Sopenharmony_ci auto env = GetEnvironment(); \ 11164514f5e3Sopenharmony_ci Label exit(env); 11174514f5e3Sopenharmony_ci Label slowpath(env); 11184514f5e3Sopenharmony_ci 11194514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 11204514f5e3Sopenharmony_ci GateRef obj = TaggedArgument(1); 11214514f5e3Sopenharmony_ci 11224514f5e3Sopenharmony_ci DEFVARIABLE(result, VariableType::JS_ANY(), Undefined()); 11234514f5e3Sopenharmony_ci 11244514f5e3Sopenharmony_ci BuiltinsStringStubBuilder builder(this); 11254514f5e3Sopenharmony_ci builder.StringIteratorNext(glue, obj, Gate::InvalidGateRef, &result, &exit, &slowpath); 11264514f5e3Sopenharmony_ci Bind(&slowpath); 11274514f5e3Sopenharmony_ci { 11284514f5e3Sopenharmony_ci result = CallRuntime(glue, RTSTUB_ID(StringIteratorNext), { obj }); 11294514f5e3Sopenharmony_ci Jump(&exit); 11304514f5e3Sopenharmony_ci } 11314514f5e3Sopenharmony_ci Bind(&exit); 11324514f5e3Sopenharmony_ci Return(*result); 11334514f5e3Sopenharmony_ci} 11344514f5e3Sopenharmony_ci 11354514f5e3Sopenharmony_civoid JSMapGetStubBuilder::GenerateCircuit() 11364514f5e3Sopenharmony_ci{ 11374514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 11384514f5e3Sopenharmony_ci GateRef obj = TaggedArgument(1); 11394514f5e3Sopenharmony_ci GateRef key = TaggedArgument(2U); 11404514f5e3Sopenharmony_ci 11414514f5e3Sopenharmony_ci LinkedHashTableStubBuilder<LinkedHashMap, LinkedHashMapObject> builder(this, glue); 11424514f5e3Sopenharmony_ci GateRef linkedTable = builder.GetLinked(obj); 11434514f5e3Sopenharmony_ci Return(builder.Get(linkedTable, key)); 11444514f5e3Sopenharmony_ci} 11454514f5e3Sopenharmony_ci 11464514f5e3Sopenharmony_civoid JSMapHasStubBuilder::GenerateCircuit() 11474514f5e3Sopenharmony_ci{ 11484514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 11494514f5e3Sopenharmony_ci GateRef obj = TaggedArgument(1); 11504514f5e3Sopenharmony_ci GateRef key = TaggedArgument(2U); 11514514f5e3Sopenharmony_ci 11524514f5e3Sopenharmony_ci LinkedHashTableStubBuilder<LinkedHashMap, LinkedHashMapObject> builder(this, glue); 11534514f5e3Sopenharmony_ci GateRef linkedTable = builder.GetLinked(obj); 11544514f5e3Sopenharmony_ci Return(builder.Has(linkedTable, key)); 11554514f5e3Sopenharmony_ci} 11564514f5e3Sopenharmony_ci 11574514f5e3Sopenharmony_civoid JSSetHasStubBuilder::GenerateCircuit() 11584514f5e3Sopenharmony_ci{ 11594514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 11604514f5e3Sopenharmony_ci GateRef obj = TaggedArgument(1); 11614514f5e3Sopenharmony_ci GateRef key = TaggedArgument(2U); 11624514f5e3Sopenharmony_ci 11634514f5e3Sopenharmony_ci LinkedHashTableStubBuilder<LinkedHashSet, LinkedHashSetObject> builder(this, glue); 11644514f5e3Sopenharmony_ci GateRef linkedTable = builder.GetLinked(obj); 11654514f5e3Sopenharmony_ci Return(builder.Has(linkedTable, key)); 11664514f5e3Sopenharmony_ci} 11674514f5e3Sopenharmony_ci 11684514f5e3Sopenharmony_civoid CreateJSTypedArrayEntriesStubBuilder::GenerateCircuit() 11694514f5e3Sopenharmony_ci{ 11704514f5e3Sopenharmony_ci auto env = GetEnvironment(); 11714514f5e3Sopenharmony_ci Label exit(env); 11724514f5e3Sopenharmony_ci 11734514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 11744514f5e3Sopenharmony_ci GateRef obj = TaggedArgument(1); 11754514f5e3Sopenharmony_ci DEFVARIABLE(result, VariableType::JS_ANY(), Undefined()); 11764514f5e3Sopenharmony_ci 11774514f5e3Sopenharmony_ci NewObjectStubBuilder newBuilder(this); 11784514f5e3Sopenharmony_ci newBuilder.SetGlue(glue); 11794514f5e3Sopenharmony_ci GateRef kind = Int32(static_cast<int32_t>(IterationKind::KEY_AND_VALUE)); 11804514f5e3Sopenharmony_ci newBuilder.CreateJSTypedArrayIterator(&result, &exit, obj, kind); 11814514f5e3Sopenharmony_ci Bind(&exit); 11824514f5e3Sopenharmony_ci Return(*result); 11834514f5e3Sopenharmony_ci} 11844514f5e3Sopenharmony_ci 11854514f5e3Sopenharmony_civoid CreateJSTypedArrayKeysStubBuilder::GenerateCircuit() 11864514f5e3Sopenharmony_ci{ 11874514f5e3Sopenharmony_ci auto env = GetEnvironment(); 11884514f5e3Sopenharmony_ci Label exit(env); 11894514f5e3Sopenharmony_ci 11904514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 11914514f5e3Sopenharmony_ci GateRef obj = TaggedArgument(1); 11924514f5e3Sopenharmony_ci DEFVARIABLE(result, VariableType::JS_ANY(), Undefined()); 11934514f5e3Sopenharmony_ci 11944514f5e3Sopenharmony_ci NewObjectStubBuilder newBuilder(this); 11954514f5e3Sopenharmony_ci newBuilder.SetGlue(glue); 11964514f5e3Sopenharmony_ci GateRef kind = Int32(static_cast<int32_t>(IterationKind::KEY)); 11974514f5e3Sopenharmony_ci newBuilder.CreateJSTypedArrayIterator(&result, &exit, obj, kind); 11984514f5e3Sopenharmony_ci Bind(&exit); 11994514f5e3Sopenharmony_ci Return(*result); 12004514f5e3Sopenharmony_ci} 12014514f5e3Sopenharmony_ci 12024514f5e3Sopenharmony_civoid CreateJSTypedArrayValuesStubBuilder::GenerateCircuit() 12034514f5e3Sopenharmony_ci{ 12044514f5e3Sopenharmony_ci auto env = GetEnvironment(); 12054514f5e3Sopenharmony_ci Label exit(env); 12064514f5e3Sopenharmony_ci 12074514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 12084514f5e3Sopenharmony_ci GateRef obj = TaggedArgument(1); 12094514f5e3Sopenharmony_ci DEFVARIABLE(result, VariableType::JS_ANY(), Undefined()); 12104514f5e3Sopenharmony_ci 12114514f5e3Sopenharmony_ci NewObjectStubBuilder newBuilder(this); 12124514f5e3Sopenharmony_ci newBuilder.SetGlue(glue); 12134514f5e3Sopenharmony_ci GateRef kind = Int32(static_cast<int32_t>(IterationKind::VALUE)); 12144514f5e3Sopenharmony_ci newBuilder.CreateJSTypedArrayIterator(&result, &exit, obj, kind); 12154514f5e3Sopenharmony_ci Bind(&exit); 12164514f5e3Sopenharmony_ci Return(*result); 12174514f5e3Sopenharmony_ci} 12184514f5e3Sopenharmony_ci 12194514f5e3Sopenharmony_civoid JSMapDeleteStubBuilder::GenerateCircuit() 12204514f5e3Sopenharmony_ci{ 12214514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 12224514f5e3Sopenharmony_ci GateRef obj = TaggedArgument(1); 12234514f5e3Sopenharmony_ci GateRef key = TaggedArgument(2U); 12244514f5e3Sopenharmony_ci 12254514f5e3Sopenharmony_ci LinkedHashTableStubBuilder<LinkedHashMap, LinkedHashMapObject> builder(this, glue); 12264514f5e3Sopenharmony_ci GateRef linkedTable = builder.GetLinked(obj); 12274514f5e3Sopenharmony_ci Return(builder.Delete(linkedTable, key)); 12284514f5e3Sopenharmony_ci} 12294514f5e3Sopenharmony_ci 12304514f5e3Sopenharmony_civoid JSSetDeleteStubBuilder::GenerateCircuit() 12314514f5e3Sopenharmony_ci{ 12324514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 12334514f5e3Sopenharmony_ci GateRef obj = TaggedArgument(1); 12344514f5e3Sopenharmony_ci GateRef key = TaggedArgument(2U); 12354514f5e3Sopenharmony_ci 12364514f5e3Sopenharmony_ci LinkedHashTableStubBuilder<LinkedHashSet, LinkedHashSetObject> builder(this, glue); 12374514f5e3Sopenharmony_ci GateRef linkedTable = builder.GetLinked(obj); 12384514f5e3Sopenharmony_ci Return(builder.Delete(linkedTable, key)); 12394514f5e3Sopenharmony_ci} 12404514f5e3Sopenharmony_ci 12414514f5e3Sopenharmony_civoid JSSetAddStubBuilder::GenerateCircuit() 12424514f5e3Sopenharmony_ci{ 12434514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 12444514f5e3Sopenharmony_ci GateRef obj = TaggedArgument(1); 12454514f5e3Sopenharmony_ci GateRef key = TaggedArgument(2U); 12464514f5e3Sopenharmony_ci 12474514f5e3Sopenharmony_ci LinkedHashTableStubBuilder<LinkedHashSet, LinkedHashSetObject> builder(this, glue); 12484514f5e3Sopenharmony_ci GateRef linkedTable = builder.GetLinked(obj); 12494514f5e3Sopenharmony_ci GateRef newTable = builder.Insert(linkedTable, key, key); 12504514f5e3Sopenharmony_ci builder.Store(VariableType::JS_ANY(), glue, obj, IntPtr(JSSet::LINKED_SET_OFFSET), newTable); 12514514f5e3Sopenharmony_ci Return(obj); 12524514f5e3Sopenharmony_ci} 12534514f5e3Sopenharmony_ci 12544514f5e3Sopenharmony_civoid SameValueStubBuilder::GenerateCircuit() 12554514f5e3Sopenharmony_ci{ 12564514f5e3Sopenharmony_ci GateRef glue = PtrArgument(0); 12574514f5e3Sopenharmony_ci GateRef left = TaggedArgument(1); 12584514f5e3Sopenharmony_ci GateRef right = TaggedArgument(2U); 12594514f5e3Sopenharmony_ci GateRef result = SameValue(glue, left, right); 12604514f5e3Sopenharmony_ci Return(result); 12614514f5e3Sopenharmony_ci} 12624514f5e3Sopenharmony_ci 12634514f5e3Sopenharmony_ciCallSignature CommonStubCSigns::callSigns_[CommonStubCSigns::NUM_OF_STUBS]; 12644514f5e3Sopenharmony_ci 12654514f5e3Sopenharmony_civoid CommonStubCSigns::Initialize() 12664514f5e3Sopenharmony_ci{ 12674514f5e3Sopenharmony_ci#define INIT_SIGNATURES(name) \ 12684514f5e3Sopenharmony_ci name##CallSignature::Initialize(&callSigns_[name]); \ 12694514f5e3Sopenharmony_ci callSigns_[name].SetID(name); \ 12704514f5e3Sopenharmony_ci callSigns_[name].SetName(std::string("COStub_") + #name); \ 12714514f5e3Sopenharmony_ci callSigns_[name].SetConstructor( \ 12724514f5e3Sopenharmony_ci [](void* env) { \ 12734514f5e3Sopenharmony_ci return static_cast<void*>( \ 12744514f5e3Sopenharmony_ci new name##StubBuilder(&callSigns_[name], static_cast<Environment*>(env))); \ 12754514f5e3Sopenharmony_ci }); 12764514f5e3Sopenharmony_ci 12774514f5e3Sopenharmony_ci COMMON_STUB_ID_LIST(INIT_SIGNATURES) 12784514f5e3Sopenharmony_ci#undef INIT_SIGNATURES 12794514f5e3Sopenharmony_ci} 12804514f5e3Sopenharmony_ci 12814514f5e3Sopenharmony_civoid CommonStubCSigns::GetCSigns(std::vector<const CallSignature*>& outCSigns) 12824514f5e3Sopenharmony_ci{ 12834514f5e3Sopenharmony_ci for (size_t i = 0; i < NUM_OF_STUBS; i++) { 12844514f5e3Sopenharmony_ci outCSigns.push_back(&callSigns_[i]); 12854514f5e3Sopenharmony_ci } 12864514f5e3Sopenharmony_ci} 12874514f5e3Sopenharmony_ci} // namespace panda::ecmascript::kungfu 1288