!5047 Revert 4973 "Bugfix for GetObjectLiteralFromCache" And 4938 "Optimize CreateObjectWithBuffer"

Merge pull request !5047 from herongpeng/revert_4973
This commit is contained in:
openharmony_ci 2023-10-24 14:31:54 +00:00 committed by Gitee
commit 6c27328048
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
15 changed files with 17 additions and 359 deletions

View File

@ -684,67 +684,4 @@ void BuiltinsObjectStubBuilder::Assign(Variable *result, Label *exit, Label *slo
}
}
}
GateRef BuiltinsObjectStubBuilder::CloneObjectLiteral(GateRef glue, GateRef objLiteral)
{
auto env = GetEnvironment();
Label entry(env);
Label loopHead(env);
Label loopExit(env);
Label loopBack(env);
env->SubCfgEntry(&entry);
auto klass = LoadHClass(objLiteral);
NewObjectStubBuilder objBuilder(this);
auto newObj = objBuilder.NewJSObject(glue, klass);
auto elements = GetElementsArray(objLiteral);
auto newElements = CloneProperties(glue, elements);
SetElementsArray(VariableType::JS_ANY(), glue, newObj, newElements);
auto properties = GetPropertiesArray(objLiteral);
auto newProperties = CloneProperties(glue, properties);
SetPropertiesArray(VariableType::JS_ANY(), glue, newObj, newProperties);
auto inlinedProperties = GetInlinedPropertiesFromHClass(klass);
DEFVARIABLE(idx, VariableType::INT32(), Int32(0));
Jump(&loopHead);
LoopBegin(&loopHead);
Branch(Int32UnsignedLessThan(*idx, inlinedProperties), &loopBack, &loopExit);
Bind(&loopBack);
{
auto value = GetPropertyInlinedProps(objLiteral, klass, *idx);
SetPropertyInlinedProps(glue, newObj, klass, value, *idx, VariableType::JS_ANY());
idx = Int32Add(*idx, Int32(1));
LoopEnd(&loopHead);
}
Bind(&loopExit);
env->SubCfgExit();
return newObj;
}
GateRef BuiltinsObjectStubBuilder::CloneProperties(GateRef glue, GateRef old)
{
auto env = GetEnvironment();
Label entry(env);
env->SubCfgEntry(&entry);
DEFVARIABLE(res, VariableType::JS_ANY(), Hole());
DEFVARIABLE(idx, VariableType::INT32(), Int32(0));
auto newLength = GetLengthOfTaggedArray(old);
Label exit(env);
Label loopHead(env);
Label loopBack(env);
NewObjectStubBuilder newObjBuilder(GetEnvironment());
auto newArray = newObjBuilder.NewTaggedArray(glue, newLength);
Jump(&loopHead);
LoopBegin(&loopHead);
Branch(Int32UnsignedLessThan(*idx, newLength), &loopBack, &exit);
Bind(&loopBack);
auto value = GetValueFromTaggedArray(old, *idx);
SetValueToTaggedArray(VariableType::JS_ANY(), glue, newArray, *idx, value);
idx = Int32Add(*idx, Int32(1));
LoopEnd(&loopHead);
Bind(&exit);
env->SubCfgExit();
return newArray;
}
} // namespace panda::ecmascript::kungfu

View File

@ -32,8 +32,6 @@ public:
void ToString(Variable *result, Label *exit, Label *slowPath);
void Create(Variable *result, Label *exit, Label *slowPath);
void Assign(Variable *result, Label *exit, Label *slowPath);
GateRef CloneObjectLiteral(GateRef glue, GateRef objLiteral);
GateRef CloneProperties(GateRef glue, GateRef old);
private:
GateRef OrdinaryNewJSObjectCreate(GateRef proto);

View File

@ -26,7 +26,6 @@
#include "ecmascript/global_env.h"
#include "ecmascript/js_thread.h"
#include "ecmascript/js_function.h"
#include "ecmascript/jspandafile/program_object.h"
#include "ecmascript/mem/region.h"
#include "ecmascript/method.h"
@ -564,19 +563,13 @@ GateRef CircuitBuilder::GetObjectFromConstPool(GateRef glue, GateRef hirGate, Ga
}
} else if (type == ConstPoolType::OBJECT_LITERAL) {
Label isAOTLiteralInfo(env_);
Label notAotLiteralInfo(env_);
Branch(IsAOTLiteralInfo(*result), &isAOTLiteralInfo, &notAotLiteralInfo);
Branch(IsAOTLiteralInfo(*result), &isAOTLiteralInfo, &exit);
Bind(&isAOTLiteralInfo);
{
result = CallRuntime(glue, RTSTUB_ID(GetObjectLiteralFromCache), Gate::InvalidGateRef,
{ constPool, Int32ToTaggedInt(index), module }, hirGate);
Jump(&exit);
}
Bind(&notAotLiteralInfo);
{
result = GetValueFromTaggedArray(cacheValue, Int32(ConstantPool::OBJECT_LITERAL_INFO_OBJECT_INDEX));
Jump(&exit);
}
} else {
Jump(&exit);
}
@ -587,57 +580,6 @@ GateRef CircuitBuilder::GetObjectFromConstPool(GateRef glue, GateRef hirGate, Ga
return ret;
}
GateRef CircuitBuilder::GetObjectInfoFromConstPool(GateRef glue, GateRef hirGate, GateRef jsFunc, GateRef index,
ConstPoolType type)
{
GateRef constPool = GetConstPoolFromFunction(jsFunc);
GateRef module = GetModuleFromFunction(jsFunc);
return GetObjectInfoFromConstPool(glue, hirGate, constPool, module, index, type);
}
GateRef CircuitBuilder::GetObjectInfoFromConstPool(GateRef glue, GateRef hirGate, GateRef constPool, GateRef module,
GateRef index, ConstPoolType type)
{
Label entry(env_);
SubCfgEntry(&entry);
Label exit(env_);
Label cacheMiss(env_);
Label cache(env_);
auto cacheValue = GetValueFromTaggedArray(constPool, index);
DEFVAlUE(result, env_, VariableType::JS_ANY(), cacheValue);
Branch(BoolOr(TaggedIsHole(*result), TaggedIsNullPtr(*result)), &cacheMiss, &cache);
Bind(&cacheMiss);
{
if (type == ConstPoolType::OBJECT_LITERAL) {
result = CallRuntime(glue, RTSTUB_ID(GetObjectLiteralInfoFromCache), Gate::InvalidGateRef,
{ constPool, Int32ToTaggedInt(index), module }, hirGate);
} else {
UNREACHABLE();
}
Jump(&exit);
}
Bind(&cache);
{
if (type == ConstPoolType::OBJECT_LITERAL) {
Label isAOTLiteralInfo(env_);
Branch(IsAOTLiteralInfo(*result), &isAOTLiteralInfo, &exit);
Bind(&isAOTLiteralInfo);
{
result = CallRuntime(glue, RTSTUB_ID(GetObjectLiteralInfoFromCache), Gate::InvalidGateRef,
{ constPool, Int32ToTaggedInt(index), module }, hirGate);
Jump(&exit);
}
} else {
UNREACHABLE();
}
}
Bind(&exit);
auto ret = *result;
SubCfgExit();
return ret;
}
GateRef CircuitBuilder::GetFunctionLexicalEnv(GateRef function)
{
return Load(VariableType::JS_POINTER(), function, IntPtr(JSFunction::LEXICAL_ENV_OFFSET));

View File

@ -220,10 +220,6 @@ public:
GateRef GetObjectFromConstPool(GateRef glue, GateRef hirGate, GateRef jsFunc, GateRef index, ConstPoolType type);
GateRef GetObjectFromConstPool(GateRef glue, GateRef hirGate, GateRef constPool, GateRef module, GateRef index,
ConstPoolType type);
GateRef GetObjectInfoFromConstPool(GateRef glue, GateRef hirGate, GateRef jsFunc,
GateRef index, ConstPoolType type);
GateRef GetObjectInfoFromConstPool(GateRef glue, GateRef hirGate, GateRef constPool,
GateRef module, GateRef index, ConstPoolType type);
GateRef GetFunctionLexicalEnv(GateRef function);
GateRef GetGlobalEnv();
GateRef GetGlobalEnvObj(GateRef env, size_t index);

View File

@ -17,7 +17,6 @@
#include "ecmascript/base/number_helper.h"
#include "ecmascript/compiler/access_object_stub_builder.h"
#include "ecmascript/compiler/bc_call_signature.h"
#include "ecmascript/compiler/builtins/builtins_object_stub_builder.h"
#include "ecmascript/compiler/ic_stub_builder.h"
#include "ecmascript/compiler/interpreter_stub-inl.h"
#include "ecmascript/compiler/llvm_ir_builder.h"
@ -33,7 +32,6 @@
#include "ecmascript/js_array.h"
#include "ecmascript/js_function.h"
#include "ecmascript/js_generator_object.h"
#include "ecmascript/jspandafile/program_object.h"
#include "ecmascript/message_string.h"
#include "ecmascript/tagged_hash_table.h"
#include "libpandafile/bytecode_instruction-inl.h"
@ -3943,66 +3941,26 @@ DECLARE_ASM_HANDLER(HandleDeprecatedCreatearraywithbufferPrefImm16)
DECLARE_ASM_HANDLER(HandleCreateobjectwithbufferImm8Id16)
{
auto env = GetEnvironment();
GateRef imm = ZExtInt16ToInt32(ReadInst16_1(pc));
GateRef currentFunc = GetFunctionFromFrame(GetFrame(sp));
GateRef module = GetModuleFromFunction(currentFunc);
GateRef fixedArray = GetObjectLiteralInfoFromConstPool(glue, constpool, imm, module);
GateRef result = GetValueFromTaggedArray(fixedArray, Int32(ConstantPool::OBJECT_LITERAL_INFO_OBJECT_INDEX));
GateRef hasMethod = GetValueFromTaggedArray(fixedArray, Int32(ConstantPool::OBJECT_LITERAL_INFO_HAS_METHOD_INDEX));
DEFVARIABLE(res, VariableType::JS_ANY(), Hole());
Label fastpath(env);
Label slowpath(env);
Label dispatch(env);
GateRef flag = BoolOr(IsDictionaryModeByHClass(LoadHClass(result)), TaggedIsTrue(hasMethod));
Branch(flag, &slowpath, &fastpath);
Bind(&slowpath);
{
GateRef currentEnv = GetEnvFromFrame(GetFrame(sp));
res = CallRuntime(glue, RTSTUB_ID(CreateObjectHavingMethod), { result, currentEnv });
Jump(&dispatch);
}
Bind(&fastpath);
{
BuiltinsObjectStubBuilder builder(this);
res = builder.CloneObjectLiteral(glue, result);
Jump(&dispatch);
}
Bind(&dispatch);
callback.ProfileCreateObject(*res);
CHECK_EXCEPTION_WITH_ACC(*res, INT_PTR(CREATEOBJECTWITHBUFFER_IMM8_ID16));
GateRef result = GetObjectLiteralFromConstPool(glue, constpool, imm, module);
GateRef currentEnv = GetEnvFromFrame(GetFrame(sp));
GateRef res = CallRuntime(glue, RTSTUB_ID(CreateObjectHavingMethod), { result, currentEnv });
callback.ProfileCreateObject(res);
CHECK_EXCEPTION_WITH_ACC(res, INT_PTR(CREATEOBJECTWITHBUFFER_IMM8_ID16));
}
DECLARE_ASM_HANDLER(HandleCreateobjectwithbufferImm16Id16)
{
auto env = GetEnvironment();
GateRef imm = ZExtInt16ToInt32(ReadInst16_2(pc));
GateRef currentFunc = GetFunctionFromFrame(GetFrame(sp));
GateRef module = GetModuleFromFunction(currentFunc);
GateRef fixedArray = GetObjectLiteralInfoFromConstPool(glue, constpool, imm, module);
GateRef result = GetValueFromTaggedArray(fixedArray, Int32(ConstantPool::OBJECT_LITERAL_INFO_OBJECT_INDEX));
GateRef hasMethod = GetValueFromTaggedArray(fixedArray, Int32(ConstantPool::OBJECT_LITERAL_INFO_HAS_METHOD_INDEX));
DEFVARIABLE(res, VariableType::JS_ANY(), Hole());
Label fastpath(env);
Label slowpath(env);
Label dispatch(env);
GateRef flag = BoolOr(IsDictionaryModeByHClass(LoadHClass(result)), TaggedIsTrue(hasMethod));
Branch(flag, &slowpath, &fastpath);
Bind(&slowpath);
{
GateRef currentEnv = GetEnvFromFrame(GetFrame(sp));
res = CallRuntime(glue, RTSTUB_ID(CreateObjectHavingMethod), { result, currentEnv });
Jump(&dispatch);
}
Bind(&fastpath);
{
BuiltinsObjectStubBuilder builder(this);
res = builder.CloneObjectLiteral(glue, result);
Jump(&dispatch);
}
Bind(&dispatch);
callback.ProfileCreateObject(*res);
CHECK_EXCEPTION_WITH_ACC(*res, INT_PTR(CREATEOBJECTWITHBUFFER_IMM16_ID16));
GateRef result = GetObjectLiteralFromConstPool(glue, constpool, imm, module);
GateRef currentEnv = GetEnvFromFrame(GetFrame(sp));
GateRef res = CallRuntime(glue, RTSTUB_ID(CreateObjectHavingMethod), { result, currentEnv });
callback.ProfileCreateObject(res);
CHECK_EXCEPTION_WITH_ACC(res, INT_PTR(CREATEOBJECTWITHBUFFER_IMM16_ID16));
}
DECLARE_ASM_HANDLER(HandleDeprecatedCreateobjectwithbufferPrefImm16)

View File

@ -1010,11 +1010,6 @@ inline GateRef StubBuilder::GetExtractLengthOfTaggedArray(GateRef array)
return Load(VariableType::INT32(), array, IntPtr(TaggedArray::EXTRACT_LENGTH_OFFSET));
}
inline void StubBuilder::SetExtractLengthOfTaggedArray(GateRef glue, GateRef array, GateRef extraLength)
{
return Store(VariableType::INT32(), glue, array, IntPtr(TaggedArray::EXTRACT_LENGTH_OFFSET), extraLength);
}
inline GateRef StubBuilder::IsJSHClass(GateRef obj)
{
ASM_ASSERT(GET_MESSAGE_STRING_ID(IsJSHClass), TaggedIsHeapObject(obj));

View File

@ -5438,13 +5438,6 @@ GateRef StubBuilder::GetObjectLiteralFromConstPool(GateRef glue, GateRef constpo
ConstPoolType::OBJECT_LITERAL);
}
GateRef StubBuilder::GetObjectLiteralInfoFromConstPool(GateRef glue, GateRef constpool, GateRef index, GateRef module)
{
GateRef hirGate = Circuit::NullGate();
return env_->GetBuilder()->GetObjectInfoFromConstPool(glue, hirGate, constpool, module, index,
ConstPoolType::OBJECT_LITERAL);
}
GateRef StubBuilder::JSAPIContainerGet(GateRef glue, GateRef receiver, GateRef index)
{
auto env = GetEnvironment();

View File

@ -290,7 +290,6 @@ public:
void SetHash(GateRef glue, GateRef object, GateRef hash);
GateRef GetLengthOfTaggedArray(GateRef array);
GateRef GetExtractLengthOfTaggedArray(GateRef array);
void SetExtractLengthOfTaggedArray(GateRef glue, GateRef array, GateRef extraLength);
// object operation
GateRef IsJSHClass(GateRef obj);
GateRef LoadHClass(GateRef object);
@ -604,7 +603,6 @@ public:
GateRef GetMethodFromConstPool(GateRef glue, GateRef constpool, GateRef index, GateRef module);
GateRef GetArrayLiteralFromConstPool(GateRef glue, GateRef constpool, GateRef index, GateRef module);
GateRef GetObjectLiteralFromConstPool(GateRef glue, GateRef constpool, GateRef index, GateRef module);
GateRef GetObjectLiteralInfoFromConstPool(GateRef glue, GateRef constpool, GateRef index, GateRef module);
void SetExtensibleToBitfield(GateRef glue, GateRef obj, bool isExtensible);
// fast path

View File

@ -32,6 +32,7 @@
#include "ecmascript/pgo_profiler/pgo_utils.h"
#include "libpandafile/class_data_accessor-inl.h"
#include "libpandafile/index_accessor.h"
namespace panda {
namespace ecmascript {
class JSThread;
@ -73,10 +74,6 @@ class ConstantPool : public TaggedArray {
public:
static constexpr size_t JS_PANDA_FILE_INDEX = 1; // not need gc
static constexpr size_t INDEX_HEADER_INDEX = 2; // not need gc
static constexpr size_t OBJECT_LITERAL_INFO_OBJECT_INDEX = 0;
static constexpr size_t OBJECT_LITERAL_INFO_HAS_METHOD_INDEX = 1;
static constexpr size_t KEY_VALUE_PAIR_VALUE_OFFSET = 1;
static constexpr size_t KEY_VALUE_PAIR_SIZE = 2;
static constexpr size_t CONSTANT_INDEX_INFO_INDEX = 3;
static constexpr size_t RESERVED_POOL_LENGTH = INDEX_HEADER_INDEX; // divide the gc area
@ -271,14 +268,14 @@ public:
}
template <ConstPoolType type>
static JSTaggedValue GetLiteralInfoFromCache(JSThread *thread, JSTaggedValue constpool,
uint32_t index, CString entry)
static JSTaggedValue GetLiteralFromCache(JSThread *thread, JSTaggedValue constpool, uint32_t index, CString entry)
{
static_assert(type == ConstPoolType::OBJECT_LITERAL || type == ConstPoolType::ARRAY_LITERAL);
[[maybe_unused]] EcmaHandleScope handleScope(thread);
const ConstantPool *taggedPool = ConstantPool::Cast(constpool.GetTaggedObject());
auto val = taggedPool->GetObjectFromCache(index);
JSPandaFile *jsPandaFile = taggedPool->GetJSPandaFile();
// For AOT
bool isLoadedAOT = jsPandaFile->IsLoadedAOT();
JSHandle<AOTLiteralInfo> entryIndexes(thread, JSTaggedValue::Undefined());
@ -307,28 +304,13 @@ public:
JSHandle<JSObject> obj = JSObject::CreateObjectFromProperties(thread, properties, ihcVal);
JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined());
JSMutableHandle<JSTaggedValue> valueHandle(thread, JSTaggedValue::Undefined());
bool hasMethod = false;
size_t propertiesLen = properties->GetLength();
for (size_t i = 0; i < propertiesLen; i += ConstantPool::KEY_VALUE_PAIR_SIZE) {
key.Update(properties->Get(i));
if (key->IsHole()) {
break;
}
valueHandle.Update(properties->Get(i + ConstantPool::KEY_VALUE_PAIR_VALUE_OFFSET));
if (key->IsJSFunction() || valueHandle->IsJSFunction()) {
hasMethod = true;
}
}
size_t elementsLen = elements->GetLength();
for (size_t i = 0; i < elementsLen; i += ConstantPool::KEY_VALUE_PAIR_SIZE) {
for (size_t i = 0; i < elementsLen; i += 2) { // 2: Each literal buffer has a pair of key-value.
key.Update(elements->Get(i));
if (key->IsHole()) {
break;
}
valueHandle.Update(elements->Get(i + ConstantPool::KEY_VALUE_PAIR_VALUE_OFFSET));
if (key->IsJSFunction() || valueHandle->IsJSFunction()) {
hasMethod = true;
}
valueHandle.Update(elements->Get(i + 1));
JSObject::DefinePropertyByLiteral(thread, obj, key, valueHandle);
}
if (thread->GetEcmaVM()->IsEnablePGOProfiler()) {
@ -338,13 +320,7 @@ public:
thread->GetEcmaVM()->GetPGOProfiler()->ProfileCreateObject(obj.GetTaggedType(), abcId,
id.GetOffset());
}
JSHandle<TaggedArray> fixedArray =
thread->GetEcmaVM()->GetFactory()->NewTaggedArray(2); // 2: object + hasMethod
// new fixed array
fixedArray->Set(thread, ConstantPool::OBJECT_LITERAL_INFO_OBJECT_INDEX, obj);
fixedArray->Set(thread, ConstantPool::OBJECT_LITERAL_INFO_HAS_METHOD_INDEX,
hasMethod ? JSTaggedValue::True() : JSTaggedValue::False());
val = fixedArray.GetTaggedValue();
val = obj.GetTaggedValue();
break;
}
case ConstPoolType::ARRAY_LITERAL: {
@ -365,16 +341,7 @@ public:
}
constpoolHandle->SetObjectToCache(thread, index, val);
}
return val;
}
template <ConstPoolType type>
static JSTaggedValue GetLiteralFromCache(JSThread *thread, JSTaggedValue constpool, uint32_t index, CString entry)
{
auto val = GetLiteralInfoFromCache<type>(thread, constpool, index, entry);
if (type == ConstPoolType::OBJECT_LITERAL) {
return JSHandle<TaggedArray>(thread, val)->Get(ConstantPool::OBJECT_LITERAL_INFO_OBJECT_INDEX);
}
return val;
}
@ -393,14 +360,6 @@ public:
return GetLiteralFromCache<type>(thread, constpool, index, entry);
}
template <ConstPoolType type>
static JSTaggedValue GetLiteralInfoFromCache(JSThread *thread, JSTaggedValue constpool,
uint32_t index, JSTaggedValue module)
{
CString entry = ModuleManager::GetRecordName(module);
return GetLiteralInfoFromCache<type>(thread, constpool, index, entry);
}
static JSTaggedValue PUBLIC_API GetStringFromCache(JSThread *thread, JSTaggedValue constpool, uint32_t index)
{
const ConstantPool *taggedPool = ConstantPool::Cast(constpool.GetTaggedObject());

View File

@ -899,16 +899,6 @@ DEF_RUNTIME_STUBS(GetObjectLiteralFromCache)
thread, constpool.GetTaggedValue(), index.GetInt(), module.GetTaggedValue()).GetRawData();
}
DEF_RUNTIME_STUBS(GetObjectLiteralInfoFromCache)
{
RUNTIME_STUBS_HEADER(GetObjectLiteralInfoFromCache);
JSHandle<JSTaggedValue> constpool = GetHArg<JSTaggedValue>(argv, argc, 0); // 0: means the zeroth parameter
JSTaggedValue index = GetArg(argv, argc, 1); // 1: means the first parameter
JSHandle<JSTaggedValue> module = GetHArg<JSTaggedValue>(argv, argc, 2); // 2: means the second parameter
return ConstantPool::GetLiteralInfoFromCache<ConstPoolType::OBJECT_LITERAL>(
thread, constpool.GetTaggedValue(), index.GetInt(), module.GetTaggedValue()).GetRawData();
}
DEF_RUNTIME_STUBS(GetArrayLiteralFromCache)
{
RUNTIME_STUBS_HEADER(GetArrayLiteralFromCache);

View File

@ -306,7 +306,6 @@ using FastCallAotEntryType = JSTaggedValue (*)(uintptr_t glue, uint32_t argc, co
V(GetMethodFromCache) \
V(GetArrayLiteralFromCache) \
V(GetObjectLiteralFromCache) \
V(GetObjectLiteralInfoFromCache) \
V(GetStringFromCache) \
V(OptLdSuperByValue) \
V(OptStSuperByValue) \

View File

@ -39,7 +39,6 @@ group("ark_js_moduletest") {
"concurrent",
"container",
"createarray",
"createobjectwithbuffer",
"dataproperty",
"datecase",
"datecompare",
@ -176,7 +175,6 @@ group("ark_asm_test") {
"compareobjecthclass",
"concurrent",
"container",
"createobjectwithbuffer",
"dataproperty",
"dateparse",
"decodeuricomponent",
@ -293,7 +291,6 @@ group("ark_asm_single_step_test") {
"compareobjecthclass",
"concurrent",
"container",
"createobjectwithbuffer",
"dataproperty",
"dynamicimport",
"dyninstruction",

View File

@ -1,18 +0,0 @@
# 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.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_moduletest_action("createobjectwithbuffer") {
deps = []
}

View File

@ -1,64 +0,0 @@
/*
* 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.
*/
/*
* @tc.name:createobjectwithbuffer
* @tc.desc:test createobjectwithbuffer
* @tc.type: FUNC
* @tc.require: issueI84U4E
*/
function logit(a) {
print(a.x)
print(a.y)
print(a[0])
print(a[1])
}
function foo() {
for (let i = 0; i < 1; ++i) {
let a = {
x : 1,
y : "tik",
z() { return 666 },
0 : 0,
1 : 1,
}
logit(a)
}
}
function goo() {
let a = {
x : 1,
y : "yyy",
0 : 0,
1 : 1,
}
logit(a)
}
function hoo() {
for (let i = 0; i < 1; ++i) {
let a = {
444444444444 : 16,
}
print(a[444444444444]);
}
}
foo();
goo();
hoo();

View File

@ -1,22 +0,0 @@
# 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.
1
tik
0
1
1
yyy
0
1
16