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 5430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5441 | 5441 |
5442 // Indicate that this function only consists of assignments of the form | 5442 // Indicate that this function only consists of assignments of the form |
5443 // this.x = y; where y is either a constant or refers to an argument. | 5443 // this.x = y; where y is either a constant or refers to an argument. |
5444 inline bool has_only_simple_this_property_assignments(); | 5444 inline bool has_only_simple_this_property_assignments(); |
5445 | 5445 |
5446 // Indicates if this function can be lazy compiled. | 5446 // Indicates if this function can be lazy compiled. |
5447 // This is used to determine if we can safely flush code from a function | 5447 // This is used to determine if we can safely flush code from a function |
5448 // when doing GC if we expect that the function will no longer be used. | 5448 // when doing GC if we expect that the function will no longer be used. |
5449 DECL_BOOLEAN_ACCESSORS(allows_lazy_compilation) | 5449 DECL_BOOLEAN_ACCESSORS(allows_lazy_compilation) |
5450 | 5450 |
| 5451 // Indicates if this function can be lazy compiled without a context. |
| 5452 // This is used to determine if we can force compilation without reaching |
| 5453 // the function through program execution but through other means (e.g. heap |
| 5454 // iteration by the debugger). |
| 5455 DECL_BOOLEAN_ACCESSORS(allows_lazy_compilation_without_context) |
| 5456 |
5451 // Indicates how many full GCs this function has survived with assigned | 5457 // Indicates how many full GCs this function has survived with assigned |
5452 // code object. Used to determine when it is relatively safe to flush | 5458 // code object. Used to determine when it is relatively safe to flush |
5453 // this code object and replace it with lazy compilation stub. | 5459 // this code object and replace it with lazy compilation stub. |
5454 // Age is reset when GC notices that the code object is referenced | 5460 // Age is reset when GC notices that the code object is referenced |
5455 // from the stack or compilation cache. | 5461 // from the stack or compilation cache. |
5456 inline int code_age(); | 5462 inline int code_age(); |
5457 inline void set_code_age(int age); | 5463 inline void set_code_age(int age); |
5458 | 5464 |
5459 // Indicates whether optimizations have been disabled for this | 5465 // Indicates whether optimizations have been disabled for this |
5460 // shared function info. If a function is repeatedly optimized or if | 5466 // shared function info. If a function is repeatedly optimized or if |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5587 SharedFunctionInfoPrint(stdout); | 5593 SharedFunctionInfoPrint(stdout); |
5588 } | 5594 } |
5589 void SharedFunctionInfoPrint(FILE* out); | 5595 void SharedFunctionInfoPrint(FILE* out); |
5590 #endif | 5596 #endif |
5591 #ifdef DEBUG | 5597 #ifdef DEBUG |
5592 void SharedFunctionInfoVerify(); | 5598 void SharedFunctionInfoVerify(); |
5593 #endif | 5599 #endif |
5594 | 5600 |
5595 void ResetForNewContext(int new_ic_age); | 5601 void ResetForNewContext(int new_ic_age); |
5596 | 5602 |
5597 // Helpers to compile the shared code. Returns true on success, false on | 5603 // Helper to compile the shared code. Returns true on success, false on |
5598 // failure (e.g., stack overflow during compilation). | 5604 // failure (e.g., stack overflow during compilation). This is only used by |
5599 static bool EnsureCompiled(Handle<SharedFunctionInfo> shared, | 5605 // the debugger, it is not possible to compile without a context otherwise. |
5600 ClearExceptionFlag flag); | |
5601 static bool CompileLazy(Handle<SharedFunctionInfo> shared, | 5606 static bool CompileLazy(Handle<SharedFunctionInfo> shared, |
5602 ClearExceptionFlag flag); | 5607 ClearExceptionFlag flag); |
5603 | 5608 |
5604 void SharedFunctionInfoIterateBody(ObjectVisitor* v); | 5609 void SharedFunctionInfoIterateBody(ObjectVisitor* v); |
5605 | 5610 |
5606 // Casting. | 5611 // Casting. |
5607 static inline SharedFunctionInfo* cast(Object* obj); | 5612 static inline SharedFunctionInfo* cast(Object* obj); |
5608 | 5613 |
5609 // Constants. | 5614 // Constants. |
5610 static const int kDontAdaptArgumentsSentinel = -1; | 5615 static const int kDontAdaptArgumentsSentinel = -1; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5724 static const int kStartPositionShift = 2; | 5729 static const int kStartPositionShift = 2; |
5725 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); | 5730 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); |
5726 | 5731 |
5727 // Bit positions in compiler_hints. | 5732 // Bit positions in compiler_hints. |
5728 static const int kCodeAgeSize = 3; | 5733 static const int kCodeAgeSize = 3; |
5729 static const int kCodeAgeMask = (1 << kCodeAgeSize) - 1; | 5734 static const int kCodeAgeMask = (1 << kCodeAgeSize) - 1; |
5730 | 5735 |
5731 enum CompilerHints { | 5736 enum CompilerHints { |
5732 kHasOnlySimpleThisPropertyAssignments, | 5737 kHasOnlySimpleThisPropertyAssignments, |
5733 kAllowLazyCompilation, | 5738 kAllowLazyCompilation, |
| 5739 kAllowLazyCompilationWithoutContext, |
5734 kLiveObjectsMayExist, | 5740 kLiveObjectsMayExist, |
5735 kCodeAgeShift, | 5741 kCodeAgeShift, |
5736 kOptimizationDisabled = kCodeAgeShift + kCodeAgeSize, | 5742 kOptimizationDisabled = kCodeAgeShift + kCodeAgeSize, |
5737 kStrictModeFunction, | 5743 kStrictModeFunction, |
5738 kExtendedModeFunction, | 5744 kExtendedModeFunction, |
5739 kUsesArguments, | 5745 kUsesArguments, |
5740 kHasDuplicateParameters, | 5746 kHasDuplicateParameters, |
5741 kNative, | 5747 kNative, |
5742 kBoundFunction, | 5748 kBoundFunction, |
5743 kIsAnonymous, | 5749 kIsAnonymous, |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5872 | 5878 |
5873 // Tells whether or not this function can be optimized. | 5879 // Tells whether or not this function can be optimized. |
5874 inline bool IsOptimizable(); | 5880 inline bool IsOptimizable(); |
5875 | 5881 |
5876 // Mark this function for lazy recompilation. The function will be | 5882 // Mark this function for lazy recompilation. The function will be |
5877 // recompiled the next time it is executed. | 5883 // recompiled the next time it is executed. |
5878 void MarkForLazyRecompilation(); | 5884 void MarkForLazyRecompilation(); |
5879 | 5885 |
5880 // Helpers to compile this function. Returns true on success, false on | 5886 // Helpers to compile this function. Returns true on success, false on |
5881 // failure (e.g., stack overflow during compilation). | 5887 // failure (e.g., stack overflow during compilation). |
| 5888 static bool EnsureCompiled(Handle<JSFunction> function, |
| 5889 ClearExceptionFlag flag); |
5882 static bool CompileLazy(Handle<JSFunction> function, | 5890 static bool CompileLazy(Handle<JSFunction> function, |
5883 ClearExceptionFlag flag); | 5891 ClearExceptionFlag flag); |
5884 static bool CompileOptimized(Handle<JSFunction> function, | 5892 static bool CompileOptimized(Handle<JSFunction> function, |
5885 int osr_ast_id, | 5893 int osr_ast_id, |
5886 ClearExceptionFlag flag); | 5894 ClearExceptionFlag flag); |
5887 | 5895 |
5888 // Tells whether or not the function is already marked for lazy | 5896 // Tells whether or not the function is already marked for lazy |
5889 // recompilation. | 5897 // recompilation. |
5890 inline bool IsMarkedForLazyRecompilation(); | 5898 inline bool IsMarkedForLazyRecompilation(); |
5891 | 5899 |
(...skipping 2876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8768 } else { | 8776 } else { |
8769 value &= ~(1 << bit_position); | 8777 value &= ~(1 << bit_position); |
8770 } | 8778 } |
8771 return value; | 8779 return value; |
8772 } | 8780 } |
8773 }; | 8781 }; |
8774 | 8782 |
8775 } } // namespace v8::internal | 8783 } } // namespace v8::internal |
8776 | 8784 |
8777 #endif // V8_OBJECTS_H_ | 8785 #endif // V8_OBJECTS_H_ |
OLD | NEW |