Commit 6af30f41 authored by Stephan Herhut's avatar Stephan Herhut Committed by Commit Bot

Use String16Builder.appendUnsignedAsHex for hashes

The debugger script implementation had its own way to write
uint32_t values to a string as hex values. This removes the
custom code and uses a shared implementation in String16Builder
instead.

The observable effect is that script hashes are now lower-case
and the character sequence is reversed for each 8-character
pair.

Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Ib21769fbe10c24055fbd3fa9573bc5c2d72f6a74
Reviewed-on: https://chromium-review.googlesource.com/951303Reviewed-by: 's avatarAleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Commit-Queue: Stephan Herhut <herhut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51801}
parent 8ae00f5a
......@@ -13,17 +13,8 @@ namespace v8_inspector {
namespace {
const char hexDigits[17] = "0123456789ABCDEF";
const char kGlobalDebuggerScriptHandleLabel[] = "DevTools debugger";
void appendUnsignedAsHex(uint64_t number, String16Builder& destination) {
for (size_t i = 0; i < 8; ++i) {
UChar c = hexDigits[number & 0xF];
destination.append(c);
number >>= 4;
}
}
// Hash algorithm for substrings is described in "Über die Komplexität der
// Multiplikation in
// eingeschränkten Branchingprogrammmodellen" by Woelfe.
......@@ -82,8 +73,8 @@ String16 calculateHash(const String16& str) {
hashes[i] = (hashes[i] + zi[i] * (prime[i] - 1)) % prime[i];
String16Builder hash;
// TODO(herhut): Use String16Builder.appendUnsignedAsHex.
for (size_t i = 0; i < hashesSize; ++i) appendUnsignedAsHex(hashes[i], hash);
for (size_t i = 0; i < hashesSize; ++i)
hash.appendUnsignedAsHex((uint32_t)hashes[i]);
return hash.toString();
}
......
......@@ -8,7 +8,7 @@ Running test: testLoadedModulesOnDebuggerEnable
endLine : 3
executionContextId : <executionContextId>
hasSourceURL : false
hash : DD672B308FB57B18CCEBFA236C372DBBC001DAD2
hash : 03b276dd81b75bf832afbeccbbd273c62dad100c
isLiveEdit : false
isModule : true
length : 39
......@@ -28,7 +28,7 @@ Running test: testScriptEventsWhenDebuggerIsEnabled
endLine : 3
executionContextId : <executionContextId>
hasSourceURL : false
hash : DD672B308FB57B18CCEBFA236C372DBBC001DAD2
hash : 03b276dd81b75bf832afbeccbbd273c62dad100c
isLiveEdit : false
isModule : true
length : 39
......@@ -46,7 +46,7 @@ Running test: testScriptEventsWhenDebuggerIsEnabled
endLine : 0
executionContextId : <executionContextId>
hasSourceURL : false
hash : FF746120E4E4F1BA4CB5762843D429DC872EBA18
hash : 021647ffab1f4e4e82675bc4cd924d3481abe278
isModule : true
length : 1
scriptId : <scriptId>
......
......@@ -6,7 +6,7 @@ getPossibleBreakpoints should not crash during lazy compilation (crbug.com/71533
endLine : 2
executionContextId : <executionContextId>
hasSourceURL : true
hash : 720BC4212F9AA3E834D156055BEFEDC32027C816
hash : 124cb0278e3aa9f250651d433cdefeb5618c7202
isLiveEdit : false
isModule : false
length : 52
......
......@@ -7,7 +7,7 @@ Runtime.evaluate with valid expression
endLine : 0
executionContextId : <executionContextId>
hasSourceURL : true
hash : A933D880D35072516A27D817C0079F01FEE46E23
hash : 088d339a1527053d718d72a610f9700c32e64eef
isLiveEdit : false
isModule : false
length : 29
......@@ -26,7 +26,7 @@ Runtime.evaluate with syntax error
endLine : 0
executionContextId : <executionContextId>
hasSourceURL : true
hash : 81077F73E5B26710D5CE891275FA68AC12493B57
hash : 37f7701801762b5e2198ec5dca86af5775b39421
isModule : false
length : 39
scriptId : <scriptId>
......@@ -44,7 +44,7 @@ Runtime.callFunctionOn with valid functionDeclaration
endLine : 0
executionContextId : <executionContextId>
hasSourceURL : false
hash : 53BA9611A1E9ABE81E93AF82DEC875F94048A807
hash : 1169ab358eba9e1a28fa39e19f578ced708a8404
isLiveEdit : false
isModule : false
length : 18
......@@ -63,7 +63,7 @@ Runtime.callFunctionOn with syntax error
endLine : 0
executionContextId : <executionContextId>
hasSourceURL : false
hash : 9D04D83251E2B7F64CB5762843D429DC872EBA18
hash : 238d40d96f7b2e1582675bc4cd924d3481abe278
isModule : false
length : 3
scriptId : <scriptId>
......@@ -81,7 +81,7 @@ Runtime.compileScript with valid expression
endLine : 0
executionContextId : <executionContextId>
hasSourceURL : false
hash : 9D04F7336B76D25A4CB5762843D429DC872EBA18
hash : 337f40d9a52d67b682675bc4cd924d3481abe278
isLiveEdit : false
isModule : false
length : 4
......@@ -100,7 +100,7 @@ Runtime.compileScript with syntax error
endLine : 0
executionContextId : <executionContextId>
hasSourceURL : false
hash : FF746120E4E4F1BA4CB5762843D429DC872EBA18
hash : 021647ffab1f4e4e82675bc4cd924d3481abe278
isModule : false
length : 1
scriptId : <scriptId>
......@@ -119,7 +119,7 @@ Runtime.evaluate compiled script with stack trace
endLine : 0
executionContextId : <executionContextId>
hasSourceURL : false
hash : A2185340102B6713AB58F5467452EC0C872EBA18
hash : 0435812a3176b201645f85bac0ce254781abe278
isLiveEdit : false
isModule : false
length : 8
......@@ -137,7 +137,7 @@ Runtime.evaluate compiled script with stack trace
endLine : 4
executionContextId : <executionContextId>
hasSourceURL : true
hash : 31052EF18E11A850DBC812A6154A27BA713D3521
hash : 1fe25013058a11e86a218cbdab72a4511253d317
isLiveEdit : false
isModule : false
length : 86
......@@ -166,7 +166,7 @@ Runtime.evaluate compiled script with stack trace
endLine : 0
executionContextId : <executionContextId>
hasSourceURL : false
hash : 9D04F7336B76D25A4CB5762843D429DC872EBA18
hash : 337f40d9a52d67b682675bc4cd924d3481abe278
isLiveEdit : false
isModule : false
length : 4
......@@ -196,7 +196,7 @@ Runtime.evaluate compile script error with stack trace
endLine : 0
executionContextId : <executionContextId>
hasSourceURL : false
hash : 55C8AE40102B6713AB58F546879BAE951E6BF325
hash : 04ea8c553176b201645f85ba59eab978523fb6e1
isLiveEdit : false
isModule : false
length : 12
......@@ -214,7 +214,7 @@ Runtime.evaluate compile script error with stack trace
endLine : 4
executionContextId : <executionContextId>
hasSourceURL : true
hash : 578C87106744016A01ADEA516DC739379190F4E2
hash : 0178c875a610447615aeda1073937cd62e4f0919
isLiveEdit : false
isModule : false
length : 98
......@@ -243,7 +243,7 @@ Runtime.evaluate compile script error with stack trace
endLine : 0
executionContextId : <executionContextId>
hasSourceURL : false
hash : 9D04F7336C348CA34CB5762843D429DC872EBA18
hash : 337f40d93ac843c682675bc4cd924d3481abe278
isModule : false
length : 3
scriptId : <scriptId>
......
......@@ -4,7 +4,7 @@ Tests scripts hasing
endLine : 0
executionContextId : <executionContextId>
hasSourceURL : false
hash : 1C6D2E82E4E4F1BA4CB5762843D429DC872EBA18
hash : 28e2d6c1ab1f4e4e82675bc4cd924d3481abe278
isLiveEdit : false
isModule : false
length : 1
......@@ -19,7 +19,7 @@ Tests scripts hasing
endLine : 0
executionContextId : <executionContextId>
hasSourceURL : false
hash : EBF1ECD351E7A3294CB5762843D429DC872EBA18
hash : 3dce1fbe923a7e1582675bc4cd924d3481abe278
isLiveEdit : false
isModule : false
length : 3
......@@ -34,7 +34,7 @@ Tests scripts hasing
endLine : 0
executionContextId : <executionContextId>
hasSourceURL : false
hash : 0449F3A28D4C32C1EC3696332EAD65644BDE59A7
hash : 2a3f94401c23c4d8336963ce4656dae27a95edb4
isLiveEdit : false
isModule : false
length : 8106
......
......@@ -6,7 +6,7 @@ Checks basic ES6 modules support.
endLine : 5
executionContextId : <executionContextId>
hasSourceURL : false
hash : E885A593519C4CD31BC243D5D06DCB961A1C69B5
hash : 395a588e3dc4c9155d342cb169bcd60d5b96c1a1
isLiveEdit : false
isModule : true
length : 83
......@@ -24,7 +24,7 @@ Checks basic ES6 modules support.
endLine : 5
executionContextId : <executionContextId>
hasSourceURL : false
hash : EFD8445134EBF926917EAE6072964574AB6D6C60
hash : 15448dfe629fbe4306eae7194754692706c6d6ba
isLiveEdit : false
isModule : true
length : 84
......@@ -42,7 +42,7 @@ Checks basic ES6 modules support.
endLine : 8
executionContextId : <executionContextId>
hasSourceURL : false
hash : B454ADE26B54DA4057C498A205C459099654AC47
hash : 2eda454b04ad45b62a894c7590954c5074ca4569
isLiveEdit : false
isModule : true
length : 191
......@@ -189,7 +189,7 @@ console.log(239)
endLine : 0
executionContextId : <executionContextId>
hasSourceURL : false
hash : FF746120E4E4F1BA4CB5762843D429DC872EBA18
hash : 021647ffab1f4e4e82675bc4cd924d3481abe278
isModule : true
length : 1
scriptId : <scriptId>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment