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 106 matching lines...) Loading... |
117 | 117 |
118 // Gets the major key from a code object that is a code stub or binary op IC. | 118 // Gets the major key from a code object that is a code stub or binary op IC. |
119 static Major GetMajorKey(Code* code_stub) { | 119 static Major GetMajorKey(Code* code_stub) { |
120 return static_cast<Major>(code_stub->major_key()); | 120 return static_cast<Major>(code_stub->major_key()); |
121 } | 121 } |
122 | 122 |
123 static const char* MajorName(Major major_key, bool allow_unknown_keys); | 123 static const char* MajorName(Major major_key, bool allow_unknown_keys); |
124 | 124 |
125 virtual ~CodeStub() {} | 125 virtual ~CodeStub() {} |
126 | 126 |
127 // Override these methods to provide a custom caching mechanism for | |
128 // an individual type of code stub. | |
129 virtual bool GetCustomCache(Code** code_out) { return false; } | |
130 virtual void SetCustomCache(Code* value) { } | |
131 virtual bool has_custom_cache() { return false; } | |
132 | |
133 protected: | 127 protected: |
134 static const int kMajorBits = 5; | 128 static const int kMajorBits = 5; |
135 static const int kMinorBits = kBitsPerInt - kSmiTagSize - kMajorBits; | 129 static const int kMinorBits = kBitsPerInt - kSmiTagSize - kMajorBits; |
136 | 130 |
137 private: | 131 private: |
138 // Lookup the code in the (possibly custom) cache. | 132 // Lookup the code in the (possibly custom) cache. |
139 bool FindCodeInCache(Code** code_out); | 133 bool FindCodeInCache(Code** code_out); |
140 | 134 |
141 // Nonvirtual wrapper around the stub-specific Generate function. Call | 135 // Nonvirtual wrapper around the stub-specific Generate function. Call |
142 // this function to set up the macro assembler and generate the code. | 136 // this function to set up the macro assembler and generate the code. |
(...skipping 374 matching lines...) Loading... |
517 | 511 |
518 Major MajorKey() { return CEntry; } | 512 Major MajorKey() { return CEntry; } |
519 // Minor key must differ if different result_size_ values means different | 513 // Minor key must differ if different result_size_ values means different |
520 // code is generated. | 514 // code is generated. |
521 int MinorKey(); | 515 int MinorKey(); |
522 | 516 |
523 const char* GetName() { return "CEntryStub"; } | 517 const char* GetName() { return "CEntryStub"; } |
524 }; | 518 }; |
525 | 519 |
526 | 520 |
527 class ApiGetterEntryStub : public CodeStub { | |
528 public: | |
529 ApiGetterEntryStub(Handle<AccessorInfo> info, | |
530 ApiFunction* fun) | |
531 : info_(info), | |
532 fun_(fun) { } | |
533 void Generate(MacroAssembler* masm); | |
534 virtual bool has_custom_cache() { return true; } | |
535 virtual bool GetCustomCache(Code** code_out); | |
536 virtual void SetCustomCache(Code* value); | |
537 | |
538 static const int kStackSpace = 5; | |
539 static const int kArgc = 2; | |
540 private: | |
541 Handle<AccessorInfo> info() { return info_; } | |
542 ApiFunction* fun() { return fun_; } | |
543 Major MajorKey() { return NoCache; } | |
544 int MinorKey() { return 0; } | |
545 const char* GetName() { return "ApiGetterEntryStub"; } | |
546 // The accessor info associated with the function. | |
547 Handle<AccessorInfo> info_; | |
548 // The function to be called. | |
549 ApiFunction* fun_; | |
550 }; | |
551 | |
552 | |
553 class ApiCallEntryStub : public CodeStub { | |
554 public: | |
555 ApiCallEntryStub(Handle<CallHandlerInfo> info, | |
556 ApiFunction* fun) | |
557 : info_(info), | |
558 fun_(fun) { } | |
559 void Generate(MacroAssembler* masm); | |
560 virtual bool has_custom_cache() { return true; } | |
561 virtual bool GetCustomCache(Code** code_out); | |
562 virtual void SetCustomCache(Code* value); | |
563 | |
564 static const int kStackSpace = 0; | |
565 static const int kArgc = 5; | |
566 private: | |
567 Handle<CallHandlerInfo> info() { return info_; } | |
568 ApiFunction* fun() { return fun_; } | |
569 Major MajorKey() { return NoCache; } | |
570 int MinorKey() { return 0; } | |
571 const char* GetName() { return "ApiCallEntryStub"; } | |
572 // The call handler info associated with the function. | |
573 Handle<CallHandlerInfo> info_; | |
574 // The function to be called. | |
575 ApiFunction* fun_; | |
576 }; | |
577 | |
578 | |
579 class JSEntryStub : public CodeStub { | 521 class JSEntryStub : public CodeStub { |
580 public: | 522 public: |
581 JSEntryStub() { } | 523 JSEntryStub() { } |
582 | 524 |
583 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); } | 525 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); } |
584 | 526 |
585 protected: | 527 protected: |
586 void GenerateBody(MacroAssembler* masm, bool is_construct); | 528 void GenerateBody(MacroAssembler* masm, bool is_construct); |
587 | 529 |
588 private: | 530 private: |
(...skipping 264 matching lines...) Loading... |
853 private: | 795 private: |
854 StringCharCodeAtGenerator char_code_at_generator_; | 796 StringCharCodeAtGenerator char_code_at_generator_; |
855 StringCharFromCodeGenerator char_from_code_generator_; | 797 StringCharFromCodeGenerator char_from_code_generator_; |
856 | 798 |
857 DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator); | 799 DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator); |
858 }; | 800 }; |
859 | 801 |
860 } } // namespace v8::internal | 802 } } // namespace v8::internal |
861 | 803 |
862 #endif // V8_CODE_STUBS_H_ | 804 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |