| 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 <stdarg.h> | 5 #include <stdarg.h> |
| 6 #include <stdlib.h> | 6 #include <stdlib.h> |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "v8.h" | 9 #include "v8.h" |
| 10 | 10 |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 intptr_t address = reinterpret_cast<intptr_t>(instr); | 687 intptr_t address = reinterpret_cast<intptr_t>(instr); |
| 688 void* page = reinterpret_cast<void*>(address & (~CachePage::kPageMask)); | 688 void* page = reinterpret_cast<void*>(address & (~CachePage::kPageMask)); |
| 689 void* line = reinterpret_cast<void*>(address & (~CachePage::kLineMask)); | 689 void* line = reinterpret_cast<void*>(address & (~CachePage::kLineMask)); |
| 690 int offset = (address & CachePage::kPageMask); | 690 int offset = (address & CachePage::kPageMask); |
| 691 CachePage* cache_page = GetCachePage(i_cache, page); | 691 CachePage* cache_page = GetCachePage(i_cache, page); |
| 692 char* cache_valid_byte = cache_page->ValidityByte(offset); | 692 char* cache_valid_byte = cache_page->ValidityByte(offset); |
| 693 bool cache_hit = (*cache_valid_byte == CachePage::LINE_VALID); | 693 bool cache_hit = (*cache_valid_byte == CachePage::LINE_VALID); |
| 694 char* cached_line = cache_page->CachedData(offset & ~CachePage::kLineMask); | 694 char* cached_line = cache_page->CachedData(offset & ~CachePage::kLineMask); |
| 695 if (cache_hit) { | 695 if (cache_hit) { |
| 696 // Check that the data in memory matches the contents of the I-cache. | 696 // Check that the data in memory matches the contents of the I-cache. |
| 697 CHECK(memcmp(reinterpret_cast<void*>(instr), | 697 CHECK_EQ(0, memcmp(reinterpret_cast<void*>(instr), |
| 698 cache_page->CachedData(offset), | 698 cache_page->CachedData(offset), |
| 699 Instruction::kInstrSize) == 0); | 699 Instruction::kInstrSize)); |
| 700 } else { | 700 } else { |
| 701 // Cache miss. Load memory into the cache. | 701 // Cache miss. Load memory into the cache. |
| 702 OS::MemCopy(cached_line, line, CachePage::kLineLength); | 702 OS::MemCopy(cached_line, line, CachePage::kLineLength); |
| 703 *cache_valid_byte = CachePage::LINE_VALID; | 703 *cache_valid_byte = CachePage::LINE_VALID; |
| 704 } | 704 } |
| 705 } | 705 } |
| 706 | 706 |
| 707 | 707 |
| 708 void Simulator::Initialize(Isolate* isolate) { | 708 void Simulator::Initialize(Isolate* isolate) { |
| 709 if (isolate->simulator_initialized()) return; | 709 if (isolate->simulator_initialized()) return; |
| (...skipping 3119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3829 uintptr_t address = *stack_slot; | 3829 uintptr_t address = *stack_slot; |
| 3830 set_register(sp, current_sp + sizeof(uintptr_t)); | 3830 set_register(sp, current_sp + sizeof(uintptr_t)); |
| 3831 return address; | 3831 return address; |
| 3832 } | 3832 } |
| 3833 | 3833 |
| 3834 } } // namespace v8::internal | 3834 } } // namespace v8::internal |
| 3835 | 3835 |
| 3836 #endif // USE_SIMULATOR | 3836 #endif // USE_SIMULATOR |
| 3837 | 3837 |
| 3838 #endif // V8_TARGET_ARCH_ARM | 3838 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |