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

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

Issue 4044003: Clean up definitions in simulator. ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 2 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 | « src/arm/cpu-arm.cc ('k') | src/arm/simulator-arm.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 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 20 matching lines...) Expand all
31 // regular desktop machines. 31 // regular desktop machines.
32 // V8 calls into generated code by "calling" the CALL_GENERATED_CODE macro, 32 // V8 calls into generated code by "calling" the CALL_GENERATED_CODE macro,
33 // which will start execution in the Simulator or forwards to the real entry 33 // which will start execution in the Simulator or forwards to the real entry
34 // on a ARM HW platform. 34 // on a ARM HW platform.
35 35
36 #ifndef V8_ARM_SIMULATOR_ARM_H_ 36 #ifndef V8_ARM_SIMULATOR_ARM_H_
37 #define V8_ARM_SIMULATOR_ARM_H_ 37 #define V8_ARM_SIMULATOR_ARM_H_
38 38
39 #include "allocation.h" 39 #include "allocation.h"
40 40
41 #if defined(__arm__) && !defined(USE_SIMULATOR) 41 #if !defined(USE_SIMULATOR)
42 // Running without a simulator on a native arm platform.
43
44 namespace v8 {
45 namespace internal {
42 46
43 // When running without a simulator we call the entry directly. 47 // When running without a simulator we call the entry directly.
44 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \ 48 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \
45 (entry(p0, p1, p2, p3, p4)) 49 (entry(p0, p1, p2, p3, p4))
46 50
51 // Call the generated regexp code directly. The entry function pointer should
52 // expect seven int/pointer sized arguments and return an int.
53 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6) \
54 (entry(p0, p1, p2, p3, p4, p5, p6))
55
56 #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \
57 (reinterpret_cast<TryCatch*>(try_catch_address))
58
47 // The stack limit beyond which we will throw stack overflow errors in 59 // The stack limit beyond which we will throw stack overflow errors in
48 // generated code. Because generated code on arm uses the C stack, we 60 // generated code. Because generated code on arm uses the C stack, we
49 // just use the C stack limit. 61 // just use the C stack limit.
50 class SimulatorStack : public v8::internal::AllStatic { 62 class SimulatorStack : public v8::internal::AllStatic {
51 public: 63 public:
52 static inline uintptr_t JsLimitFromCLimit(uintptr_t c_limit) { 64 static inline uintptr_t JsLimitFromCLimit(uintptr_t c_limit) {
53 return c_limit; 65 return c_limit;
54 } 66 }
55 67
56 static inline uintptr_t RegisterCTryCatch(uintptr_t try_catch_address) { 68 static inline uintptr_t RegisterCTryCatch(uintptr_t try_catch_address) {
57 return try_catch_address; 69 return try_catch_address;
58 } 70 }
59 71
60 static inline void UnregisterCTryCatch() { } 72 static inline void UnregisterCTryCatch() { }
61 }; 73 };
62 74
75 } } // namespace v8::internal
63 76
64 // Call the generated regexp code directly. The entry function pointer should 77 #else // !defined(USE_SIMULATOR)
65 // expect eight int/pointer sized arguments and return an int. 78 // Running with a simulator.
66 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6) \
67 entry(p0, p1, p2, p3, p4, p5, p6)
68
69 #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \
70 reinterpret_cast<TryCatch*>(try_catch_address)
71
72
73 #else // !defined(__arm__) || defined(USE_SIMULATOR)
74
75 // When running with the simulator transition into simulated execution at this
76 // point.
77 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \
78 reinterpret_cast<Object*>( \
79 assembler::arm::Simulator::current()->Call(FUNCTION_ADDR(entry), 5, \
80 p0, p1, p2, p3, p4))
81
82 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6) \
83 assembler::arm::Simulator::current()->Call( \
84 FUNCTION_ADDR(entry), 7, p0, p1, p2, p3, p4, p5, p6)
85
86 #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \
87 try_catch_address == NULL ? \
88 NULL : *(reinterpret_cast<TryCatch**>(try_catch_address))
89
90 79
91 #include "constants-arm.h" 80 #include "constants-arm.h"
92 #include "hashmap.h" 81 #include "hashmap.h"
93 82
94
95 namespace assembler { 83 namespace assembler {
96 namespace arm { 84 namespace arm {
97 85
98 class CachePage { 86 class CachePage {
99 public: 87 public:
100 static const int LINE_VALID = 0; 88 static const int LINE_VALID = 0;
101 static const int LINE_INVALID = 1; 89 static const int LINE_INVALID = 1;
102 90
103 static const int kPageShift = 12; 91 static const int kPageShift = 12;
104 static const int kPageSize = 1 << kPageShift; 92 static const int kPageSize = 1 << kPageShift;
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 static v8::internal::HashMap* i_cache_; 315 static v8::internal::HashMap* i_cache_;
328 316
329 // Registered breakpoints. 317 // Registered breakpoints.
330 Instr* break_pc_; 318 Instr* break_pc_;
331 instr_t break_instr_; 319 instr_t break_instr_;
332 }; 320 };
333 321
334 } } // namespace assembler::arm 322 } } // namespace assembler::arm
335 323
336 324
325 namespace v8 {
326 namespace internal {
327
328 // When running with the simulator transition into simulated execution at this
329 // point.
330 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \
331 reinterpret_cast<Object*>(assembler::arm::Simulator::current()->Call( \
332 FUNCTION_ADDR(entry), 5, p0, p1, p2, p3, p4))
333
334 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6) \
335 assembler::arm::Simulator::current()->Call( \
336 FUNCTION_ADDR(entry), 7, p0, p1, p2, p3, p4, p5, p6)
337
338 #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \
339 try_catch_address == \
340 NULL ? NULL : *(reinterpret_cast<TryCatch**>(try_catch_address))
341
342
337 // The simulator has its own stack. Thus it has a different stack limit from 343 // The simulator has its own stack. Thus it has a different stack limit from
338 // the C-based native code. Setting the c_limit to indicate a very small 344 // the C-based native code. Setting the c_limit to indicate a very small
339 // stack cause stack overflow errors, since the simulator ignores the input. 345 // stack cause stack overflow errors, since the simulator ignores the input.
340 // This is unlikely to be an issue in practice, though it might cause testing 346 // This is unlikely to be an issue in practice, though it might cause testing
341 // trouble down the line. 347 // trouble down the line.
342 class SimulatorStack : public v8::internal::AllStatic { 348 class SimulatorStack : public v8::internal::AllStatic {
343 public: 349 public:
344 static inline uintptr_t JsLimitFromCLimit(uintptr_t c_limit) { 350 static inline uintptr_t JsLimitFromCLimit(uintptr_t c_limit) {
345 return assembler::arm::Simulator::current()->StackLimit(); 351 return assembler::arm::Simulator::current()->StackLimit();
346 } 352 }
347 353
348 static inline uintptr_t RegisterCTryCatch(uintptr_t try_catch_address) { 354 static inline uintptr_t RegisterCTryCatch(uintptr_t try_catch_address) {
349 assembler::arm::Simulator* sim = assembler::arm::Simulator::current(); 355 assembler::arm::Simulator* sim = assembler::arm::Simulator::current();
350 return sim->PushAddress(try_catch_address); 356 return sim->PushAddress(try_catch_address);
351 } 357 }
352 358
353 static inline void UnregisterCTryCatch() { 359 static inline void UnregisterCTryCatch() {
354 assembler::arm::Simulator::current()->PopAddress(); 360 assembler::arm::Simulator::current()->PopAddress();
355 } 361 }
356 }; 362 };
357 363
364 } } // namespace v8::internal
358 365
359 #endif // !defined(__arm__) || defined(USE_SIMULATOR) 366 #endif // !defined(USE_SIMULATOR)
360
361 #endif // V8_ARM_SIMULATOR_ARM_H_ 367 #endif // V8_ARM_SIMULATOR_ARM_H_
OLDNEW
« no previous file with comments | « src/arm/cpu-arm.cc ('k') | src/arm/simulator-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698