Skip to content
This repository was archived by the owner on Oct 15, 2020. It is now read-only.

Commit 4cae9e4

Browse files
obastemurchakrabot
authored andcommitted
deps: update ChakraCore to chakra-core/ChakraCore@4d96e78734
[1.8>1.9] [MERGE #4580 @obastemur] Update PropertyRecord interface to preserve the record life time Merge pull request #4580 from obastemur:props_swb Reviewed-By: chakrabot <chakrabot@users.noreply.github.com>
1 parent 762da23 commit 4cae9e4

15 files changed

+70
-49
lines changed

deps/chakrashim/core/lib/Runtime/Base/ScriptContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ namespace Js
877877

878878
void ScriptContext::GetOrAddPropertyRecord(_In_ Js::JavascriptString * propertyString, _Out_ PropertyRecord const** propertyRecord)
879879
{
880-
*propertyRecord = propertyString->GetPropertyRecord();
880+
propertyString->GetPropertyRecord(propertyRecord);
881881
}
882882

883883
void ScriptContext::GetOrAddPropertyRecord(JsUtil::CharacterBuffer<WCHAR> const& propertyName, PropertyRecord const ** propertyRecord)

deps/chakrashim/core/lib/Runtime/Base/ThreadContext.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -888,10 +888,9 @@ ThreadContext::GetPropertyNameImpl(Js::PropertyId propertyId)
888888
void
889889
ThreadContext::FindPropertyRecord(Js::JavascriptString *pstName, Js::PropertyRecord const ** propertyRecord)
890890
{
891-
const Js::PropertyRecord * propRecord = pstName->GetPropertyRecord(true);
892-
if (propRecord != nullptr)
891+
pstName->GetPropertyRecord(propertyRecord, true);
892+
if (*propertyRecord != nullptr)
893893
{
894-
*propertyRecord = propRecord;
895894
return;
896895
}
897896

deps/chakrashim/core/lib/Runtime/Language/JavascriptConversion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ namespace Js
293293
{
294294
// For all other types, convert the key into a string and use that as the property name
295295
JavascriptString * propName = JavascriptConversion::ToString(key, scriptContext);
296-
*propertyRecord = propName->GetPropertyRecord();
296+
propName->GetPropertyRecord(propertyRecord);
297297
}
298298

299299
if (propString)

deps/chakrashim/core/lib/Runtime/Language/JavascriptOperators.cpp

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1914,7 +1914,7 @@ namespace Js
19141914
{
19151915
if (value && !WithScopeObject::Is(object) && info->GetPropertyString())
19161916
{
1917-
PropertyId propertyId = info->GetPropertyString()->GetPropertyRecord()->GetPropertyId();
1917+
PropertyId propertyId = info->GetPropertyString()->GetPropertyId();
19181918
CacheOperators::CachePropertyRead(instance, object, false, propertyId, false, info, requestContext);
19191919
}
19201920
return JavascriptConversion::PropertyQueryFlagsToBoolean(result);
@@ -1928,7 +1928,7 @@ namespace Js
19281928
if (!PHASE_OFF1(MissingPropertyCachePhase) && info->GetPropertyString() && DynamicObject::Is(instance) && ((DynamicObject*)instance)->GetDynamicType()->GetTypeHandler()->IsPathTypeHandler())
19291929
{
19301930
PropertyValueInfo::Set(info, requestContext->GetLibrary()->GetMissingPropertyHolder(), 0);
1931-
CacheOperators::CachePropertyRead(instance, requestContext->GetLibrary()->GetMissingPropertyHolder(), false, info->GetPropertyString()->GetPropertyRecord()->GetPropertyId(), true, info, requestContext);
1931+
CacheOperators::CachePropertyRead(instance, requestContext->GetLibrary()->GetMissingPropertyHolder(), false, info->GetPropertyString()->GetPropertyId(), true, info, requestContext);
19321932
}
19331933

19341934
*value = requestContext->GetMissingPropertyResult();
@@ -2302,7 +2302,7 @@ namespace Js
23022302
{
23032303
if (!WithScopeObject::Is(receiver) && info->GetPropertyString())
23042304
{
2305-
CacheOperators::CachePropertyWrite(RecyclableObject::FromVar(receiver), false, object->GetType(), info->GetPropertyString()->GetPropertyRecord()->GetPropertyId(), info, requestContext);
2305+
CacheOperators::CachePropertyWrite(RecyclableObject::FromVar(receiver), false, object->GetType(), info->GetPropertyString()->GetPropertyId(), info, requestContext);
23062306
}
23072307
receiver = (RecyclableObject::FromVar(receiver))->GetThisObjectOrUnWrap();
23082308
RecyclableObject* func = RecyclableObject::FromVar(setterValueOrProxy);
@@ -2358,12 +2358,12 @@ namespace Js
23582358
{
23592359
if (!JavascriptProxy::Is(receiver) && info->GetPropertyString() && info->GetFlags() != InlineCacheSetterFlag && !object->CanHaveInterceptors())
23602360
{
2361-
CacheOperators::CachePropertyWrite(RecyclableObject::FromVar(receiver), false, typeWithoutProperty, info->GetPropertyString()->GetPropertyRecord()->GetPropertyId(), info, requestContext);
2361+
CacheOperators::CachePropertyWrite(RecyclableObject::FromVar(receiver), false, typeWithoutProperty, info->GetPropertyString()->GetPropertyId(), info, requestContext);
23622362

23632363
if (info->GetInstance() == receiverObject)
23642364
{
23652365
PropertyValueInfo::SetCacheInfo(info, info->GetPropertyString(), info->GetPropertyString()->GetLdElemInlineCache(), info->AllowResizingPolymorphicInlineCache());
2366-
CacheOperators::CachePropertyRead(object, receiverObject, false, info->GetPropertyString()->GetPropertyRecord()->GetPropertyId(), false, info, requestContext);
2366+
CacheOperators::CachePropertyRead(object, receiverObject, false, info->GetPropertyString()->GetPropertyId(), false, info, requestContext);
23672367
}
23682368
}
23692369
return TRUE;
@@ -3778,7 +3778,8 @@ namespace Js
37783778
LiteralStringWithPropertyStringPtr * strWithPtr = (LiteralStringWithPropertyStringPtr *)temp;
37793779
if (!strWithPtr->HasPropertyRecord())
37803780
{
3781-
strWithPtr->GetPropertyRecord(); // lookup-cache propertyRecord
3781+
PropertyRecord const * propertyRecord;
3782+
strWithPtr->GetPropertyRecord(&propertyRecord); // lookup-cache propertyRecord
37823783
}
37833784
else
37843785
{
@@ -3798,7 +3799,8 @@ namespace Js
37983799
JavascriptString::FromVar(index)->GetSz());
37993800
}
38003801

3801-
PropertyRecord const * propertyRecord = propertyString->GetPropertyRecord();
3802+
PropertyRecord const * propertyRecord;
3803+
propertyString->GetPropertyRecord(&propertyRecord);
38023804
Var value;
38033805

38043806
if (propertyRecord->IsNumeric())
@@ -4430,13 +4432,13 @@ namespace Js
44304432
LiteralStringWithPropertyStringPtr * strWithPtr = LiteralStringWithPropertyStringPtr::TryFromVar(index);
44314433
if (strWithPtr != nullptr)
44324434
{
4433-
propertyString = strWithPtr->GetPropertyString(); // do not force create the PropertyString,
4434-
// if it wasn't there, it won't be efficient for now.
4435-
propertyRecord = strWithPtr->GetPropertyRecord(true /* dontLookupFromDictionary */);
4435+
propertyString = strWithPtr->GetPropertyString(); // do not force create the PropertyString,
4436+
// if it wasn't there, it won't be efficient for now.
4437+
strWithPtr->GetPropertyRecord(&propertyRecord, true /* dontLookupFromDictionary */);
44364438
if (propertyRecord == nullptr)
44374439
{
4438-
propertyRecord = strWithPtr->GetPropertyRecord(); // lookup-cache propertyRecord
4439-
// later this call, there will be a lookup anyways!
4440+
strWithPtr->GetPropertyRecord(&propertyRecord); // lookup-cache propertyRecord
4441+
// later this call, there will be a lookup anyways!
44404442
}
44414443
else if (propertyString == nullptr)
44424444
{
@@ -4448,7 +4450,7 @@ namespace Js
44484450
}
44494451
else
44504452
{
4451-
propertyRecord = propertyString->GetPropertyRecord();
4453+
propertyString->GetPropertyRecord(&propertyRecord);
44524454
}
44534455

44544456
if (propertyRecord != nullptr)
@@ -10529,7 +10531,9 @@ namespace Js
1052910531

1053010532
BOOL JavascriptOperators::CheckPrototypesForAccessorOrNonWritableProperty(RecyclableObject* instance, JavascriptString* propertyNameString, Var* setterValue, DescriptorFlags* flags, PropertyValueInfo* info, ScriptContext* scriptContext)
1053110533
{
10532-
PropertyId propertyId = propertyNameString->GetPropertyRecord()->GetPropertyId();
10534+
Js::PropertyRecord const * localPropertyRecord;
10535+
propertyNameString->GetPropertyRecord(&localPropertyRecord);
10536+
PropertyId propertyId = localPropertyRecord->GetPropertyId();
1053310537
return CheckPrototypesForAccessorOrNonWritableProperty(instance, propertyId, setterValue, flags, info, scriptContext);
1053410538
}
1053510539

deps/chakrashim/core/lib/Runtime/Library/ConcatString.cpp

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,9 @@ namespace Js
151151
this->propertyString = propStr;
152152
if (propStr != nullptr)
153153
{
154-
this->propertyRecord = propStr->GetPropertyRecord();
154+
Js::PropertyRecord const * localPropertyRecord;
155+
propStr->GetPropertyRecord(&localPropertyRecord);
156+
this->propertyRecord = localPropertyRecord;
155157
}
156158
}
157159

@@ -167,20 +169,29 @@ namespace Js
167169
return RecyclableObject::Is(var) && LiteralStringWithPropertyStringPtr::Is(RecyclableObject::UnsafeFromVar(var));
168170
}
169171

170-
Js::PropertyRecord const * LiteralStringWithPropertyStringPtr::GetPropertyRecord(bool dontLookupFromDictionary)
172+
void LiteralStringWithPropertyStringPtr::GetPropertyRecord(_Out_ PropertyRecord const** propRecord, bool dontLookupFromDictionary)
171173
{
174+
*propRecord = nullptr;
172175
ScriptContext * scriptContext = this->GetScriptContext();
173176

174-
if (this->propertyRecord == nullptr && !dontLookupFromDictionary)
177+
if (this->propertyRecord == nullptr)
175178
{
176-
Js::PropertyRecord const * localPropertyRecord;
177-
scriptContext->GetOrAddPropertyRecord(this->GetSz(),
178-
static_cast<int>(this->GetLength()),
179-
&localPropertyRecord);
180-
this->propertyRecord = localPropertyRecord;
179+
if (!dontLookupFromDictionary)
180+
{
181+
// cache PropertyRecord
182+
Js::PropertyRecord const * localPropertyRecord;
183+
scriptContext->GetOrAddPropertyRecord(this->GetSz(),
184+
static_cast<int>(this->GetLength()),
185+
&localPropertyRecord);
186+
this->propertyRecord = localPropertyRecord;
187+
}
188+
else
189+
{
190+
return;
191+
}
181192
}
182193

183-
return this->propertyRecord;
194+
*propRecord = this->propertyRecord;
184195
}
185196

186197
/////////////////////// ConcatStringBase //////////////////////////

deps/chakrashim/core/lib/Runtime/Library/ConcatString.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ namespace Js
1313
Field(const Js::PropertyRecord*) propertyRecord;
1414

1515
public:
16-
virtual Js::PropertyRecord const * GetPropertyRecord(bool dontLookupFromDictionary = false) override;
16+
virtual void GetPropertyRecord(_Out_ PropertyRecord const** propRecord, bool dontLookupFromDictionary = false) override;
17+
1718
bool HasPropertyRecord() const { return propertyRecord != nullptr; }
1819

1920
PropertyString * GetPropertyString() const;

deps/chakrashim/core/lib/Runtime/Library/ForInObjectEnumerator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,10 @@ namespace Js
184184
// Property Id does not exist.
185185
if (propertyId == Constants::NoProperty)
186186
{
187-
propRecord = currentIndex->GetPropertyRecord(true);
187+
currentIndex->GetPropertyRecord(&propRecord, true);
188188
if (propRecord == nullptr)
189189
{
190-
propRecord = currentIndex->GetPropertyRecord(false); // will create
190+
currentIndex->GetPropertyRecord(&propRecord, false); // will create
191191
// We keep the track of what is enumerated using a bit vector of propertyID.
192192
// so the propertyId can't be collected until the end of the for in enumerator
193193
// Keep a list of the property string.

deps/chakrashim/core/lib/Runtime/Library/JSONStringifier.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ JSONStringifier::ReadValue(_In_ JavascriptString* key, _In_opt_ const PropertyRe
235235

236236
if (propertyRecord == nullptr)
237237
{
238-
propertyRecord = key->GetPropertyRecord();
238+
key->GetPropertyRecord(&propertyRecord);
239239
}
240240
JavascriptOperators::GetProperty(holder, propertyRecord->GetPropertyId(), &value, this->scriptContext, &info);
241241
return value;

deps/chakrashim/core/lib/Runtime/Library/JavascriptObject.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1733,7 +1733,7 @@ namespace Js
17331733
}
17341734
else
17351735
{
1736-
propertyRecord = ((PropertyString*)propertyName)->GetPropertyRecord();
1736+
propertyName->GetPropertyRecord(&propertyRecord);
17371737
}
17381738

17391739
if (descCount == descSize)

deps/chakrashim/core/lib/Runtime/Library/JavascriptString.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -224,17 +224,15 @@ namespace Js
224224
return JavascriptOperators::GetTypeId(aValue) == TypeIds_String;
225225
}
226226

227-
Js::PropertyRecord const * JavascriptString::GetPropertyRecord(bool dontLookupFromDictionary)
227+
void JavascriptString::GetPropertyRecord(_Out_ Js::PropertyRecord const ** propertyRecord, bool dontLookupFromDictionary)
228228
{
229+
*propertyRecord = nullptr;
229230
if (dontLookupFromDictionary)
230231
{
231-
return nullptr;
232+
return;
232233
}
233234

234-
Js::PropertyRecord const * propertyRecord;
235-
GetScriptContext()->GetOrAddPropertyRecord(GetString(), GetLength(), &propertyRecord);
236-
237-
return propertyRecord;
235+
GetScriptContext()->GetOrAddPropertyRecord(GetString(), GetLength(), propertyRecord);
238236
}
239237

240238
JavascriptString* JavascriptString::FromVar(Var aValue)

0 commit comments

Comments
 (0)