| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // Types of uncatchable exceptions. | 79 // Types of uncatchable exceptions. |
| 80 enum UncatchableExceptionType { OUT_OF_MEMORY, TERMINATION }; | 80 enum UncatchableExceptionType { OUT_OF_MEMORY, TERMINATION }; |
| 81 | 81 |
| 82 | 82 |
| 83 #if V8_TARGET_ARCH_IA32 | 83 #if V8_TARGET_ARCH_IA32 |
| 84 #include "ia32/codegen-ia32.h" | 84 #include "ia32/codegen-ia32.h" |
| 85 #elif V8_TARGET_ARCH_X64 | 85 #elif V8_TARGET_ARCH_X64 |
| 86 #include "x64/codegen-x64.h" | 86 #include "x64/codegen-x64.h" |
| 87 #elif V8_TARGET_ARCH_ARM | 87 #elif V8_TARGET_ARCH_ARM |
| 88 #include "arm/codegen-arm.h" | 88 #include "arm/codegen-arm.h" |
| 89 #elif V8_TARGET_ARCH_MIPS |
| 90 #include "mips/codegen-mips.h" |
| 89 #else | 91 #else |
| 90 #error Unsupported target architecture. | 92 #error Unsupported target architecture. |
| 91 #endif | 93 #endif |
| 92 | 94 |
| 93 #include "register-allocator.h" | 95 #include "register-allocator.h" |
| 94 | 96 |
| 95 namespace v8 { | 97 namespace v8 { |
| 96 namespace internal { | 98 namespace internal { |
| 97 | 99 |
| 98 | 100 |
| 101 // Support for "structured" code comments. |
| 102 #ifdef DEBUG |
| 103 |
| 104 class Comment BASE_EMBEDDED { |
| 105 public: |
| 106 Comment(MacroAssembler* masm, const char* msg); |
| 107 ~Comment(); |
| 108 |
| 109 private: |
| 110 MacroAssembler* masm_; |
| 111 const char* msg_; |
| 112 }; |
| 113 |
| 114 #else |
| 115 |
| 116 class Comment BASE_EMBEDDED { |
| 117 public: |
| 118 Comment(MacroAssembler*, const char*) {} |
| 119 }; |
| 120 |
| 121 #endif // DEBUG |
| 122 |
| 123 |
| 99 // Code generation can be nested. Code generation scopes form a stack | 124 // Code generation can be nested. Code generation scopes form a stack |
| 100 // of active code generators. | 125 // of active code generators. |
| 101 class CodeGeneratorScope BASE_EMBEDDED { | 126 class CodeGeneratorScope BASE_EMBEDDED { |
| 102 public: | 127 public: |
| 103 explicit CodeGeneratorScope(CodeGenerator* cgen) { | 128 explicit CodeGeneratorScope(CodeGenerator* cgen) { |
| 104 previous_ = top_; | 129 previous_ = top_; |
| 105 top_ = cgen; | 130 top_ = cgen; |
| 106 } | 131 } |
| 107 | 132 |
| 108 ~CodeGeneratorScope() { | 133 ~CodeGeneratorScope() { |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 Label* throw_normal_exception, | 366 Label* throw_normal_exception, |
| 342 Label* throw_termination_exception, | 367 Label* throw_termination_exception, |
| 343 Label* throw_out_of_memory_exception, | 368 Label* throw_out_of_memory_exception, |
| 344 bool do_gc, | 369 bool do_gc, |
| 345 bool always_allocate_scope); | 370 bool always_allocate_scope); |
| 346 void GenerateThrowTOS(MacroAssembler* masm); | 371 void GenerateThrowTOS(MacroAssembler* masm); |
| 347 void GenerateThrowUncatchable(MacroAssembler* masm, | 372 void GenerateThrowUncatchable(MacroAssembler* masm, |
| 348 UncatchableExceptionType type); | 373 UncatchableExceptionType type); |
| 349 | 374 |
| 350 // Number of pointers/values returned. | 375 // Number of pointers/values returned. |
| 351 int const result_size_; | 376 const int result_size_; |
| 352 ExitFrame::Mode const mode_; | 377 const ExitFrame::Mode mode_; |
| 353 | 378 |
| 354 // Minor key encoding | 379 // Minor key encoding |
| 355 class ExitFrameModeBits: public BitField<ExitFrame::Mode, 0, 1> {}; | 380 class ExitFrameModeBits: public BitField<ExitFrame::Mode, 0, 1> {}; |
| 356 class IndirectResultBits: public BitField<bool, 1, 1> {}; | 381 class IndirectResultBits: public BitField<bool, 1, 1> {}; |
| 357 | 382 |
| 358 Major MajorKey() { return CEntry; } | 383 Major MajorKey() { return CEntry; } |
| 359 // Minor key must differ if different result_size_ values means different | 384 // Minor key must differ if different result_size_ values means different |
| 360 // code is generated. | 385 // code is generated. |
| 361 int MinorKey(); | 386 int MinorKey(); |
| 362 | 387 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 383 Major MajorKey() { return NoCache; } | 408 Major MajorKey() { return NoCache; } |
| 384 int MinorKey() { return 0; } | 409 int MinorKey() { return 0; } |
| 385 const char* GetName() { return "ApiEntryStub"; } | 410 const char* GetName() { return "ApiEntryStub"; } |
| 386 // The accessor info associated with the function. | 411 // The accessor info associated with the function. |
| 387 Handle<AccessorInfo> info_; | 412 Handle<AccessorInfo> info_; |
| 388 // The function to be called. | 413 // The function to be called. |
| 389 ApiFunction* fun_; | 414 ApiFunction* fun_; |
| 390 }; | 415 }; |
| 391 | 416 |
| 392 | 417 |
| 393 // Mark the debugger statemet to be recognized by debugger (by the MajorKey) | 418 // Mark the debugger statement to be recognized by debugger (by the MajorKey) |
| 394 class DebugerStatementStub : public CodeStub { | 419 class DebuggerStatementStub : public CodeStub { |
| 395 public: | 420 public: |
| 396 DebugerStatementStub() { } | 421 DebuggerStatementStub() { } |
| 397 | 422 |
| 398 void Generate(MacroAssembler* masm); | 423 void Generate(MacroAssembler* masm); |
| 399 | 424 |
| 400 private: | 425 private: |
| 401 Major MajorKey() { return DebuggerStatement; } | 426 Major MajorKey() { return DebuggerStatement; } |
| 402 int MinorKey() { return 0; } | 427 int MinorKey() { return 0; } |
| 403 | 428 |
| 404 const char* GetName() { return "DebugerStatementStub"; } | 429 const char* GetName() { return "DebuggerStatementStub"; } |
| 405 }; | 430 }; |
| 406 | 431 |
| 407 | 432 |
| 408 class JSEntryStub : public CodeStub { | 433 class JSEntryStub : public CodeStub { |
| 409 public: | 434 public: |
| 410 JSEntryStub() { } | 435 JSEntryStub() { } |
| 411 | 436 |
| 412 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); } | 437 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); } |
| 413 | 438 |
| 414 protected: | 439 protected: |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 private: | 566 private: |
| 542 Major MajorKey() { return ToBoolean; } | 567 Major MajorKey() { return ToBoolean; } |
| 543 int MinorKey() { return 0; } | 568 int MinorKey() { return 0; } |
| 544 }; | 569 }; |
| 545 | 570 |
| 546 | 571 |
| 547 } // namespace internal | 572 } // namespace internal |
| 548 } // namespace v8 | 573 } // namespace v8 |
| 549 | 574 |
| 550 #endif // V8_CODEGEN_H_ | 575 #endif // V8_CODEGEN_H_ |
| OLD | NEW |