| 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  |      9  | 
|     10 #include "src/allocation.h" |     10 #include "src/allocation.h" | 
| (...skipping 6756 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   6767   inline void set_function_token_position(int function_token_position); |   6767   inline void set_function_token_position(int function_token_position); | 
|   6768  |   6768  | 
|   6769   // Position of this function in the script source. |   6769   // Position of this function in the script source. | 
|   6770   inline int start_position() const; |   6770   inline int start_position() const; | 
|   6771   inline void set_start_position(int start_position); |   6771   inline void set_start_position(int start_position); | 
|   6772  |   6772  | 
|   6773   // End position of this function in the script source. |   6773   // End position of this function in the script source. | 
|   6774   inline int end_position() const; |   6774   inline int end_position() const; | 
|   6775   inline void set_end_position(int end_position); |   6775   inline void set_end_position(int end_position); | 
|   6776  |   6776  | 
|   6777   // Is this function a function expression in the source code. |   6777   // Is this function a named function expression in the source code. | 
|   6778   DECL_BOOLEAN_ACCESSORS(is_expression) |   6778   DECL_BOOLEAN_ACCESSORS(is_named_expression) | 
|   6779  |   6779  | 
|   6780   // Is this function a top-level function (scripts, evals). |   6780   // Is this function a top-level function (scripts, evals). | 
|   6781   DECL_BOOLEAN_ACCESSORS(is_toplevel) |   6781   DECL_BOOLEAN_ACCESSORS(is_toplevel) | 
|   6782  |   6782  | 
|   6783   // Bit field containing various information collected by the compiler to |   6783   // Bit field containing various information collected by the compiler to | 
|   6784   // drive optimization. |   6784   // drive optimization. | 
|   6785   inline int compiler_hints() const; |   6785   inline int compiler_hints() const; | 
|   6786   inline void set_compiler_hints(int value); |   6786   inline void set_compiler_hints(int value); | 
|   6787  |   6787  | 
|   6788   inline int ast_node_count() const; |   6788   inline int ast_node_count() const; | 
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   6836  |   6836  | 
|   6837   // Indicate that this function should always be inlined in optimized code. |   6837   // Indicate that this function should always be inlined in optimized code. | 
|   6838   DECL_BOOLEAN_ACCESSORS(force_inline) |   6838   DECL_BOOLEAN_ACCESSORS(force_inline) | 
|   6839  |   6839  | 
|   6840   // Indicates that the function was created by the Function function. |   6840   // Indicates that the function was created by the Function function. | 
|   6841   // Though it's anonymous, toString should treat it as if it had the name |   6841   // Though it's anonymous, toString should treat it as if it had the name | 
|   6842   // "anonymous".  We don't set the name itself so that the system does not |   6842   // "anonymous".  We don't set the name itself so that the system does not | 
|   6843   // see a binding for it. |   6843   // see a binding for it. | 
|   6844   DECL_BOOLEAN_ACCESSORS(name_should_print_as_anonymous) |   6844   DECL_BOOLEAN_ACCESSORS(name_should_print_as_anonymous) | 
|   6845  |   6845  | 
|   6846   // Indicates that the function is anonymous (the name field can be set |   6846   // Indicates that the function is either an anonymous expression | 
|   6847   // through the API, which does not change this flag). |   6847   // or an arrow function (the name field can be set through the API, | 
|   6848   DECL_BOOLEAN_ACCESSORS(is_anonymous) |   6848   // which does not change this flag). | 
 |   6849   DECL_BOOLEAN_ACCESSORS(is_anonymous_expression) | 
|   6849  |   6850  | 
|   6850   // Is this a function or top-level/eval code. |   6851   // Is this a function or top-level/eval code. | 
|   6851   DECL_BOOLEAN_ACCESSORS(is_function) |   6852   DECL_BOOLEAN_ACCESSORS(is_function) | 
|   6852  |   6853  | 
|   6853   // Indicates that code for this function cannot be compiled with Crankshaft. |   6854   // Indicates that code for this function cannot be compiled with Crankshaft. | 
|   6854   DECL_BOOLEAN_ACCESSORS(dont_crankshaft) |   6855   DECL_BOOLEAN_ACCESSORS(dont_crankshaft) | 
|   6855  |   6856  | 
|   6856   // Indicates that code for this function cannot be flushed. |   6857   // Indicates that code for this function cannot be flushed. | 
|   6857   DECL_BOOLEAN_ACCESSORS(dont_flush) |   6858   DECL_BOOLEAN_ACCESSORS(dont_flush) | 
|   6858  |   6859  | 
|   6859   // Indicates that this function is a generator. |   6860   // Indicates that this function is a generator. | 
|   6860   DECL_BOOLEAN_ACCESSORS(is_generator) |   6861   DECL_BOOLEAN_ACCESSORS(is_generator) | 
|   6861  |   6862  | 
|   6862   // Indicates that this function is an arrow function. |   6863   // Indicates that this function is an arrow function. | 
|   6863   DECL_BOOLEAN_ACCESSORS(is_arrow) |   6864   DECL_BOOLEAN_ACCESSORS(is_arrow) | 
|   6864  |   6865  | 
|   6865   // Indicates that this function is a concise method. |   6866   // Indicates that this function is a concise method. | 
|   6866   DECL_BOOLEAN_ACCESSORS(is_concise_method) |   6867   DECL_BOOLEAN_ACCESSORS(is_concise_method) | 
|   6867  |   6868  | 
|   6868   // Indicates that this function is an accessor (getter or setter). |   6869   // Indicates that this function is a getter. | 
|   6869   DECL_BOOLEAN_ACCESSORS(is_accessor_function) |   6870   DECL_BOOLEAN_ACCESSORS(is_getter_function) | 
 |   6871  | 
 |   6872   // Indicates that this function is a setter. | 
 |   6873   DECL_BOOLEAN_ACCESSORS(is_setter_function) | 
|   6870  |   6874  | 
|   6871   // Indicates that this function is a default constructor. |   6875   // Indicates that this function is a default constructor. | 
|   6872   DECL_BOOLEAN_ACCESSORS(is_default_constructor) |   6876   DECL_BOOLEAN_ACCESSORS(is_default_constructor) | 
|   6873  |   6877  | 
|   6874   // Indicates that this function is an asm function. |   6878   // Indicates that this function is an asm function. | 
|   6875   DECL_BOOLEAN_ACCESSORS(asm_function) |   6879   DECL_BOOLEAN_ACCESSORS(asm_function) | 
|   6876  |   6880  | 
|   6877   // Indicates that the the shared function info is deserialized from cache. |   6881   // Indicates that the the shared function info is deserialized from cache. | 
|   6878   DECL_BOOLEAN_ACCESSORS(deserialized) |   6882   DECL_BOOLEAN_ACCESSORS(deserialized) | 
|   6879  |   6883  | 
|   6880   // Indicates that the the shared function info has never been compiled before. |   6884   // Indicates that the the shared function info has never been compiled before. | 
|   6881   DECL_BOOLEAN_ACCESSORS(never_compiled) |   6885   DECL_BOOLEAN_ACCESSORS(never_compiled) | 
|   6882  |   6886  | 
 |   6887   // Whether this function was created from a FunctionDeclaration. | 
 |   6888   DECL_BOOLEAN_ACCESSORS(is_declaration) | 
 |   6889  | 
|   6883   inline FunctionKind kind(); |   6890   inline FunctionKind kind(); | 
|   6884   inline void set_kind(FunctionKind kind); |   6891   inline void set_kind(FunctionKind kind); | 
|   6885  |   6892  | 
|   6886   // Indicates whether or not the code in the shared function support |   6893   // Indicates whether or not the code in the shared function support | 
|   6887   // deoptimization. |   6894   // deoptimization. | 
|   6888   inline bool has_deoptimization_support(); |   6895   inline bool has_deoptimization_support(); | 
|   6889  |   6896  | 
|   6890   // Enable deoptimization support through recompiled code. |   6897   // Enable deoptimization support through recompiled code. | 
|   6891   void EnableDeoptimizationSupport(Code* recompiled); |   6898   void EnableDeoptimizationSupport(Code* recompiled); | 
|   6892  |   6899  | 
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   7106  |   7113  | 
|   7107   static const int kAlignedSize = POINTER_SIZE_ALIGN(kSize); |   7114   static const int kAlignedSize = POINTER_SIZE_ALIGN(kSize); | 
|   7108  |   7115  | 
|   7109   typedef FixedBodyDescriptor<kNameOffset, |   7116   typedef FixedBodyDescriptor<kNameOffset, | 
|   7110                               kLastPointerFieldOffset + kPointerSize, |   7117                               kLastPointerFieldOffset + kPointerSize, | 
|   7111                               kSize> BodyDescriptor; |   7118                               kSize> BodyDescriptor; | 
|   7112  |   7119  | 
|   7113   // Bit positions in start_position_and_type. |   7120   // Bit positions in start_position_and_type. | 
|   7114   // The source code start position is in the 30 most significant bits of |   7121   // The source code start position is in the 30 most significant bits of | 
|   7115   // the start_position_and_type field. |   7122   // the start_position_and_type field. | 
|   7116   static const int kIsExpressionBit    = 0; |   7123   static const int kIsNamedExpressionBit = 0; | 
|   7117   static const int kIsTopLevelBit      = 1; |   7124   static const int kIsTopLevelBit = 1; | 
|   7118   static const int kStartPositionShift = 2; |   7125   static const int kStartPositionShift = 2; | 
|   7119   static const int kStartPositionMask  = ~((1 << kStartPositionShift) - 1); |   7126   static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); | 
|   7120  |   7127  | 
|   7121   // Bit positions in compiler_hints. |   7128   // Bit positions in compiler_hints. | 
|   7122   enum CompilerHints { |   7129   enum CompilerHints { | 
|   7123     // byte 0 |   7130     // byte 0 | 
|   7124     kAllowLazyCompilation, |   7131     kAllowLazyCompilation, | 
|   7125     kAllowLazyCompilationWithoutContext, |   7132     kAllowLazyCompilationWithoutContext, | 
|   7126     kOptimizationDisabled, |   7133     kOptimizationDisabled, | 
|   7127     kNative, |   7134     kNative, | 
|   7128     kStrictModeFunction, |   7135     kStrictModeFunction, | 
|   7129     kStrongModeFunction, |   7136     kStrongModeFunction, | 
|   7130     kUsesArguments, |   7137     kUsesArguments, | 
|   7131     kNeedsHomeObject, |   7138     kNeedsHomeObject, | 
|   7132     // byte 1 |   7139     // byte 1 | 
|   7133     kHasDuplicateParameters, |   7140     kHasDuplicateParameters, | 
|   7134     kForceInline, |   7141     kForceInline, | 
|   7135     kIsAsmFunction, |   7142     kIsAsmFunction, | 
|   7136     kIsAnonymous, |   7143     kIsAnonymousExpression, | 
|   7137     kNameShouldPrintAsAnonymous, |   7144     kNameShouldPrintAsAnonymous, | 
|   7138     kIsFunction, |   7145     kIsFunction, | 
|   7139     kDontCrankshaft, |   7146     kDontCrankshaft, | 
|   7140     kDontFlush, |   7147     kDontFlush, | 
|   7141     // byte 2 |   7148     // byte 2 | 
|   7142     kFunctionKind, |   7149     kFunctionKind, | 
|   7143     kIsArrow = kFunctionKind, |   7150     kIsArrow = kFunctionKind, | 
|   7144     kIsGenerator, |   7151     kIsGenerator, | 
|   7145     kIsConciseMethod, |   7152     kIsConciseMethod, | 
|   7146     kIsAccessorFunction, |  | 
|   7147     kIsDefaultConstructor, |   7153     kIsDefaultConstructor, | 
|   7148     kIsSubclassConstructor, |   7154     kIsSubclassConstructor, | 
|   7149     kIsBaseConstructor, |   7155     kIsBaseConstructor, | 
 |   7156     kIsGetterFunction, | 
 |   7157     kIsSetterFunction, | 
|   7150     // byte 3 |   7158     // byte 3 | 
|   7151     kDeserialized, |   7159     kDeserialized, | 
|   7152     kNeverCompiled, |   7160     kNeverCompiled, | 
 |   7161     kIsDeclaration, | 
|   7153     kCompilerHintsCount,  // Pseudo entry |   7162     kCompilerHintsCount,  // Pseudo entry | 
|   7154   }; |   7163   }; | 
|   7155   // Add hints for other modes when they're added. |   7164   // Add hints for other modes when they're added. | 
|   7156   STATIC_ASSERT(LANGUAGE_END == 3); |   7165   STATIC_ASSERT(LANGUAGE_END == 3); | 
|   7157   // kFunctionKind has to be byte-aligned |   7166   // kFunctionKind has to be byte-aligned | 
|   7158   STATIC_ASSERT((kFunctionKind % kBitsPerByte) == 0); |   7167   STATIC_ASSERT((kFunctionKind % kBitsPerByte) == 0); | 
|   7159 // Make sure that FunctionKind and byte 2 are in sync: |   7168 // Make sure that FunctionKind and byte 2 are in sync: | 
|   7160 #define ASSERT_FUNCTION_KIND_ORDER(functionKind, compilerFunctionKind) \ |   7169 #define ASSERT_FUNCTION_KIND_ORDER(functionKind, compilerFunctionKind) \ | 
|   7161   STATIC_ASSERT(FunctionKind::functionKind ==                          \ |   7170   STATIC_ASSERT(FunctionKind::functionKind ==                          \ | 
|   7162                 1 << (compilerFunctionKind - kFunctionKind)) |   7171                 1 << (compilerFunctionKind - kFunctionKind)) | 
|   7163   ASSERT_FUNCTION_KIND_ORDER(kArrowFunction, kIsArrow); |   7172   ASSERT_FUNCTION_KIND_ORDER(kArrowFunction, kIsArrow); | 
|   7164   ASSERT_FUNCTION_KIND_ORDER(kGeneratorFunction, kIsGenerator); |   7173   ASSERT_FUNCTION_KIND_ORDER(kGeneratorFunction, kIsGenerator); | 
|   7165   ASSERT_FUNCTION_KIND_ORDER(kConciseMethod, kIsConciseMethod); |   7174   ASSERT_FUNCTION_KIND_ORDER(kConciseMethod, kIsConciseMethod); | 
|   7166   ASSERT_FUNCTION_KIND_ORDER(kAccessorFunction, kIsAccessorFunction); |  | 
|   7167   ASSERT_FUNCTION_KIND_ORDER(kDefaultConstructor, kIsDefaultConstructor); |   7175   ASSERT_FUNCTION_KIND_ORDER(kDefaultConstructor, kIsDefaultConstructor); | 
|   7168   ASSERT_FUNCTION_KIND_ORDER(kSubclassConstructor, kIsSubclassConstructor); |   7176   ASSERT_FUNCTION_KIND_ORDER(kSubclassConstructor, kIsSubclassConstructor); | 
|   7169   ASSERT_FUNCTION_KIND_ORDER(kBaseConstructor, kIsBaseConstructor); |   7177   ASSERT_FUNCTION_KIND_ORDER(kBaseConstructor, kIsBaseConstructor); | 
 |   7178   ASSERT_FUNCTION_KIND_ORDER(kGetterFunction, kIsGetterFunction); | 
 |   7179   ASSERT_FUNCTION_KIND_ORDER(kSetterFunction, kIsSetterFunction); | 
|   7170 #undef ASSERT_FUNCTION_KIND_ORDER |   7180 #undef ASSERT_FUNCTION_KIND_ORDER | 
|   7171  |   7181  | 
|   7172   class FunctionKindBits : public BitField<FunctionKind, kIsArrow, 7> {}; |   7182   class FunctionKindBits : public BitField<FunctionKind, kIsArrow, 8> {}; | 
|   7173  |   7183  | 
|   7174   class DeoptCountBits : public BitField<int, 0, 4> {}; |   7184   class DeoptCountBits : public BitField<int, 0, 4> {}; | 
|   7175   class OptReenableTriesBits : public BitField<int, 4, 18> {}; |   7185   class OptReenableTriesBits : public BitField<int, 4, 18> {}; | 
|   7176   class ICAgeBits : public BitField<int, 22, 8> {}; |   7186   class ICAgeBits : public BitField<int, 22, 8> {}; | 
|   7177  |   7187  | 
|   7178   class OptCountBits : public BitField<int, 0, 22> {}; |   7188   class OptCountBits : public BitField<int, 0, 22> {}; | 
|   7179   class DisabledOptimizationReasonBits : public BitField<int, 22, 8> {}; |   7189   class DisabledOptimizationReasonBits : public BitField<int, 22, 8> {}; | 
|   7180  |   7190  | 
|   7181  private: |   7191  private: | 
|   7182 #if V8_HOST_ARCH_32_BIT |   7192 #if V8_HOST_ARCH_32_BIT | 
| (...skipping 3637 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  10820     } |  10830     } | 
|  10821     return value; |  10831     return value; | 
|  10822   } |  10832   } | 
|  10823 }; |  10833 }; | 
|  10824  |  10834  | 
|  10825  |  10835  | 
|  10826 }  // NOLINT, false-positive due to second-order macros. |  10836 }  // NOLINT, false-positive due to second-order macros. | 
|  10827 }  // NOLINT, false-positive due to second-order macros. |  10837 }  // NOLINT, false-positive due to second-order macros. | 
|  10828  |  10838  | 
|  10829 #endif  // V8_OBJECTS_H_ |  10839 #endif  // V8_OBJECTS_H_ | 
| OLD | NEW |