| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6) \ | 82 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6) \ |
| 83 assembler::arm::Simulator::current()->Call( \ | 83 assembler::arm::Simulator::current()->Call( \ |
| 84 FUNCTION_ADDR(entry), 7, p0, p1, p2, p3, p4, p5, p6) | 84 FUNCTION_ADDR(entry), 7, p0, p1, p2, p3, p4, p5, p6) |
| 85 | 85 |
| 86 #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \ | 86 #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \ |
| 87 try_catch_address == NULL ? \ | 87 try_catch_address == NULL ? \ |
| 88 NULL : *(reinterpret_cast<TryCatch**>(try_catch_address)) | 88 NULL : *(reinterpret_cast<TryCatch**>(try_catch_address)) |
| 89 | 89 |
| 90 | 90 |
| 91 #include "constants-arm.h" | 91 #include "constants-arm.h" |
| 92 | 92 #include "hashmap.h" |
| 93 | 93 |
| 94 namespace assembler { | 94 namespace assembler { |
| 95 namespace arm { | 95 namespace arm { |
| 96 | 96 |
| 97 class Simulator { | 97 class Simulator { |
| 98 public: | 98 public: |
| 99 friend class Debugger; | 99 friend class Debugger; |
| 100 enum Register { | 100 enum Register { |
| 101 no_reg = -1, | 101 no_reg = -1, |
| 102 r0 = 0, r1, r2, r3, r4, r5, r6, r7, | 102 r0 = 0, r1, r2, r3, r4, r5, r6, r7, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 // generated RegExp code with 7 parameters. This is a convenience function, | 155 // generated RegExp code with 7 parameters. This is a convenience function, |
| 156 // which sets up the simulator state and grabs the result on return. | 156 // which sets up the simulator state and grabs the result on return. |
| 157 int32_t Call(byte* entry, int argument_count, ...); | 157 int32_t Call(byte* entry, int argument_count, ...); |
| 158 | 158 |
| 159 // Push an address onto the JS stack. | 159 // Push an address onto the JS stack. |
| 160 uintptr_t PushAddress(uintptr_t address); | 160 uintptr_t PushAddress(uintptr_t address); |
| 161 | 161 |
| 162 // Pop an address from the JS stack. | 162 // Pop an address from the JS stack. |
| 163 uintptr_t PopAddress(); | 163 uintptr_t PopAddress(); |
| 164 | 164 |
| 165 // ICache checking. |
| 166 void FlushICache(void* start, size_t size); |
| 167 |
| 165 private: | 168 private: |
| 166 enum special_values { | 169 enum special_values { |
| 167 // Known bad pc value to ensure that the simulator does not execute | 170 // Known bad pc value to ensure that the simulator does not execute |
| 168 // without being properly setup. | 171 // without being properly setup. |
| 169 bad_lr = -1, | 172 bad_lr = -1, |
| 170 // A pc value used to signal the simulator to stop execution. Generally | 173 // A pc value used to signal the simulator to stop execution. Generally |
| 171 // the lr is set to this value on transition from native C code to | 174 // the lr is set to this value on transition from native C code to |
| 172 // simulated execution, so that the simulator can "return" to the native | 175 // simulated execution, so that the simulator can "return" to the native |
| 173 // C code. | 176 // C code. |
| 174 end_sim_pc = -2 | 177 end_sim_pc = -2 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 void DecodeType6CoprocessorIns(Instr* instr); | 235 void DecodeType6CoprocessorIns(Instr* instr); |
| 233 | 236 |
| 234 void DecodeVMOVBetweenCoreAndSinglePrecisionRegisters(Instr* instr); | 237 void DecodeVMOVBetweenCoreAndSinglePrecisionRegisters(Instr* instr); |
| 235 void DecodeVCMP(Instr* instr); | 238 void DecodeVCMP(Instr* instr); |
| 236 void DecodeVCVTBetweenDoubleAndSingle(Instr* instr); | 239 void DecodeVCVTBetweenDoubleAndSingle(Instr* instr); |
| 237 void DecodeVCVTBetweenFloatingPointAndInteger(Instr* instr); | 240 void DecodeVCVTBetweenFloatingPointAndInteger(Instr* instr); |
| 238 | 241 |
| 239 // Executes one instruction. | 242 // Executes one instruction. |
| 240 void InstructionDecode(Instr* instr); | 243 void InstructionDecode(Instr* instr); |
| 241 | 244 |
| 245 // ICache. |
| 246 void CheckICache(Instr* instr); |
| 247 void FlushOnePage(intptr_t start, int size); |
| 248 char* GetCachePage(void* page); |
| 249 |
| 242 // Runtime call support. | 250 // Runtime call support. |
| 243 static void* RedirectExternalReference(void* external_function, | 251 static void* RedirectExternalReference(void* external_function, |
| 244 bool fp_return); | 252 bool fp_return); |
| 245 | 253 |
| 246 // For use in calls that take two double values, constructed from r0, r1, r2 | 254 // For use in calls that take two double values, constructed from r0, r1, r2 |
| 247 // and r3. | 255 // and r3. |
| 248 void GetFpArgs(double* x, double* y); | 256 void GetFpArgs(double* x, double* y); |
| 249 void SetFpResult(const double& result); | 257 void SetFpResult(const double& result); |
| 250 void TrashCallerSaveRegisters(); | 258 void TrashCallerSaveRegisters(); |
| 251 | 259 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 269 bool overflow_vfp_flag_; | 277 bool overflow_vfp_flag_; |
| 270 bool underflow_vfp_flag_; | 278 bool underflow_vfp_flag_; |
| 271 bool inexact_vfp_flag_; | 279 bool inexact_vfp_flag_; |
| 272 | 280 |
| 273 // Simulator support. | 281 // Simulator support. |
| 274 char* stack_; | 282 char* stack_; |
| 275 bool pc_modified_; | 283 bool pc_modified_; |
| 276 int icount_; | 284 int icount_; |
| 277 static bool initialized_; | 285 static bool initialized_; |
| 278 | 286 |
| 287 // Icache simulation |
| 288 v8::internal::HashMap i_cache_; |
| 289 |
| 279 // Registered breakpoints. | 290 // Registered breakpoints. |
| 280 Instr* break_pc_; | 291 Instr* break_pc_; |
| 281 instr_t break_instr_; | 292 instr_t break_instr_; |
| 282 }; | 293 }; |
| 283 | 294 |
| 284 } } // namespace assembler::arm | 295 } } // namespace assembler::arm |
| 285 | 296 |
| 286 | 297 |
| 287 // The simulator has its own stack. Thus it has a different stack limit from | 298 // The simulator has its own stack. Thus it has a different stack limit from |
| 288 // the C-based native code. Setting the c_limit to indicate a very small | 299 // the C-based native code. Setting the c_limit to indicate a very small |
| (...skipping 13 matching lines...) Expand all Loading... |
| 302 | 313 |
| 303 static inline void UnregisterCTryCatch() { | 314 static inline void UnregisterCTryCatch() { |
| 304 assembler::arm::Simulator::current()->PopAddress(); | 315 assembler::arm::Simulator::current()->PopAddress(); |
| 305 } | 316 } |
| 306 }; | 317 }; |
| 307 | 318 |
| 308 | 319 |
| 309 #endif // defined(__arm__) | 320 #endif // defined(__arm__) |
| 310 | 321 |
| 311 #endif // V8_ARM_SIMULATOR_ARM_H_ | 322 #endif // V8_ARM_SIMULATOR_ARM_H_ |
| OLD | NEW |