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

Commit 2fd0425

Browse files
obastemurchakrabot
authored andcommitted
deps: update ChakraCore to chakra-core/ChakraCore@e93b29b80d
[MERGE #3717 @obastemur] remove old interceptors code and open a space under TypeFlagMask Merge pull request #3717 from obastemur:rem_inter CanHaveInterceptors was being triggered heavily on some of the benchmarks and looking deeper shown that there is no reason keeping this code around. Besides.. Removing this, comes with a very useful space within `TypeFlagMask` that I could use for ExternalData support. So.. unless someone comes and say that this particular mask is in use at some place (which I could not find), I will update the external data PR too. Reminder: Both TypeFlagMask_External and TypeFlagMask_CanHaveInterceptors are set at the same place in full code. There is no place that they were being set separately. Reviewed-By: chakrabot <chakrabot@users.noreply.github.com>
1 parent 88a568f commit 2fd0425

File tree

9 files changed

+22
-28
lines changed

9 files changed

+22
-28
lines changed

deps/chakrashim/core/lib/Runtime/Debug/DiagObjectModel.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2141,7 +2141,7 @@ namespace Js
21412141
auto funcPtr = [&]()
21422142
{
21432143
IGNORE_STACKWALK_EXCEPTION(scriptContext);
2144-
if (object->CanHaveInterceptors())
2144+
if (object->IsExternal())
21452145
{
21462146
Js::ForInObjectEnumerator enumerator(object, object->GetScriptContext(), /* enumSymbols */ true);
21472147
Js::PropertyId propertyId;
@@ -2461,7 +2461,7 @@ namespace Js
24612461

24622462
if (JavascriptOperators::IsObject(object))
24632463
{
2464-
if (object->CanHaveInterceptors() || JavascriptOperators::GetTypeId(object) == TypeIds_Proxy)
2464+
if (object->IsExternal() || JavascriptOperators::GetTypeId(object) == TypeIds_Proxy)
24652465
{
24662466
try
24672467
{

deps/chakrashim/core/lib/Runtime/Debug/TTSnapObjects.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace TTD
1515
{
1616
void ExtractCompoundObject(NSSnapObjects::SnapObject* sobj, Js::RecyclableObject* obj, bool isWellKnown, const TTDIdentifierDictionary<TTD_PTR_ID, NSSnapType::SnapType*>& idToTypeMap, SlabAllocator& alloc)
1717
{
18-
TTDAssert(!obj->CanHaveInterceptors(), "We are not prepared for custom external objects yet");
18+
TTDAssert(!obj->IsExternal(), "We are not prepared for custom external objects yet");
1919

2020
sobj->ObjectPtrId = TTD_CONVERT_VAR_TO_PTR_ID(obj);
2121
sobj->SnapObjectTag = obj->GetSnapTag_TTD();

deps/chakrashim/core/lib/Runtime/Debug/TTSnapshotExtractor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ namespace TTD
247247
void SnapshotExtractor::MarkVisitVar(Js::Var var)
248248
{
249249
TTDAssert(var != nullptr, "I don't think this should happen but not 100% sure.");
250-
TTDAssert(Js::JavascriptOperators::GetTypeId(var) < Js::TypeIds_Limit || Js::RecyclableObject::FromVar(var)->CanHaveInterceptors(), "Not cool.");
250+
TTDAssert(Js::JavascriptOperators::GetTypeId(var) < Js::TypeIds_Limit || Js::RecyclableObject::FromVar(var)->IsExternal(), "Not cool.");
251251

252252
//We don't need to visit tagged things
253253
if(JsSupport::IsVarTaggedInline(var))

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ namespace Js
10451045
#endif
10461046
}
10471047

1048-
if (RecyclableObject::FromVar(aLeft)->CanHaveInterceptors())
1048+
if (RecyclableObject::FromVar(aLeft)->IsExternal())
10491049
{
10501050
BOOL result;
10511051
if (RecyclableObject::FromVar(aLeft)->StrictEquals(aRight, &result, requestContext))
@@ -1057,7 +1057,7 @@ namespace Js
10571057
}
10581058
}
10591059

1060-
if (!TaggedNumber::Is(aRight) && RecyclableObject::FromVar(aRight)->CanHaveInterceptors())
1060+
if (!TaggedNumber::Is(aRight) && RecyclableObject::FromVar(aRight)->IsExternal())
10611061
{
10621062
BOOL result;
10631063
if (RecyclableObject::FromVar(aRight)->StrictEquals(aLeft, &result, requestContext))
@@ -2356,7 +2356,7 @@ namespace Js
23562356
// in 9.1.9, step 5, we should return false if receiver is not object, and that will happen in default RecyclableObject operation anyhow.
23572357
if (receiverObject->SetProperty(propertyKey, newValue, propertyOperationFlags, info))
23582358
{
2359-
if (!JavascriptProxy::Is(receiver) && info->GetPropertyString() && info->GetFlags() != InlineCacheSetterFlag && !object->CanHaveInterceptors())
2359+
if (!JavascriptProxy::Is(receiver) && info->GetPropertyString() && info->GetFlags() != InlineCacheSetterFlag && !object->IsExternal())
23602360
{
23612361
CacheOperators::CachePropertyWrite(RecyclableObject::FromVar(receiver), false, typeWithoutProperty, info->GetPropertyString()->GetPropertyId(), info, requestContext);
23622362

@@ -8276,7 +8276,7 @@ namespace Js
82768276
// It is valid for some objects to not-support getters and setters, specifically, for projection of an ABI method
82778277
// (CustomExternalObject => MapWithStringKey) which SetAccessors returns VBSErr_ActionNotSupported.
82788278
// But for non-external objects SetAccessors should succeed.
8279-
Assert(isSetAccessorsSuccess || obj->CanHaveInterceptors());
8279+
Assert(isSetAccessorsSuccess || obj->IsExternal());
82808280

82818281
// If SetAccessors failed, the property wasn't created, so no need to change the attributes.
82828282
if (isSetAccessorsSuccess)
@@ -8354,7 +8354,7 @@ namespace Js
83548354
// It is valid for some objects to not-support getters and setters, specifically, for projection of an ABI method
83558355
// (CustomExternalObject => MapWithStringKey) which SetAccessors returns VBSErr_ActionNotSupported.
83568356
// But for non-external objects SetAccessors should succeed.
8357-
Assert(isSetAccessorsSuccess || obj->CanHaveInterceptors());
8357+
Assert(isSetAccessorsSuccess || obj->IsExternal());
83588358

83598359
if (isSetAccessorsSuccess)
83608360
{

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ namespace Js
1111
AssertMsg(obj != nullptr, "GetTypeId aValue is null");
1212

1313
auto typeId = obj->GetTypeId();
14-
#if DBG
15-
auto isExternal = obj->CanHaveInterceptors();
16-
AssertMsg(typeId < TypeIds_Limit || isExternal, "GetTypeId aValue has invalid TypeId");
17-
#endif
14+
AssertMsg(typeId < TypeIds_Limit || obj->IsExternal(), "GetTypeId aValue has invalid TypeId");
1815
return typeId;
1916
}
2017

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ namespace Js
635635
BOOL JavascriptObject::GetOwnPropertyDescriptorHelper(RecyclableObject* obj, PropertyId propertyId, ScriptContext* scriptContext, PropertyDescriptor& propertyDescriptor)
636636
{
637637
BOOL isPropertyDescriptorDefined;
638-
if (obj->CanHaveInterceptors())
638+
if (obj->IsExternal())
639639
{
640640
isPropertyDescriptorDefined = obj->HasOwnProperty(propertyId) ?
641641
JavascriptOperators::GetOwnPropertyDescriptor(obj, propertyId, scriptContext, &propertyDescriptor) : obj->GetDefaultPropertyDescriptor(propertyDescriptor);

deps/chakrashim/core/lib/Runtime/Types/RecyclableObject.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,6 @@ namespace Js {
336336
virtual BOOL HasInstance(Var instance, ScriptContext* scriptContext, IsInstInlineCache* inlineCache = NULL);
337337

338338
BOOL SkipsPrototype() const;
339-
BOOL CanHaveInterceptors() const;
340339
BOOL IsExternal() const;
341340
// Used only in JsVarToExtension where it may be during dispose and the type is not available
342341
virtual BOOL IsExternalVirtual() const { return FALSE; }
@@ -402,7 +401,6 @@ namespace Js {
402401
// Used to Assert that the object may safely be cast to a DynamicObject
403402
virtual bool DbgIsDynamicObject() const { return false; }
404403
virtual BOOL DbgSkipsPrototype() const { return FALSE; }
405-
virtual BOOL DbgCanHaveInterceptors() const { return false; }
406404
#endif
407405
#if defined(PROFILE_RECYCLER_ALLOC) && defined(RECYCLER_DUMP_OBJECT_GRAPH)
408406
public:

deps/chakrashim/core/lib/Runtime/Types/RecyclableObject.inl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,6 @@ namespace Js
5656
return this->GetLibrary()->GetScriptContext();
5757
}
5858

59-
inline BOOL RecyclableObject::CanHaveInterceptors() const
60-
{
61-
#if !defined(USED_IN_STATIC_LIB)
62-
Assert(this->DbgCanHaveInterceptors() == this->GetType()->CanHaveInterceptors());
63-
#endif
64-
return this->GetType()->CanHaveInterceptors();
65-
}
66-
6759
inline BOOL RecyclableObject::HasItem(uint32 index)
6860
{
6961
return JavascriptConversion::PropertyQueryFlagsToBoolean(HasItemQuery(index));

deps/chakrashim/core/lib/Runtime/Types/Type.h

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ enum TypeFlagMask : uint8
1010
TypeFlagMask_AreThisAndPrototypesEnsuredToHaveOnlyWritableDataProperties = 0x01,
1111
TypeFlagMask_IsFalsy = 0x02,
1212
TypeFlagMask_HasSpecialPrototype = 0x04,
13-
TypeFlagMask_External = 0x08,
13+
TypeFlagMask_EngineExternal = 0x08,
1414
TypeFlagMask_SkipsPrototype = 0x10,
15-
TypeFlagMask_CanHaveInterceptors = 0x20,
15+
TypeFlagMask_RESERVED = 0x20,
1616
TypeFlagMask_JsrtExternal = 0x40,
1717
TypeFlagMask_HasBeenCached = 0x80
1818
};
@@ -60,10 +60,17 @@ namespace Js
6060
BOOL AreThisAndPrototypesEnsuredToHaveOnlyWritableDataProperties() const;
6161
void SetAreThisAndPrototypesEnsuredToHaveOnlyWritableDataProperties(const bool truth);
6262

63-
inline BOOL IsExternal() const { return (this->flags & TypeFlagMask_External) != 0; }
63+
inline BOOL IsExternal() const
64+
{
65+
#ifdef NTBUILD
66+
return (this->flags & TypeFlagMask_EngineExternal) != 0;
67+
#else
68+
AssertMsg((this->flags & TypeFlagMask_EngineExternal) == 0, "Not expected.");
69+
return false;
70+
#endif
71+
}
6472
inline BOOL IsJsrtExternal() const { return (this->flags & TypeFlagMask_JsrtExternal) != 0; }
6573
inline BOOL SkipsPrototype() const { return (this->flags & TypeFlagMask_SkipsPrototype) != 0 ; }
66-
inline BOOL CanHaveInterceptors() const { return (this->flags & TypeFlagMask_CanHaveInterceptors) != 0; }
6774
inline BOOL IsFalsy() const { return flags & TypeFlagMask_IsFalsy; }
6875
inline BOOL HasBeenCached() const { return flags & TypeFlagMask_HasBeenCached; }
6976
inline void SetHasBeenCached()

0 commit comments

Comments
 (0)