• Home
  • Raw
  • Download

Lines Matching +full:non +full:- +full:static

7  *     http://www.apache.org/licenses/LICENSE-2.0
27 const GlobalEnvConstants *globalConst = thread->GlobalConstants(); in BuildClassInfoExtractorFromLiteral()
28 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in BuildClassInfoExtractorFromLiteral()
30 uint32_t literalBufferLength = literal->GetLength(); in BuildClassInfoExtractorFromLiteral()
31 // non static properties number is hidden in the last index of Literal buffer in BuildClassInfoExtractorFromLiteral()
32 uint32_t nonStaticNum = literal->Get(thread, literalBufferLength - 1).GetInt(); in BuildClassInfoExtractorFromLiteral()
35 …JSHandle<TaggedArray> nonStaticKeys = factory->NewTaggedArray(nonStaticNum + NON_STATIC_RESERVED_L… in BuildClassInfoExtractorFromLiteral()
36 …JSHandle<TaggedArray> nonStaticProperties = factory->NewTaggedArray(nonStaticNum + NON_STATIC_RESE… in BuildClassInfoExtractorFromLiteral()
38 nonStaticKeys->Set(thread, CONSTRUCTOR_INDEX, globalConst->GetConstructorString()); in BuildClassInfoExtractorFromLiteral()
40 JSHandle<TaggedArray> nonStaticElements = factory->EmptyArray(); in BuildClassInfoExtractorFromLiteral()
47 extractor->SetNonStaticWithElements(true); in BuildClassInfoExtractorFromLiteral()
48 extractor->SetNonStaticElements(thread, nonStaticElements); in BuildClassInfoExtractorFromLiteral()
52 extractor->SetNonStaticKeys(thread, nonStaticKeys); in BuildClassInfoExtractorFromLiteral()
53 extractor->SetNonStaticProperties(thread, nonStaticProperties); in BuildClassInfoExtractorFromLiteral()
56 extractor->SetPrototypeHClass(thread, prototypeHClass); in BuildClassInfoExtractorFromLiteral()
58 uint32_t staticNum = (literalBufferLength - 1) / 2 - nonStaticNum; in BuildClassInfoExtractorFromLiteral()
61 JSHandle<TaggedArray> staticKeys = factory->NewTaggedArray(staticNum + STATIC_RESERVED_LENGTH); in BuildClassInfoExtractorFromLiteral()
62 …JSHandle<TaggedArray> staticProperties = factory->NewTaggedArray(staticNum + STATIC_RESERVED_LENGT… in BuildClassInfoExtractorFromLiteral()
64 staticKeys->Set(thread, LENGTH_INDEX, globalConst->GetLengthString()); in BuildClassInfoExtractorFromLiteral()
65 staticKeys->Set(thread, NAME_INDEX, globalConst->GetNameString()); in BuildClassInfoExtractorFromLiteral()
66 staticKeys->Set(thread, PROTOTYPE_INDEX, globalConst->GetPrototypeString()); in BuildClassInfoExtractorFromLiteral()
68 JSHandle<TaggedArray> staticElements = factory->EmptyArray(); in BuildClassInfoExtractorFromLiteral()
73 literalBufferLength - 1, in BuildClassInfoExtractorFromLiteral()
75 extractor->GetConstructorMethod() in BuildClassInfoExtractorFromLiteral()
80 extractor->SetStaticWithElements(true); in BuildClassInfoExtractorFromLiteral()
81 extractor->SetStaticElements(thread, staticElements); in BuildClassInfoExtractorFromLiteral()
84 // without static properties, set class name in BuildClassInfoExtractorFromLiteral()
85 std::string clsName = extractor->GetConstructorMethod()->ParseFunctionName(); in BuildClassInfoExtractorFromLiteral()
86 JSHandle<EcmaString> clsNameHandle = factory->NewFromStdString(clsName); in BuildClassInfoExtractorFromLiteral()
87 staticProperties->Set(thread, NAME_INDEX, clsNameHandle); in BuildClassInfoExtractorFromLiteral()
91 JSHandle<JSTaggedValue> prototypeAccessor = globalConst->GetHandledFunctionPrototypeAccessor(); in BuildClassInfoExtractorFromLiteral()
92 staticProperties->Set(thread, PROTOTYPE_INDEX, prototypeAccessor); in BuildClassInfoExtractorFromLiteral()
94 extractor->SetStaticKeys(thread, staticKeys); in BuildClassInfoExtractorFromLiteral()
95 extractor->SetStaticProperties(thread, staticProperties); in BuildClassInfoExtractorFromLiteral()
98 extractor->SetConstructorHClass(thread, ctorHClass); in BuildClassInfoExtractorFromLiteral()
107 const GlobalEnvConstants *globalConst = thread->GlobalConstants(); in ExtractAndReturnWhetherWithElements()
109 ASSERT(keys->GetLength() == properties->GetLength() && elements->GetLength() == 0); in ExtractAndReturnWhetherWithElements()
116 JSHandle<JSTaggedValue> nameString = globalConst->GetHandledNameString(); in ExtractAndReturnWhetherWithElements()
119 …for (uint32_t index = detail.extractBegin; index < detail.extractEnd; index += 2) { // 2: key-val… in ExtractAndReturnWhetherWithElements()
120 firstValue.Update(literal->Get(index)); in ExtractAndReturnWhetherWithElements()
121 secondValue.Update(literal->Get(index + 1)); in ExtractAndReturnWhetherWithElements()
124 if (LIKELY(firstValue->IsString())) { in ExtractAndReturnWhetherWithElements()
126 properties->Set(thread, NAME_INDEX, secondValue); in ExtractAndReturnWhetherWithElements()
131 // front-end can do better: write index in class literal directly. in ExtractAndReturnWhetherWithElements()
135 uint32_t elementsLength = elements->GetLength(); in ExtractAndReturnWhetherWithElements()
136 … elements = TaggedArray::SetCapacity(thread, elements, elementsLength + 2); // 2: key-value pair in ExtractAndReturnWhetherWithElements()
137 elements->Set(thread, elementsLength, firstValue); in ExtractAndReturnWhetherWithElements()
138 elements->Set(thread, elementsLength + 1, secondValue); in ExtractAndReturnWhetherWithElements()
144 keys->Set(thread, pos, firstValue); in ExtractAndReturnWhetherWithElements()
145 properties->Set(thread, pos, secondValue); in ExtractAndReturnWhetherWithElements()
152 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in ExtractAndReturnWhetherWithElements()
153 std::string clsName = detail.ctorMethod->ParseFunctionName(); in ExtractAndReturnWhetherWithElements()
154 JSHandle<EcmaString> clsNameHandle = factory->NewFromStdString(clsName); in ExtractAndReturnWhetherWithElements()
155 properties->Set(thread, NAME_INDEX, clsNameHandle); in ExtractAndReturnWhetherWithElements()
157 // class has static name property, reserved length bigger 1 than actual, need trim in ExtractAndReturnWhetherWithElements()
158 uint32_t trimOneLength = keys->GetLength() - 1; in ExtractAndReturnWhetherWithElements()
159 keys->Trim(thread, trimOneLength); in ExtractAndReturnWhetherWithElements()
160 properties->Trim(thread, trimOneLength); in ExtractAndReturnWhetherWithElements()
165 ASSERT(pos + elements->GetLength() / 2 == properties->GetLength()); // 2: half in ExtractAndReturnWhetherWithElements()
166 keys->Trim(thread, pos); in ExtractAndReturnWhetherWithElements()
167 properties->Trim(thread, pos); in ExtractAndReturnWhetherWithElements()
176 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in CreatePrototypeHClass()
178 uint32_t length = keys->GetLength(); in CreatePrototypeHClass()
182 JSHandle<LayoutInfo> layout = factory->CreateLayoutInfo(length); in CreatePrototypeHClass()
184 key.Update(keys->Get(index)); in CreatePrototypeHClass()
186 … PropertyAttributes attributes = PropertyAttributes::Default(true, false, true); // non-enumerable in CreatePrototypeHClass()
188 if (UNLIKELY(properties->Get(index).IsAccessor())) { in CreatePrototypeHClass()
195 layout->AddKey(thread, index, key.GetTaggedValue(), attributes); in CreatePrototypeHClass()
198 hclass = factory->NewEcmaDynClass(JSObject::SIZE, JSType::JS_OBJECT, length); in CreatePrototypeHClass()
200 hclass->SetLayout(thread, layout); in CreatePrototypeHClass()
201 hclass->SetNumberOfProps(length); in CreatePrototypeHClass()
204 hclass = factory->NewEcmaDynClass(JSObject::SIZE, JSType::JS_OBJECT, 0); // without in-obj in CreatePrototypeHClass()
205 hclass->SetIsDictionaryMode(true); in CreatePrototypeHClass()
206 hclass->SetNumberOfProps(0); in CreatePrototypeHClass()
209 hclass->SetClassPrototype(true); in CreatePrototypeHClass()
210 hclass->SetIsPrototype(true); in CreatePrototypeHClass()
217 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in CreateConstructorHClass()
219 uint32_t length = keys->GetLength(); in CreateConstructorHClass()
223 JSHandle<LayoutInfo> layout = factory->CreateLayoutInfo(length); in CreateConstructorHClass()
225 key.Update(keys->Get(index)); in CreateConstructorHClass()
233 if (LIKELY(properties->Get(NAME_INDEX).IsString())) { in CreateConstructorHClass()
236 ASSERT(properties->Get(NAME_INDEX).IsJSFunction()); in CreateConstructorHClass()
248 if (UNLIKELY(properties->Get(index).IsAccessor())) { in CreateConstructorHClass()
255 layout->AddKey(thread, index, key.GetTaggedValue(), attributes); in CreateConstructorHClass()
258 hclass = factory->NewEcmaDynClass(JSFunction::SIZE, JSType::JS_FUNCTION, length); in CreateConstructorHClass()
260 hclass->SetLayout(thread, layout); in CreateConstructorHClass()
261 hclass->SetNumberOfProps(length); in CreateConstructorHClass()
264 … hclass = factory->NewEcmaDynClass(JSFunction::SIZE, JSType::JS_FUNCTION, 0); // without in-obj in CreateConstructorHClass()
265 hclass->SetIsDictionaryMode(true); in CreateConstructorHClass()
266 hclass->SetNumberOfProps(0); in CreateConstructorHClass()
269 hclass->SetClassConstructor(true); in CreateConstructorHClass()
270 hclass->SetConstructor(true); in CreateConstructorHClass()
278 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in DefineClassTemplate()
280 JSHandle<JSHClass> prototypeHClass(thread, extractor->GetPrototypeHClass()); in DefineClassTemplate()
281 JSHandle<JSObject> prototype = factory->NewJSObject(prototypeHClass); in DefineClassTemplate()
283 JSHandle<JSHClass> constructorHClass(thread, extractor->GetConstructorHClass()); in DefineClassTemplate()
284 …JSHandle<JSFunction> constructor = factory->NewJSFunctionByDynClass(extractor->GetConstructorMetho… in DefineClassTemplate()
288 // non-static in DefineClassTemplate()
289 JSHandle<TaggedArray> nonStaticProperties(thread, extractor->GetNonStaticProperties()); in DefineClassTemplate()
290 nonStaticProperties->Set(thread, 0, constructor); in DefineClassTemplate()
292 uint32_t nonStaticLength = nonStaticProperties->GetLength(); in DefineClassTemplate()
295 if (LIKELY(!prototypeHClass->IsDictionaryMode())) { in DefineClassTemplate()
297 propValue.Update(nonStaticProperties->Get(index)); in DefineClassTemplate()
298 if (propValue->IsJSFunction()) { in DefineClassTemplate()
300 propFunc->SetHomeObject(thread, prototype); in DefineClassTemplate()
301 propFunc->SetConstantPool(thread, constantpool); in DefineClassTemplate()
303 prototype->SetPropertyInlinedProps(thread, index, propValue.GetTaggedValue()); in DefineClassTemplate()
306 JSHandle<TaggedArray> nonStaticKeys(thread, extractor->GetNonStaticKeys()); in DefineClassTemplate()
309 prototype->SetProperties(thread, dict); in DefineClassTemplate()
312 // non-static elements in DefineClassTemplate()
313 if (UNLIKELY(extractor->GetNonStaticWithElements())) { in DefineClassTemplate()
314 JSHandle<TaggedArray> nonStaticElements(thread, extractor->GetNonStaticElements()); in DefineClassTemplate()
318 // static in DefineClassTemplate()
319 JSHandle<TaggedArray> staticProperties(thread, extractor->GetStaticProperties()); in DefineClassTemplate()
320 uint32_t staticLength = staticProperties->GetLength(); in DefineClassTemplate()
322 if (LIKELY(!constructorHClass->IsDictionaryMode())) { in DefineClassTemplate()
324 propValue.Update(staticProperties->Get(index)); in DefineClassTemplate()
325 if (propValue->IsJSFunction()) { in DefineClassTemplate()
327 propFunc->SetHomeObject(thread, constructor); in DefineClassTemplate()
328 propFunc->SetConstantPool(thread, constantpool); in DefineClassTemplate()
330 …JSHandle<JSObject>::Cast(constructor)->SetPropertyInlinedProps(thread, index, propValue.GetTaggedV… in DefineClassTemplate()
333 JSHandle<TaggedArray> staticKeys(thread, extractor->GetStaticKeys()); in DefineClassTemplate()
335 … staticProperties, ClassPropertyType::STATIC, in DefineClassTemplate()
337 constructor->SetProperties(thread, dict); in DefineClassTemplate()
340 // static elements in DefineClassTemplate()
341 if (UNLIKELY(extractor->GetStaticWithElements())) { in DefineClassTemplate()
342 JSHandle<TaggedArray> staticElements(thread, extractor->GetStaticElements()); in DefineClassTemplate()
346 constructor->SetProtoOrDynClass(thread, prototype); in DefineClassTemplate()
357 uint32_t length = keys->GetLength(); in BuildDictionaryPropeties()
359 ASSERT(keys->GetLength() == properties->GetLength()); in BuildDictionaryPropeties()
367 if (type == ClassPropertyType::STATIC) { in BuildDictionaryPropeties()
373 if (LIKELY(properties->Get(ClassInfoExtractor::NAME_INDEX).IsString())) { in BuildDictionaryPropeties()
376 ASSERT(properties->Get(ClassInfoExtractor::NAME_INDEX).IsJSFunction()); in BuildDictionaryPropeties()
388 attributes = PropertyAttributes::Default(true, false, true); // non-enumerable in BuildDictionaryPropeties()
390 propKey.Update(keys->Get(index)); in BuildDictionaryPropeties()
391 propValue.Update(properties->Get(index)); in BuildDictionaryPropeties()
392 if (propValue->IsJSFunction()) { in BuildDictionaryPropeties()
394 propFunc->SetHomeObject(thread, object); in BuildDictionaryPropeties()
395 propFunc->SetConstantPool(thread, constantpool); in BuildDictionaryPropeties()
409 for (uint32_t index = 0; index < elements->GetLength(); index += 2) { // 2: key-value pair in HandleElementsProperties()
410 elementsKey.Update(elements->Get(index)); in HandleElementsProperties()
411 elementsValue.Update(elements->Get(index + 1)); in HandleElementsProperties()
415 if (elementsValue->IsJSFunction()) { in HandleElementsProperties()
417 elementsFunc->SetHomeObject(thread, object); in HandleElementsProperties()
418 elementsFunc->SetConstantPool(thread, constantpool); in HandleElementsProperties()