diff --git a/include/hermes/BCGen/HBC/Bytecode.h b/include/hermes/BCGen/HBC/Bytecode.h index a1552a712b8..b0ffc99aefd 100644 --- a/include/hermes/BCGen/HBC/Bytecode.h +++ b/include/hermes/BCGen/HBC/Bytecode.h @@ -217,10 +217,11 @@ class BytecodeModule { /// Object Value Buffer table. SerializableBufferTy objValBuffer_; - /// The ID of the first CJS module in this BytecodeModule. - /// This is the first entry in the Domain's CJS module table that will be - /// populated by the corresponding RuntimeModule. - uint32_t cjsModuleOffset_; + /// The segment ID corresponding to this BytecodeModule. + /// This uniquely identifies this BytecodeModule within a set of modules + /// which were compiled at the same time (and will correspond to a set of + /// RuntimeModules in a Domain). + uint32_t segmentID_; /// Table which indicates where to find the different CommonJS modules. /// Mapping from {filename ID => function index}. @@ -260,7 +261,7 @@ class BytecodeModule { std::vector &&arrayBuffer, std::vector &&objKeyBuffer, std::vector &&objValBuffer, - uint32_t cjsModuleOffset, + uint32_t segmentID, std::vector> &&cjsModuleTable, std::vector> &&cjsModuleTableStatic, BytecodeOptions options) @@ -274,7 +275,7 @@ class BytecodeModule { arrayBuffer_(std::move(arrayBuffer)), objKeyBuffer_(std::move(objKeyBuffer)), objValBuffer_(std::move(objValBuffer)), - cjsModuleOffset_(cjsModuleOffset), + segmentID_(segmentID), cjsModuleTable_(std::move(cjsModuleTable)), cjsModuleTableStatic_(std::move(cjsModuleTableStatic)), options_(options) { @@ -343,8 +344,8 @@ class BytecodeModule { return regExpStorage_; } - uint32_t getCJSModuleOffset() const { - return cjsModuleOffset_; + uint32_t getSegmentID() const { + return segmentID_; } llvh::ArrayRef> getCJSModuleTable() const { diff --git a/include/hermes/BCGen/HBC/BytecodeDataProvider.h b/include/hermes/BCGen/HBC/BytecodeDataProvider.h index 2cde0779323..875ea5a75bf 100644 --- a/include/hermes/BCGen/HBC/BytecodeDataProvider.h +++ b/include/hermes/BCGen/HBC/BytecodeDataProvider.h @@ -126,8 +126,8 @@ class BCProviderBase { llvh::ArrayRef regExpTable_{}; llvh::ArrayRef regExpStorage_{}; - /// The ID of the first CJS module in this BytecodeModule. - uint32_t cjsModuleOffset_; + /// The segment ID corresponding to the bytecode module. + uint32_t segmentID_; /// Table which indicates where to find the different CommonJS modules. /// List of unsorted pairs from {filename ID => function index}. @@ -187,8 +187,8 @@ class BCProviderBase { llvh::ArrayRef getRegExpStorage() const { return regExpStorage_; } - uint32_t getCJSModuleOffset() const { - return cjsModuleOffset_; + uint32_t getSegmentID() const { + return segmentID_; } llvh::ArrayRef> getCJSModuleTable() const { return cjsModuleTable_; diff --git a/include/hermes/BCGen/HBC/BytecodeFileFormat.h b/include/hermes/BCGen/HBC/BytecodeFileFormat.h index 2736c1463ec..cd2ba767e11 100644 --- a/include/hermes/BCGen/HBC/BytecodeFileFormat.h +++ b/include/hermes/BCGen/HBC/BytecodeFileFormat.h @@ -30,7 +30,7 @@ const static uint64_t DELTA_MAGIC = ~MAGIC; // Bytecode version generated by this version of the compiler. // Updated: Oct 5, 2020 -const static uint32_t BYTECODE_VERSION = 77; +const static uint32_t BYTECODE_VERSION = 78; /// Property cache index which indicates no caching. static constexpr uint8_t PROPERTY_CACHING_DISABLED = 0; @@ -85,7 +85,7 @@ struct BytecodeFileHeader { uint32_t arrayBufferSize; uint32_t objKeyBufferSize; uint32_t objValueBufferSize; - uint32_t cjsModuleOffset; // The starting module ID in this segment. + uint32_t segmentID; // The ID of this segment. uint32_t cjsModuleCount; // Number of modules. uint32_t debugInfoOffset; BytecodeOptions options; @@ -111,7 +111,7 @@ struct BytecodeFileHeader { uint32_t arrayBufferSize, uint32_t objKeyBufferSize, uint32_t objValueBufferSize, - uint32_t cjsModuleOffset, + uint32_t segmentID, uint32_t cjsModuleCount, uint32_t debugInfoOffset, BytecodeOptions options) @@ -131,7 +131,7 @@ struct BytecodeFileHeader { arrayBufferSize(arrayBufferSize), objKeyBufferSize(objKeyBufferSize), objValueBufferSize(objValueBufferSize), - cjsModuleOffset(cjsModuleOffset), + segmentID(segmentID), cjsModuleCount(cjsModuleCount), debugInfoOffset(debugInfoOffset), options(options) { diff --git a/include/hermes/BCGen/HBC/BytecodeGenerator.h b/include/hermes/BCGen/HBC/BytecodeGenerator.h index 12977c50f46..da79d5534eb 100644 --- a/include/hermes/BCGen/HBC/BytecodeGenerator.h +++ b/include/hermes/BCGen/HBC/BytecodeGenerator.h @@ -264,8 +264,8 @@ class BytecodeModuleGenerator { /// This allows us to serialize the filenames as part of the debug info. UniquingFilenameTable filenameTable_{}; - /// The ID of the first CJS module in this BytecodeModule. - uint32_t cjsModuleOffset_{0}; + /// The ID of this segment. + uint32_t segmentID_{0}; /// A record of all the CJS modules registered in this run of generation. /// List of pairs: (filename ID, function index). @@ -352,9 +352,9 @@ class BytecodeModuleGenerator { /// \return the index of the string. uint32_t addFilename(StringRef str); - /// Set the CJS module offset for this module. - void setCJSModuleOffset(uint32_t offset) { - cjsModuleOffset_ = offset; + /// Set the segment ID for this module. + void setSegmentID(uint32_t id) { + segmentID_ = id; } /// Adds a CJS module entry to the table. diff --git a/include/hermes/BCGen/HBC/DebugInfo.h b/include/hermes/BCGen/HBC/DebugInfo.h index f4e8652fbcd..a28d4a53358 100644 --- a/include/hermes/BCGen/HBC/DebugInfo.h +++ b/include/hermes/BCGen/HBC/DebugInfo.h @@ -250,7 +250,7 @@ class DebugInfo { void populateSourceMap( SourceMapGenerator *sourceMap, std::vector &&functionOffsets, - uint32_t cjsModuleOffset) const; + uint32_t segmentID) const; #endif }; diff --git a/include/hermes/SourceMap/SourceMapGenerator.h b/include/hermes/SourceMap/SourceMapGenerator.h index bb026ecdc48..c4da671c3f8 100644 --- a/include/hermes/SourceMap/SourceMapGenerator.h +++ b/include/hermes/SourceMap/SourceMapGenerator.h @@ -27,14 +27,14 @@ class SourceMapGenerator { public: /// Add a line \p line represented as a list of Segments to the 'mappings' /// section. - /// \param cjsModuleOffset the offset of the module represented by the given - /// line, used as the "line" when reporting stack traces from the VM, - /// which doesn't have access to the segment IDs. - void addMappingsLine(SourceMap::SegmentList line, uint32_t cjsModuleOffset) { - if (lines_.size() <= cjsModuleOffset) { - lines_.resize(cjsModuleOffset + 1); + /// \param segmentID the ID of the segment ( = the BytecodeModule / + /// RuntimeModule), used as the "line" when reporting stack traces from the + /// VM. + void addMappingsLine(SourceMap::SegmentList line, uint32_t segmentID) { + if (lines_.size() <= segmentID) { + lines_.resize(segmentID + 1); } - lines_[cjsModuleOffset] = std::move(line); + lines_[segmentID] = std::move(line); } /// \return the list of mappings lines. @@ -66,7 +66,7 @@ class SourceMapGenerator { /// SourceMapGenerator::outputAsJSON. void addFunctionOffsets( std::vector &&functionOffsets, - uint32_t cjsModuleOffset); + uint32_t segmentID); /// Get the source index given the filename. uint32_t getSourceIndex(llvh::StringRef filename) const { @@ -141,7 +141,7 @@ class SourceMapGenerator { /// x_facebook_sources field in the JSON source map. SourceMap::MetadataList sourcesMetadata_; - /// Maps cjsModuleOffset to a vector of function offsets indexed by their + /// Maps segmentID to a vector of function offsets indexed by their /// function id. llvh::DenseMap> functionOffsets_{}; }; diff --git a/include/hermes/VM/PredefinedStrings.def b/include/hermes/VM/PredefinedStrings.def index 363a3753cb9..5741a1b192e 100644 --- a/include/hermes/VM/PredefinedStrings.def +++ b/include/hermes/VM/PredefinedStrings.def @@ -423,7 +423,7 @@ STR(getFunctionLocation, "getFunctionLocation") STR(isNative, "isNative") STR(lineNumber, "lineNumber") STR(columnNumber, "columnNumber") -STR(cjsModuleOffset, "cjsModuleOffset") +STR(segmentID, "segmentID") STR(virtualOffset, "virtualOffset") STR(fileName, "fileName") diff --git a/lib/BCGen/HBC/Bytecode.cpp b/lib/BCGen/HBC/Bytecode.cpp index 2bcaedd6dc1..e391b6541c1 100644 --- a/lib/BCGen/HBC/Bytecode.cpp +++ b/lib/BCGen/HBC/Bytecode.cpp @@ -37,7 +37,7 @@ void BytecodeModule::populateSourceMap(SourceMapGenerator *sourceMap) const { offset += func->getHeader().bytecodeSizeInBytes; } debugInfo_.populateSourceMap( - sourceMap, std::move(functionOffsets), cjsModuleOffset_); + sourceMap, std::move(functionOffsets), segmentID_); } void BytecodeModule::inlineJumpTables() { diff --git a/lib/BCGen/HBC/BytecodeDataProvider.cpp b/lib/BCGen/HBC/BytecodeDataProvider.cpp index 11394a15f05..ac4676d4f41 100644 --- a/lib/BCGen/HBC/BytecodeDataProvider.cpp +++ b/lib/BCGen/HBC/BytecodeDataProvider.cpp @@ -580,7 +580,7 @@ BCProviderFromBuffer::BCProviderFromBuffer( objValueBuffer_ = fields.objValueBuffer; regExpTable_ = fields.regExpTable; regExpStorage_ = fields.regExpStorage; - cjsModuleOffset_ = fileHeader->cjsModuleOffset; + segmentID_ = fileHeader->segmentID; cjsModuleTable_ = fields.cjsModuleTable; cjsModuleTableStatic_ = fields.cjsModuleTableStatic; } diff --git a/lib/BCGen/HBC/BytecodeDisassembler.cpp b/lib/BCGen/HBC/BytecodeDisassembler.cpp index 8dd3d3f015d..a97257cb0bd 100644 --- a/lib/BCGen/HBC/BytecodeDisassembler.cpp +++ b/lib/BCGen/HBC/BytecodeDisassembler.cpp @@ -124,8 +124,7 @@ void BytecodeDisassembler::disassembleBytecodeFileHeader(raw_ostream &OS) { OS << " String Kind Entry count: " << bcProvider_->getStringKinds().size() << "\n"; OS << " RegExp count: " << bcProvider_->getRegExpTable().size() << "\n"; - OS << " CommonJS module offset: " << bcProvider_->getCJSModuleOffset() - << "\n"; + OS << " Segment ID: " << bcProvider_->getSegmentID() << "\n"; OS << " CommonJS module count: " << bcProvider_->getCJSModuleTable().size() << "\n"; OS << " CommonJS module count (static): " diff --git a/lib/BCGen/HBC/BytecodeGenerator.cpp b/lib/BCGen/HBC/BytecodeGenerator.cpp index 07aad48d36e..c71e1efafc2 100644 --- a/lib/BCGen/HBC/BytecodeGenerator.cpp +++ b/lib/BCGen/HBC/BytecodeGenerator.cpp @@ -195,10 +195,6 @@ void BytecodeModuleGenerator::addCJSModuleStatic( uint32_t moduleID, uint32_t functionID) { assert(cjsModules_.empty() && "Unresolved modules must be in cjsModules_"); - assert( - moduleID - cjsModuleOffset_ == cjsModulesStatic_.size() && - "Module ID out of order in cjsModulesStatic_"); - (void)moduleID; cjsModulesStatic_.push_back({moduleID, functionID}); } @@ -230,7 +226,7 @@ std::unique_ptr BytecodeModuleGenerator::generate() { std::move(arrayBuffer_), std::move(objKeyBuffer_), std::move(objValBuffer_), - cjsModuleOffset_, + segmentID_, std::move(cjsModules_), std::move(cjsModulesStatic_), bytecodeOptions)}; diff --git a/lib/BCGen/HBC/BytecodeProviderFromSrc.cpp b/lib/BCGen/HBC/BytecodeProviderFromSrc.cpp index 1a7ed23d72c..e9eae0900b9 100644 --- a/lib/BCGen/HBC/BytecodeProviderFromSrc.cpp +++ b/lib/BCGen/HBC/BytecodeProviderFromSrc.cpp @@ -72,7 +72,7 @@ BCProviderFromSrc::BCProviderFromSrc( objKeyBuffer_ = module_->getObjectBuffer().first; objValueBuffer_ = module_->getObjectBuffer().second; - cjsModuleOffset_ = module_->getCJSModuleOffset(); + segmentID_ = module_->getSegmentID(); cjsModuleTable_ = module_->getCJSModuleTable(); cjsModuleTableStatic_ = module_->getCJSModuleTableStatic(); diff --git a/lib/BCGen/HBC/BytecodeStream.cpp b/lib/BCGen/HBC/BytecodeStream.cpp index f6d93db247a..08736390d51 100644 --- a/lib/BCGen/HBC/BytecodeStream.cpp +++ b/lib/BCGen/HBC/BytecodeStream.cpp @@ -32,7 +32,7 @@ void BytecodeSerializer::serialize(BytecodeModule &BM, const SHA1 &sourceHash) { BM.getArrayBufferSize(), BM.getObjectKeyBufferSize(), BM.getObjectValueBufferSize(), - BM.getCJSModuleOffset(), + BM.getSegmentID(), cjsModuleCount, debugInfoOffset_, BM.getBytecodeOptions()}; diff --git a/lib/BCGen/HBC/DebugInfo.cpp b/lib/BCGen/HBC/DebugInfo.cpp index abb73845fcf..965323976ea 100644 --- a/lib/BCGen/HBC/DebugInfo.cpp +++ b/lib/BCGen/HBC/DebugInfo.cpp @@ -322,7 +322,7 @@ void DebugInfo::disassembleLexicalData(llvh::raw_ostream &OS) const { void DebugInfo::populateSourceMap( SourceMapGenerator *sourceMap, std::vector &&functionOffsets, - uint32_t cjsModuleOffset) const { + uint32_t segmentID) const { // Since our bytecode is not JavaScript, we interpret the source map in a // creative way: each bytecode module is represented as a line, and bytecode // addresses in the file are represented as column offsets. @@ -355,8 +355,8 @@ void DebugInfo::populateSourceMap( segments.push_back(segmentFor(*loc, offsetInFile, offset)); offset = fdid.getOffset(); } - sourceMap->addMappingsLine(std::move(segments), cjsModuleOffset); - sourceMap->addFunctionOffsets(std::move(functionOffsets), cjsModuleOffset); + sourceMap->addMappingsLine(std::move(segments), segmentID); + sourceMap->addFunctionOffsets(std::move(functionOffsets), segmentID); } #endif diff --git a/lib/BCGen/HBC/HBC.cpp b/lib/BCGen/HBC/HBC.cpp index ed8f663a5d4..04b787545f7 100644 --- a/lib/BCGen/HBC/HBC.cpp +++ b/lib/BCGen/HBC/HBC.cpp @@ -171,7 +171,7 @@ std::unique_ptr hbc::generateBytecodeModule( BytecodeModuleGenerator BMGen(options); if (range) { - BMGen.setCJSModuleOffset(range->first); + BMGen.setSegmentID(range->segment); } // Empty if all functions should be generated (i.e. bundle splitting was not diff --git a/lib/SourceMap/SourceMapGenerator.cpp b/lib/SourceMap/SourceMapGenerator.cpp index 92cc4f73fce..1da31ecffda 100644 --- a/lib/SourceMap/SourceMapGenerator.cpp +++ b/lib/SourceMap/SourceMapGenerator.cpp @@ -242,9 +242,9 @@ void SourceMapGenerator::outputAsJSONImpl(llvh::raw_ostream &OS) const { void SourceMapGenerator::addFunctionOffsets( std::vector &&functionOffsets, - uint32_t cjsModuleOffset) { + uint32_t segmentID) { assert(functionOffsets.size() > 0 && "functionOffsets can not be empty"); - functionOffsets_[cjsModuleOffset] = std::move(functionOffsets); + functionOffsets_[segmentID] = std::move(functionOffsets); } } // namespace hermes diff --git a/lib/VM/JSError.cpp b/lib/VM/JSError.cpp index 222c4b3afaf..7ebef4a89f3 100644 --- a/lib/VM/JSError.cpp +++ b/lib/VM/JSError.cpp @@ -607,12 +607,10 @@ ExecutionStatus JSError::constructStackTraceString( // Code block was not in the cache, update the cache. virtualOffset = sti.codeBlock->getVirtualOffset(); } - // Add 1 to the CJSModuleOffset to account for 1-based indexing of + // Add 1 to the SegmentID to account for 1-based indexing of // symbolication tools. - lineNo = sti.codeBlock->getRuntimeModule() - ->getBytecode() - ->getCJSModuleOffset() + - 1; + lineNo = + sti.codeBlock->getRuntimeModule()->getBytecode()->getSegmentID() + 1; columnNo = sti.bytecodeOffset + virtualOffset; isAddress = true; } diff --git a/lib/VM/JSLib/HermesInternal.cpp b/lib/VM/JSLib/HermesInternal.cpp index 7f2b12130aa..beb6e1be54d 100644 --- a/lib/VM/JSLib/HermesInternal.cpp +++ b/lib/VM/JSLib/HermesInternal.cpp @@ -599,7 +599,7 @@ static CallResult getCodeBlockFileName( /// * fileName (string) /// * lineNumber (number) - 1 based /// * columnNumber (number) - 1 based -/// * cjsModuleOffset (number) - 0 based +/// * segmentID (number) - 0 based /// * virtualOffset (number) - 0 based /// * isNative (boolean) /// TypeError if func is not a function. @@ -651,15 +651,14 @@ hermesInternalGetFunctionLocation(void *, Runtime *runtime, NativeArgs args) { (void)res; } else { tmpHandle = HermesValue::encodeNumberValue( - codeBlock->getRuntimeModule()->getBytecode()->getCJSModuleOffset()); + codeBlock->getRuntimeModule()->getBytecode()->getSegmentID()); res = JSObject::defineOwnProperty( resultHandle, runtime, - Predefined::getSymbolID(Predefined::cjsModuleOffset), + Predefined::getSymbolID(Predefined::segmentID), DefinePropertyFlags::getDefaultNewPropertyFlags(), tmpHandle); - assert( - res != ExecutionStatus::EXCEPTION && "Failed to set cjsModuleOffset"); + assert(res != ExecutionStatus::EXCEPTION && "Failed to set segmentID"); (void)res; tmpHandle = HermesValue::encodeNumberValue(codeBlock->getVirtualOffset()); diff --git a/lib/VM/Profiler/CodeCoverageProfiler.cpp b/lib/VM/Profiler/CodeCoverageProfiler.cpp index 7eec5a7f386..4d935039da8 100644 --- a/lib/VM/Profiler/CodeCoverageProfiler.cpp +++ b/lib/VM/Profiler/CodeCoverageProfiler.cpp @@ -58,13 +58,13 @@ CodeCoverageProfiler::getExecutedFunctions() { } for (auto &entry : coverageInfoIter->second.executedFuncBitsArrayMap) { auto *bcProvider = entry.first->getBytecode(); - const uint32_t moduleId = bcProvider->getCJSModuleOffset(); + const uint32_t segmentID = bcProvider->getSegmentID(); const std::vector &moduleFuncBitsArray = entry.second; for (uint32_t i = 0; i < moduleFuncBitsArray.size(); ++i) { if (moduleFuncBitsArray[i]) { const uint32_t funcVirtualOffset = bcProvider->getVirtualOffsetForFunction(i); - funcInfos.emplace_back(moduleId, funcVirtualOffset); + funcInfos.emplace_back(segmentID, funcVirtualOffset); } } } diff --git a/lib/VM/Profiler/SamplingProfilerPosix.cpp b/lib/VM/Profiler/SamplingProfilerPosix.cpp index e0d5c11de0a..14ee33d6bc6 100644 --- a/lib/VM/Profiler/SamplingProfilerPosix.cpp +++ b/lib/VM/Profiler/SamplingProfilerPosix.cpp @@ -363,8 +363,8 @@ uint32_t SamplingProfiler::walkRuntimeStack( stackFrame.jsFrame.functionId) + stackFrame.jsFrame.offset; - uint32_t moduleId = bcProvider->getCJSModuleOffset(); - uint64_t frameAddress = ((uint64_t)moduleId << 32) + virtualOffset; + uint32_t segmentID = bcProvider->getSegmentID(); + uint64_t frameAddress = ((uint64_t)segmentID << 32) + virtualOffset; assert( (frameAddress & kNativeFrameMask) == 0 && "Module id should take less than 32 bits"); diff --git a/lib/VM/Runtime.cpp b/lib/VM/Runtime.cpp index 126d4657988..3123b59b67c 100644 --- a/lib/VM/Runtime.cpp +++ b/lib/VM/Runtime.cpp @@ -1762,10 +1762,9 @@ void Runtime::crashWriteCallStack(JSONEmitter &json) { .toStringRef(srcLocStorage)); } } - uint32_t cjsModuleOffset = - runtimeModule->getBytecode()->getCJSModuleOffset(); + uint32_t segmentID = runtimeModule->getBytecode()->getSegmentID(); llvh::StringRef sourceURL = runtimeModule->getSourceURL(); - json.emitKeyValue("CJSModuleOffset", cjsModuleOffset); + json.emitKeyValue("SegmentID", segmentID); json.emitKeyValue("SourceURL", sourceURL); } else { json.emitKeyValue("NativeCode", true); diff --git a/test/hermes/hermes-internal-get-function-location.js b/test/hermes/hermes-internal-get-function-location.js index 906db695aaa..968df81dd92 100644 --- a/test/hermes/hermes-internal-get-function-location.js +++ b/test/hermes/hermes-internal-get-function-location.js @@ -22,7 +22,7 @@ print(loc(fn1).lineNumber); print(loc(fn1).columnNumber); // JS-NEXT: 1 // BC-NEXT: undefined -print(loc(fn1).cjsModuleOffset); +print(loc(fn1).segmentID); // JS-NEXT: undefined // BC-NEXT: 0 print(loc(fn1).virtualOffset); @@ -42,7 +42,7 @@ print(loc(fn1Bound).lineNumber); print(loc(fn1Bound).columnNumber); // JS-NEXT: 1 // BC-NEXT: undefined -print(loc(fn1Bound).cjsModuleOffset); +print(loc(fn1Bound).segmentID); // JS-NEXT: undefined // BC-NEXT: 0 print(loc(fn1Bound).virtualOffset); @@ -61,7 +61,7 @@ print(loc(Object).lineNumber); print(loc(Object).columnNumber); // JS-NEXT: undefined // BC-NEXT: undefined -print(loc(Object).cjsModuleOffset); +print(loc(Object).segmentID); // JS-NEXT: undefined // BC-NEXT: undefined print(loc(Object).virtualOffset); @@ -81,7 +81,7 @@ print(loc(fn2).lineNumber); print(loc(fn2).columnNumber); // JS-NEXT: 2 // BC-NEXT: 2 -print(loc(fn2).cjsModuleOffset); +print(loc(fn2).segmentID); // JS-NEXT: undefined // BC-NEXT: undefined print(loc(fn2).virtualOffset); diff --git a/tools/hbc-attribute/hbc-attribute.cpp b/tools/hbc-attribute/hbc-attribute.cpp index b5369e17385..ca30452dc25 100644 --- a/tools/hbc-attribute/hbc-attribute.cpp +++ b/tools/hbc-attribute/hbc-attribute.cpp @@ -68,7 +68,7 @@ using SLG = hermes::hbc::SerializedLiteralGenerator; * If you have added or modified sections, make sure they're counted properly. */ static_assert( - BYTECODE_VERSION == 77, + BYTECODE_VERSION == 78, "Bytecode version changed. Please verify that hbc-attribute counts correctly.."); static llvh::cl::opt InputFilename( diff --git a/unittests/VMRuntime/CodeCoverageProfilerTest.cpp b/unittests/VMRuntime/CodeCoverageProfilerTest.cpp index 80c8f67d9c6..5d4ddea56ae 100644 --- a/unittests/VMRuntime/CodeCoverageProfilerTest.cpp +++ b/unittests/VMRuntime/CodeCoverageProfilerTest.cpp @@ -30,10 +30,10 @@ class CodeCoverageProfilerTest : public RuntimeTestFixture { protected: static CodeCoverageProfiler::FuncInfo getFuncInfo(Handle func) { auto bcProvider = func->getCodeBlock()->getRuntimeModule()->getBytecode(); - const uint32_t moduleId = bcProvider->getCJSModuleOffset(); + const uint32_t segmentID = bcProvider->getSegmentID(); const uint32_t funcVirtualOffset = bcProvider->getVirtualOffsetForFunction( func->getCodeBlock()->getFunctionID()); - return {moduleId, funcVirtualOffset}; + return {segmentID, funcVirtualOffset}; } // Check if the function is executed or not.