| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 | 9 |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| (...skipping 3940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3951 | 3951 |
| 3952 // Return the type of this scope. | 3952 // Return the type of this scope. |
| 3953 ScopeType scope_type(); | 3953 ScopeType scope_type(); |
| 3954 | 3954 |
| 3955 // Does this scope call eval? | 3955 // Does this scope call eval? |
| 3956 bool CallsEval(); | 3956 bool CallsEval(); |
| 3957 | 3957 |
| 3958 // Return the language mode of this scope. | 3958 // Return the language mode of this scope. |
| 3959 LanguageMode language_mode(); | 3959 LanguageMode language_mode(); |
| 3960 | 3960 |
| 3961 // Return the asm mode of this scope. |
| 3962 AsmMode asm_mode(); |
| 3963 |
| 3961 // Does this scope make a sloppy eval call? | 3964 // Does this scope make a sloppy eval call? |
| 3962 bool CallsSloppyEval() { return CallsEval() && is_sloppy(language_mode()); } | 3965 bool CallsSloppyEval() { return CallsEval() && is_sloppy(language_mode()); } |
| 3963 | 3966 |
| 3964 // Return the total number of locals allocated on the stack and in the | 3967 // Return the total number of locals allocated on the stack and in the |
| 3965 // context. This includes the parameters that are allocated in the context. | 3968 // context. This includes the parameters that are allocated in the context. |
| 3966 int LocalCount(); | 3969 int LocalCount(); |
| 3967 | 3970 |
| 3968 // Return the number of stack slots for code. This number consists of two | 3971 // Return the number of stack slots for code. This number consists of two |
| 3969 // parts: | 3972 // parts: |
| 3970 // 1. One stack slot per stack allocated local. | 3973 // 1. One stack slot per stack allocated local. |
| (...skipping 2641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6612 // shared by multiple instances of the function. | 6615 // shared by multiple instances of the function. |
| 6613 class SharedFunctionInfo: public HeapObject { | 6616 class SharedFunctionInfo: public HeapObject { |
| 6614 public: | 6617 public: |
| 6615 // [name]: Function name. | 6618 // [name]: Function name. |
| 6616 DECL_ACCESSORS(name, Object) | 6619 DECL_ACCESSORS(name, Object) |
| 6617 | 6620 |
| 6618 // [code]: Function code. | 6621 // [code]: Function code. |
| 6619 DECL_ACCESSORS(code, Code) | 6622 DECL_ACCESSORS(code, Code) |
| 6620 inline void ReplaceCode(Code* code); | 6623 inline void ReplaceCode(Code* code); |
| 6621 | 6624 |
| 6625 // [code]: Code for asm functions. |
| 6626 DECL_ACCESSORS(asm_code, Code) |
| 6627 |
| 6622 // [optimized_code_map]: Map from native context to optimized code | 6628 // [optimized_code_map]: Map from native context to optimized code |
| 6623 // and a shared literals array or Smi(0) if none. | 6629 // and a shared literals array or Smi(0) if none. |
| 6624 DECL_ACCESSORS(optimized_code_map, Object) | 6630 DECL_ACCESSORS(optimized_code_map, Object) |
| 6625 | 6631 |
| 6626 // Returns index i of the entry with the specified context and OSR entry. | 6632 // Returns index i of the entry with the specified context and OSR entry. |
| 6627 // At position i - 1 is the context, position i the code, and i + 1 the | 6633 // At position i - 1 is the context, position i the code, and i + 1 the |
| 6628 // literals array. Returns -1 when no matching entry is found. | 6634 // literals array. Returns -1 when no matching entry is found. |
| 6629 int SearchOptimizedCodeMap(Context* native_context, BailoutId osr_ast_id); | 6635 int SearchOptimizedCodeMap(Context* native_context, BailoutId osr_ast_id); |
| 6630 | 6636 |
| 6631 // Installs optimized code from the code map on the given closure. The | 6637 // Installs optimized code from the code map on the given closure. The |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6802 // Indicates whether optimizations have been disabled for this | 6808 // Indicates whether optimizations have been disabled for this |
| 6803 // shared function info. If a function is repeatedly optimized or if | 6809 // shared function info. If a function is repeatedly optimized or if |
| 6804 // we cannot optimize the function we disable optimization to avoid | 6810 // we cannot optimize the function we disable optimization to avoid |
| 6805 // spending time attempting to optimize it again. | 6811 // spending time attempting to optimize it again. |
| 6806 DECL_BOOLEAN_ACCESSORS(optimization_disabled) | 6812 DECL_BOOLEAN_ACCESSORS(optimization_disabled) |
| 6807 | 6813 |
| 6808 // Indicates the language mode. | 6814 // Indicates the language mode. |
| 6809 inline LanguageMode language_mode(); | 6815 inline LanguageMode language_mode(); |
| 6810 inline void set_language_mode(LanguageMode language_mode); | 6816 inline void set_language_mode(LanguageMode language_mode); |
| 6811 | 6817 |
| 6818 // Indicates the asm mode. |
| 6819 inline AsmMode asm_mode(); |
| 6820 inline void set_asm_mode(AsmMode asm_mode); |
| 6821 |
| 6812 // False if the function definitely does not allocate an arguments object. | 6822 // False if the function definitely does not allocate an arguments object. |
| 6813 DECL_BOOLEAN_ACCESSORS(uses_arguments) | 6823 DECL_BOOLEAN_ACCESSORS(uses_arguments) |
| 6814 | 6824 |
| 6815 // Indicates that this function uses a super property (or an eval that may | 6825 // Indicates that this function uses a super property (or an eval that may |
| 6816 // use a super property). | 6826 // use a super property). |
| 6817 // This is needed to set up the [[HomeObject]] on the function instance. | 6827 // This is needed to set up the [[HomeObject]] on the function instance. |
| 6818 DECL_BOOLEAN_ACCESSORS(needs_home_object) | 6828 DECL_BOOLEAN_ACCESSORS(needs_home_object) |
| 6819 | 6829 |
| 6820 // True if the function has any duplicated parameter names. | 6830 // True if the function has any duplicated parameter names. |
| 6821 DECL_BOOLEAN_ACCESSORS(has_duplicate_parameters) | 6831 DECL_BOOLEAN_ACCESSORS(has_duplicate_parameters) |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6866 | 6876 |
| 6867 // Indicates that this function is an accessor (getter or setter). | 6877 // Indicates that this function is an accessor (getter or setter). |
| 6868 DECL_BOOLEAN_ACCESSORS(is_accessor_function) | 6878 DECL_BOOLEAN_ACCESSORS(is_accessor_function) |
| 6869 | 6879 |
| 6870 // Indicates that this function is a default constructor. | 6880 // Indicates that this function is a default constructor. |
| 6871 DECL_BOOLEAN_ACCESSORS(is_default_constructor) | 6881 DECL_BOOLEAN_ACCESSORS(is_default_constructor) |
| 6872 | 6882 |
| 6873 // Indicates that this function is an asm function. | 6883 // Indicates that this function is an asm function. |
| 6874 DECL_BOOLEAN_ACCESSORS(asm_function) | 6884 DECL_BOOLEAN_ACCESSORS(asm_function) |
| 6875 | 6885 |
| 6886 // Indicates that this function is an asm module. |
| 6887 DECL_BOOLEAN_ACCESSORS(asm_module) |
| 6888 |
| 6876 // Indicates that the the shared function info is deserialized from cache. | 6889 // Indicates that the the shared function info is deserialized from cache. |
| 6877 DECL_BOOLEAN_ACCESSORS(deserialized) | 6890 DECL_BOOLEAN_ACCESSORS(deserialized) |
| 6878 | 6891 |
| 6879 inline FunctionKind kind(); | 6892 inline FunctionKind kind(); |
| 6880 inline void set_kind(FunctionKind kind); | 6893 inline void set_kind(FunctionKind kind); |
| 6881 | 6894 |
| 6882 // Indicates whether or not the code in the shared function support | 6895 // Indicates whether or not the code in the shared function support |
| 6883 // deoptimization. | 6896 // deoptimization. |
| 6884 inline bool has_deoptimization_support(); | 6897 inline bool has_deoptimization_support(); |
| 6885 | 6898 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6963 static const int kOptimizedCodeMapOffset = kCodeOffset + kPointerSize; | 6976 static const int kOptimizedCodeMapOffset = kCodeOffset + kPointerSize; |
| 6964 static const int kScopeInfoOffset = kOptimizedCodeMapOffset + kPointerSize; | 6977 static const int kScopeInfoOffset = kOptimizedCodeMapOffset + kPointerSize; |
| 6965 static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize; | 6978 static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize; |
| 6966 static const int kInstanceClassNameOffset = | 6979 static const int kInstanceClassNameOffset = |
| 6967 kConstructStubOffset + kPointerSize; | 6980 kConstructStubOffset + kPointerSize; |
| 6968 static const int kFunctionDataOffset = | 6981 static const int kFunctionDataOffset = |
| 6969 kInstanceClassNameOffset + kPointerSize; | 6982 kInstanceClassNameOffset + kPointerSize; |
| 6970 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; | 6983 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; |
| 6971 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; | 6984 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; |
| 6972 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; | 6985 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; |
| 6973 static const int kFeedbackVectorOffset = | 6986 static const int kAsmCodeOffset = kInferredNameOffset + kPointerSize; |
| 6974 kInferredNameOffset + kPointerSize; | 6987 static const int kFeedbackVectorOffset = kAsmCodeOffset + kPointerSize; |
| 6975 #if TRACE_MAPS | 6988 #if TRACE_MAPS |
| 6976 static const int kUniqueIdOffset = kFeedbackVectorOffset + kPointerSize; | 6989 static const int kUniqueIdOffset = kFeedbackVectorOffset + kPointerSize; |
| 6977 static const int kLastPointerFieldOffset = kUniqueIdOffset; | 6990 static const int kLastPointerFieldOffset = kUniqueIdOffset; |
| 6978 #else | 6991 #else |
| 6979 // Just to not break the postmortrem support with conditional offsets | 6992 // Just to not break the postmortrem support with conditional offsets |
| 6980 static const int kUniqueIdOffset = kFeedbackVectorOffset; | 6993 static const int kUniqueIdOffset = kFeedbackVectorOffset; |
| 6981 static const int kLastPointerFieldOffset = kFeedbackVectorOffset; | 6994 static const int kLastPointerFieldOffset = kFeedbackVectorOffset; |
| 6982 #endif | 6995 #endif |
| 6983 | 6996 |
| 6984 #if V8_HOST_ARCH_32_BIT | 6997 #if V8_HOST_ARCH_32_BIT |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7118 kDontFlush, | 7131 kDontFlush, |
| 7119 kIsArrow, | 7132 kIsArrow, |
| 7120 kIsGenerator, | 7133 kIsGenerator, |
| 7121 kIsConciseMethod, | 7134 kIsConciseMethod, |
| 7122 kIsAccessorFunction, | 7135 kIsAccessorFunction, |
| 7123 kIsDefaultConstructor, | 7136 kIsDefaultConstructor, |
| 7124 kIsSubclassConstructor, | 7137 kIsSubclassConstructor, |
| 7125 kIsBaseConstructor, | 7138 kIsBaseConstructor, |
| 7126 kInClassLiteral, | 7139 kInClassLiteral, |
| 7127 kIsAsmFunction, | 7140 kIsAsmFunction, |
| 7141 kIsAsmModule, |
| 7128 kDeserialized, | 7142 kDeserialized, |
| 7129 kCompilerHintsCount // Pseudo entry | 7143 kCompilerHintsCount // Pseudo entry |
| 7130 }; | 7144 }; |
| 7131 // Add hints for other modes when they're added. | 7145 // Add hints for other modes when they're added. |
| 7132 STATIC_ASSERT(LANGUAGE_END == 3); | 7146 STATIC_ASSERT(LANGUAGE_END == 3); |
| 7133 | 7147 |
| 7134 class FunctionKindBits : public BitField<FunctionKind, kIsArrow, 8> {}; | 7148 class FunctionKindBits : public BitField<FunctionKind, kIsArrow, 8> {}; |
| 7135 | 7149 |
| 7136 class DeoptCountBits : public BitField<int, 0, 4> {}; | 7150 class DeoptCountBits : public BitField<int, 0, 4> {}; |
| 7137 class OptReenableTriesBits : public BitField<int, 4, 18> {}; | 7151 class OptReenableTriesBits : public BitField<int, 4, 18> {}; |
| (...skipping 3735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10873 } else { | 10887 } else { |
| 10874 value &= ~(1 << bit_position); | 10888 value &= ~(1 << bit_position); |
| 10875 } | 10889 } |
| 10876 return value; | 10890 return value; |
| 10877 } | 10891 } |
| 10878 }; | 10892 }; |
| 10879 | 10893 |
| 10880 } } // namespace v8::internal | 10894 } } // namespace v8::internal |
| 10881 | 10895 |
| 10882 #endif // V8_OBJECTS_H_ | 10896 #endif // V8_OBJECTS_H_ |
| OLD | NEW |