diff --git a/ecmascript/interpreter/interpreter-inl.h b/ecmascript/interpreter/interpreter-inl.h index c777e42923cdb3edd24ca386946d4cd09bc33ef9..e236eead5f7cfdce62ae0b2132cd011aa88f47da 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); } } diff --git a/ecmascript/interpreter/slow_runtime_stub.cpp b/ecmascript/interpreter/slow_runtime_stub.cpp index 7b41340d6259c9f08fac2eab76336f422314955e..5874bcd6cb94543c838b29b4afb366a02a4967a6 100644 --- a/ecmascript/interpreter/slow_runtime_stub.cpp +++ b/ecmascript/interpreter/slow_runtime_stub.cpp @@ -1284,18 +1284,10 @@ JSTaggedValue SlowRuntimeStub::TryLdGlobalByName(JSThread *thread, JSTaggedValue 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 0081051128efcd49edd96e5465863bff59f7028e..da96a2a755d3c9ecc2910c220c7da70fe9bc4f6e 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);