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 5789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5800 class SharedFunctionInfo: public HeapObject { | 5800 class SharedFunctionInfo: public HeapObject { |
5801 public: | 5801 public: |
5802 // [name]: Function name. | 5802 // [name]: Function name. |
5803 DECL_ACCESSORS(name, Object) | 5803 DECL_ACCESSORS(name, Object) |
5804 | 5804 |
5805 // [code]: Function code. | 5805 // [code]: Function code. |
5806 DECL_ACCESSORS(code, Code) | 5806 DECL_ACCESSORS(code, Code) |
5807 inline void ReplaceCode(Code* code); | 5807 inline void ReplaceCode(Code* code); |
5808 | 5808 |
5809 // [optimized_code_map]: Map from native context to optimized code | 5809 // [optimized_code_map]: Map from native context to optimized code |
5810 // and a shared literals array or Smi 0 if none. | 5810 // and a shared literals array or Smi(0) if none. |
5811 DECL_ACCESSORS(optimized_code_map, Object) | 5811 DECL_ACCESSORS(optimized_code_map, Object) |
5812 | 5812 |
5813 // Returns index i of the entry with the specified context. At position | 5813 // Returns index i of the entry with the specified context. At position |
5814 // i - 1 is the context, position i the code, and i + 1 the literals array. | 5814 // i - 1 is the context, position i the code, and i + 1 the literals array. |
5815 // Returns -1 when no matching entry is found. | 5815 // Returns -1 when no matching entry is found. |
5816 int SearchOptimizedCodeMap(Context* native_context); | 5816 int SearchOptimizedCodeMap(Context* native_context); |
5817 | 5817 |
5818 // Installs optimized code from the code map on the given closure. The | 5818 // Installs optimized code from the code map on the given closure. The |
5819 // index has to be consistent with a search result as defined above. | 5819 // index has to be consistent with a search result as defined above. |
5820 void InstallFromOptimizedCodeMap(JSFunction* function, int index); | 5820 void InstallFromOptimizedCodeMap(JSFunction* function, int index); |
5821 | 5821 |
5822 // Clear optimized code map. | 5822 // Clear optimized code map. |
5823 void ClearOptimizedCodeMap(const char* reason); | 5823 void ClearOptimizedCodeMap(); |
5824 | 5824 |
5825 // Removed a specific optimized code object from the optimized code map. | 5825 // Removed a specific optimized code object from the optimized code map. |
5826 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason); | 5826 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason); |
5827 | 5827 |
| 5828 // Trims the optimized code map after entries have been removed. |
| 5829 void TrimOptimizedCodeMap(int shrink_by); |
| 5830 |
| 5831 // Zaps the contents of backing optimized code map. |
| 5832 void ZapOptimizedCodeMap(); |
| 5833 |
5828 // Add a new entry to the optimized code map. | 5834 // Add a new entry to the optimized code map. |
| 5835 MUST_USE_RESULT MaybeObject* AddToOptimizedCodeMap(Context* native_context, |
| 5836 Code* code, |
| 5837 FixedArray* literals); |
5829 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, | 5838 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, |
5830 Handle<Context> native_context, | 5839 Handle<Context> native_context, |
5831 Handle<Code> code, | 5840 Handle<Code> code, |
5832 Handle<FixedArray> literals); | 5841 Handle<FixedArray> literals); |
| 5842 |
| 5843 // Layout description of the optimized code map. |
| 5844 static const int kNextMapIndex = 0; |
| 5845 static const int kEntriesStart = 1; |
5833 static const int kEntryLength = 3; | 5846 static const int kEntryLength = 3; |
| 5847 static const int kFirstContextSlot = FixedArray::kHeaderSize + kPointerSize; |
| 5848 static const int kFirstCodeSlot = FixedArray::kHeaderSize + 2 * kPointerSize; |
| 5849 static const int kSecondEntryIndex = kEntryLength + kEntriesStart; |
5834 | 5850 |
5835 // [scope_info]: Scope info. | 5851 // [scope_info]: Scope info. |
5836 DECL_ACCESSORS(scope_info, ScopeInfo) | 5852 DECL_ACCESSORS(scope_info, ScopeInfo) |
5837 | 5853 |
5838 // [construct stub]: Code stub for constructing instances of this function. | 5854 // [construct stub]: Code stub for constructing instances of this function. |
5839 DECL_ACCESSORS(construct_stub, Code) | 5855 DECL_ACCESSORS(construct_stub, Code) |
5840 | 5856 |
5841 inline Code* unchecked_code(); | 5857 inline Code* unchecked_code(); |
5842 | 5858 |
5843 // Returns if this function has been compiled to native code yet. | 5859 // Returns if this function has been compiled to native code yet. |
(...skipping 3747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9591 } else { | 9607 } else { |
9592 value &= ~(1 << bit_position); | 9608 value &= ~(1 << bit_position); |
9593 } | 9609 } |
9594 return value; | 9610 return value; |
9595 } | 9611 } |
9596 }; | 9612 }; |
9597 | 9613 |
9598 } } // namespace v8::internal | 9614 } } // namespace v8::internal |
9599 | 9615 |
9600 #endif // V8_OBJECTS_H_ | 9616 #endif // V8_OBJECTS_H_ |
OLD | NEW |