@@ -427,61 +427,64 @@ Encoder::Encode()
427
427
// point to register each guard for invalidation.
428
428
if (this ->m_func ->propertyGuardsByPropertyId != nullptr )
429
429
{
430
- Assert (!isSimpleJit);
430
+ if (!this ->m_func ->IsOOPJIT ())
431
+ {
432
+ Assert (!isSimpleJit);
431
433
432
- AssertMsg (!(PHASE_OFF (Js::ObjTypeSpecPhase, this ->m_func ) && PHASE_OFF (Js::FixedMethodsPhase, this ->m_func )),
433
- " Why do we have type guards if we don't do object type spec or fixed methods?" );
434
+ AssertMsg (!(PHASE_OFF (Js::ObjTypeSpecPhase, this ->m_func ) && PHASE_OFF (Js::FixedMethodsPhase, this ->m_func )),
435
+ " Why do we have type guards if we don't do object type spec or fixed methods?" );
434
436
435
- int propertyCount = this ->m_func ->propertyGuardsByPropertyId ->Count ();
436
- Assert (propertyCount > 0 );
437
+ int propertyCount = this ->m_func ->propertyGuardsByPropertyId ->Count ();
438
+ Assert (propertyCount > 0 );
437
439
438
440
#if DBG
439
- int totalGuardCount = (this ->m_func ->singleTypeGuards != nullptr ? this ->m_func ->singleTypeGuards ->Count () : 0 )
440
- + (this ->m_func ->equivalentTypeGuards != nullptr ? this ->m_func ->equivalentTypeGuards ->Count () : 0 );
441
- Assert (totalGuardCount > 0 );
442
- Assert (totalGuardCount == this ->m_func ->indexedPropertyGuardCount );
441
+ int totalGuardCount = (this ->m_func ->singleTypeGuards != nullptr ? this ->m_func ->singleTypeGuards ->Count () : 0 )
442
+ + (this ->m_func ->equivalentTypeGuards != nullptr ? this ->m_func ->equivalentTypeGuards ->Count () : 0 );
443
+ Assert (totalGuardCount > 0 );
444
+ Assert (totalGuardCount == this ->m_func ->indexedPropertyGuardCount );
443
445
#endif
444
446
445
- int guardSlotCount = 0 ;
446
- this ->m_func ->propertyGuardsByPropertyId ->Map ([&guardSlotCount](Js::PropertyId propertyId, Func::IndexedPropertyGuardSet* set) -> void
447
- {
448
- guardSlotCount += set->Count ();
449
- });
447
+ int guardSlotCount = 0 ;
448
+ this ->m_func ->propertyGuardsByPropertyId ->Map ([&guardSlotCount](Js::PropertyId propertyId, Func::IndexedPropertyGuardSet* set) -> void
449
+ {
450
+ guardSlotCount += set->Count ();
451
+ });
450
452
451
- size_t typeGuardTransferSize = // Reserve enough room for:
452
- propertyCount * sizeof (Js::TypeGuardTransferEntry) + // each propertyId,
453
- propertyCount * sizeof (Js::JitIndexedPropertyGuard*) + // terminating nullptr guard for each propertyId,
454
- guardSlotCount * sizeof (Js::JitIndexedPropertyGuard*); // a pointer for each guard we counted above.
453
+ size_t typeGuardTransferSize = // Reserve enough room for:
454
+ propertyCount * sizeof (Js::TypeGuardTransferEntry) + // each propertyId,
455
+ propertyCount * sizeof (Js::JitIndexedPropertyGuard*) + // terminating nullptr guard for each propertyId,
456
+ guardSlotCount * sizeof (Js::JitIndexedPropertyGuard*); // a pointer for each guard we counted above.
455
457
456
- // The extra room for sizeof(Js::TypePropertyGuardEntry) allocated by HeapNewPlus will be used for the terminating invalid propertyId.
457
- // Review (jedmiad): Skip zeroing? This is heap allocated so there shouldn't be any false recycler references.
458
- Js::TypeGuardTransferEntry* typeGuardTransferRecord = NativeCodeDataNewPlusZ (typeGuardTransferSize, m_func->GetNativeCodeDataAllocator (), Js::TypeGuardTransferEntry);
458
+ // The extra room for sizeof(Js::TypePropertyGuardEntry) allocated by HeapNewPlus will be used for the terminating invalid propertyId.
459
+ // Review (jedmiad): Skip zeroing? This is heap allocated so there shouldn't be any false recycler references.
460
+ Js::TypeGuardTransferEntry* typeGuardTransferRecord = NativeCodeDataNewPlusZ (typeGuardTransferSize, m_func->GetNativeCodeDataAllocator (), Js::TypeGuardTransferEntry);
459
461
460
- Func* func = this ->m_func ;
462
+ Func* func = this ->m_func ;
461
463
462
- Js::TypeGuardTransferEntry* dstEntry = typeGuardTransferRecord;
463
- this ->m_func ->propertyGuardsByPropertyId ->Map ([func, &dstEntry](Js::PropertyId propertyId, Func::IndexedPropertyGuardSet* srcSet) -> void
464
- {
465
- dstEntry->propertyId = propertyId;
464
+ Js::TypeGuardTransferEntry* dstEntry = typeGuardTransferRecord;
465
+ this ->m_func ->propertyGuardsByPropertyId ->Map ([func, &dstEntry](Js::PropertyId propertyId, Func::IndexedPropertyGuardSet* srcSet) -> void
466
+ {
467
+ dstEntry->propertyId = propertyId;
466
468
467
- int guardIndex = 0 ;
469
+ int guardIndex = 0 ;
468
470
469
- srcSet->Map ([dstEntry, &guardIndex](Js::JitIndexedPropertyGuard* guard) -> void
470
- {
471
- dstEntry->guards [guardIndex++] = guard;
472
- });
471
+ srcSet->Map ([dstEntry, &guardIndex](Js::JitIndexedPropertyGuard* guard) -> void
472
+ {
473
+ dstEntry->guards [guardIndex++] = guard;
474
+ });
473
475
474
- dstEntry->guards [guardIndex++] = nullptr ;
475
- dstEntry = reinterpret_cast <Js::TypeGuardTransferEntry*>(&dstEntry->guards [guardIndex]);
476
- });
477
- dstEntry->propertyId = Js::Constants::NoProperty;
478
- dstEntry++;
476
+ dstEntry->guards [guardIndex++] = nullptr ;
477
+ dstEntry = reinterpret_cast <Js::TypeGuardTransferEntry*>(&dstEntry->guards [guardIndex]);
478
+ });
479
+ dstEntry->propertyId = Js::Constants::NoProperty;
480
+ dstEntry++;
479
481
480
- Assert (reinterpret_cast <char *>(dstEntry) <= reinterpret_cast <char *>(typeGuardTransferRecord) + typeGuardTransferSize + sizeof (Js::TypeGuardTransferEntry));
482
+ Assert (reinterpret_cast <char *>(dstEntry) <= reinterpret_cast <char *>(typeGuardTransferRecord) + typeGuardTransferSize + sizeof (Js::TypeGuardTransferEntry));
481
483
482
- // TODO: OOP JIT need a way to pass back the jitTransferData and in main process it need to amend the reference to typeGuardTransferRecord
483
- // or just have a allocation offset to locate the typeGuardTransferRecord
484
- // entryPointInfo->RecordTypeGuards(this->m_func->indexedPropertyGuardCount, typeGuardTransferRecord, typeGuardTransferSize);
484
+ // TODO: OOP JIT need a way to pass back the jitTransferData and in main process it need to amend the reference to typeGuardTransferRecord
485
+ // or just have a allocation offset to locate the typeGuardTransferRecord
486
+ entryPointInfo->RecordTypeGuards (this ->m_func ->indexedPropertyGuardCount , typeGuardTransferRecord, typeGuardTransferSize);
487
+ }
485
488
}
486
489
487
490
// Save all constructor caches on the JIT transfer data in a map keyed by property ID. We will use this map when installing the entry
0 commit comments