Skip to content

Commit 7b17602

Browse files
alexmarkovcommit-bot@chromium.org
authored andcommitted
[vm/bytecode] Include function name into source fingerprints
This change aligns BytecodeFingerprintHelper::CalculateFunctionFingerprint with KernelFingerprintHelper::CalculateFunctionFingerprint. Fixes vm/cc/FunctionSourceFingerprint with bytecode. Change-Id: I72fd25cbd2d04935c30cfe52838ef5aa890e1291 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114750 Reviewed-by: Ryan Macnak <[email protected]> Reviewed-by: Régis Crelier <[email protected]> Commit-Queue: Alexander Markov <[email protected]>
1 parent 851701d commit 7b17602

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

runtime/vm/compiler/frontend/bytecode_fingerprints.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,17 @@ static uint32_t FingerprintA_B_C(uint32_t fp,
173173
uint32_t BytecodeFingerprintHelper::CalculateFunctionFingerprint(
174174
const Function& function) {
175175
ASSERT(function.is_declared_in_bytecode());
176+
const intptr_t kHashBits = 30;
177+
uint32_t fp = 0;
178+
fp = CombineHashes(fp, String::Handle(function.UserVisibleName()).Hash());
176179
if (function.is_abstract()) {
177-
return 0;
180+
return FinalizeHash(fp, kHashBits);
178181
}
179182
if (!function.HasBytecode()) {
180183
kernel::BytecodeReader::ReadFunctionBytecode(Thread::Current(), function);
181184
}
182185
const Bytecode& code = Bytecode::Handle(function.bytecode());
183186
const ObjectPool& pool = ObjectPool::Handle(code.object_pool());
184-
uint32_t fp = 0;
185187
const KBCInstr* const start =
186188
reinterpret_cast<const KBCInstr*>(code.instructions());
187189
for (const KBCInstr* instr = start; (instr - start) < code.Size();
@@ -200,7 +202,7 @@ uint32_t BytecodeFingerprintHelper::CalculateFunctionFingerprint(
200202
}
201203
}
202204

203-
return FinalizeHash(fp, 30);
205+
return FinalizeHash(fp, kHashBits);
204206
}
205207

206208
} // namespace kernel

0 commit comments

Comments
 (0)