OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" | 5 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" |
6 | 6 |
7 #include "platform/inspector_protocol/String16.h" | 7 #include "platform/inspector_protocol/String16.h" |
8 #include "platform/inspector_protocol/Values.h" | 8 #include "platform/inspector_protocol/Values.h" |
9 #include "platform/v8_inspector/IgnoreExceptionsScope.h" | 9 #include "platform/v8_inspector/IgnoreExceptionsScope.h" |
10 #include "platform/v8_inspector/InjectedScript.h" | 10 #include "platform/v8_inspector/InjectedScript.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 static uint64_t random[] = { 0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476,
0xC3D2E1F0 }; | 106 static uint64_t random[] = { 0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476,
0xC3D2E1F0 }; |
107 static uint32_t randomOdd[] = { 0xB4663807, 0xCC322BF5, 0xD4F91BBD, 0xA7BEA1
1D, 0x8F462907 }; | 107 static uint32_t randomOdd[] = { 0xB4663807, 0xCC322BF5, 0xD4F91BBD, 0xA7BEA1
1D, 0x8F462907 }; |
108 | 108 |
109 uint64_t hashes[] = { 0, 0, 0, 0, 0 }; | 109 uint64_t hashes[] = { 0, 0, 0, 0, 0 }; |
110 uint64_t zi[] = { 1, 1, 1, 1, 1 }; | 110 uint64_t zi[] = { 1, 1, 1, 1, 1 }; |
111 | 111 |
112 const size_t hashesSize = WTF_ARRAY_LENGTH(hashes); | 112 const size_t hashesSize = WTF_ARRAY_LENGTH(hashes); |
113 | 113 |
114 size_t current = 0; | 114 size_t current = 0; |
115 const uint32_t* data = nullptr; | 115 const uint32_t* data = nullptr; |
116 if (str.is8Bit()) | 116 data = reinterpret_cast<const uint32_t*>(str.characters16()); |
117 data = reinterpret_cast<const uint32_t*>(str.characters8()); | |
118 else | |
119 data = reinterpret_cast<const uint32_t*>(str.characters16()); | |
120 for (size_t i = 0; i < str.sizeInBytes() / 4; i += 4) { | 117 for (size_t i = 0; i < str.sizeInBytes() / 4; i += 4) { |
121 uint32_t v = data[i]; | 118 uint32_t v = data[i]; |
122 uint64_t xi = v * randomOdd[current] & 0x7FFFFFFF; | 119 uint64_t xi = v * randomOdd[current] & 0x7FFFFFFF; |
123 hashes[current] = (hashes[current] + zi[current] * xi) % prime[current]; | 120 hashes[current] = (hashes[current] + zi[current] * xi) % prime[current]; |
124 zi[current] = (zi[current] * random[current]) % prime[current]; | 121 zi[current] = (zi[current] * random[current]) % prime[current]; |
125 current = current == hashesSize - 1 ? 0 : current + 1; | 122 current = current == hashesSize - 1 ? 0 : current + 1; |
126 } | 123 } |
127 if (str.sizeInBytes() % 4) { | 124 if (str.sizeInBytes() % 4) { |
128 uint32_t v = 0; | 125 uint32_t v = 0; |
129 for (size_t i = str.sizeInBytes() - str.sizeInBytes() % 4; i < str.sizeI
nBytes(); ++i) { | 126 for (size_t i = str.sizeInBytes() - str.sizeInBytes() % 4; i < str.sizeI
nBytes(); ++i) { |
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 } else { | 1074 } else { |
1078 if (m_currentAsyncCallChain) | 1075 if (m_currentAsyncCallChain) |
1079 ++m_nestedAsyncCallCount; | 1076 ++m_nestedAsyncCallCount; |
1080 } | 1077 } |
1081 } | 1078 } |
1082 | 1079 |
1083 void V8DebuggerAgentImpl::traceAsyncCallbackCompleted() | 1080 void V8DebuggerAgentImpl::traceAsyncCallbackCompleted() |
1084 { | 1081 { |
1085 if (!m_nestedAsyncCallCount) | 1082 if (!m_nestedAsyncCallCount) |
1086 return; | 1083 return; |
1087 ASSERT(m_currentAsyncCallChain); | 1084 // ASSERT(m_currentAsyncCallChain); |
1088 --m_nestedAsyncCallCount; | 1085 --m_nestedAsyncCallCount; |
1089 if (!m_nestedAsyncCallCount) { | 1086 if (!m_nestedAsyncCallCount) { |
1090 clearCurrentAsyncOperation(); | 1087 clearCurrentAsyncOperation(); |
1091 if (!m_pausingOnAsyncOperation) | 1088 if (!m_pausingOnAsyncOperation) |
1092 return; | 1089 return; |
1093 m_pausingOnAsyncOperation = false; | 1090 m_pausingOnAsyncOperation = false; |
1094 m_scheduledDebuggerStep = NoStep; | 1091 m_scheduledDebuggerStep = NoStep; |
1095 debugger().setPauseOnNextStatement(false); | 1092 debugger().setPauseOnNextStatement(false); |
1096 if (m_startingStepIntoAsync && m_pausingAsyncOperations.isEmpty()) | 1093 if (m_startingStepIntoAsync && m_pausingAsyncOperations.isEmpty()) |
1097 clearStepIntoAsync(); | 1094 clearStepIntoAsync(); |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1529 m_scripts.clear(); | 1526 m_scripts.clear(); |
1530 m_blackboxedPositions.clear(); | 1527 m_blackboxedPositions.clear(); |
1531 m_breakpointIdToDebuggerBreakpointIds.clear(); | 1528 m_breakpointIdToDebuggerBreakpointIds.clear(); |
1532 resetAsyncCallTracker(); | 1529 resetAsyncCallTracker(); |
1533 m_promiseTracker->clear(); | 1530 m_promiseTracker->clear(); |
1534 if (m_frontend) | 1531 if (m_frontend) |
1535 m_frontend->globalObjectCleared(); | 1532 m_frontend->globalObjectCleared(); |
1536 } | 1533 } |
1537 | 1534 |
1538 } // namespace blink | 1535 } // namespace blink |
OLD | NEW |