OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 Label exit_label_; | 174 Label exit_label_; |
175 | 175 |
176 int registers_[RegisterAllocator::kNumRegisters]; | 176 int registers_[RegisterAllocator::kNumRegisters]; |
177 | 177 |
178 #ifdef DEBUG | 178 #ifdef DEBUG |
179 const char* comment_; | 179 const char* comment_; |
180 #endif | 180 #endif |
181 DISALLOW_COPY_AND_ASSIGN(DeferredCode); | 181 DISALLOW_COPY_AND_ASSIGN(DeferredCode); |
182 }; | 182 }; |
183 | 183 |
184 | |
185 // RuntimeStub models code stubs calling entry points in the Runtime class. | |
186 class RuntimeStub : public CodeStub { | |
187 public: | |
188 explicit RuntimeStub(Runtime::FunctionId id, int num_arguments) | |
189 : id_(id), num_arguments_(num_arguments) { } | |
190 | |
191 void Generate(MacroAssembler* masm); | |
192 | |
193 // Disassembler support. It is useful to be able to print the name | |
194 // of the runtime function called through this stub. | |
195 static const char* GetNameFromMinorKey(int minor_key) { | |
196 return Runtime::FunctionForId(IdField::decode(minor_key))->stub_name; | |
197 } | |
198 | |
199 private: | |
200 Runtime::FunctionId id_; | |
201 int num_arguments_; | |
202 | |
203 class ArgumentField: public BitField<int, 0, 16> {}; | |
204 class IdField: public BitField<Runtime::FunctionId, 16, kMinorBits - 16> {}; | |
205 | |
206 Major MajorKey() { return Runtime; } | |
207 int MinorKey() { | |
208 return IdField::encode(id_) | ArgumentField::encode(num_arguments_); | |
209 } | |
210 | |
211 const char* GetName(); | |
212 | |
213 #ifdef DEBUG | |
214 void Print() { | |
215 PrintF("RuntimeStub (id %s)\n", Runtime::FunctionForId(id_)->name); | |
216 } | |
217 #endif | |
218 }; | |
219 | |
220 | |
221 class StackCheckStub : public CodeStub { | 184 class StackCheckStub : public CodeStub { |
222 public: | 185 public: |
223 StackCheckStub() { } | 186 StackCheckStub() { } |
224 | 187 |
225 void Generate(MacroAssembler* masm); | 188 void Generate(MacroAssembler* masm); |
226 | 189 |
227 private: | 190 private: |
228 | 191 |
229 const char* GetName() { return "StackCheckStub"; } | 192 const char* GetName() { return "StackCheckStub"; } |
230 | 193 |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 Major MajorKey() { return NoCache; } | 378 Major MajorKey() { return NoCache; } |
416 int MinorKey() { return 0; } | 379 int MinorKey() { return 0; } |
417 const char* GetName() { return "ApiEntryStub"; } | 380 const char* GetName() { return "ApiEntryStub"; } |
418 // The accessor info associated with the function. | 381 // The accessor info associated with the function. |
419 Handle<AccessorInfo> info_; | 382 Handle<AccessorInfo> info_; |
420 // The function to be called. | 383 // The function to be called. |
421 ApiFunction* fun_; | 384 ApiFunction* fun_; |
422 }; | 385 }; |
423 | 386 |
424 | 387 |
425 class CEntryDebugBreakStub : public CEntryStub { | 388 // Mark the debugger statemet to be recognized bu debugger (by the MajorKey) |
| 389 class DebugerStatementStub : public CodeStub { |
426 public: | 390 public: |
427 CEntryDebugBreakStub() : CEntryStub(1) { } | 391 DebugerStatementStub() { } |
428 | 392 |
429 void Generate(MacroAssembler* masm) { GenerateBody(masm, true); } | 393 void Generate(MacroAssembler* masm); |
430 | 394 |
431 private: | 395 private: |
432 int MinorKey() { return 1; } | 396 Major MajorKey() { return DebuggerStatement; } |
| 397 int MinorKey() { return 0; } |
433 | 398 |
434 const char* GetName() { return "CEntryDebugBreakStub"; } | 399 const char* GetName() { return "DebugerStatementStub"; } |
435 }; | 400 }; |
436 | 401 |
437 | 402 |
438 class JSEntryStub : public CodeStub { | 403 class JSEntryStub : public CodeStub { |
439 public: | 404 public: |
440 JSEntryStub() { } | 405 JSEntryStub() { } |
441 | 406 |
442 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); } | 407 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); } |
443 | 408 |
444 protected: | 409 protected: |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 private: | 536 private: |
572 Major MajorKey() { return ToBoolean; } | 537 Major MajorKey() { return ToBoolean; } |
573 int MinorKey() { return 0; } | 538 int MinorKey() { return 0; } |
574 }; | 539 }; |
575 | 540 |
576 | 541 |
577 } // namespace internal | 542 } // namespace internal |
578 } // namespace v8 | 543 } // namespace v8 |
579 | 544 |
580 #endif // V8_CODEGEN_H_ | 545 #endif // V8_CODEGEN_H_ |
OLD | NEW |