Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(602)

Side by Side Diff: src/objects.h

Issue 14794007: Preserve optimized code map during GCs weakly. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Hannes Payer. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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;
5850 static const int kInitialLength = kEntriesStart + kEntryLength;
5834 5851
5835 // [scope_info]: Scope info. 5852 // [scope_info]: Scope info.
5836 DECL_ACCESSORS(scope_info, ScopeInfo) 5853 DECL_ACCESSORS(scope_info, ScopeInfo)
5837 5854
5838 // [construct stub]: Code stub for constructing instances of this function. 5855 // [construct stub]: Code stub for constructing instances of this function.
5839 DECL_ACCESSORS(construct_stub, Code) 5856 DECL_ACCESSORS(construct_stub, Code)
5840 5857
5841 inline Code* unchecked_code(); 5858 inline Code* unchecked_code();
5842 5859
5843 // Returns if this function has been compiled to native code yet. 5860 // Returns if this function has been compiled to native code yet.
(...skipping 3747 matching lines...) Expand 10 before | Expand all | Expand 10 after
9591 } else { 9608 } else {
9592 value &= ~(1 << bit_position); 9609 value &= ~(1 << bit_position);
9593 } 9610 }
9594 return value; 9611 return value;
9595 } 9612 }
9596 }; 9613 };
9597 9614
9598 } } // namespace v8::internal 9615 } } // namespace v8::internal
9599 9616
9600 #endif // V8_OBJECTS_H_ 9617 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698