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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/ast.h" | 7 #include "src/ast.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/frames-inl.h" | 10 #include "src/frames-inl.h" |
(...skipping 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1494 Address next_addr = addr + obj_size; | 1494 Address next_addr = addr + obj_size; |
1495 if (next_addr > inner_pointer) return GcSafeCastToCode(obj, inner_pointer); | 1495 if (next_addr > inner_pointer) return GcSafeCastToCode(obj, inner_pointer); |
1496 addr = next_addr; | 1496 addr = next_addr; |
1497 } | 1497 } |
1498 } | 1498 } |
1499 | 1499 |
1500 | 1500 |
1501 InnerPointerToCodeCache::InnerPointerToCodeCacheEntry* | 1501 InnerPointerToCodeCache::InnerPointerToCodeCacheEntry* |
1502 InnerPointerToCodeCache::GetCacheEntry(Address inner_pointer) { | 1502 InnerPointerToCodeCache::GetCacheEntry(Address inner_pointer) { |
1503 isolate_->counters()->pc_to_code()->Increment(); | 1503 isolate_->counters()->pc_to_code()->Increment(); |
1504 DCHECK(IsPowerOf2(kInnerPointerToCodeCacheSize)); | 1504 DCHECK(base::bits::IsPowerOfTwo32(kInnerPointerToCodeCacheSize)); |
1505 uint32_t hash = ComputeIntegerHash( | 1505 uint32_t hash = ComputeIntegerHash( |
1506 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(inner_pointer)), | 1506 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(inner_pointer)), |
1507 v8::internal::kZeroHashSeed); | 1507 v8::internal::kZeroHashSeed); |
1508 uint32_t index = hash & (kInnerPointerToCodeCacheSize - 1); | 1508 uint32_t index = hash & (kInnerPointerToCodeCacheSize - 1); |
1509 InnerPointerToCodeCacheEntry* entry = cache(index); | 1509 InnerPointerToCodeCacheEntry* entry = cache(index); |
1510 if (entry->inner_pointer == inner_pointer) { | 1510 if (entry->inner_pointer == inner_pointer) { |
1511 isolate_->counters()->pc_to_code_cached()->Increment(); | 1511 isolate_->counters()->pc_to_code_cached()->Increment(); |
1512 DCHECK(entry->code == GcSafeFindCodeForInnerPointer(inner_pointer)); | 1512 DCHECK(entry->code == GcSafeFindCodeForInnerPointer(inner_pointer)); |
1513 } else { | 1513 } else { |
1514 // Because this code may be interrupted by a profiling signal that | 1514 // Because this code may be interrupted by a profiling signal that |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1635 ZoneList<StackFrame*> list(10, zone); | 1635 ZoneList<StackFrame*> list(10, zone); |
1636 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 1636 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
1637 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1637 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
1638 list.Add(frame, zone); | 1638 list.Add(frame, zone); |
1639 } | 1639 } |
1640 return list.ToVector(); | 1640 return list.ToVector(); |
1641 } | 1641 } |
1642 | 1642 |
1643 | 1643 |
1644 } } // namespace v8::internal | 1644 } } // namespace v8::internal |
OLD | NEW |