From 2b383ccc4a94417121da06b2feaa7b02fb9bc242 Mon Sep 17 00:00:00 2001 From: Chernykh Sergey Date: Wed, 5 Jun 2024 19:20:51 +0300 Subject: [PATCH] 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