From 2b383ccc4a94417121da06b2feaa7b02fb9bc242 Mon Sep 17 00:00:00 2001 From: Chernykh Sergey Date: Wed, 5 Jun 2024 19:20:51 +0300 Subject: [PATCH 1/2] Fix TypedArray::Subarray Issue: #I9VIX7 Description: 1. Add missed handle in typed_array::proto::Subarray 2. Add SaveStateOptimization in ecma pipeline Tests: ninja all tests. All required pre-merge tests passed. Results are available in the internal CI Signed-off-by: Chernykh Sergey --- compiler/optimizer/ecma_pipeline.cpp | 7 +++++-- runtime/builtins/builtins_typedarray.cpp | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/compiler/optimizer/ecma_pipeline.cpp b/compiler/optimizer/ecma_pipeline.cpp index fc8619f16..2d27dce37 100644 --- a/compiler/optimizer/ecma_pipeline.cpp +++ b/compiler/optimizer/ecma_pipeline.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 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 @@ -26,6 +26,7 @@ #include "optimizer/optimizations/checks_elimination.h" #include "optimizer/optimizations/code_sink.h" #include "optimizer/optimizations/deoptimize_elimination.h" +#include "optimizer/optimizations/savestate_optimization.h" #include "optimizer/optimizations/cleanup.h" #include "optimizer/optimizations/if_conversion.h" #include "optimizer/optimizations/licm.h" @@ -103,7 +104,9 @@ bool EcmaPipeline::RunOptimizations() if (graph->IsAotMode()) { graph->RunPass(); } - if (graph->RunPass()) { + bool deoptElim = graph->RunPass(); + bool saveStateOpt = graph->RunPass(); + if (deoptElim || saveStateOpt) { graph->RunPass(); } diff --git a/runtime/builtins/builtins_typedarray.cpp b/runtime/builtins/builtins_typedarray.cpp index 5f21eccc1..a3fd8fe3c 100644 --- a/runtime/builtins/builtins_typedarray.cpp +++ b/runtime/builtins/builtins_typedarray.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 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 @@ -1387,6 +1387,7 @@ JSTaggedValue typed_array::proto::Subarray(EcmaRuntimeCallInfo *argv) std::array args = {buffer.GetRawData(), JSTaggedValue(beginByteOffset).GetRawData(), JSTaggedValue(newLength).GetRawData()}; + JSSpanHandle argsHandle(thread, Span(reinterpret_cast(args.data()), args.size())); JSHandle newArr = TypedArrayHelper::TypedArraySpeciesCreate(thread, thisObj, args.size(), args.data()); // 3: three args RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); -- Gitee From aa36f07ed5f984a31af9fc1b8b402e3743ed8fac Mon Sep 17 00:00:00 2001 From: Vsevolod Pukhov Date: Fri, 26 Apr 2024 19:35:37 +0300 Subject: [PATCH 2/2] Update ITable/VTable builders according to core runtime changes Signed-off-by: Vsevolod Pukhov --- runtime/ecma_language_context.cpp | 9 +++++---- runtime/ecma_language_context.h | 7 ++++--- runtime/napi/jsnapi.cpp | 8 ++++---- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/runtime/ecma_language_context.cpp b/runtime/ecma_language_context.cpp index 3a6841137..983db405c 100644 --- a/runtime/ecma_language_context.cpp +++ b/runtime/ecma_language_context.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 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 @@ -88,14 +88,15 @@ void EcmaLanguageContext::ThrowStackOverflowException(ManagedThread *thread) con "Maximum call stack size exceeded"); } -PandaUniquePtr EcmaLanguageContext::CreateITableBuilder() const +PandaUniquePtr EcmaLanguageContext::CreateITableBuilder( + [[maybe_unused]] ClassLinkerErrorHandler *errHandler) const { return MakePandaUnique(); } -PandaUniquePtr EcmaLanguageContext::CreateVTableBuilder() const +PandaUniquePtr EcmaLanguageContext::CreateVTableBuilder(ClassLinkerErrorHandler *errHandler) const { - return MakePandaUnique(); + return MakePandaUnique(errHandler); } size_t EcmaLanguageContext::GetStringSize(const ObjectHeader *stringObject) const diff --git a/runtime/ecma_language_context.h b/runtime/ecma_language_context.h index 64790b468..d6dbbf27a 100644 --- a/runtime/ecma_language_context.h +++ b/runtime/ecma_language_context.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 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 @@ -276,9 +276,10 @@ public: return panda_file::File::READ_WRITE; } - PandaUniquePtr CreateITableBuilder() const override; + PandaUniquePtr CreateITableBuilder( + [[maybe_unused]] ClassLinkerErrorHandler *errHandler) const override; - PandaUniquePtr CreateVTableBuilder() const override; + PandaUniquePtr CreateVTableBuilder(ClassLinkerErrorHandler *errHandler) const override; bool InitializeClass(ClassLinker *classLinker, ManagedThread *thread, Class *klass) const override { diff --git a/runtime/napi/jsnapi.cpp b/runtime/napi/jsnapi.cpp index 3714477dc..a84f311a8 100644 --- a/runtime/napi/jsnapi.cpp +++ b/runtime/napi/jsnapi.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 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 @@ -100,9 +100,9 @@ template using JSHandle = ecmascript::JSHandle; namespace { -constexpr uint32_t INTERNAL_POOL_SIZE = 0; -constexpr uint32_t CODE_POOL_SIZE = 2000000; -constexpr uint32_t COMPILER_POOL_SIZE = 2000000; +constexpr uint32_t INTERNAL_POOL_SIZE = 2_MB; +constexpr uint32_t CODE_POOL_SIZE = 2_MB; +constexpr uint32_t COMPILER_POOL_SIZE = 2_MB; // NOLINTNEXTLINE(fuchsia-statically-constructed-objects) constexpr std::string_view ENTRY_POINTER = "_GLOBAL::func_main_0"; -- Gitee