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 6517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6528 // and a shared literals array or Smi(0) if none. | 6528 // and a shared literals array or Smi(0) if none. |
6529 DECL_ACCESSORS(optimized_code_map, Object) | 6529 DECL_ACCESSORS(optimized_code_map, Object) |
6530 | 6530 |
6531 // Returns index i of the entry with the specified context. At position | 6531 // Returns index i of the entry with the specified context. At position |
6532 // i - 1 is the context, position i the code, and i + 1 the literals array. | 6532 // i - 1 is the context, position i the code, and i + 1 the literals array. |
6533 // Returns -1 when no matching entry is found. | 6533 // Returns -1 when no matching entry is found. |
6534 int SearchOptimizedCodeMap(Context* native_context); | 6534 int SearchOptimizedCodeMap(Context* native_context); |
6535 | 6535 |
6536 // Installs optimized code from the code map on the given closure. The | 6536 // Installs optimized code from the code map on the given closure. The |
6537 // index has to be consistent with a search result as defined above. | 6537 // index has to be consistent with a search result as defined above. |
6538 void InstallFromOptimizedCodeMap(JSFunction* function, int index); | 6538 FixedArray* GetLiteralsFromOptimizedCodeMap(int index); |
| 6539 |
| 6540 Code* GetCodeFromOptimizedCodeMap(int index); |
6539 | 6541 |
6540 // Clear optimized code map. | 6542 // Clear optimized code map. |
6541 void ClearOptimizedCodeMap(); | 6543 void ClearOptimizedCodeMap(); |
6542 | 6544 |
6543 // Removed a specific optimized code object from the optimized code map. | 6545 // Removed a specific optimized code object from the optimized code map. |
6544 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason); | 6546 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason); |
6545 | 6547 |
6546 // Trims the optimized code map after entries have been removed. | 6548 // Trims the optimized code map after entries have been removed. |
6547 void TrimOptimizedCodeMap(int shrink_by); | 6549 void TrimOptimizedCodeMap(int shrink_by); |
6548 | 6550 |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6912 int CalculateInObjectProperties(); | 6914 int CalculateInObjectProperties(); |
6913 | 6915 |
6914 // Dispatched behavior. | 6916 // Dispatched behavior. |
6915 // Set max_length to -1 for unlimited length. | 6917 // Set max_length to -1 for unlimited length. |
6916 void SourceCodePrint(StringStream* accumulator, int max_length); | 6918 void SourceCodePrint(StringStream* accumulator, int max_length); |
6917 DECLARE_PRINTER(SharedFunctionInfo) | 6919 DECLARE_PRINTER(SharedFunctionInfo) |
6918 DECLARE_VERIFIER(SharedFunctionInfo) | 6920 DECLARE_VERIFIER(SharedFunctionInfo) |
6919 | 6921 |
6920 void ResetForNewContext(int new_ic_age); | 6922 void ResetForNewContext(int new_ic_age); |
6921 | 6923 |
6922 // Helper to compile the shared code. Returns true on success, false on | |
6923 // failure (e.g., stack overflow during compilation). This is only used by | |
6924 // the debugger, it is not possible to compile without a context otherwise. | |
6925 static bool CompileLazy(Handle<SharedFunctionInfo> shared, | |
6926 ClearExceptionFlag flag); | |
6927 | |
6928 // Casting. | 6924 // Casting. |
6929 static inline SharedFunctionInfo* cast(Object* obj); | 6925 static inline SharedFunctionInfo* cast(Object* obj); |
6930 | 6926 |
6931 // Constants. | 6927 // Constants. |
6932 static const int kDontAdaptArgumentsSentinel = -1; | 6928 static const int kDontAdaptArgumentsSentinel = -1; |
6933 | 6929 |
6934 // Layout description. | 6930 // Layout description. |
6935 // Pointer fields. | 6931 // Pointer fields. |
6936 static const int kNameOffset = HeapObject::kHeaderSize; | 6932 static const int kNameOffset = HeapObject::kHeaderSize; |
6937 static const int kCodeOffset = kNameOffset + kPointerSize; | 6933 static const int kCodeOffset = kNameOffset + kPointerSize; |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7248 inline bool NeedsArgumentsAdaption(); | 7244 inline bool NeedsArgumentsAdaption(); |
7249 | 7245 |
7250 // Tells whether or not this function has been optimized. | 7246 // Tells whether or not this function has been optimized. |
7251 inline bool IsOptimized(); | 7247 inline bool IsOptimized(); |
7252 | 7248 |
7253 // Tells whether or not this function can be optimized. | 7249 // Tells whether or not this function can be optimized. |
7254 inline bool IsOptimizable(); | 7250 inline bool IsOptimizable(); |
7255 | 7251 |
7256 // Mark this function for lazy recompilation. The function will be | 7252 // Mark this function for lazy recompilation. The function will be |
7257 // recompiled the next time it is executed. | 7253 // recompiled the next time it is executed. |
7258 void MarkForLazyRecompilation(); | 7254 void MarkForCompileOptimized(); |
7259 void MarkForConcurrentRecompilation(); | 7255 void MarkForCompileOptimizedConcurrent(); |
7260 void MarkInRecompileQueue(); | 7256 void MarkInOptimizationQueue(); |
7261 | 7257 |
7262 // Helpers to compile this function. Returns true on success, false on | |
7263 // failure (e.g., stack overflow during compilation). | |
7264 static bool EnsureCompiled(Handle<JSFunction> function, | |
7265 ClearExceptionFlag flag); | |
7266 static bool CompileLazy(Handle<JSFunction> function, | |
7267 ClearExceptionFlag flag); | |
7268 static Handle<Code> CompileOsr(Handle<JSFunction> function, | |
7269 BailoutId osr_ast_id, | |
7270 ClearExceptionFlag flag); | |
7271 static bool CompileOptimized(Handle<JSFunction> function, | 7258 static bool CompileOptimized(Handle<JSFunction> function, |
7272 ClearExceptionFlag flag); | 7259 ClearExceptionFlag flag); |
7273 | 7260 |
7274 // Tells whether or not the function is already marked for lazy | 7261 // Tells whether or not the function is already marked for lazy |
7275 // recompilation. | 7262 // recompilation. |
7276 inline bool IsMarkedForLazyRecompilation(); | 7263 inline bool IsMarkedForCompileOptimized(); |
7277 inline bool IsMarkedForConcurrentRecompilation(); | 7264 inline bool IsMarkedForCompileOptimizedConcurrent(); |
7278 | 7265 |
7279 // Tells whether or not the function is on the concurrent recompilation queue. | 7266 // Tells whether or not the function is on the concurrent recompilation queue. |
7280 inline bool IsInRecompileQueue(); | 7267 inline bool IsInOptimizationQueue(); |
7281 | 7268 |
7282 // [literals_or_bindings]: Fixed array holding either | 7269 // [literals_or_bindings]: Fixed array holding either |
7283 // the materialized literals or the bindings of a bound function. | 7270 // the materialized literals or the bindings of a bound function. |
7284 // | 7271 // |
7285 // If the function contains object, regexp or array literals, the | 7272 // If the function contains object, regexp or array literals, the |
7286 // literals array prefix contains the object, regexp, and array | 7273 // literals array prefix contains the object, regexp, and array |
7287 // function to be used when creating these literals. This is | 7274 // function to be used when creating these literals. This is |
7288 // necessary so that we do not dynamically lookup the object, regexp | 7275 // necessary so that we do not dynamically lookup the object, regexp |
7289 // or array functions. Performing a dynamic lookup, we might end up | 7276 // or array functions. Performing a dynamic lookup, we might end up |
7290 // using the functions from a new context that we should not have | 7277 // using the functions from a new context that we should not have |
(...skipping 3315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10606 } else { | 10593 } else { |
10607 value &= ~(1 << bit_position); | 10594 value &= ~(1 << bit_position); |
10608 } | 10595 } |
10609 return value; | 10596 return value; |
10610 } | 10597 } |
10611 }; | 10598 }; |
10612 | 10599 |
10613 } } // namespace v8::internal | 10600 } } // namespace v8::internal |
10614 | 10601 |
10615 #endif // V8_OBJECTS_H_ | 10602 #endif // V8_OBJECTS_H_ |
OLD | NEW |