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

Side by Side Diff: src/objects.h

Issue 10538102: Enable lazy compilation for non-trivial outer contexts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Ulan Degenbaev. Created 8 years, 6 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/full-codegen.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 5421 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
5442 // Indicates how many full GCs this function has survived with assigned 5448 // Indicates how many full GCs this function has survived with assigned
5443 // code object. Used to determine when it is relatively safe to flush 5449 // code object. Used to determine when it is relatively safe to flush
5444 // this code object and replace it with lazy compilation stub. 5450 // this code object and replace it with lazy compilation stub.
5445 // Age is reset when GC notices that the code object is referenced 5451 // Age is reset when GC notices that the code object is referenced
5446 // from the stack or compilation cache. 5452 // from the stack or compilation cache.
5447 inline int code_age(); 5453 inline int code_age();
5448 inline void set_code_age(int age); 5454 inline void set_code_age(int age);
5449 5455
5450 // Indicates whether optimizations have been disabled for this 5456 // Indicates whether optimizations have been disabled for this
5451 // shared function info. If a function is repeatedly optimized or if 5457 // shared function info. If a function is repeatedly optimized or if
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
5578 SharedFunctionInfoPrint(stdout); 5584 SharedFunctionInfoPrint(stdout);
5579 } 5585 }
5580 void SharedFunctionInfoPrint(FILE* out); 5586 void SharedFunctionInfoPrint(FILE* out);
5581 #endif 5587 #endif
5582 #ifdef DEBUG 5588 #ifdef DEBUG
5583 void SharedFunctionInfoVerify(); 5589 void SharedFunctionInfoVerify();
5584 #endif 5590 #endif
5585 5591
5586 void ResetForNewContext(int new_ic_age); 5592 void ResetForNewContext(int new_ic_age);
5587 5593
5588 // Helpers to compile the shared code. Returns true on success, false on 5594 // Helper to compile the shared code. Returns true on success, false on
5589 // failure (e.g., stack overflow during compilation). 5595 // failure (e.g., stack overflow during compilation). This is only used by
5590 static bool EnsureCompiled(Handle<SharedFunctionInfo> shared, 5596 // the debugger, it is not possible to compile without a context otherwise.
5591 ClearExceptionFlag flag);
5592 static bool CompileLazy(Handle<SharedFunctionInfo> shared, 5597 static bool CompileLazy(Handle<SharedFunctionInfo> shared,
5593 ClearExceptionFlag flag); 5598 ClearExceptionFlag flag);
5594 5599
5595 void SharedFunctionInfoIterateBody(ObjectVisitor* v); 5600 void SharedFunctionInfoIterateBody(ObjectVisitor* v);
5596 5601
5597 // Casting. 5602 // Casting.
5598 static inline SharedFunctionInfo* cast(Object* obj); 5603 static inline SharedFunctionInfo* cast(Object* obj);
5599 5604
5600 // Constants. 5605 // Constants.
5601 static const int kDontAdaptArgumentsSentinel = -1; 5606 static const int kDontAdaptArgumentsSentinel = -1;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
5715 static const int kStartPositionShift = 2; 5720 static const int kStartPositionShift = 2;
5716 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); 5721 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1);
5717 5722
5718 // Bit positions in compiler_hints. 5723 // Bit positions in compiler_hints.
5719 static const int kCodeAgeSize = 3; 5724 static const int kCodeAgeSize = 3;
5720 static const int kCodeAgeMask = (1 << kCodeAgeSize) - 1; 5725 static const int kCodeAgeMask = (1 << kCodeAgeSize) - 1;
5721 5726
5722 enum CompilerHints { 5727 enum CompilerHints {
5723 kHasOnlySimpleThisPropertyAssignments, 5728 kHasOnlySimpleThisPropertyAssignments,
5724 kAllowLazyCompilation, 5729 kAllowLazyCompilation,
5730 kAllowLazyCompilationWithoutContext,
5725 kLiveObjectsMayExist, 5731 kLiveObjectsMayExist,
5726 kCodeAgeShift, 5732 kCodeAgeShift,
5727 kOptimizationDisabled = kCodeAgeShift + kCodeAgeSize, 5733 kOptimizationDisabled = kCodeAgeShift + kCodeAgeSize,
5728 kStrictModeFunction, 5734 kStrictModeFunction,
5729 kExtendedModeFunction, 5735 kExtendedModeFunction,
5730 kUsesArguments, 5736 kUsesArguments,
5731 kHasDuplicateParameters, 5737 kHasDuplicateParameters,
5732 kNative, 5738 kNative,
5733 kBoundFunction, 5739 kBoundFunction,
5734 kIsAnonymous, 5740 kIsAnonymous,
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
5863 5869
5864 // Tells whether or not this function can be optimized. 5870 // Tells whether or not this function can be optimized.
5865 inline bool IsOptimizable(); 5871 inline bool IsOptimizable();
5866 5872
5867 // Mark this function for lazy recompilation. The function will be 5873 // Mark this function for lazy recompilation. The function will be
5868 // recompiled the next time it is executed. 5874 // recompiled the next time it is executed.
5869 void MarkForLazyRecompilation(); 5875 void MarkForLazyRecompilation();
5870 5876
5871 // Helpers to compile this function. Returns true on success, false on 5877 // Helpers to compile this function. Returns true on success, false on
5872 // failure (e.g., stack overflow during compilation). 5878 // failure (e.g., stack overflow during compilation).
5879 static bool EnsureCompiled(Handle<JSFunction> function,
5880 ClearExceptionFlag flag);
5873 static bool CompileLazy(Handle<JSFunction> function, 5881 static bool CompileLazy(Handle<JSFunction> function,
5874 ClearExceptionFlag flag); 5882 ClearExceptionFlag flag);
5875 static bool CompileOptimized(Handle<JSFunction> function, 5883 static bool CompileOptimized(Handle<JSFunction> function,
5876 int osr_ast_id, 5884 int osr_ast_id,
5877 ClearExceptionFlag flag); 5885 ClearExceptionFlag flag);
5878 5886
5879 // Tells whether or not the function is already marked for lazy 5887 // Tells whether or not the function is already marked for lazy
5880 // recompilation. 5888 // recompilation.
5881 inline bool IsMarkedForLazyRecompilation(); 5889 inline bool IsMarkedForLazyRecompilation();
5882 5890
(...skipping 2876 matching lines...) Expand 10 before | Expand all | Expand 10 after
8759 } else { 8767 } else {
8760 value &= ~(1 << bit_position); 8768 value &= ~(1 << bit_position);
8761 } 8769 }
8762 return value; 8770 return value;
8763 } 8771 }
8764 }; 8772 };
8765 8773
8766 } } // namespace v8::internal 8774 } } // namespace v8::internal
8767 8775
8768 #endif // V8_OBJECTS_H_ 8776 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/full-codegen.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698