From d7ea2f331393f511263f9bf2b77ac03e563b8a9a Mon Sep 17 00:00:00 2001 From: lifansheng Date: Mon, 13 Sep 2021 13:02:38 +0800 Subject: [PATCH 1/3] modify IC and host_test Signed-off-by: lifansheng --- ecmascript/interpreter/slow_runtime_stub.cpp | 14 +++----------- test/moduletest/globalrecord/globalrecord.js | 2 +- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/ecmascript/interpreter/slow_runtime_stub.cpp b/ecmascript/interpreter/slow_runtime_stub.cpp index 7b41340d62..e1539f02fd 100644 --- a/ecmascript/interpreter/slow_runtime_stub.cpp +++ b/ecmascript/interpreter/slow_runtime_stub.cpp @@ -1280,22 +1280,14 @@ JSTaggedValue SlowRuntimeStub::TryLdGlobalByName(JSThread *thread, JSTaggedValue { INTERPRETER_TRACE(thread, Trygetobjprop); [[maybe_unused]] EcmaHandleScope handleScope(thread); - + JSHandle obj(thread, global.GetTaggedObject()->GetClass()->GetPrototype()); JSHandle propHandle(thread, prop); OperationResult res = JSTaggedValue::GetProperty(thread, obj, propHandle); - if (res.GetPropertyMetaData().IsFound()) { - return res.GetValue().GetTaggedValue(); - } - - EcmaVM *vm = thread->GetEcmaVM(); - JSHandle env = vm->GetGlobalEnv(); - NameDictionary *dict = NameDictionary::Cast(env->GetGlobalRecord()->GetTaggedObject()); - int entry = dict->FindEntry(propHandle.GetTaggedValue()); - if (entry == -1) { + if (!res.GetPropertyMetaData().IsFound()) { return ThrowReferenceError(thread, prop, " is not defined"); } - return dict->GetValue(entry); + return res.GetValue().GetTaggedValue(); } JSTaggedValue SlowRuntimeStub::TryStGlobalByName(JSThread *thread, JSTaggedValue prop) diff --git a/test/moduletest/globalrecord/globalrecord.js b/test/moduletest/globalrecord/globalrecord.js index 0081051128..da96a2a755 100755 --- a/test/moduletest/globalrecord/globalrecord.js +++ b/test/moduletest/globalrecord/globalrecord.js @@ -26,7 +26,7 @@ var view = new myString("extends String"); print(view); print(a); -a = "a" +a = "aa" print(a); print(b); -- Gitee From fc81268e29481657029ce5ece69e65b460cbc964 Mon Sep 17 00:00:00 2001 From: lifansheng Date: Mon, 13 Sep 2021 14:11:34 +0800 Subject: [PATCH 2/3] codecheck Signed-off-by: lifansheng --- ecmascript/interpreter/slow_runtime_stub.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ecmascript/interpreter/slow_runtime_stub.cpp b/ecmascript/interpreter/slow_runtime_stub.cpp index e1539f02fd..5874bcd6cb 100644 --- a/ecmascript/interpreter/slow_runtime_stub.cpp +++ b/ecmascript/interpreter/slow_runtime_stub.cpp @@ -1280,7 +1280,7 @@ JSTaggedValue SlowRuntimeStub::TryLdGlobalByName(JSThread *thread, JSTaggedValue { INTERPRETER_TRACE(thread, Trygetobjprop); [[maybe_unused]] EcmaHandleScope handleScope(thread); - + JSHandle obj(thread, global.GetTaggedObject()->GetClass()->GetPrototype()); JSHandle propHandle(thread, prop); OperationResult res = JSTaggedValue::GetProperty(thread, obj, propHandle); -- Gitee From 368ad91a126f3191144dde5156a2f6ae8d13583f Mon Sep 17 00:00:00 2001 From: lifansheng Date: Mon, 13 Sep 2021 16:04:46 +0800 Subject: [PATCH 3/3] delete space Signed-off-by: lifansheng --- ecmascript/interpreter/interpreter-inl.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ecmascript/interpreter/interpreter-inl.h b/ecmascript/interpreter/interpreter-inl.h index c777e42923..e236eead5f 100644 --- a/ecmascript/interpreter/interpreter-inl.h +++ b/ecmascript/interpreter/interpreter-inl.h @@ -2641,9 +2641,9 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, ConstantPool SET_ACC(globalResult); } else { // slow path - JSTaggedValue res = SlowRuntimeStub::TryLdGlobalByName(thread, globalObj, prop); - INTERPRETER_RETURN_IF_ABRUPT(res); - SET_ACC(res); + JSTaggedValue res = SlowRuntimeStub::TryLdGlobalByName(thread, globalObj, prop); + INTERPRETER_RETURN_IF_ABRUPT(res); + SET_ACC(res); } } -- Gitee