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

Side by Side Diff: src/arm/simulator-arm.cc

Issue 1787006: Put the icache checks in the ARM simulator behind a flag,... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/flag-definitions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 ASSERT((size & CachePage::kLineMask) == 0); 534 ASSERT((size & CachePage::kLineMask) == 0);
535 void* page = reinterpret_cast<void*>(start & (~CachePage::kPageMask)); 535 void* page = reinterpret_cast<void*>(start & (~CachePage::kPageMask));
536 int offset = (start & CachePage::kPageMask); 536 int offset = (start & CachePage::kPageMask);
537 CachePage* cache_page = GetCachePage(page); 537 CachePage* cache_page = GetCachePage(page);
538 char* valid_bytemap = cache_page->ValidityByte(offset); 538 char* valid_bytemap = cache_page->ValidityByte(offset);
539 memset(valid_bytemap, CachePage::LINE_INVALID, size >> CachePage::kLineShift); 539 memset(valid_bytemap, CachePage::LINE_INVALID, size >> CachePage::kLineShift);
540 } 540 }
541 541
542 542
543 void Simulator::CheckICache(Instr* instr) { 543 void Simulator::CheckICache(Instr* instr) {
544 #ifdef DEBUG
545 intptr_t address = reinterpret_cast<intptr_t>(instr); 544 intptr_t address = reinterpret_cast<intptr_t>(instr);
546 void* page = reinterpret_cast<void*>(address & (~CachePage::kPageMask)); 545 void* page = reinterpret_cast<void*>(address & (~CachePage::kPageMask));
547 void* line = reinterpret_cast<void*>(address & (~CachePage::kLineMask)); 546 void* line = reinterpret_cast<void*>(address & (~CachePage::kLineMask));
548 int offset = (address & CachePage::kPageMask); 547 int offset = (address & CachePage::kPageMask);
549 CachePage* cache_page = GetCachePage(page); 548 CachePage* cache_page = GetCachePage(page);
550 char* cache_valid_byte = cache_page->ValidityByte(offset); 549 char* cache_valid_byte = cache_page->ValidityByte(offset);
551 bool cache_hit = (*cache_valid_byte == CachePage::LINE_VALID); 550 bool cache_hit = (*cache_valid_byte == CachePage::LINE_VALID);
552 char* cached_line = cache_page->CachedData(offset & ~CachePage::kLineMask); 551 char* cached_line = cache_page->CachedData(offset & ~CachePage::kLineMask);
553 if (cache_hit) { 552 if (cache_hit) {
554 // Check that the data in memory matches the contents of the I-cache. 553 // Check that the data in memory matches the contents of the I-cache.
555 CHECK(memcmp(reinterpret_cast<void*>(instr), 554 CHECK(memcmp(reinterpret_cast<void*>(instr),
556 cache_page->CachedData(offset), 555 cache_page->CachedData(offset),
557 Instr::kInstrSize) == 0); 556 Instr::kInstrSize) == 0);
558 } else { 557 } else {
559 // Cache miss. Load memory into the cache. 558 // Cache miss. Load memory into the cache.
560 memcpy(cached_line, line, CachePage::kLineLength); 559 memcpy(cached_line, line, CachePage::kLineLength);
561 *cache_valid_byte = CachePage::LINE_VALID; 560 *cache_valid_byte = CachePage::LINE_VALID;
562 } 561 }
563 #endif
564 } 562 }
565 563
566 564
567 // Create one simulator per thread and keep it in thread local storage. 565 // Create one simulator per thread and keep it in thread local storage.
568 static v8::internal::Thread::LocalStorageKey simulator_key; 566 static v8::internal::Thread::LocalStorageKey simulator_key;
569 567
570 568
571 bool Simulator::initialized_ = false; 569 bool Simulator::initialized_ = false;
572 570
573 571
(...skipping 1860 matching lines...) Expand 10 before | Expand all | Expand 10 after
2434 break; 2432 break;
2435 } 2433 }
2436 } else { 2434 } else {
2437 UNIMPLEMENTED(); // Not used by V8. 2435 UNIMPLEMENTED(); // Not used by V8.
2438 } 2436 }
2439 } 2437 }
2440 2438
2441 2439
2442 // Executes the current instruction. 2440 // Executes the current instruction.
2443 void Simulator::InstructionDecode(Instr* instr) { 2441 void Simulator::InstructionDecode(Instr* instr) {
2444 CheckICache(instr); 2442 if (v8::internal::FLAG_check_icache) {
2443 CheckICache(instr);
2444 }
2445 pc_modified_ = false; 2445 pc_modified_ = false;
2446 if (::v8::internal::FLAG_trace_sim) { 2446 if (::v8::internal::FLAG_trace_sim) {
2447 disasm::NameConverter converter; 2447 disasm::NameConverter converter;
2448 disasm::Disassembler dasm(converter); 2448 disasm::Disassembler dasm(converter);
2449 // use a reasonably large buffer 2449 // use a reasonably large buffer
2450 v8::internal::EmbeddedVector<char, 256> buffer; 2450 v8::internal::EmbeddedVector<char, 256> buffer;
2451 dasm.InstructionDecode(buffer, 2451 dasm.InstructionDecode(buffer,
2452 reinterpret_cast<byte*>(instr)); 2452 reinterpret_cast<byte*>(instr));
2453 PrintF(" 0x%08x %s\n", instr, buffer.start()); 2453 PrintF(" 0x%08x %s\n", instr, buffer.start());
2454 } 2454 }
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
2632 int current_sp = get_register(sp); 2632 int current_sp = get_register(sp);
2633 uintptr_t* stack_slot = reinterpret_cast<uintptr_t*>(current_sp); 2633 uintptr_t* stack_slot = reinterpret_cast<uintptr_t*>(current_sp);
2634 uintptr_t address = *stack_slot; 2634 uintptr_t address = *stack_slot;
2635 set_register(sp, current_sp + sizeof(uintptr_t)); 2635 set_register(sp, current_sp + sizeof(uintptr_t));
2636 return address; 2636 return address;
2637 } 2637 }
2638 2638
2639 } } // namespace assembler::arm 2639 } } // namespace assembler::arm
2640 2640
2641 #endif // __arm__ 2641 #endif // __arm__
OLDNEW
« no previous file with comments | « no previous file | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698