Lines Matching full:thread
29 JSTaggedValue JSAPIHashMap::HasKey(JSThread *thread, JSTaggedValue key) in HasKey() argument
31 TaggedHashArray *hashArray = TaggedHashArray::Cast(GetTable(thread).GetTaggedObject()); in HasKey()
32 int hash = TaggedNode::Hash(thread, key); in HasKey()
33 return JSTaggedValue(!(hashArray->GetNode(thread, hash, key).IsHole())); in HasKey()
36 JSTaggedValue JSAPIHashMap::HasValue(JSThread *thread, JSHandle<JSAPIHashMap> hashMap, in HasValue() argument
39 JSHandle<TaggedHashArray> hashArray(thread, hashMap->GetTable(thread)); in HasValue()
43 JSTaggedValue node = hashArray->Get(thread, index); in HasValue()
48 if (HasValueLinkedNode(thread, node, taggedValue)) { in HasValue()
52 if (HasValueRBTreeNode(thread, node, taggedValue)) { in HasValue()
60 bool JSAPIHashMap::HasValueLinkedNode(JSThread *thread, JSTaggedValue node, JSTaggedValue value) in HasValueLinkedNode() argument
65 if (JSTaggedValue::SameValue(thread, p->GetValue(thread), value)) { in HasValueLinkedNode()
68 node = p->GetNext(thread); in HasValueLinkedNode()
73 bool JSAPIHashMap::HasValueRBTreeNode(JSThread *thread, JSTaggedValue node, JSTaggedValue value) in HasValueRBTreeNode() argument
77 if (JSTaggedValue::SameValue(thread, p->GetValue(thread), value)) { in HasValueRBTreeNode()
80 JSTaggedValue left = p->GetLeft(thread); in HasValueRBTreeNode()
81 if (!left.IsHole() && HasValueRBTreeNode(thread, left, value)) { in HasValueRBTreeNode()
84 JSTaggedValue right = p->GetRight(thread); in HasValueRBTreeNode()
85 if (!right.IsHole() && HasValueRBTreeNode(thread, right, value)) { in HasValueRBTreeNode()
91 bool JSAPIHashMap::Replace(JSThread *thread, JSTaggedValue key, JSTaggedValue newValue) in Replace() argument
93 TaggedHashArray *hashArray = TaggedHashArray::Cast(GetTable(thread).GetTaggedObject()); in Replace()
94 int hash = TaggedNode::Hash(thread, key); in Replace()
95 JSTaggedValue nodeVa = hashArray->GetNode(thread, hash, key); in Replace()
100 LinkedNode::Cast(nodeVa.GetTaggedObject())->SetValue(thread, newValue); in Replace()
102 RBTreeNode::Cast(nodeVa.GetTaggedObject())->SetValue(thread, newValue); in Replace()
107 void JSAPIHashMap::Set(JSThread *thread, JSHandle<JSAPIHashMap> hashMap, in Set() argument
111 JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, key.GetTaggedValue()); in Set()
113 … "The type of \"key\" must be Key of JS. Received value is: " + ConvertToString(thread, *result); in Set()
114 …JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str(… in Set()
115 THROW_NEW_ERROR_AND_RETURN(thread, error); in Set()
117 JSHandle<TaggedHashArray> hashArray(thread, hashMap->GetTable(thread)); in Set()
118 int hash = TaggedNode::Hash(thread, key.GetTaggedValue()); in Set()
119 JSTaggedValue setValue = TaggedHashArray::SetVal(thread, hashArray, hash, key, value); in Set()
126 hashArray = TaggedHashArray::Resize(thread, hashArray, hashArray->GetLength()); in Set()
127 hashMap->SetTable(thread, hashArray); in Set()
131 JSTaggedValue JSAPIHashMap::Get(JSThread *thread, JSTaggedValue key) in Get() argument
133 TaggedHashArray *hashArray = TaggedHashArray::Cast(GetTable(thread).GetTaggedObject()); in Get()
134 int hash = TaggedNode::Hash(thread, key); in Get()
135 JSTaggedValue node = hashArray->GetNode(thread, hash, key); in Get()
139 return RBTreeNode::Cast(node.GetTaggedObject())->GetValue(thread); in Get()
141 return LinkedNode::Cast(node.GetTaggedObject())->GetValue(thread); in Get()
145 void JSAPIHashMap::SetAll(JSThread *thread, JSHandle<JSAPIHashMap> dst, JSHandle<JSAPIHashMap> src) in SetAll() argument
147 JSHandle<TaggedHashArray> hashArray(thread, src->GetTable(thread)); in SetAll()
149 JSMutableHandle<JSTaggedValue> node(thread, JSTaggedValue::Hole()); in SetAll()
151 node.Update(hashArray->Get(thread, index)); in SetAll()
156 SetAllLinkedNode(thread, dst, JSMutableHandle<LinkedNode>::Cast(node)); in SetAll()
158 SetAllRBTreeNode(thread, dst, JSHandle<RBTreeNode>(node)); in SetAll()
163 void JSAPIHashMap::SetAllLinkedNode(JSThread *thread, JSHandle<JSAPIHashMap> hashMap, JSMutableHand… in SetAllLinkedNode() argument
167 if (!hashMap->Replace(thread, node->GetKey(thread), node->GetValue(thread))) { in SetAllLinkedNode()
168 JSHandle<JSTaggedValue> key(thread, node->GetKey(thread)); in SetAllLinkedNode()
169 JSHandle<JSTaggedValue> value(thread, node->GetValue(thread)); in SetAllLinkedNode()
170 Set(thread, hashMap, key, value); in SetAllLinkedNode()
172 node.Update(node->GetNext(thread)); in SetAllLinkedNode()
176 void JSAPIHashMap::SetAllRBTreeNode(JSThread *thread, JSHandle<JSAPIHashMap> hashMap, JSHandle<RBTr… in SetAllRBTreeNode() argument
179 JSMutableHandle<JSTaggedValue> key(thread, node->GetKey(thread)); in SetAllRBTreeNode()
180 JSMutableHandle<JSTaggedValue> value(thread, node->GetValue(thread)); in SetAllRBTreeNode()
181 if (!hashMap->Replace(thread, key.GetTaggedValue(), value.GetTaggedValue())) { in SetAllRBTreeNode()
182 Set(thread, hashMap, key, value); in SetAllRBTreeNode()
184 JSMutableHandle<RBTreeNode> left(thread, node->GetLeft(thread)); in SetAllRBTreeNode()
186 SetAllRBTreeNode(thread, hashMap, left); in SetAllRBTreeNode()
188 JSMutableHandle<RBTreeNode> right(thread, node->GetRight(thread)); in SetAllRBTreeNode()
190 SetAllRBTreeNode(thread, hashMap, right); in SetAllRBTreeNode()
194 void JSAPIHashMap::Clear(JSThread *thread) in Clear() argument
196 TaggedHashArray *hashArray = TaggedHashArray::Cast(GetTable(thread).GetTaggedObject()); in Clear()
199 hashArray->Clear(thread); in Clear()
204 JSTaggedValue JSAPIHashMap::Remove(JSThread *thread, JSHandle<JSAPIHashMap> hashMap, JSTaggedValue … in Remove() argument
210 JSHandle<TaggedHashArray> hashArray(thread, hashMap->GetTable(thread)); in Remove()
215 uint32_t hash = static_cast<uint32_t>(TaggedNode::Hash(thread, key)); in Remove()
216 JSHandle<JSTaggedValue> removeValue(thread, hashArray->RemoveNode(thread, hash, key)); in Remove()
226 JSTaggedValue rootVa = hashArray->Get(thread, index); in Remove()
230 JSHandle<RBTreeNode> root(thread, rootVa); in Remove()
231 JSHandle<LinkedNode> head = RBTreeNode::Detreeing(thread, root); in Remove()
232 hashArray->Set(thread, index, head); in Remove()