| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 public: | 119 public: |
| 120 enum Major { | 120 enum Major { |
| 121 #define DEF_ENUM(name) name, | 121 #define DEF_ENUM(name) name, |
| 122 CODE_STUB_LIST(DEF_ENUM) | 122 CODE_STUB_LIST(DEF_ENUM) |
| 123 #undef DEF_ENUM | 123 #undef DEF_ENUM |
| 124 NoCache, // marker for stubs that do custom caching | 124 NoCache, // marker for stubs that do custom caching |
| 125 NUMBER_OF_IDS | 125 NUMBER_OF_IDS |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 // Retrieve the code for the stub. Generate the code if needed. | 128 // Retrieve the code for the stub. Generate the code if needed. |
| 129 Handle<Code> GetCode(); | 129 Handle<Code> GetCode(Isolate* isolate); |
| 130 | 130 |
| 131 static Major MajorKeyFromKey(uint32_t key) { | 131 static Major MajorKeyFromKey(uint32_t key) { |
| 132 return static_cast<Major>(MajorKeyBits::decode(key)); | 132 return static_cast<Major>(MajorKeyBits::decode(key)); |
| 133 } | 133 } |
| 134 static int MinorKeyFromKey(uint32_t key) { | 134 static int MinorKeyFromKey(uint32_t key) { |
| 135 return MinorKeyBits::decode(key); | 135 return MinorKeyBits::decode(key); |
| 136 } | 136 } |
| 137 | 137 |
| 138 // Gets the major key from a code object that is a code stub or binary op IC. | 138 // Gets the major key from a code object that is a code stub or binary op IC. |
| 139 static Major GetMajorKey(Code* code_stub) { | 139 static Major GetMajorKey(Code* code_stub) { |
| 140 return static_cast<Major>(code_stub->major_key()); | 140 return static_cast<Major>(code_stub->major_key()); |
| 141 } | 141 } |
| 142 | 142 |
| 143 static const char* MajorName(Major major_key, bool allow_unknown_keys); | 143 static const char* MajorName(Major major_key, bool allow_unknown_keys); |
| 144 | 144 |
| 145 virtual ~CodeStub() {} | 145 virtual ~CodeStub() {} |
| 146 | 146 |
| 147 bool CompilingCallsToThisStubIsGCSafe() { | 147 bool CompilingCallsToThisStubIsGCSafe() { |
| 148 bool is_pregenerated = IsPregenerated(); | 148 bool is_pregenerated = IsPregenerated(); |
| 149 Code* code = NULL; | 149 Code* code = NULL; |
| 150 CHECK(!is_pregenerated || FindCodeInCache(&code, Isolate::Current())); | 150 CHECK(!is_pregenerated || FindCodeInCache(&code, Isolate::Current())); |
| 151 return is_pregenerated; | 151 return is_pregenerated; |
| 152 } | 152 } |
| 153 | 153 |
| 154 // See comment above, where Instanceof is defined. | 154 // See comment above, where Instanceof is defined. |
| 155 virtual bool IsPregenerated() { return false; } | 155 virtual bool IsPregenerated() { return false; } |
| 156 | 156 |
| 157 static void GenerateStubsAheadOfTime(); | 157 static void GenerateStubsAheadOfTime(Isolate* isolate); |
| 158 static void GenerateFPStubs(); | 158 static void GenerateFPStubs(Isolate* isolate); |
| 159 | 159 |
| 160 // Some stubs put untagged junk on the stack that cannot be scanned by the | 160 // Some stubs put untagged junk on the stack that cannot be scanned by the |
| 161 // GC. This means that we must be statically sure that no GC can occur while | 161 // GC. This means that we must be statically sure that no GC can occur while |
| 162 // they are running. If that is the case they should override this to return | 162 // they are running. If that is the case they should override this to return |
| 163 // true, which will cause an assertion if we try to call something that can | 163 // true, which will cause an assertion if we try to call something that can |
| 164 // GC or if we try to put a stack frame on top of the junk, which would not | 164 // GC or if we try to put a stack frame on top of the junk, which would not |
| 165 // result in a traversable stack. | 165 // result in a traversable stack. |
| 166 virtual bool SometimesSetsUpAFrame() { return true; } | 166 virtual bool SometimesSetsUpAFrame() { return true; } |
| 167 | 167 |
| 168 // Lookup the code in the (possibly custom) cache. | 168 // Lookup the code in the (possibly custom) cache. |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 SaveFPRegsMode save_doubles = kDontSaveFPRegs) | 837 SaveFPRegsMode save_doubles = kDontSaveFPRegs) |
| 838 : result_size_(result_size), save_doubles_(save_doubles) { } | 838 : result_size_(result_size), save_doubles_(save_doubles) { } |
| 839 | 839 |
| 840 void Generate(MacroAssembler* masm); | 840 void Generate(MacroAssembler* masm); |
| 841 | 841 |
| 842 // The version of this stub that doesn't save doubles is generated ahead of | 842 // The version of this stub that doesn't save doubles is generated ahead of |
| 843 // time, so it's OK to call it from other stubs that can't cope with GC during | 843 // time, so it's OK to call it from other stubs that can't cope with GC during |
| 844 // their code generation. On machines that always have gp registers (x64) we | 844 // their code generation. On machines that always have gp registers (x64) we |
| 845 // can generate both variants ahead of time. | 845 // can generate both variants ahead of time. |
| 846 virtual bool IsPregenerated(); | 846 virtual bool IsPregenerated(); |
| 847 static void GenerateAheadOfTime(); | 847 static void GenerateAheadOfTime(Isolate* isolate); |
| 848 | 848 |
| 849 private: | 849 private: |
| 850 void GenerateCore(MacroAssembler* masm, | 850 void GenerateCore(MacroAssembler* masm, |
| 851 Label* throw_normal_exception, | 851 Label* throw_normal_exception, |
| 852 Label* throw_termination_exception, | 852 Label* throw_termination_exception, |
| 853 Label* throw_out_of_memory_exception, | 853 Label* throw_out_of_memory_exception, |
| 854 bool do_gc, | 854 bool do_gc, |
| 855 bool always_allocate_scope); | 855 bool always_allocate_scope); |
| 856 | 856 |
| 857 // Number of pointers/values returned. | 857 // Number of pointers/values returned. |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1455 | 1455 |
| 1456 class StubFailureTrampolineStub : public PlatformCodeStub { | 1456 class StubFailureTrampolineStub : public PlatformCodeStub { |
| 1457 public: | 1457 public: |
| 1458 static const int kMaxExtraExpressionStackCount = 1; | 1458 static const int kMaxExtraExpressionStackCount = 1; |
| 1459 | 1459 |
| 1460 explicit StubFailureTrampolineStub(int extra_expression_stack_count) | 1460 explicit StubFailureTrampolineStub(int extra_expression_stack_count) |
| 1461 : extra_expression_stack_count_(extra_expression_stack_count) {} | 1461 : extra_expression_stack_count_(extra_expression_stack_count) {} |
| 1462 | 1462 |
| 1463 virtual bool IsPregenerated() { return true; } | 1463 virtual bool IsPregenerated() { return true; } |
| 1464 | 1464 |
| 1465 static void GenerateAheadOfTime(); | 1465 static void GenerateAheadOfTime(Isolate* isolate); |
| 1466 | 1466 |
| 1467 private: | 1467 private: |
| 1468 Major MajorKey() { return StubFailureTrampoline; } | 1468 Major MajorKey() { return StubFailureTrampoline; } |
| 1469 int MinorKey() { return extra_expression_stack_count_; } | 1469 int MinorKey() { return extra_expression_stack_count_; } |
| 1470 | 1470 |
| 1471 void Generate(MacroAssembler* masm); | 1471 void Generate(MacroAssembler* masm); |
| 1472 | 1472 |
| 1473 int extra_expression_stack_count_; | 1473 int extra_expression_stack_count_; |
| 1474 | 1474 |
| 1475 DISALLOW_COPY_AND_ASSIGN(StubFailureTrampolineStub); | 1475 DISALLOW_COPY_AND_ASSIGN(StubFailureTrampolineStub); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1504 | 1504 |
| 1505 // The current function entry hook. | 1505 // The current function entry hook. |
| 1506 static FunctionEntryHook entry_hook_; | 1506 static FunctionEntryHook entry_hook_; |
| 1507 | 1507 |
| 1508 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 1508 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
| 1509 }; | 1509 }; |
| 1510 | 1510 |
| 1511 } } // namespace v8::internal | 1511 } } // namespace v8::internal |
| 1512 | 1512 |
| 1513 #endif // V8_CODE_STUBS_H_ | 1513 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |