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

Side by Side Diff: src/mips/simulator-mips.h

Issue 2010243003: Move hashmap into base/. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 6 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
« no previous file with comments | « src/libsampler/v8-sampler.cc ('k') | src/mips/simulator-mips.cc » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 5
6 // Declares a Simulator for MIPS instructions if we are not generating a native 6 // Declares a Simulator for MIPS instructions if we are not generating a native
7 // MIPS binary. This Simulator allows us to run and debug MIPS code generation 7 // MIPS binary. This Simulator allows us to run and debug MIPS code generation
8 // on regular desktop machines. 8 // on regular desktop machines.
9 // V8 calls into generated code by "calling" the CALL_GENERATED_CODE macro, 9 // V8 calls into generated code by "calling" the CALL_GENERATED_CODE macro,
10 // which will start execution in the Simulator or forwards to the real entry 10 // which will start execution in the Simulator or forwards to the real entry
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // NOTE: The check for overflow is not safe as there is no guarantee that the 68 // NOTE: The check for overflow is not safe as there is no guarantee that the
69 // running thread has its stack in all memory up to address 0x00000000. 69 // running thread has its stack in all memory up to address 0x00000000.
70 #define GENERATED_CODE_STACK_LIMIT(limit) \ 70 #define GENERATED_CODE_STACK_LIMIT(limit) \
71 (reinterpret_cast<uintptr_t>(this) >= limit ? \ 71 (reinterpret_cast<uintptr_t>(this) >= limit ? \
72 reinterpret_cast<uintptr_t>(this) - limit : 0) 72 reinterpret_cast<uintptr_t>(this) - limit : 0)
73 73
74 #else // !defined(USE_SIMULATOR) 74 #else // !defined(USE_SIMULATOR)
75 // Running with a simulator. 75 // Running with a simulator.
76 76
77 #include "src/assembler.h" 77 #include "src/assembler.h"
78 #include "src/hashmap.h" 78 #include "src/base/hashmap.h"
79 79
80 namespace v8 { 80 namespace v8 {
81 namespace internal { 81 namespace internal {
82 82
83 // ----------------------------------------------------------------------------- 83 // -----------------------------------------------------------------------------
84 // Utility functions 84 // Utility functions
85 85
86 class CachePage { 86 class CachePage {
87 public: 87 public:
88 static const int LINE_VALID = 0; 88 static const int LINE_VALID = 0;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 209
210 // Accessor to the internal simulator stack area. 210 // Accessor to the internal simulator stack area.
211 uintptr_t StackLimit(uintptr_t c_limit) const; 211 uintptr_t StackLimit(uintptr_t c_limit) const;
212 212
213 // Executes MIPS instructions until the PC reaches end_sim_pc. 213 // Executes MIPS instructions until the PC reaches end_sim_pc.
214 void Execute(); 214 void Execute();
215 215
216 // Call on program start. 216 // Call on program start.
217 static void Initialize(Isolate* isolate); 217 static void Initialize(Isolate* isolate);
218 218
219 static void TearDown(HashMap* i_cache, Redirection* first); 219 static void TearDown(base::HashMap* i_cache, Redirection* first);
220 220
221 // V8 generally calls into generated JS code with 5 parameters and into 221 // V8 generally calls into generated JS code with 5 parameters and into
222 // generated RegExp code with 7 parameters. This is a convenience function, 222 // generated RegExp code with 7 parameters. This is a convenience function,
223 // which sets up the simulator state and grabs the result on return. 223 // which sets up the simulator state and grabs the result on return.
224 int32_t Call(byte* entry, int argument_count, ...); 224 int32_t Call(byte* entry, int argument_count, ...);
225 // Alternative: call a 2-argument double function. 225 // Alternative: call a 2-argument double function.
226 double CallFP(byte* entry, double d0, double d1); 226 double CallFP(byte* entry, double d0, double d1);
227 227
228 // Push an address onto the JS stack. 228 // Push an address onto the JS stack.
229 uintptr_t PushAddress(uintptr_t address); 229 uintptr_t PushAddress(uintptr_t address);
230 230
231 // Pop an address from the JS stack. 231 // Pop an address from the JS stack.
232 uintptr_t PopAddress(); 232 uintptr_t PopAddress();
233 233
234 // Debugger input. 234 // Debugger input.
235 void set_last_debugger_input(char* input); 235 void set_last_debugger_input(char* input);
236 char* last_debugger_input() { return last_debugger_input_; } 236 char* last_debugger_input() { return last_debugger_input_; }
237 237
238 // ICache checking. 238 // ICache checking.
239 static void FlushICache(v8::internal::HashMap* i_cache, void* start, 239 static void FlushICache(base::HashMap* i_cache, void* start, size_t size);
240 size_t size);
241 240
242 // Returns true if pc register contains one of the 'special_values' defined 241 // Returns true if pc register contains one of the 'special_values' defined
243 // below (bad_ra, end_sim_pc). 242 // below (bad_ra, end_sim_pc).
244 bool has_bad_pc() const; 243 bool has_bad_pc() const;
245 244
246 private: 245 private:
247 enum special_values { 246 enum special_values {
248 // Known bad pc value to ensure that the simulator does not execute 247 // Known bad pc value to ensure that the simulator does not execute
249 // without being properly setup. 248 // without being properly setup.
250 bad_ra = -1, 249 bad_ra = -1,
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 if (instr->IsForbiddenInBranchDelay()) { 393 if (instr->IsForbiddenInBranchDelay()) {
395 V8_Fatal(__FILE__, __LINE__, 394 V8_Fatal(__FILE__, __LINE__,
396 "Eror:Unexpected %i opcode in a branch delay slot.", 395 "Eror:Unexpected %i opcode in a branch delay slot.",
397 instr->OpcodeValue()); 396 instr->OpcodeValue());
398 } 397 }
399 InstructionDecode(instr); 398 InstructionDecode(instr);
400 SNPrintF(trace_buf_, " "); 399 SNPrintF(trace_buf_, " ");
401 } 400 }
402 401
403 // ICache. 402 // ICache.
404 static void CheckICache(v8::internal::HashMap* i_cache, Instruction* instr); 403 static void CheckICache(base::HashMap* i_cache, Instruction* instr);
405 static void FlushOnePage(v8::internal::HashMap* i_cache, intptr_t start, 404 static void FlushOnePage(base::HashMap* i_cache, intptr_t start, int size);
406 int size); 405 static CachePage* GetCachePage(base::HashMap* i_cache, void* page);
407 static CachePage* GetCachePage(v8::internal::HashMap* i_cache, void* page);
408 406
409 enum Exception { 407 enum Exception {
410 none, 408 none,
411 kIntegerOverflow, 409 kIntegerOverflow,
412 kIntegerUnderflow, 410 kIntegerUnderflow,
413 kDivideByZero, 411 kDivideByZero,
414 kNumExceptions 412 kNumExceptions
415 }; 413 };
416 414
417 // Exceptions. 415 // Exceptions.
(...skipping 25 matching lines...) Expand all
443 static const size_t stack_size_ = 1 * 1024*1024; 441 static const size_t stack_size_ = 1 * 1024*1024;
444 char* stack_; 442 char* stack_;
445 bool pc_modified_; 443 bool pc_modified_;
446 uint64_t icount_; 444 uint64_t icount_;
447 int break_count_; 445 int break_count_;
448 446
449 // Debugger input. 447 // Debugger input.
450 char* last_debugger_input_; 448 char* last_debugger_input_;
451 449
452 // Icache simulation. 450 // Icache simulation.
453 v8::internal::HashMap* i_cache_; 451 base::HashMap* i_cache_;
454 452
455 v8::internal::Isolate* isolate_; 453 v8::internal::Isolate* isolate_;
456 454
457 // Registered breakpoints. 455 // Registered breakpoints.
458 Instruction* break_pc_; 456 Instruction* break_pc_;
459 Instr break_instr_; 457 Instr break_instr_;
460 458
461 // Stop is disabled if bit 31 is set. 459 // Stop is disabled if bit 31 is set.
462 static const uint32_t kStopDisabledBit = 1 << 31; 460 static const uint32_t kStopDisabledBit = 1 << 31;
463 461
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 static inline void UnregisterCTryCatch(Isolate* isolate) { 503 static inline void UnregisterCTryCatch(Isolate* isolate) {
506 Simulator::current(isolate)->PopAddress(); 504 Simulator::current(isolate)->PopAddress();
507 } 505 }
508 }; 506 };
509 507
510 } // namespace internal 508 } // namespace internal
511 } // namespace v8 509 } // namespace v8
512 510
513 #endif // !defined(USE_SIMULATOR) 511 #endif // !defined(USE_SIMULATOR)
514 #endif // V8_MIPS_SIMULATOR_MIPS_H_ 512 #endif // V8_MIPS_SIMULATOR_MIPS_H_
OLDNEW
« no previous file with comments | « src/libsampler/v8-sampler.cc ('k') | src/mips/simulator-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698