| 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, Object) | 7117 DECL_ACCESSORS(shared_function_infos, FixedArray) |
| 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(FunctionLiteral* fun); | 7202 MaybeHandle<SharedFunctionInfo> FindSharedFunctionInfo(Isolate* isolate, |
| 7203 FunctionLiteral* fun); |
| 7203 | 7204 |
| 7204 // Iterate over all script objects on the heap. | 7205 // Iterate over all script objects on the heap. |
| 7205 class Iterator { | 7206 class Iterator { |
| 7206 public: | 7207 public: |
| 7207 explicit Iterator(Isolate* isolate); | 7208 explicit Iterator(Isolate* isolate); |
| 7208 Script* Next(); | 7209 Script* Next(); |
| 7209 | 7210 |
| 7210 private: | 7211 private: |
| 7211 WeakFixedArray::Iterator iterator_; | 7212 WeakFixedArray::Iterator iterator_; |
| 7212 DISALLOW_COPY_AND_ASSIGN(Iterator); | 7213 DISALLOW_COPY_AND_ASSIGN(Iterator); |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7720 // Indicates that this is a synthesized function to set up class instance | 7721 // Indicates that this is a synthesized function to set up class instance |
| 7721 // fields. | 7722 // fields. |
| 7722 DECL_BOOLEAN_ACCESSORS(is_class_field_initializer) | 7723 DECL_BOOLEAN_ACCESSORS(is_class_field_initializer) |
| 7723 | 7724 |
| 7724 // Indicates that this function is an asm function. | 7725 // Indicates that this function is an asm function. |
| 7725 DECL_BOOLEAN_ACCESSORS(asm_function) | 7726 DECL_BOOLEAN_ACCESSORS(asm_function) |
| 7726 | 7727 |
| 7727 // Indicates that the the shared function info is deserialized from cache. | 7728 // Indicates that the the shared function info is deserialized from cache. |
| 7728 DECL_BOOLEAN_ACCESSORS(deserialized) | 7729 DECL_BOOLEAN_ACCESSORS(deserialized) |
| 7729 | 7730 |
| 7730 // Indicates that the the shared function info has never been compiled before. | |
| 7731 DECL_BOOLEAN_ACCESSORS(never_compiled) | |
| 7732 | |
| 7733 // Whether this function was created from a FunctionDeclaration. | 7731 // Whether this function was created from a FunctionDeclaration. |
| 7734 DECL_BOOLEAN_ACCESSORS(is_declaration) | 7732 DECL_BOOLEAN_ACCESSORS(is_declaration) |
| 7735 | 7733 |
| 7736 // Whether this function was marked to be tiered up. | 7734 // Whether this function was marked to be tiered up. |
| 7737 DECL_BOOLEAN_ACCESSORS(marked_for_tier_up) | 7735 DECL_BOOLEAN_ACCESSORS(marked_for_tier_up) |
| 7738 | 7736 |
| 7739 // Indicates that asm->wasm conversion failed and should not be re-attempted. | 7737 // Indicates that asm->wasm conversion failed and should not be re-attempted. |
| 7740 DECL_BOOLEAN_ACCESSORS(is_asm_wasm_broken) | 7738 DECL_BOOLEAN_ACCESSORS(is_asm_wasm_broken) |
| 7741 | 7739 |
| 7742 inline FunctionKind kind() const; | 7740 inline FunctionKind kind() const; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7810 // Initialize a SharedFunctionInfo from a parsed function literal. | 7808 // Initialize a SharedFunctionInfo from a parsed function literal. |
| 7811 static void InitFromFunctionLiteral(Handle<SharedFunctionInfo> shared_info, | 7809 static void InitFromFunctionLiteral(Handle<SharedFunctionInfo> shared_info, |
| 7812 FunctionLiteral* lit); | 7810 FunctionLiteral* lit); |
| 7813 | 7811 |
| 7814 // Dispatched behavior. | 7812 // Dispatched behavior. |
| 7815 DECLARE_PRINTER(SharedFunctionInfo) | 7813 DECLARE_PRINTER(SharedFunctionInfo) |
| 7816 DECLARE_VERIFIER(SharedFunctionInfo) | 7814 DECLARE_VERIFIER(SharedFunctionInfo) |
| 7817 | 7815 |
| 7818 void ResetForNewContext(int new_ic_age); | 7816 void ResetForNewContext(int new_ic_age); |
| 7819 | 7817 |
| 7820 // Iterate over all shared function infos. | 7818 // Iterate over all shared function infos in a given script. |
| 7821 class Iterator { | 7819 class ScriptIterator { |
| 7822 public: | 7820 public: |
| 7823 explicit Iterator(Isolate* isolate); | 7821 explicit ScriptIterator(Handle<Script> script); |
| 7822 SharedFunctionInfo* Next(); |
| 7823 |
| 7824 // Reset the iterator to run on |script|. |
| 7825 void Reset(Handle<Script> script); |
| 7826 |
| 7827 private: |
| 7828 Handle<Script> script_; |
| 7829 int index_; |
| 7830 DISALLOW_COPY_AND_ASSIGN(ScriptIterator); |
| 7831 }; |
| 7832 |
| 7833 // Iterate over all shared function infos on the heap. |
| 7834 class GlobalIterator { |
| 7835 public: |
| 7836 explicit GlobalIterator(Isolate* isolate); |
| 7824 SharedFunctionInfo* Next(); | 7837 SharedFunctionInfo* Next(); |
| 7825 | 7838 |
| 7826 private: | 7839 private: |
| 7827 bool NextScript(); | |
| 7828 | |
| 7829 Script::Iterator script_iterator_; | 7840 Script::Iterator script_iterator_; |
| 7830 WeakFixedArray::Iterator sfi_iterator_; | 7841 WeakFixedArray::Iterator noscript_sfi_iterator_; |
| 7842 SharedFunctionInfo::ScriptIterator sfi_iterator_; |
| 7831 DisallowHeapAllocation no_gc_; | 7843 DisallowHeapAllocation no_gc_; |
| 7832 DISALLOW_COPY_AND_ASSIGN(Iterator); | 7844 DISALLOW_COPY_AND_ASSIGN(GlobalIterator); |
| 7833 }; | 7845 }; |
| 7834 | 7846 |
| 7835 DECLARE_CAST(SharedFunctionInfo) | 7847 DECLARE_CAST(SharedFunctionInfo) |
| 7836 | 7848 |
| 7837 // Constants. | 7849 // Constants. |
| 7838 static const int kDontAdaptArgumentsSentinel = -1; | 7850 static const int kDontAdaptArgumentsSentinel = -1; |
| 7839 | 7851 |
| 7840 // Layout description. | 7852 // Layout description. |
| 7841 // Pointer fields. | 7853 // Pointer fields. |
| 7842 static const int kCodeOffset = HeapObject::kHeaderSize; | 7854 static const int kCodeOffset = HeapObject::kHeaderSize; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7982 static const int kIsTopLevelBit = 1; | 7994 static const int kIsTopLevelBit = 1; |
| 7983 static const int kStartPositionShift = 2; | 7995 static const int kStartPositionShift = 2; |
| 7984 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); | 7996 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); |
| 7985 | 7997 |
| 7986 // Bit positions in compiler_hints. | 7998 // Bit positions in compiler_hints. |
| 7987 enum CompilerHints { | 7999 enum CompilerHints { |
| 7988 // byte 0 | 8000 // byte 0 |
| 7989 kAllowLazyCompilation, | 8001 kAllowLazyCompilation, |
| 7990 kMarkedForTierUp, | 8002 kMarkedForTierUp, |
| 7991 kOptimizationDisabled, | 8003 kOptimizationDisabled, |
| 7992 kNeverCompiled, | 8004 kIsClassFieldInitializer, |
| 7993 kNative, | 8005 kNative, |
| 7994 kStrictModeFunction, | 8006 kStrictModeFunction, |
| 7995 kUsesArguments, | 8007 kUsesArguments, |
| 7996 kNeedsHomeObject, | 8008 kNeedsHomeObject, |
| 7997 // byte 1 | 8009 // byte 1 |
| 7998 kHasDuplicateParameters, | 8010 kHasDuplicateParameters, |
| 7999 kForceInline, | 8011 kForceInline, |
| 8000 kIsAsmFunction, | 8012 kIsAsmFunction, |
| 8001 kIsAnonymousExpression, | 8013 kIsAnonymousExpression, |
| 8002 kNameShouldPrintAsAnonymous, | 8014 kNameShouldPrintAsAnonymous, |
| 8003 kIsFunction, | 8015 kIsFunction, |
| 8004 kMustUseIgnitionTurbo, | 8016 kMustUseIgnitionTurbo, |
| 8005 kDontFlush, | 8017 kDontFlush, |
| 8006 // byte 2 | 8018 // byte 2 |
| 8007 kFunctionKind, | 8019 kFunctionKind, |
| 8008 // rest of byte 2 and first two bits of byte 3 are used by FunctionKind | 8020 // rest of byte 2 and first two bits of byte 3 are used by FunctionKind |
| 8009 // byte 3 | 8021 // byte 3 |
| 8010 kDeserialized = kFunctionKind + 10, | 8022 kDeserialized = kFunctionKind + 10, |
| 8011 kIsDeclaration, | 8023 kIsDeclaration, |
| 8012 kIsAsmWasmBroken, | 8024 kIsAsmWasmBroken, |
| 8013 kRequiresClassFieldInit, | 8025 kRequiresClassFieldInit, |
| 8014 kIsClassFieldInitializer, | |
| 8015 kCompilerHintsCount, // Pseudo entry | 8026 kCompilerHintsCount, // Pseudo entry |
| 8016 }; | 8027 }; |
| 8017 // kFunctionKind has to be byte-aligned | 8028 // kFunctionKind has to be byte-aligned |
| 8018 STATIC_ASSERT((kFunctionKind % kBitsPerByte) == 0); | 8029 STATIC_ASSERT((kFunctionKind % kBitsPerByte) == 0); |
| 8019 | 8030 |
| 8020 class FunctionKindBits : public BitField<FunctionKind, kFunctionKind, 10> {}; | 8031 class FunctionKindBits : public BitField<FunctionKind, kFunctionKind, 10> {}; |
| 8021 | 8032 |
| 8022 class DeoptCountBits : public BitField<int, 0, 4> {}; | 8033 class DeoptCountBits : public BitField<int, 0, 4> {}; |
| 8023 class OptReenableTriesBits : public BitField<int, 4, 18> {}; | 8034 class OptReenableTriesBits : public BitField<int, 4, 18> {}; |
| 8024 class ICAgeBits : public BitField<int, 22, 8> {}; | 8035 class ICAgeBits : public BitField<int, 22, 8> {}; |
| (...skipping 3961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11986 } | 11997 } |
| 11987 return value; | 11998 return value; |
| 11988 } | 11999 } |
| 11989 }; | 12000 }; |
| 11990 | 12001 |
| 11991 | 12002 |
| 11992 } // NOLINT, false-positive due to second-order macros. | 12003 } // NOLINT, false-positive due to second-order macros. |
| 11993 } // NOLINT, false-positive due to second-order macros. | 12004 } // NOLINT, false-positive due to second-order macros. |
| 11994 | 12005 |
| 11995 #endif // V8_OBJECTS_H_ | 12006 #endif // V8_OBJECTS_H_ |
| OLD | NEW |