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

Side by Side Diff: src/mips64/simulator-mips64.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/mips/simulator-mips.cc ('k') | src/mips64/simulator-mips64.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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // NOTE: The check for overflow is not safe as there is no guarantee that the 77 // NOTE: The check for overflow is not safe as there is no guarantee that the
78 // running thread has its stack in all memory up to address 0x00000000. 78 // running thread has its stack in all memory up to address 0x00000000.
79 #define GENERATED_CODE_STACK_LIMIT(limit) \ 79 #define GENERATED_CODE_STACK_LIMIT(limit) \
80 (reinterpret_cast<uintptr_t>(this) >= limit ? \ 80 (reinterpret_cast<uintptr_t>(this) >= limit ? \
81 reinterpret_cast<uintptr_t>(this) - limit : 0) 81 reinterpret_cast<uintptr_t>(this) - limit : 0)
82 82
83 #else // !defined(USE_SIMULATOR) 83 #else // !defined(USE_SIMULATOR)
84 // Running with a simulator. 84 // Running with a simulator.
85 85
86 #include "src/assembler.h" 86 #include "src/assembler.h"
87 #include "src/hashmap.h" 87 #include "src/base/hashmap.h"
88 88
89 namespace v8 { 89 namespace v8 {
90 namespace internal { 90 namespace internal {
91 91
92 // ----------------------------------------------------------------------------- 92 // -----------------------------------------------------------------------------
93 // Utility functions 93 // Utility functions
94 94
95 class CachePage { 95 class CachePage {
96 public: 96 public:
97 static const int LINE_VALID = 0; 97 static const int LINE_VALID = 0;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 219
220 // Accessor to the internal simulator stack area. 220 // Accessor to the internal simulator stack area.
221 uintptr_t StackLimit(uintptr_t c_limit) const; 221 uintptr_t StackLimit(uintptr_t c_limit) const;
222 222
223 // Executes MIPS instructions until the PC reaches end_sim_pc. 223 // Executes MIPS instructions until the PC reaches end_sim_pc.
224 void Execute(); 224 void Execute();
225 225
226 // Call on program start. 226 // Call on program start.
227 static void Initialize(Isolate* isolate); 227 static void Initialize(Isolate* isolate);
228 228
229 static void TearDown(HashMap* i_cache, Redirection* first); 229 static void TearDown(base::HashMap* i_cache, Redirection* first);
230 230
231 // V8 generally calls into generated JS code with 5 parameters and into 231 // V8 generally calls into generated JS code with 5 parameters and into
232 // generated RegExp code with 7 parameters. This is a convenience function, 232 // generated RegExp code with 7 parameters. This is a convenience function,
233 // which sets up the simulator state and grabs the result on return. 233 // which sets up the simulator state and grabs the result on return.
234 int64_t Call(byte* entry, int argument_count, ...); 234 int64_t Call(byte* entry, int argument_count, ...);
235 // Alternative: call a 2-argument double function. 235 // Alternative: call a 2-argument double function.
236 double CallFP(byte* entry, double d0, double d1); 236 double CallFP(byte* entry, double d0, double d1);
237 237
238 // Push an address onto the JS stack. 238 // Push an address onto the JS stack.
239 uintptr_t PushAddress(uintptr_t address); 239 uintptr_t PushAddress(uintptr_t address);
240 240
241 // Pop an address from the JS stack. 241 // Pop an address from the JS stack.
242 uintptr_t PopAddress(); 242 uintptr_t PopAddress();
243 243
244 // Debugger input. 244 // Debugger input.
245 void set_last_debugger_input(char* input); 245 void set_last_debugger_input(char* input);
246 char* last_debugger_input() { return last_debugger_input_; } 246 char* last_debugger_input() { return last_debugger_input_; }
247 247
248 // ICache checking. 248 // ICache checking.
249 static void FlushICache(v8::internal::HashMap* i_cache, void* start, 249 static void FlushICache(base::HashMap* i_cache, void* start, size_t size);
250 size_t size);
251 250
252 // Returns true if pc register contains one of the 'special_values' defined 251 // Returns true if pc register contains one of the 'special_values' defined
253 // below (bad_ra, end_sim_pc). 252 // below (bad_ra, end_sim_pc).
254 bool has_bad_pc() const; 253 bool has_bad_pc() const;
255 254
256 private: 255 private:
257 enum special_values { 256 enum special_values {
258 // Known bad pc value to ensure that the simulator does not execute 257 // Known bad pc value to ensure that the simulator does not execute
259 // without being properly setup. 258 // without being properly setup.
260 bad_ra = -1, 259 bad_ra = -1,
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 if (instr->IsForbiddenAfterBranch()) { 407 if (instr->IsForbiddenAfterBranch()) {
409 V8_Fatal(__FILE__, __LINE__, 408 V8_Fatal(__FILE__, __LINE__,
410 "Eror:Unexpected %i opcode in a branch delay slot.", 409 "Eror:Unexpected %i opcode in a branch delay slot.",
411 instr->OpcodeValue()); 410 instr->OpcodeValue());
412 } 411 }
413 InstructionDecode(instr); 412 InstructionDecode(instr);
414 SNPrintF(trace_buf_, " "); 413 SNPrintF(trace_buf_, " ");
415 } 414 }
416 415
417 // ICache. 416 // ICache.
418 static void CheckICache(v8::internal::HashMap* i_cache, Instruction* instr); 417 static void CheckICache(base::HashMap* i_cache, Instruction* instr);
419 static void FlushOnePage(v8::internal::HashMap* i_cache, intptr_t start, 418 static void FlushOnePage(base::HashMap* i_cache, intptr_t start, size_t size);
420 size_t size); 419 static CachePage* GetCachePage(base::HashMap* i_cache, void* page);
421 static CachePage* GetCachePage(v8::internal::HashMap* i_cache, void* page);
422 420
423 enum Exception { 421 enum Exception {
424 none, 422 none,
425 kIntegerOverflow, 423 kIntegerOverflow,
426 kIntegerUnderflow, 424 kIntegerUnderflow,
427 kDivideByZero, 425 kDivideByZero,
428 kNumExceptions 426 kNumExceptions
429 }; 427 };
430 428
431 // Exceptions. 429 // Exceptions.
(...skipping 24 matching lines...) Expand all
456 char* stack_; 454 char* stack_;
457 bool pc_modified_; 455 bool pc_modified_;
458 int64_t icount_; 456 int64_t icount_;
459 int break_count_; 457 int break_count_;
460 EmbeddedVector<char, 128> trace_buf_; 458 EmbeddedVector<char, 128> trace_buf_;
461 459
462 // Debugger input. 460 // Debugger input.
463 char* last_debugger_input_; 461 char* last_debugger_input_;
464 462
465 // Icache simulation. 463 // Icache simulation.
466 v8::internal::HashMap* i_cache_; 464 base::HashMap* i_cache_;
467 465
468 v8::internal::Isolate* isolate_; 466 v8::internal::Isolate* isolate_;
469 467
470 // Registered breakpoints. 468 // Registered breakpoints.
471 Instruction* break_pc_; 469 Instruction* break_pc_;
472 Instr break_instr_; 470 Instr break_instr_;
473 471
474 // Stop is disabled if bit 31 is set. 472 // Stop is disabled if bit 31 is set.
475 static const uint32_t kStopDisabledBit = 1 << 31; 473 static const uint32_t kStopDisabledBit = 1 << 31;
476 474
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 static inline void UnregisterCTryCatch(Isolate* isolate) { 520 static inline void UnregisterCTryCatch(Isolate* isolate) {
523 Simulator::current(isolate)->PopAddress(); 521 Simulator::current(isolate)->PopAddress();
524 } 522 }
525 }; 523 };
526 524
527 } // namespace internal 525 } // namespace internal
528 } // namespace v8 526 } // namespace v8
529 527
530 #endif // !defined(USE_SIMULATOR) 528 #endif // !defined(USE_SIMULATOR)
531 #endif // V8_MIPS_SIMULATOR_MIPS_H_ 529 #endif // V8_MIPS_SIMULATOR_MIPS_H_
OLDNEW
« no previous file with comments | « src/mips/simulator-mips.cc ('k') | src/mips64/simulator-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698