Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(948)

Unified Diff: src/objects.cc

Issue 2788413004: [inspector] cache stack frame for call sites (Closed)
Patch Set: put map separately Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/isolate.cc ('K') | « src/isolate.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index db419b0c04b77b5ba4d80c4dba66da83fa30a4bb..9fd725cf408a45e1c5c6e045b2434a488426034c 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -2199,6 +2199,24 @@ Object* GetSimpleHash(Object* object) {
uint32_t hash = Oddball::cast(object)->to_string()->Hash();
return Smi::FromInt(hash);
}
+ if (object->IsByteArray()) {
+ ByteArray* array = ByteArray::cast(object);
+ int size = array->Size();
+ uint32_t hash = kZeroHashSeed;
+ uint32_t* data = reinterpret_cast<uint32_t*>(array->GetDataStartAddress());
+ for (int i = 0; i < size / 4; i += 4) {
Yang 2017/04/04 21:15:18 Do we really need to hash the entire byte array? F
kozy 2017/04/04 23:08:12 Done.
+ hash = ComputeIntegerHash(hash, *data);
+ ++data;
+ }
+ int tail_start = size - size % 4;
+ uint32_t tail = 0;
+ for (int i = tail_start; i < size; ++i) {
+ tail |= array->get(i);
+ tail <<= 8;
+ }
+ hash = ComputeIntegerHash(hash, tail);
+ return Smi::FromInt(hash);
+ }
DCHECK(object->IsJSReceiver());
// Simply return the receiver as it is guaranteed to not be a SMI.
return object;
« src/isolate.cc ('K') | « src/isolate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698