• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef ECMASCRIPT_CROSS_VM_DYNAMIC_OBJECT_DESCRIPTOR_H
17 #define ECMASCRIPT_CROSS_VM_DYNAMIC_OBJECT_DESCRIPTOR_H
18 
19 #include "common_interfaces/objects/base_object.h"
20 #include "common_interfaces/objects/base_object_descriptor.h"
21 #include "ecmascript/ic/ic_handler.h"
22 
23 namespace panda::ecmascript {
24 class DynamicObjectDescriptor : public common::DynamicObjectDescriptorInterface {
25 public:
26     static void Initialize();
27 
28     std::pair<JSTaggedValue, HandlerBase> GetProperty(ThreadHolder *thread,
29                                                       const BaseObject *obj,
30                                                       const char *name) const override;
31 
32     std::pair<bool, HandlerBase> SetProperty(ThreadHolder *thread, BaseObject *obj, const char *name,
33                                              JSTaggedValue value) override;
34 
35     std::pair<JSTaggedValue, HandlerBase> GetElementByIdx(ThreadHolder *thread, const BaseObject *obj,
36                                                           uint32_t index) const override;
37 
38     std::pair<bool, HandlerBase> SetElementByIdx(ThreadHolder *thread, BaseObject *obj, uint32_t index,
39                                                  JSTaggedValue value) override;
40 
41 private:
42     static DynamicObjectDescriptor dynObjectDescriptor_;
43 };
44 } // namespace panda::ecmascript
45 #endif // ECMASCRIPT_CROSS_VM_DYNAMIC_OBJECT_DESCRIPTOR_H
46