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 5421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5432 | 5432 |
5433 // Indicate that this function only consists of assignments of the form | 5433 // Indicate that this function only consists of assignments of the form |
5434 // this.x = y; where y is either a constant or refers to an argument. | 5434 // this.x = y; where y is either a constant or refers to an argument. |
5435 inline bool has_only_simple_this_property_assignments(); | 5435 inline bool has_only_simple_this_property_assignments(); |
5436 | 5436 |
5437 // Indicates if this function can be lazy compiled. | 5437 // Indicates if this function can be lazy compiled. |
5438 // This is used to determine if we can safely flush code from a function | 5438 // This is used to determine if we can safely flush code from a function |
5439 // when doing GC if we expect that the function will no longer be used. | 5439 // when doing GC if we expect that the function will no longer be used. |
5440 DECL_BOOLEAN_ACCESSORS(allows_lazy_compilation) | 5440 DECL_BOOLEAN_ACCESSORS(allows_lazy_compilation) |
5441 | 5441 |
5442 // Indicates if this function can be lazy compiled without a context. | |
5443 // This is used to determine if we can force compilation without reaching | |
5444 // the function through program execution but through other means (e.g. heap | |
5445 // iteration by the debugger). | |
5446 DECL_BOOLEAN_ACCESSORS(allows_lazy_compilation_without_context) | |
5447 | |
5448 // Indicates how many full GCs this function has survived with assigned | 5442 // Indicates how many full GCs this function has survived with assigned |
5449 // code object. Used to determine when it is relatively safe to flush | 5443 // code object. Used to determine when it is relatively safe to flush |
5450 // this code object and replace it with lazy compilation stub. | 5444 // this code object and replace it with lazy compilation stub. |
5451 // Age is reset when GC notices that the code object is referenced | 5445 // Age is reset when GC notices that the code object is referenced |
5452 // from the stack or compilation cache. | 5446 // from the stack or compilation cache. |
5453 inline int code_age(); | 5447 inline int code_age(); |
5454 inline void set_code_age(int age); | 5448 inline void set_code_age(int age); |
5455 | 5449 |
5456 // Indicates whether optimizations have been disabled for this | 5450 // Indicates whether optimizations have been disabled for this |
5457 // shared function info. If a function is repeatedly optimized or if | 5451 // shared function info. If a function is repeatedly optimized or if |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5584 SharedFunctionInfoPrint(stdout); | 5578 SharedFunctionInfoPrint(stdout); |
5585 } | 5579 } |
5586 void SharedFunctionInfoPrint(FILE* out); | 5580 void SharedFunctionInfoPrint(FILE* out); |
5587 #endif | 5581 #endif |
5588 #ifdef DEBUG | 5582 #ifdef DEBUG |
5589 void SharedFunctionInfoVerify(); | 5583 void SharedFunctionInfoVerify(); |
5590 #endif | 5584 #endif |
5591 | 5585 |
5592 void ResetForNewContext(int new_ic_age); | 5586 void ResetForNewContext(int new_ic_age); |
5593 | 5587 |
5594 // Helper to compile the shared code. Returns true on success, false on | 5588 // Helpers to compile the shared code. Returns true on success, false on |
5595 // failure (e.g., stack overflow during compilation). This is only used by | 5589 // failure (e.g., stack overflow during compilation). |
5596 // the debugger, it is not possible to compile without a context otherwise. | 5590 static bool EnsureCompiled(Handle<SharedFunctionInfo> shared, |
| 5591 ClearExceptionFlag flag); |
5597 static bool CompileLazy(Handle<SharedFunctionInfo> shared, | 5592 static bool CompileLazy(Handle<SharedFunctionInfo> shared, |
5598 ClearExceptionFlag flag); | 5593 ClearExceptionFlag flag); |
5599 | 5594 |
5600 void SharedFunctionInfoIterateBody(ObjectVisitor* v); | 5595 void SharedFunctionInfoIterateBody(ObjectVisitor* v); |
5601 | 5596 |
5602 // Casting. | 5597 // Casting. |
5603 static inline SharedFunctionInfo* cast(Object* obj); | 5598 static inline SharedFunctionInfo* cast(Object* obj); |
5604 | 5599 |
5605 // Constants. | 5600 // Constants. |
5606 static const int kDontAdaptArgumentsSentinel = -1; | 5601 static const int kDontAdaptArgumentsSentinel = -1; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5720 static const int kStartPositionShift = 2; | 5715 static const int kStartPositionShift = 2; |
5721 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); | 5716 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); |
5722 | 5717 |
5723 // Bit positions in compiler_hints. | 5718 // Bit positions in compiler_hints. |
5724 static const int kCodeAgeSize = 3; | 5719 static const int kCodeAgeSize = 3; |
5725 static const int kCodeAgeMask = (1 << kCodeAgeSize) - 1; | 5720 static const int kCodeAgeMask = (1 << kCodeAgeSize) - 1; |
5726 | 5721 |
5727 enum CompilerHints { | 5722 enum CompilerHints { |
5728 kHasOnlySimpleThisPropertyAssignments, | 5723 kHasOnlySimpleThisPropertyAssignments, |
5729 kAllowLazyCompilation, | 5724 kAllowLazyCompilation, |
5730 kAllowLazyCompilationWithoutContext, | |
5731 kLiveObjectsMayExist, | 5725 kLiveObjectsMayExist, |
5732 kCodeAgeShift, | 5726 kCodeAgeShift, |
5733 kOptimizationDisabled = kCodeAgeShift + kCodeAgeSize, | 5727 kOptimizationDisabled = kCodeAgeShift + kCodeAgeSize, |
5734 kStrictModeFunction, | 5728 kStrictModeFunction, |
5735 kExtendedModeFunction, | 5729 kExtendedModeFunction, |
5736 kUsesArguments, | 5730 kUsesArguments, |
5737 kHasDuplicateParameters, | 5731 kHasDuplicateParameters, |
5738 kNative, | 5732 kNative, |
5739 kBoundFunction, | 5733 kBoundFunction, |
5740 kIsAnonymous, | 5734 kIsAnonymous, |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5869 | 5863 |
5870 // Tells whether or not this function can be optimized. | 5864 // Tells whether or not this function can be optimized. |
5871 inline bool IsOptimizable(); | 5865 inline bool IsOptimizable(); |
5872 | 5866 |
5873 // Mark this function for lazy recompilation. The function will be | 5867 // Mark this function for lazy recompilation. The function will be |
5874 // recompiled the next time it is executed. | 5868 // recompiled the next time it is executed. |
5875 void MarkForLazyRecompilation(); | 5869 void MarkForLazyRecompilation(); |
5876 | 5870 |
5877 // Helpers to compile this function. Returns true on success, false on | 5871 // Helpers to compile this function. Returns true on success, false on |
5878 // failure (e.g., stack overflow during compilation). | 5872 // failure (e.g., stack overflow during compilation). |
5879 static bool EnsureCompiled(Handle<JSFunction> function, | |
5880 ClearExceptionFlag flag); | |
5881 static bool CompileLazy(Handle<JSFunction> function, | 5873 static bool CompileLazy(Handle<JSFunction> function, |
5882 ClearExceptionFlag flag); | 5874 ClearExceptionFlag flag); |
5883 static bool CompileOptimized(Handle<JSFunction> function, | 5875 static bool CompileOptimized(Handle<JSFunction> function, |
5884 int osr_ast_id, | 5876 int osr_ast_id, |
5885 ClearExceptionFlag flag); | 5877 ClearExceptionFlag flag); |
5886 | 5878 |
5887 // Tells whether or not the function is already marked for lazy | 5879 // Tells whether or not the function is already marked for lazy |
5888 // recompilation. | 5880 // recompilation. |
5889 inline bool IsMarkedForLazyRecompilation(); | 5881 inline bool IsMarkedForLazyRecompilation(); |
5890 | 5882 |
(...skipping 2876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8767 } else { | 8759 } else { |
8768 value &= ~(1 << bit_position); | 8760 value &= ~(1 << bit_position); |
8769 } | 8761 } |
8770 return value; | 8762 return value; |
8771 } | 8763 } |
8772 }; | 8764 }; |
8773 | 8765 |
8774 } } // namespace v8::internal | 8766 } } // namespace v8::internal |
8775 | 8767 |
8776 #endif // V8_OBJECTS_H_ | 8768 #endif // V8_OBJECTS_H_ |
OLD | NEW |