OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/frames.h" | 5 #include "src/frames.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
10 #include "src/ast/scopeinfo.h" | 10 #include "src/ast/scopeinfo.h" |
(...skipping 1491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1502 if (next_addr > inner_pointer) return GcSafeCastToCode(obj, inner_pointer); | 1502 if (next_addr > inner_pointer) return GcSafeCastToCode(obj, inner_pointer); |
1503 addr = next_addr; | 1503 addr = next_addr; |
1504 } | 1504 } |
1505 } | 1505 } |
1506 | 1506 |
1507 | 1507 |
1508 InnerPointerToCodeCache::InnerPointerToCodeCacheEntry* | 1508 InnerPointerToCodeCache::InnerPointerToCodeCacheEntry* |
1509 InnerPointerToCodeCache::GetCacheEntry(Address inner_pointer) { | 1509 InnerPointerToCodeCache::GetCacheEntry(Address inner_pointer) { |
1510 isolate_->counters()->pc_to_code()->Increment(); | 1510 isolate_->counters()->pc_to_code()->Increment(); |
1511 DCHECK(base::bits::IsPowerOfTwo32(kInnerPointerToCodeCacheSize)); | 1511 DCHECK(base::bits::IsPowerOfTwo32(kInnerPointerToCodeCacheSize)); |
1512 uint32_t hash = ComputeIntegerHash( | 1512 uint32_t hash = ComputeIntegerHash(ObjectAddressForHashing(inner_pointer), |
1513 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(inner_pointer)), | 1513 v8::internal::kZeroHashSeed); |
1514 v8::internal::kZeroHashSeed); | |
1515 uint32_t index = hash & (kInnerPointerToCodeCacheSize - 1); | 1514 uint32_t index = hash & (kInnerPointerToCodeCacheSize - 1); |
1516 InnerPointerToCodeCacheEntry* entry = cache(index); | 1515 InnerPointerToCodeCacheEntry* entry = cache(index); |
1517 if (entry->inner_pointer == inner_pointer) { | 1516 if (entry->inner_pointer == inner_pointer) { |
1518 isolate_->counters()->pc_to_code_cached()->Increment(); | 1517 isolate_->counters()->pc_to_code_cached()->Increment(); |
1519 DCHECK(entry->code == GcSafeFindCodeForInnerPointer(inner_pointer)); | 1518 DCHECK(entry->code == GcSafeFindCodeForInnerPointer(inner_pointer)); |
1520 } else { | 1519 } else { |
1521 // Because this code may be interrupted by a profiling signal that | 1520 // Because this code may be interrupted by a profiling signal that |
1522 // also queries the cache, we cannot update inner_pointer before the code | 1521 // also queries the cache, we cannot update inner_pointer before the code |
1523 // has been set. Otherwise, we risk trying to use a cache entry before | 1522 // has been set. Otherwise, we risk trying to use a cache entry before |
1524 // the code has been computed. | 1523 // the code has been computed. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1590 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 1589 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
1591 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1590 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
1592 list.Add(frame, zone); | 1591 list.Add(frame, zone); |
1593 } | 1592 } |
1594 return list.ToVector(); | 1593 return list.ToVector(); |
1595 } | 1594 } |
1596 | 1595 |
1597 | 1596 |
1598 } // namespace internal | 1597 } // namespace internal |
1599 } // namespace v8 | 1598 } // namespace v8 |
OLD | NEW |