OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 7096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7107 // function from which eval was called. | 7107 // function from which eval was called. |
7108 DECL_ACCESSORS(eval_from_shared, Object) | 7108 DECL_ACCESSORS(eval_from_shared, Object) |
7109 | 7109 |
7110 // [eval_from_position]: the source position in the code for the function | 7110 // [eval_from_position]: the source position in the code for the function |
7111 // from which eval was called, as positive integer. Or the code offset in the | 7111 // from which eval was called, as positive integer. Or the code offset in the |
7112 // code from which eval was called, as negative integer. | 7112 // code from which eval was called, as negative integer. |
7113 DECL_INT_ACCESSORS(eval_from_position) | 7113 DECL_INT_ACCESSORS(eval_from_position) |
7114 | 7114 |
7115 // [shared_function_infos]: weak fixed array containing all shared | 7115 // [shared_function_infos]: weak fixed array containing all shared |
7116 // function infos created from this script. | 7116 // function infos created from this script. |
7117 DECL_ACCESSORS(shared_function_infos, FixedArray) | 7117 DECL_ACCESSORS(shared_function_infos, Object) |
7118 | 7118 |
7119 // [flags]: Holds an exciting bitfield. | 7119 // [flags]: Holds an exciting bitfield. |
7120 DECL_INT_ACCESSORS(flags) | 7120 DECL_INT_ACCESSORS(flags) |
7121 | 7121 |
7122 // [source_url]: sourceURL from magic comment | 7122 // [source_url]: sourceURL from magic comment |
7123 DECL_ACCESSORS(source_url, Object) | 7123 DECL_ACCESSORS(source_url, Object) |
7124 | 7124 |
7125 // [source_mapping_url]: sourceMappingURL magic comment | 7125 // [source_mapping_url]: sourceMappingURL magic comment |
7126 DECL_ACCESSORS(source_mapping_url, Object) | 7126 DECL_ACCESSORS(source_mapping_url, Object) |
7127 | 7127 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7192 static int GetColumnNumber(Handle<Script> script, int code_offset); | 7192 static int GetColumnNumber(Handle<Script> script, int code_offset); |
7193 int GetColumnNumber(int code_pos) const; | 7193 int GetColumnNumber(int code_pos) const; |
7194 static int GetLineNumber(Handle<Script> script, int code_offset); | 7194 static int GetLineNumber(Handle<Script> script, int code_offset); |
7195 int GetLineNumber(int code_pos) const; | 7195 int GetLineNumber(int code_pos) const; |
7196 | 7196 |
7197 // Get the JS object wrapping the given script; create it if none exists. | 7197 // Get the JS object wrapping the given script; create it if none exists. |
7198 static Handle<JSObject> GetWrapper(Handle<Script> script); | 7198 static Handle<JSObject> GetWrapper(Handle<Script> script); |
7199 | 7199 |
7200 // Look through the list of existing shared function infos to find one | 7200 // Look through the list of existing shared function infos to find one |
7201 // that matches the function literal. Return empty handle if not found. | 7201 // that matches the function literal. Return empty handle if not found. |
7202 MaybeHandle<SharedFunctionInfo> FindSharedFunctionInfo(Isolate* isolate, | 7202 MaybeHandle<SharedFunctionInfo> FindSharedFunctionInfo(FunctionLiteral* fun); |
7203 FunctionLiteral* fun); | |
7204 | 7203 |
7205 // Iterate over all script objects on the heap. | 7204 // Iterate over all script objects on the heap. |
7206 class Iterator { | 7205 class Iterator { |
7207 public: | 7206 public: |
7208 explicit Iterator(Isolate* isolate); | 7207 explicit Iterator(Isolate* isolate); |
7209 Script* Next(); | 7208 Script* Next(); |
7210 | 7209 |
7211 private: | 7210 private: |
7212 WeakFixedArray::Iterator iterator_; | 7211 WeakFixedArray::Iterator iterator_; |
7213 DISALLOW_COPY_AND_ASSIGN(Iterator); | 7212 DISALLOW_COPY_AND_ASSIGN(Iterator); |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7721 // Indicates that this is a synthesized function to set up class instance | 7720 // Indicates that this is a synthesized function to set up class instance |
7722 // fields. | 7721 // fields. |
7723 DECL_BOOLEAN_ACCESSORS(is_class_field_initializer) | 7722 DECL_BOOLEAN_ACCESSORS(is_class_field_initializer) |
7724 | 7723 |
7725 // Indicates that this function is an asm function. | 7724 // Indicates that this function is an asm function. |
7726 DECL_BOOLEAN_ACCESSORS(asm_function) | 7725 DECL_BOOLEAN_ACCESSORS(asm_function) |
7727 | 7726 |
7728 // Indicates that the the shared function info is deserialized from cache. | 7727 // Indicates that the the shared function info is deserialized from cache. |
7729 DECL_BOOLEAN_ACCESSORS(deserialized) | 7728 DECL_BOOLEAN_ACCESSORS(deserialized) |
7730 | 7729 |
| 7730 // Indicates that the the shared function info has never been compiled before. |
| 7731 DECL_BOOLEAN_ACCESSORS(never_compiled) |
| 7732 |
7731 // Whether this function was created from a FunctionDeclaration. | 7733 // Whether this function was created from a FunctionDeclaration. |
7732 DECL_BOOLEAN_ACCESSORS(is_declaration) | 7734 DECL_BOOLEAN_ACCESSORS(is_declaration) |
7733 | 7735 |
7734 // Whether this function was marked to be tiered up. | 7736 // Whether this function was marked to be tiered up. |
7735 DECL_BOOLEAN_ACCESSORS(marked_for_tier_up) | 7737 DECL_BOOLEAN_ACCESSORS(marked_for_tier_up) |
7736 | 7738 |
7737 // Indicates that asm->wasm conversion failed and should not be re-attempted. | 7739 // Indicates that asm->wasm conversion failed and should not be re-attempted. |
7738 DECL_BOOLEAN_ACCESSORS(is_asm_wasm_broken) | 7740 DECL_BOOLEAN_ACCESSORS(is_asm_wasm_broken) |
7739 | 7741 |
7740 inline FunctionKind kind() const; | 7742 inline FunctionKind kind() const; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7808 // Initialize a SharedFunctionInfo from a parsed function literal. | 7810 // Initialize a SharedFunctionInfo from a parsed function literal. |
7809 static void InitFromFunctionLiteral(Handle<SharedFunctionInfo> shared_info, | 7811 static void InitFromFunctionLiteral(Handle<SharedFunctionInfo> shared_info, |
7810 FunctionLiteral* lit); | 7812 FunctionLiteral* lit); |
7811 | 7813 |
7812 // Dispatched behavior. | 7814 // Dispatched behavior. |
7813 DECLARE_PRINTER(SharedFunctionInfo) | 7815 DECLARE_PRINTER(SharedFunctionInfo) |
7814 DECLARE_VERIFIER(SharedFunctionInfo) | 7816 DECLARE_VERIFIER(SharedFunctionInfo) |
7815 | 7817 |
7816 void ResetForNewContext(int new_ic_age); | 7818 void ResetForNewContext(int new_ic_age); |
7817 | 7819 |
7818 // Iterate over all shared function infos in a given script. | 7820 // Iterate over all shared function infos. |
7819 class ScriptIterator { | 7821 class Iterator { |
7820 public: | 7822 public: |
7821 explicit ScriptIterator(Handle<Script> script); | 7823 explicit Iterator(Isolate* isolate); |
7822 ScriptIterator(Isolate* isolate, Handle<FixedArray> shared_function_infos); | |
7823 SharedFunctionInfo* Next(); | |
7824 | |
7825 // Reset the iterator to run on |script|. | |
7826 void Reset(Handle<Script> script); | |
7827 | |
7828 private: | |
7829 Isolate* isolate_; | |
7830 Handle<FixedArray> shared_function_infos_; | |
7831 int index_; | |
7832 DISALLOW_COPY_AND_ASSIGN(ScriptIterator); | |
7833 }; | |
7834 | |
7835 // Iterate over all shared function infos on the heap. | |
7836 class GlobalIterator { | |
7837 public: | |
7838 explicit GlobalIterator(Isolate* isolate); | |
7839 SharedFunctionInfo* Next(); | 7824 SharedFunctionInfo* Next(); |
7840 | 7825 |
7841 private: | 7826 private: |
| 7827 bool NextScript(); |
| 7828 |
7842 Script::Iterator script_iterator_; | 7829 Script::Iterator script_iterator_; |
7843 WeakFixedArray::Iterator noscript_sfi_iterator_; | 7830 WeakFixedArray::Iterator sfi_iterator_; |
7844 SharedFunctionInfo::ScriptIterator sfi_iterator_; | |
7845 DisallowHeapAllocation no_gc_; | 7831 DisallowHeapAllocation no_gc_; |
7846 DISALLOW_COPY_AND_ASSIGN(GlobalIterator); | 7832 DISALLOW_COPY_AND_ASSIGN(Iterator); |
7847 }; | 7833 }; |
7848 | 7834 |
7849 DECLARE_CAST(SharedFunctionInfo) | 7835 DECLARE_CAST(SharedFunctionInfo) |
7850 | 7836 |
7851 // Constants. | 7837 // Constants. |
7852 static const int kDontAdaptArgumentsSentinel = -1; | 7838 static const int kDontAdaptArgumentsSentinel = -1; |
7853 | 7839 |
7854 // Layout description. | 7840 // Layout description. |
7855 // Pointer fields. | 7841 // Pointer fields. |
7856 static const int kCodeOffset = HeapObject::kHeaderSize; | 7842 static const int kCodeOffset = HeapObject::kHeaderSize; |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7996 static const int kIsTopLevelBit = 1; | 7982 static const int kIsTopLevelBit = 1; |
7997 static const int kStartPositionShift = 2; | 7983 static const int kStartPositionShift = 2; |
7998 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); | 7984 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); |
7999 | 7985 |
8000 // Bit positions in compiler_hints. | 7986 // Bit positions in compiler_hints. |
8001 enum CompilerHints { | 7987 enum CompilerHints { |
8002 // byte 0 | 7988 // byte 0 |
8003 kAllowLazyCompilation, | 7989 kAllowLazyCompilation, |
8004 kMarkedForTierUp, | 7990 kMarkedForTierUp, |
8005 kOptimizationDisabled, | 7991 kOptimizationDisabled, |
8006 kIsClassFieldInitializer, | 7992 kNeverCompiled, |
8007 kNative, | 7993 kNative, |
8008 kStrictModeFunction, | 7994 kStrictModeFunction, |
8009 kUsesArguments, | 7995 kUsesArguments, |
8010 kNeedsHomeObject, | 7996 kNeedsHomeObject, |
8011 // byte 1 | 7997 // byte 1 |
8012 kHasDuplicateParameters, | 7998 kHasDuplicateParameters, |
8013 kForceInline, | 7999 kForceInline, |
8014 kIsAsmFunction, | 8000 kIsAsmFunction, |
8015 kIsAnonymousExpression, | 8001 kIsAnonymousExpression, |
8016 kNameShouldPrintAsAnonymous, | 8002 kNameShouldPrintAsAnonymous, |
8017 kIsFunction, | 8003 kIsFunction, |
8018 kMustUseIgnitionTurbo, | 8004 kMustUseIgnitionTurbo, |
8019 kDontFlush, | 8005 kDontFlush, |
8020 // byte 2 | 8006 // byte 2 |
8021 kFunctionKind, | 8007 kFunctionKind, |
8022 // rest of byte 2 and first two bits of byte 3 are used by FunctionKind | 8008 // rest of byte 2 and first two bits of byte 3 are used by FunctionKind |
8023 // byte 3 | 8009 // byte 3 |
8024 kDeserialized = kFunctionKind + 10, | 8010 kDeserialized = kFunctionKind + 10, |
8025 kIsDeclaration, | 8011 kIsDeclaration, |
8026 kIsAsmWasmBroken, | 8012 kIsAsmWasmBroken, |
8027 kRequiresClassFieldInit, | 8013 kRequiresClassFieldInit, |
| 8014 kIsClassFieldInitializer, |
8028 kCompilerHintsCount, // Pseudo entry | 8015 kCompilerHintsCount, // Pseudo entry |
8029 }; | 8016 }; |
8030 // kFunctionKind has to be byte-aligned | 8017 // kFunctionKind has to be byte-aligned |
8031 STATIC_ASSERT((kFunctionKind % kBitsPerByte) == 0); | 8018 STATIC_ASSERT((kFunctionKind % kBitsPerByte) == 0); |
8032 | 8019 |
8033 class FunctionKindBits : public BitField<FunctionKind, kFunctionKind, 10> {}; | 8020 class FunctionKindBits : public BitField<FunctionKind, kFunctionKind, 10> {}; |
8034 | 8021 |
8035 class DeoptCountBits : public BitField<int, 0, 4> {}; | 8022 class DeoptCountBits : public BitField<int, 0, 4> {}; |
8036 class OptReenableTriesBits : public BitField<int, 4, 18> {}; | 8023 class OptReenableTriesBits : public BitField<int, 4, 18> {}; |
8037 class ICAgeBits : public BitField<int, 22, 8> {}; | 8024 class ICAgeBits : public BitField<int, 22, 8> {}; |
(...skipping 3970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12008 } | 11995 } |
12009 return value; | 11996 return value; |
12010 } | 11997 } |
12011 }; | 11998 }; |
12012 | 11999 |
12013 | 12000 |
12014 } // NOLINT, false-positive due to second-order macros. | 12001 } // NOLINT, false-positive due to second-order macros. |
12015 } // NOLINT, false-positive due to second-order macros. | 12002 } // NOLINT, false-positive due to second-order macros. |
12016 | 12003 |
12017 #endif // V8_OBJECTS_H_ | 12004 #endif // V8_OBJECTS_H_ |
OLD | NEW |