| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 V(RegExpExec) \ | 68 V(RegExpExec) \ |
| 69 V(RegExpConstructResult) \ | 69 V(RegExpConstructResult) \ |
| 70 V(NumberToString) \ | 70 V(NumberToString) \ |
| 71 V(CEntry) \ | 71 V(CEntry) \ |
| 72 V(JSEntry) \ | 72 V(JSEntry) \ |
| 73 V(KeyedLoadFastElement) \ | 73 V(KeyedLoadFastElement) \ |
| 74 V(KeyedStoreFastElement) \ | 74 V(KeyedStoreFastElement) \ |
| 75 V(KeyedLoadExternalArray) \ | 75 V(KeyedLoadExternalArray) \ |
| 76 V(KeyedStoreExternalArray) \ | 76 V(KeyedStoreExternalArray) \ |
| 77 V(DebuggerStatement) \ | 77 V(DebuggerStatement) \ |
| 78 V(StringDictionaryNegativeLookup) | 78 V(StringDictionaryLookup) |
| 79 | 79 |
| 80 // List of code stubs only used on ARM platforms. | 80 // List of code stubs only used on ARM platforms. |
| 81 #ifdef V8_TARGET_ARCH_ARM | 81 #ifdef V8_TARGET_ARCH_ARM |
| 82 #define CODE_STUB_LIST_ARM(V) \ | 82 #define CODE_STUB_LIST_ARM(V) \ |
| 83 V(GetProperty) \ | 83 V(GetProperty) \ |
| 84 V(SetProperty) \ | 84 V(SetProperty) \ |
| 85 V(InvokeBuiltin) \ | 85 V(InvokeBuiltin) \ |
| 86 V(RegExpCEntry) \ | 86 V(RegExpCEntry) \ |
| 87 V(DirectCEntry) | 87 V(DirectCEntry) |
| 88 #else | 88 #else |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 // See comment above, where Instanceof is defined. |
| 148 virtual bool CompilingCallsToThisStubIsGCSafe() { |
| 149 return MajorKey() <= Instanceof; |
| 150 } |
| 151 |
| 152 virtual bool SometimesSetsUpAFrame() { return true; } |
| 153 |
| 147 protected: | 154 protected: |
| 148 static const int kMajorBits = 6; | 155 static const int kMajorBits = 6; |
| 149 static const int kMinorBits = kBitsPerInt - kSmiTagSize - kMajorBits; | 156 static const int kMinorBits = kBitsPerInt - kSmiTagSize - kMajorBits; |
| 150 | 157 |
| 151 private: | 158 private: |
| 152 // Lookup the code in the (possibly custom) cache. | 159 // Lookup the code in the (possibly custom) cache. |
| 153 bool FindCodeInCache(Code** code_out); | 160 bool FindCodeInCache(Code** code_out); |
| 154 | 161 |
| 155 // Nonvirtual wrapper around the stub-specific Generate function. Call | 162 // Nonvirtual wrapper around the stub-specific Generate function. Call |
| 156 // this function to set up the macro assembler and generate the code. | 163 // this function to set up the macro assembler and generate the code. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 virtual void Print() { PrintF("%s\n", GetName()); } | 200 virtual void Print() { PrintF("%s\n", GetName()); } |
| 194 #endif | 201 #endif |
| 195 | 202 |
| 196 // Computes the key based on major and minor. | 203 // Computes the key based on major and minor. |
| 197 uint32_t GetKey() { | 204 uint32_t GetKey() { |
| 198 ASSERT(static_cast<int>(MajorKey()) < NUMBER_OF_IDS); | 205 ASSERT(static_cast<int>(MajorKey()) < NUMBER_OF_IDS); |
| 199 return MinorKeyBits::encode(MinorKey()) | | 206 return MinorKeyBits::encode(MinorKey()) | |
| 200 MajorKeyBits::encode(MajorKey()); | 207 MajorKeyBits::encode(MajorKey()); |
| 201 } | 208 } |
| 202 | 209 |
| 203 // See comment above, where Instanceof is defined. | |
| 204 bool AllowsStubCalls() { return MajorKey() <= Instanceof; } | |
| 205 | |
| 206 class MajorKeyBits: public BitField<uint32_t, 0, kMajorBits> {}; | 210 class MajorKeyBits: public BitField<uint32_t, 0, kMajorBits> {}; |
| 207 class MinorKeyBits: public BitField<uint32_t, kMajorBits, kMinorBits> {}; | 211 class MinorKeyBits: public BitField<uint32_t, kMajorBits, kMinorBits> {}; |
| 208 | 212 |
| 209 friend class BreakPointIterator; | 213 friend class BreakPointIterator; |
| 210 }; | 214 }; |
| 211 | 215 |
| 212 | 216 |
| 213 // Helper interface to prepare to/restore after making runtime calls. | 217 // Helper interface to prepare to/restore after making runtime calls. |
| 214 class RuntimeCallHelper { | 218 class RuntimeCallHelper { |
| 215 public: | 219 public: |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 | 572 |
| 569 | 573 |
| 570 class CEntryStub : public CodeStub { | 574 class CEntryStub : public CodeStub { |
| 571 public: | 575 public: |
| 572 explicit CEntryStub(int result_size) | 576 explicit CEntryStub(int result_size) |
| 573 : result_size_(result_size), save_doubles_(false) { } | 577 : result_size_(result_size), save_doubles_(false) { } |
| 574 | 578 |
| 575 void Generate(MacroAssembler* masm); | 579 void Generate(MacroAssembler* masm); |
| 576 void SaveDoubles() { save_doubles_ = true; } | 580 void SaveDoubles() { save_doubles_ = true; } |
| 577 | 581 |
| 582 // The version of this stub that doesn't save doubles is generated ahead of |
| 583 // time, so it's OK to call it from other stubs that can't cope with GC during |
| 584 // their code generation. |
| 585 virtual bool CompilingCallsToThisStubIsGCSafe() { return !save_doubles_; } |
| 586 |
| 578 private: | 587 private: |
| 579 void GenerateCore(MacroAssembler* masm, | 588 void GenerateCore(MacroAssembler* masm, |
| 580 Label* throw_normal_exception, | 589 Label* throw_normal_exception, |
| 581 Label* throw_termination_exception, | 590 Label* throw_termination_exception, |
| 582 Label* throw_out_of_memory_exception, | 591 Label* throw_out_of_memory_exception, |
| 583 bool do_gc, | 592 bool do_gc, |
| 584 bool always_allocate_scope); | 593 bool always_allocate_scope); |
| 585 void GenerateThrowTOS(MacroAssembler* masm); | 594 void GenerateThrowTOS(MacroAssembler* masm); |
| 586 void GenerateThrowUncatchable(MacroAssembler* masm, | 595 void GenerateThrowUncatchable(MacroAssembler* masm, |
| 587 UncatchableExceptionType type); | 596 UncatchableExceptionType type); |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1008 DECLARE_ARRAY_STUB_PRINT(KeyedStoreExternalArrayStub) | 1017 DECLARE_ARRAY_STUB_PRINT(KeyedStoreExternalArrayStub) |
| 1009 | 1018 |
| 1010 protected: | 1019 protected: |
| 1011 ExternalArrayType array_type_; | 1020 ExternalArrayType array_type_; |
| 1012 }; | 1021 }; |
| 1013 | 1022 |
| 1014 | 1023 |
| 1015 } } // namespace v8::internal | 1024 } } // namespace v8::internal |
| 1016 | 1025 |
| 1017 #endif // V8_CODE_STUBS_H_ | 1026 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |