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

Side by Side Diff: src/objects.h

Issue 1208013002: [turbofan] Implement sharing of context-independent code. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_opt-code-map-3
Patch Set: Disable test for GC stress. Created 5 years, 5 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
« no previous file with comments | « src/hydrogen-instructions.h ('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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_OBJECTS_H_ 5 #ifndef V8_OBJECTS_H_
6 #define V8_OBJECTS_H_ 6 #define V8_OBJECTS_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 6536 matching lines...) Expand 10 before | Expand all | Expand 10 after
6547 FUNCTIONS_WITH_ID_LIST(DECLARE_FUNCTION_ID) 6547 FUNCTIONS_WITH_ID_LIST(DECLARE_FUNCTION_ID)
6548 ATOMIC_FUNCTIONS_WITH_ID_LIST(DECLARE_FUNCTION_ID) 6548 ATOMIC_FUNCTIONS_WITH_ID_LIST(DECLARE_FUNCTION_ID)
6549 #undef DECLARE_FUNCTION_ID 6549 #undef DECLARE_FUNCTION_ID
6550 // Fake id for a special case of Math.pow. Note, it continues the 6550 // Fake id for a special case of Math.pow. Note, it continues the
6551 // list of math functions. 6551 // list of math functions.
6552 kMathPowHalf 6552 kMathPowHalf
6553 }; 6553 };
6554 6554
6555 6555
6556 // Result of searching in an optimized code map of a SharedFunctionInfo. Note 6556 // Result of searching in an optimized code map of a SharedFunctionInfo. Note
6557 // that {code == nullptr} indicates that no entry has been found. 6557 // that both {code} and {literals} can be NULL to pass search result status.
6558 struct CodeAndLiterals { 6558 struct CodeAndLiterals {
6559 Code* code; // Cached optimized code. 6559 Code* code; // Cached optimized code.
6560 FixedArray* literals; // Cached literals array. 6560 FixedArray* literals; // Cached literals array.
6561 }; 6561 };
6562 6562
6563 6563
6564 // SharedFunctionInfo describes the JSFunction information that can be 6564 // SharedFunctionInfo describes the JSFunction information that can be
6565 // shared by multiple instances of the function. 6565 // shared by multiple instances of the function.
6566 class SharedFunctionInfo: public HeapObject { 6566 class SharedFunctionInfo: public HeapObject {
6567 public: 6567 public:
6568 // [name]: Function name. 6568 // [name]: Function name.
6569 DECL_ACCESSORS(name, Object) 6569 DECL_ACCESSORS(name, Object)
6570 6570
6571 // [code]: Function code. 6571 // [code]: Function code.
6572 DECL_ACCESSORS(code, Code) 6572 DECL_ACCESSORS(code, Code)
6573 inline void ReplaceCode(Code* code); 6573 inline void ReplaceCode(Code* code);
6574 6574
6575 // [optimized_code_map]: Map from native context to optimized code 6575 // [optimized_code_map]: Map from native context to optimized code
6576 // and a shared literals array or Smi(0) if none. 6576 // and a shared literals array or Smi(0) if none.
6577 DECL_ACCESSORS(optimized_code_map, Object) 6577 DECL_ACCESSORS(optimized_code_map, Object)
6578 6578
6579 // Returns entry from optimized code map for specified context and OSR entry. 6579 // Returns entry from optimized code map for specified context and OSR entry.
6580 // Note that {code == nullptr} indicates no matching entry has been found. 6580 // Note that {code == nullptr} indicates no matching entry has been found,
6581 // whereas {literals == nullptr} indicates the code is context-independent.
6581 CodeAndLiterals SearchOptimizedCodeMap(Context* native_context, 6582 CodeAndLiterals SearchOptimizedCodeMap(Context* native_context,
6582 BailoutId osr_ast_id); 6583 BailoutId osr_ast_id);
6583 6584
6584 // Clear optimized code map. 6585 // Clear optimized code map.
6585 void ClearOptimizedCodeMap(); 6586 void ClearOptimizedCodeMap();
6586 6587
6587 // Removed a specific optimized code object from the optimized code map. 6588 // Removed a specific optimized code object from the optimized code map.
6588 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason); 6589 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason);
6589 6590
6590 // Unconditionally clear the type feedback vector (including vector ICs).
6591 void ClearTypeFeedbackInfo();
6592
6593 // Clear the type feedback vector with a more subtle policy at GC time.
6594 void ClearTypeFeedbackInfoAtGCTime();
6595
6596 // Trims the optimized code map after entries have been removed. 6591 // Trims the optimized code map after entries have been removed.
6597 void TrimOptimizedCodeMap(int shrink_by); 6592 void TrimOptimizedCodeMap(int shrink_by);
6598 6593
6599 // Initialize a SharedFunctionInfo from a parsed function literal. 6594 // Add a new entry to the optimized code map for context-independent code.
6600 static void InitFromFunctionLiteral(Handle<SharedFunctionInfo> shared_info, 6595 static void AddSharedCodeToOptimizedCodeMap(Handle<SharedFunctionInfo> shared,
6601 FunctionLiteral* lit); 6596 Handle<Code> code);
6602 6597
6603 // Add a new entry to the optimized code map. 6598 // Add a new entry to the optimized code map for context-dependent code.
6604 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, 6599 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared,
6605 Handle<Context> native_context, 6600 Handle<Context> native_context,
6606 Handle<Code> code, 6601 Handle<Code> code,
6607 Handle<FixedArray> literals, 6602 Handle<FixedArray> literals,
6608 BailoutId osr_ast_id); 6603 BailoutId osr_ast_id);
6609 6604
6610 // Set up the link between shared function info and the script. The shared 6605 // Set up the link between shared function info and the script. The shared
6611 // function info is added to the list on the script. 6606 // function info is added to the list on the script.
6612 static void SetScript(Handle<SharedFunctionInfo> shared, 6607 static void SetScript(Handle<SharedFunctionInfo> shared,
6613 Handle<Object> script_object); 6608 Handle<Object> script_object);
6614 6609
6615 // Layout description of the optimized code map. 6610 // Layout description of the optimized code map.
6616 static const int kNextMapIndex = 0; 6611 static const int kNextMapIndex = 0;
6617 static const int kEntriesStart = 1; 6612 static const int kSharedCodeIndex = 1;
6613 static const int kEntriesStart = 2;
6618 static const int kContextOffset = 0; 6614 static const int kContextOffset = 0;
6619 static const int kCachedCodeOffset = 1; 6615 static const int kCachedCodeOffset = 1;
6620 static const int kLiteralsOffset = 2; 6616 static const int kLiteralsOffset = 2;
6621 static const int kOsrAstIdOffset = 3; 6617 static const int kOsrAstIdOffset = 3;
6622 static const int kEntryLength = 4; 6618 static const int kEntryLength = 4;
6623 static const int kInitialLength = kEntriesStart + kEntryLength; 6619 static const int kInitialLength = kEntriesStart + kEntryLength;
6624 6620
6625 // [scope_info]: Scope info. 6621 // [scope_info]: Scope info.
6626 DECL_ACCESSORS(scope_info, ScopeInfo) 6622 DECL_ACCESSORS(scope_info, ScopeInfo)
6627 6623
(...skipping 20 matching lines...) Expand all
6648 6644
6649 // [expected_nof_properties]: Expected number of properties for the function. 6645 // [expected_nof_properties]: Expected number of properties for the function.
6650 inline int expected_nof_properties() const; 6646 inline int expected_nof_properties() const;
6651 inline void set_expected_nof_properties(int value); 6647 inline void set_expected_nof_properties(int value);
6652 6648
6653 // [feedback_vector] - accumulates ast node feedback from full-codegen and 6649 // [feedback_vector] - accumulates ast node feedback from full-codegen and
6654 // (increasingly) from crankshafted code where sufficient feedback isn't 6650 // (increasingly) from crankshafted code where sufficient feedback isn't
6655 // available. 6651 // available.
6656 DECL_ACCESSORS(feedback_vector, TypeFeedbackVector) 6652 DECL_ACCESSORS(feedback_vector, TypeFeedbackVector)
6657 6653
6654 // Unconditionally clear the type feedback vector (including vector ICs).
6655 void ClearTypeFeedbackInfo();
6656
6657 // Clear the type feedback vector with a more subtle policy at GC time.
6658 void ClearTypeFeedbackInfoAtGCTime();
6659
6658 #if TRACE_MAPS 6660 #if TRACE_MAPS
6659 // [unique_id] - For --trace-maps purposes, an identifier that's persistent 6661 // [unique_id] - For --trace-maps purposes, an identifier that's persistent
6660 // even if the GC moves this SharedFunctionInfo. 6662 // even if the GC moves this SharedFunctionInfo.
6661 inline int unique_id() const; 6663 inline int unique_id() const;
6662 inline void set_unique_id(int value); 6664 inline void set_unique_id(int value);
6663 #endif 6665 #endif
6664 6666
6665 // [instance class name]: class name for instances. 6667 // [instance class name]: class name for instances.
6666 DECL_ACCESSORS(instance_class_name, Object) 6668 DECL_ACCESSORS(instance_class_name, Object)
6667 6669
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
6890 int SourceSize(); 6892 int SourceSize();
6891 6893
6892 // Calculate the instance size. 6894 // Calculate the instance size.
6893 int CalculateInstanceSize(); 6895 int CalculateInstanceSize();
6894 6896
6895 // Calculate the number of in-object properties. 6897 // Calculate the number of in-object properties.
6896 int CalculateInObjectProperties(); 6898 int CalculateInObjectProperties();
6897 6899
6898 inline bool is_simple_parameter_list(); 6900 inline bool is_simple_parameter_list();
6899 6901
6902 // Initialize a SharedFunctionInfo from a parsed function literal.
6903 static void InitFromFunctionLiteral(Handle<SharedFunctionInfo> shared_info,
6904 FunctionLiteral* lit);
6905
6900 // Dispatched behavior. 6906 // Dispatched behavior.
6901 DECLARE_PRINTER(SharedFunctionInfo) 6907 DECLARE_PRINTER(SharedFunctionInfo)
6902 DECLARE_VERIFIER(SharedFunctionInfo) 6908 DECLARE_VERIFIER(SharedFunctionInfo)
6903 6909
6904 void ResetForNewContext(int new_ic_age); 6910 void ResetForNewContext(int new_ic_age);
6905 6911
6906 DECLARE_CAST(SharedFunctionInfo) 6912 DECLARE_CAST(SharedFunctionInfo)
6907 6913
6908 // Constants. 6914 // Constants.
6909 static const int kDontAdaptArgumentsSentinel = -1; 6915 static const int kDontAdaptArgumentsSentinel = -1;
(...skipping 3899 matching lines...) Expand 10 before | Expand all | Expand 10 after
10809 } else { 10815 } else {
10810 value &= ~(1 << bit_position); 10816 value &= ~(1 << bit_position);
10811 } 10817 }
10812 return value; 10818 return value;
10813 } 10819 }
10814 }; 10820 };
10815 10821
10816 } } // namespace v8::internal 10822 } } // namespace v8::internal
10817 10823
10818 #endif // V8_OBJECTS_H_ 10824 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698