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

Side by Side 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 unified diff | Download patch
« src/isolate.cc ('K') | « src/isolate.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project 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 "src/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <memory> 9 #include <memory>
10 #include <sstream> 10 #include <sstream>
(...skipping 2181 matching lines...) Expand 10 before | Expand all | Expand 10 after
2192 return Smi::FromInt(hash & Smi::kMaxValue); 2192 return Smi::FromInt(hash & Smi::kMaxValue);
2193 } 2193 }
2194 if (object->IsName()) { 2194 if (object->IsName()) {
2195 uint32_t hash = Name::cast(object)->Hash(); 2195 uint32_t hash = Name::cast(object)->Hash();
2196 return Smi::FromInt(hash); 2196 return Smi::FromInt(hash);
2197 } 2197 }
2198 if (object->IsOddball()) { 2198 if (object->IsOddball()) {
2199 uint32_t hash = Oddball::cast(object)->to_string()->Hash(); 2199 uint32_t hash = Oddball::cast(object)->to_string()->Hash();
2200 return Smi::FromInt(hash); 2200 return Smi::FromInt(hash);
2201 } 2201 }
2202 if (object->IsByteArray()) {
2203 ByteArray* array = ByteArray::cast(object);
2204 int size = array->Size();
2205 uint32_t hash = kZeroHashSeed;
2206 uint32_t* data = reinterpret_cast<uint32_t*>(array->GetDataStartAddress());
2207 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.
2208 hash = ComputeIntegerHash(hash, *data);
2209 ++data;
2210 }
2211 int tail_start = size - size % 4;
2212 uint32_t tail = 0;
2213 for (int i = tail_start; i < size; ++i) {
2214 tail |= array->get(i);
2215 tail <<= 8;
2216 }
2217 hash = ComputeIntegerHash(hash, tail);
2218 return Smi::FromInt(hash);
2219 }
2202 DCHECK(object->IsJSReceiver()); 2220 DCHECK(object->IsJSReceiver());
2203 // Simply return the receiver as it is guaranteed to not be a SMI. 2221 // Simply return the receiver as it is guaranteed to not be a SMI.
2204 return object; 2222 return object;
2205 } 2223 }
2206 2224
2207 } // namespace 2225 } // namespace
2208 2226
2209 Object* Object::GetHash() { 2227 Object* Object::GetHash() {
2210 Object* hash = GetSimpleHash(this); 2228 Object* hash = GetSimpleHash(this);
2211 if (hash->IsSmi()) return hash; 2229 if (hash->IsSmi()) return hash;
(...skipping 18218 matching lines...) Expand 10 before | Expand all | Expand 10 after
20430 // depend on this. 20448 // depend on this.
20431 return DICTIONARY_ELEMENTS; 20449 return DICTIONARY_ELEMENTS;
20432 } 20450 }
20433 DCHECK_LE(kind, LAST_ELEMENTS_KIND); 20451 DCHECK_LE(kind, LAST_ELEMENTS_KIND);
20434 return kind; 20452 return kind;
20435 } 20453 }
20436 } 20454 }
20437 20455
20438 } // namespace internal 20456 } // namespace internal
20439 } // namespace v8 20457 } // namespace v8
OLDNEW
« 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