| 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 13 matching lines...) Expand all Loading... |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_CODEGEN_H_ | 28 #ifndef V8_CODEGEN_H_ |
| 29 #define V8_CODEGEN_H_ | 29 #define V8_CODEGEN_H_ |
| 30 | 30 |
| 31 #include "ast.h" | 31 #include "ast.h" |
| 32 #include "code-stubs.h" | 32 #include "code-stubs.h" |
| 33 #include "runtime.h" | 33 #include "runtime.h" |
| 34 #include "number-info.h" |
| 34 | 35 |
| 35 // Include the declaration of the architecture defined class CodeGenerator. | 36 // Include the declaration of the architecture defined class CodeGenerator. |
| 36 // The contract to the shared code is that the the CodeGenerator is a subclass | 37 // The contract to the shared code is that the the CodeGenerator is a subclass |
| 37 // of Visitor and that the following methods are available publicly: | 38 // of Visitor and that the following methods are available publicly: |
| 38 // MakeCode | 39 // MakeCode |
| 39 // MakeCodePrologue | 40 // MakeCodePrologue |
| 40 // MakeCodeEpilogue | 41 // MakeCodeEpilogue |
| 41 // masm | 42 // masm |
| 42 // frame | 43 // frame |
| 43 // script | 44 // script |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 Major MajorKey() { return NoCache; } | 409 Major MajorKey() { return NoCache; } |
| 409 int MinorKey() { return 0; } | 410 int MinorKey() { return 0; } |
| 410 const char* GetName() { return "ApiEntryStub"; } | 411 const char* GetName() { return "ApiEntryStub"; } |
| 411 // The accessor info associated with the function. | 412 // The accessor info associated with the function. |
| 412 Handle<AccessorInfo> info_; | 413 Handle<AccessorInfo> info_; |
| 413 // The function to be called. | 414 // The function to be called. |
| 414 ApiFunction* fun_; | 415 ApiFunction* fun_; |
| 415 }; | 416 }; |
| 416 | 417 |
| 417 | 418 |
| 418 // Mark the debugger statement to be recognized by debugger (by the MajorKey) | |
| 419 class DebuggerStatementStub : public CodeStub { | |
| 420 public: | |
| 421 DebuggerStatementStub() { } | |
| 422 | |
| 423 void Generate(MacroAssembler* masm); | |
| 424 | |
| 425 private: | |
| 426 Major MajorKey() { return DebuggerStatement; } | |
| 427 int MinorKey() { return 0; } | |
| 428 | |
| 429 const char* GetName() { return "DebuggerStatementStub"; } | |
| 430 }; | |
| 431 | |
| 432 | |
| 433 class JSEntryStub : public CodeStub { | 419 class JSEntryStub : public CodeStub { |
| 434 public: | 420 public: |
| 435 JSEntryStub() { } | 421 JSEntryStub() { } |
| 436 | 422 |
| 437 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); } | 423 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); } |
| 438 | 424 |
| 439 protected: | 425 protected: |
| 440 void GenerateBody(MacroAssembler* masm, bool is_construct); | 426 void GenerateBody(MacroAssembler* masm, bool is_construct); |
| 441 | 427 |
| 442 private: | 428 private: |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 | 511 |
| 526 #ifdef DEBUG | 512 #ifdef DEBUG |
| 527 void Print() { | 513 void Print() { |
| 528 PrintF("CallFunctionStub (args %d, in_loop %d, flags %d)\n", | 514 PrintF("CallFunctionStub (args %d, in_loop %d, flags %d)\n", |
| 529 argc_, | 515 argc_, |
| 530 static_cast<int>(in_loop_), | 516 static_cast<int>(in_loop_), |
| 531 static_cast<int>(flags_)); | 517 static_cast<int>(flags_)); |
| 532 } | 518 } |
| 533 #endif | 519 #endif |
| 534 | 520 |
| 535 // Minor key encoding in 31 bits AAAAAAAAAAAAAAAAAAAAAFI A(rgs)F(lag)I(nloop). | 521 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>. |
| 536 class InLoopBits: public BitField<InLoopFlag, 0, 1> {}; | 522 class InLoopBits: public BitField<InLoopFlag, 0, 1> {}; |
| 537 class FlagBits: public BitField<CallFunctionFlags, 1, 1> {}; | 523 class FlagBits: public BitField<CallFunctionFlags, 1, 1> {}; |
| 538 class ArgcBits: public BitField<int, 2, 29> {}; | 524 class ArgcBits: public BitField<int, 2, 32 - 2> {}; |
| 539 | 525 |
| 540 Major MajorKey() { return CallFunction; } | 526 Major MajorKey() { return CallFunction; } |
| 541 int MinorKey() { | 527 int MinorKey() { |
| 542 // Encode the parameters in a unique 31 bit value. | 528 // Encode the parameters in a unique 32 bit value. |
| 543 return InLoopBits::encode(in_loop_) | 529 return InLoopBits::encode(in_loop_) |
| 544 | FlagBits::encode(flags_) | 530 | FlagBits::encode(flags_) |
| 545 | ArgcBits::encode(argc_); | 531 | ArgcBits::encode(argc_); |
| 546 } | 532 } |
| 547 | 533 |
| 548 InLoopFlag InLoop() { return in_loop_; } | 534 InLoopFlag InLoop() { return in_loop_; } |
| 549 bool ReceiverMightBeValue() { | 535 bool ReceiverMightBeValue() { |
| 550 return (flags_ & RECEIVER_MIGHT_BE_VALUE) != 0; | 536 return (flags_ & RECEIVER_MIGHT_BE_VALUE) != 0; |
| 551 } | 537 } |
| 552 | 538 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 566 private: | 552 private: |
| 567 Major MajorKey() { return ToBoolean; } | 553 Major MajorKey() { return ToBoolean; } |
| 568 int MinorKey() { return 0; } | 554 int MinorKey() { return 0; } |
| 569 }; | 555 }; |
| 570 | 556 |
| 571 | 557 |
| 572 } // namespace internal | 558 } // namespace internal |
| 573 } // namespace v8 | 559 } // namespace v8 |
| 574 | 560 |
| 575 #endif // V8_CODEGEN_H_ | 561 #endif // V8_CODEGEN_H_ |
| OLD | NEW |