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/951303
Reviewed-by: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Commit-Queue: Stephan Herhut <herhut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51801}
This commit is contained in:
Stephan Herhut 2018-03-06 14:56:57 +01:00 committed by Commit Bot
parent 8ae00f5a46
commit 6af30f41e4
7 changed files with 64 additions and 73 deletions

View File

@ -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();
}

View File

@ -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>

View File

@ -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

View File

@ -8,7 +8,7 @@ scriptParsed
endLine : 1
executionContextId : <executionContextId>
hasSourceURL : true
hash : 662C2191D614E753232391E558B6EC90C2F0E2F1
hash : 1912c266357e416d5e19323209ce6b851f2e0f2c
isLiveEdit : false
isModule : false
length : 42
@ -27,7 +27,7 @@ scriptParsed
endLine : 0
executionContextId : <executionContextId>
hasSourceURL : true
hash : 362F9F016AAA39B904701571F19E8FA0B174F0B3
hash : 10f9f2639b93aaa6175107400af8e91f3b0f471b
isLiveEdit : false
isModule : false
length : 52
@ -46,7 +46,7 @@ scriptParsed
endLine : 2
executionContextId : <executionContextId>
hasSourceURL : true
hash : 976FA8F0184B894A9B10AFE4AC94EC437EE4FB60
hash : 0f8af679a498b4814efa01b934ce49ca06bf4ee7
isLiveEdit : false
isModule : false
length : 43
@ -65,7 +65,7 @@ scriptParsed
endLine : 3
executionContextId : <executionContextId>
hasSourceURL : true
hash : 3F4F1CC20C664E61705CD011E025DD093676ED54
hash : 2cc1f4f316e466c0110dc50790dd520e45de6763
isLiveEdit : false
isModule : false
length : 46
@ -84,7 +84,7 @@ scriptParsed
endLine : 1
executionContextId : <executionContextId>
hasSourceURL : false
hash : 55928721655B662420FC9F66450A7C2C327C8C36
hash : 127829554266b55666f9cf02c2c7a05463c8c723
isLiveEdit : false
isModule : false
length : 50
@ -103,7 +103,7 @@ scriptParsed
endLine : 0
executionContextId : <executionContextId>
hasSourceURL : false
hash : CF0E583119A280424958512525ECCFB3B4F7A262
hash : 1385e0fc24082a91521585943bfcce52262a7f4b
isLiveEdit : false
isModule : false
length : 60
@ -122,7 +122,7 @@ scriptParsed
endLine : 2
executionContextId : <executionContextId>
hasSourceURL : false
hash : D1FA51B286EA72144EC0E44681120344F2D2EBD5
hash : 2b15af1d4127ae68644e0ce4443021185dbe2d2f
isLiveEdit : false
isModule : false
length : 51
@ -141,7 +141,7 @@ scriptParsed
endLine : 3
executionContextId : <executionContextId>
hasSourceURL : false
hash : 7ABA6300FC0D3908C0536EE2EFF60B48E36FFA35
hash : 0036aba78093d0cf2ee6350c84b06ffe53aff63e
isLiveEdit : false
isModule : false
length : 54
@ -160,7 +160,7 @@ scriptParsed
endLine : 1
executionContextId : <executionContextId>
hasSourceURL : true
hash : EB6DE473AF1788035E434F41ABC86140BD638644
hash : 374ed6be308871fa14f434e504168cba446836db
isLiveEdit : false
isModule : false
length : 88
@ -179,7 +179,7 @@ scriptParsed
endLine : 1
executionContextId : <executionContextId>
hasSourceURL : true
hash : 63710BD01F77B0F0C00E0662B45B782A5976A206
hash : 0db017360f0b77f12660e00ca287b54b602a6795
isLiveEdit : false
isModule : false
length : 89
@ -198,7 +198,7 @@ scriptParsed
endLine : 1
executionContextId : <executionContextId>
hasSourceURL : true
hash : FC51669018C05471C8F46535240B9C77110E7291
hash : 096615cf17450c8153564f8c77c9b0421927e011
isLiveEdit : false
isModule : false
length : 40
@ -217,7 +217,7 @@ scriptParsed
endLine : 1
executionContextId : <executionContextId>
hasSourceURL : true
hash : FE0F41315BEF7930C8F465359F53D504110E7291
hash : 1314f0ef0397feb553564f8c405d35f91927e011
isLiveEdit : false
isModule : false
length : 41
@ -236,7 +236,7 @@ scriptParsed
endLine : 0
executionContextId : <executionContextId>
hasSourceURL : false
hash : 1D33B330614150F8F7EB45184E245F542E304118
hash : 033b33d18f0514168154be7f45f542e4811403e2
isLiveEdit : false
isModule : false
length : 18
@ -255,7 +255,7 @@ scriptParsed
endLine : 0
executionContextId : <executionContextId>
hasSourceURL : true
hash : 474CCF101B1996849E154ED20F854F368C793767
hash : 01fcc474486991b12de451e963f458f0767397c8
isLiveEdit : false
isModule : false
length : 96
@ -274,7 +274,7 @@ scriptParsed
endLine : 0
executionContextId : <executionContextId>
hasSourceURL : true
hash : DD0A3C60B97506161FA15D9419969A90DF33E2E0
hash : 06c3a0dd6160579b49d51af109a969910e2e33fd
isLiveEdit : false
isModule : false
length : 39
@ -293,7 +293,7 @@ scriptParsed
endLine : 1
executionContextId : <executionContextId>
hasSourceURL : false
hash : 1D33B330A774BD52F7EB45184E245F54C94FB815
hash : 033b33d125db477a8154be7f45f542e4518bf49c
isLiveEdit : false
isModule : false
length : 19
@ -312,7 +312,7 @@ scriptParsed
endLine : 2
executionContextId : <executionContextId>
hasSourceURL : false
hash : 1D33B330EA93E221F7EB45184E245F5479702083
hash : 033b33d1122e39ae8154be7f45f542e438020797
isLiveEdit : false
isModule : false
length : 20
@ -331,7 +331,7 @@ scriptParsed
endLine : 3
executionContextId : <executionContextId>
hasSourceURL : false
hash : 867981735982F829F7EB45184E245F5479702083
hash : 37189768928f28958154be7f45f542e438020797
isLiveEdit : false
isModule : false
length : 21
@ -350,7 +350,7 @@ scriptParsed
endLine : 4
executionContextId : <executionContextId>
hasSourceURL : false
hash : 095D6881D29C0D76F7EB45184E245F5479702083
hash : 1886d59067d0c92d8154be7f45f542e438020797
isLiveEdit : false
isModule : false
length : 22
@ -369,7 +369,7 @@ scriptParsed
endLine : 1
executionContextId : <executionContextId>
hasSourceURL : true
hash : 662C2191D614E753232391E558B6EC90C2F0E2F1
hash : 1912c266357e416d5e19323209ce6b851f2e0f2c
isLiveEdit : false
isModule : false
length : 42
@ -388,7 +388,7 @@ scriptParsed
endLine : 0
executionContextId : <executionContextId>
hasSourceURL : true
hash : 362F9F016AAA39B904701571F19E8FA0B174F0B3
hash : 10f9f2639b93aaa6175107400af8e91f3b0f471b
isLiveEdit : false
isModule : false
length : 52
@ -407,7 +407,7 @@ scriptParsed
endLine : 2
executionContextId : <executionContextId>
hasSourceURL : true
hash : 976FA8F0184B894A9B10AFE4AC94EC437EE4FB60
hash : 0f8af679a498b4814efa01b934ce49ca06bf4ee7
isLiveEdit : false
isModule : false
length : 43
@ -426,7 +426,7 @@ scriptParsed
endLine : 3
executionContextId : <executionContextId>
hasSourceURL : true
hash : 3F4F1CC20C664E61705CD011E025DD093676ED54
hash : 2cc1f4f316e466c0110dc50790dd520e45de6763
isLiveEdit : false
isModule : false
length : 46
@ -445,7 +445,7 @@ scriptParsed
endLine : 1
executionContextId : <executionContextId>
hasSourceURL : false
hash : 55928721655B662420FC9F66450A7C2C327C8C36
hash : 127829554266b55666f9cf02c2c7a05463c8c723
isLiveEdit : false
isModule : false
length : 50
@ -464,7 +464,7 @@ scriptParsed
endLine : 0
executionContextId : <executionContextId>
hasSourceURL : false
hash : CF0E583119A280424958512525ECCFB3B4F7A262
hash : 1385e0fc24082a91521585943bfcce52262a7f4b
isLiveEdit : false
isModule : false
length : 60
@ -483,7 +483,7 @@ scriptParsed
endLine : 2
executionContextId : <executionContextId>
hasSourceURL : false
hash : D1FA51B286EA72144EC0E44681120344F2D2EBD5
hash : 2b15af1d4127ae68644e0ce4443021185dbe2d2f
isLiveEdit : false
isModule : false
length : 51
@ -502,7 +502,7 @@ scriptParsed
endLine : 3
executionContextId : <executionContextId>
hasSourceURL : false
hash : 7ABA6300FC0D3908C0536EE2EFF60B48E36FFA35
hash : 0036aba78093d0cf2ee6350c84b06ffe53aff63e
isLiveEdit : false
isModule : false
length : 54
@ -521,7 +521,7 @@ scriptParsed
endLine : 1
executionContextId : <executionContextId>
hasSourceURL : true
hash : EB6DE473AF1788035E434F41ABC86140BD638644
hash : 374ed6be308871fa14f434e504168cba446836db
isLiveEdit : false
isModule : false
length : 88
@ -540,7 +540,7 @@ scriptParsed
endLine : 1
executionContextId : <executionContextId>
hasSourceURL : true
hash : 63710BD01F77B0F0C00E0662B45B782A5976A206
hash : 0db017360f0b77f12660e00ca287b54b602a6795
isLiveEdit : false
isModule : false
length : 89
@ -559,7 +559,7 @@ scriptParsed
endLine : 1
executionContextId : <executionContextId>
hasSourceURL : true
hash : FC51669018C05471C8F46535240B9C77110E7291
hash : 096615cf17450c8153564f8c77c9b0421927e011
isLiveEdit : false
isModule : false
length : 40
@ -578,7 +578,7 @@ scriptParsed
endLine : 1
executionContextId : <executionContextId>
hasSourceURL : true
hash : FE0F41315BEF7930C8F465359F53D504110E7291
hash : 1314f0ef0397feb553564f8c405d35f91927e011
isLiveEdit : false
isModule : false
length : 41
@ -597,7 +597,7 @@ scriptParsed
endLine : 0
executionContextId : <executionContextId>
hasSourceURL : false
hash : 1D33B330614150F8F7EB45184E245F542E304118
hash : 033b33d18f0514168154be7f45f542e4811403e2
isLiveEdit : false
isModule : false
length : 18
@ -616,7 +616,7 @@ scriptParsed
endLine : 0
executionContextId : <executionContextId>
hasSourceURL : true
hash : 474CCF101B1996849E154ED20F854F368C793767
hash : 01fcc474486991b12de451e963f458f0767397c8
isLiveEdit : false
isModule : false
length : 96
@ -635,7 +635,7 @@ scriptParsed
endLine : 0
executionContextId : <executionContextId>
hasSourceURL : true
hash : DD0A3C60B97506161FA15D9419969A90DF33E2E0
hash : 06c3a0dd6160579b49d51af109a969910e2e33fd
isLiveEdit : false
isModule : false
length : 39
@ -665,7 +665,7 @@ scriptFailedToParse
endLine : 1
executionContextId : <executionContextId>
hasSourceURL : true
hash : BB13EE1015533BA2FF7F72464D9CDD374BABDA67
hash : 01ee31bb2ab335516427f7ff73ddc9d476adbab4
isModule : false
length : 56
scriptId : <scriptId>
@ -683,7 +683,7 @@ scriptParsed
endLine : 1
executionContextId : <executionContextId>
hasSourceURL : false
hash : 1D33B330A774BD52F7EB45184E245F54C94FB815
hash : 033b33d125db477a8154be7f45f542e4518bf49c
isLiveEdit : false
isModule : false
length : 19
@ -702,7 +702,7 @@ scriptParsed
endLine : 2
executionContextId : <executionContextId>
hasSourceURL : false
hash : 1D33B330EA93E221F7EB45184E245F5479702083
hash : 033b33d1122e39ae8154be7f45f542e438020797
isLiveEdit : false
isModule : false
length : 20
@ -721,7 +721,7 @@ scriptParsed
endLine : 3
executionContextId : <executionContextId>
hasSourceURL : false
hash : 867981735982F829F7EB45184E245F5479702083
hash : 37189768928f28958154be7f45f542e438020797
isLiveEdit : false
isModule : false
length : 21
@ -740,7 +740,7 @@ scriptParsed
endLine : 4
executionContextId : <executionContextId>
hasSourceURL : false
hash : 095D6881D29C0D76F7EB45184E245F5479702083
hash : 1886d59067d0c92d8154be7f45f542e438020797
isLiveEdit : false
isModule : false
length : 22

View File

@ -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>

View File

@ -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

View File

@ -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>