Skip to content

Commit 0d5cbc9

Browse files
committed
Add the property ids for the scope slot array to serialized bytecode for defer-parsed functions
1 parent 2bdfc7c commit 0d5cbc9

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

lib/Runtime/ByteCode/ByteCodeSerializer.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,7 +1592,7 @@ class ByteCodeBufferBuilder
15921592
return size;
15931593
}
15941594

1595-
uint32 AddPropertyIdsForScopeSlotArray(BufferBuilderList & builder, FunctionBody * function)
1595+
uint32 AddPropertyIdsForScopeSlotArray(BufferBuilderList & builder, ParseableFunctionInfo* function)
15961596
{
15971597
if (function->scopeSlotArraySize == 0)
15981598
{
@@ -2096,8 +2096,6 @@ class ByteCodeBufferBuilder
20962096
AddCacheIdToPropertyIdMap(builder, function);
20972097
AddReferencedPropertyIdMap(builder, function);
20982098

2099-
AddPropertyIdsForScopeSlotArray(builder, function);
2100-
21012099
if (function->GetSlotIdInCachedScopeToNestedIndexArray() == nullptr)
21022100
{
21032101
definedFields.has_slotIdInCachedScopeToNestedIndexArray = false;
@@ -2285,6 +2283,8 @@ class ByteCodeBufferBuilder
22852283

22862284
#include "SerializableFunctionFields.h"
22872285

2286+
AddPropertyIdsForScopeSlotArray(builder, function);
2287+
22882288
if (functionBody != nullptr)
22892289
{
22902290
AddFunctionBody(builder, functionBody, srcInfo, definedFields);
@@ -2383,7 +2383,7 @@ class ByteCodeBufferBuilder
23832383
if (scopeInfo->areNamesCached)
23842384
{
23852385
Assert(sym->name != nullptr);
2386-
//PropertyRecord* propertyRecord = ;
2386+
symPropertyId = sym->name->GetPropertyId();
23872387
}
23882388

23892389
PropertyId propertyId = encodePossiblyBuiltInPropertyId(symPropertyId);
@@ -3270,7 +3270,7 @@ class ByteCodeBufferReader
32703270
return current;
32713271
}
32723272

3273-
const byte * ReadPropertyIdsForScopeSlotArray(const byte * current, FunctionBody * function)
3273+
const byte * ReadPropertyIdsForScopeSlotArray(const byte * current, ByteCodeCache* cache, ParseableFunctionInfo * function)
32743274
{
32753275
if (function->scopeSlotArraySize == 0)
32763276
{
@@ -3288,8 +3288,8 @@ class ByteCodeBufferReader
32883288
{
32893289
int value;
32903290
current = ReadInt32(current, &value);
3291-
PropertyId propertyId = function->GetByteCodeCache()->LookupPropertyId(value);
3292-
function->GetPropertyIdsForScopeSlotArray()[i] = propertyId;
3291+
PropertyId propertyId = cache->LookupPropertyId(value);
3292+
function->GetPropertyIdsForScopeSlotArray()[i] = propertyId;
32933293
}
32943294

32953295
#ifdef BYTE_CODE_MAGIC_CONSTANTS
@@ -4010,6 +4010,8 @@ class ByteCodeBufferReader
40104010
}
40114011
#include "SerializableFunctionFields.h"
40124012

4013+
current = ReadPropertyIdsForScopeSlotArray(current, cache, *function);
4014+
40134015
if (definedFields->has_ConstantCount)
40144016
{
40154017
FunctionBody **functionBody = (FunctionBody **)function;
@@ -4038,11 +4040,11 @@ class ByteCodeBufferReader
40384040
// that here.
40394041
if (definedFields->has_flags == false)
40404042
{
4041-
(*functionBody)->flags = FunctionBody::FunctionBodyFlags::Flags_None;
4043+
(*function)->flags = FunctionBody::FunctionBodyFlags::Flags_None;
40424044
}
40434045
else
40444046
{
4045-
(*functionBody)->flags = (FunctionBody::FunctionBodyFlags)((*functionBody)->flags & ~FunctionBody::Flags_StackNestedFunc);
4047+
(*function)->flags = (FunctionBody::FunctionBodyFlags)((*function)->flags & ~FunctionBody::Flags_StackNestedFunc);
40464048
}
40474049

40484050
if (definedFields->has_m_envDepth == false)
@@ -4144,8 +4146,6 @@ class ByteCodeBufferReader
41444146
current = ReadReferencedPropertyIdMap(current, *functionBody);
41454147
(*functionBody)->AllocateInlineCache();
41464148

4147-
current = ReadPropertyIdsForScopeSlotArray(current, *functionBody);
4148-
41494149
if (definedFields->has_slotIdInCachedScopeToNestedIndexArray)
41504150
{
41514151
current = ReadSlotIdInCachedScopeToNestedIndexArray(current, *functionBody);

0 commit comments

Comments
 (0)