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 7316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7327 inline void set_num_literals(int value); | 7327 inline void set_num_literals(int value); |
7328 | 7328 |
7329 // [start_position_and_type]: Field used to store both the source code | 7329 // [start_position_and_type]: Field used to store both the source code |
7330 // position, whether or not the function is a function expression, | 7330 // position, whether or not the function is a function expression, |
7331 // and whether or not the function is a toplevel function. The two | 7331 // and whether or not the function is a toplevel function. The two |
7332 // least significants bit indicates whether the function is an | 7332 // least significants bit indicates whether the function is an |
7333 // expression and the rest contains the source code position. | 7333 // expression and the rest contains the source code position. |
7334 inline int start_position_and_type() const; | 7334 inline int start_position_and_type() const; |
7335 inline void set_start_position_and_type(int value); | 7335 inline void set_start_position_and_type(int value); |
7336 | 7336 |
| 7337 // [end_position_and_is_blackboxed]: Field used to store both the source code |
| 7338 // position, whether or not the function is blackboxed, and whether or not the |
| 7339 // blackboxed state is computed in the two |
| 7340 // least significants bits. |
| 7341 inline int end_position_and_is_blackboxed() const; |
| 7342 inline void set_end_position_and_is_blackboxed(int value); |
| 7343 |
7337 // The function is subject to debugging if a debug info is attached. | 7344 // The function is subject to debugging if a debug info is attached. |
7338 inline bool HasDebugInfo(); | 7345 inline bool HasDebugInfo(); |
7339 inline DebugInfo* GetDebugInfo(); | 7346 inline DebugInfo* GetDebugInfo(); |
7340 | 7347 |
7341 // A function has debug code if the compiled code has debug break slots. | 7348 // A function has debug code if the compiled code has debug break slots. |
7342 inline bool HasDebugCode(); | 7349 inline bool HasDebugCode(); |
7343 | 7350 |
7344 // [debug info]: Debug information. | 7351 // [debug info]: Debug information. |
7345 DECL_ACCESSORS(debug_info, Object) | 7352 DECL_ACCESSORS(debug_info, Object) |
7346 | 7353 |
7347 // The function's name if it is non-empty, otherwise the inferred name. | 7354 // The function's name if it is non-empty, otherwise the inferred name. |
7348 String* DebugName(); | 7355 String* DebugName(); |
7349 | 7356 |
| 7357 // The function is blackboxed in debugger. |
| 7358 bool DebugIsBlackboxed(); |
| 7359 |
7350 // The function cannot cause any side effects. | 7360 // The function cannot cause any side effects. |
7351 bool HasNoSideEffect(); | 7361 bool HasNoSideEffect(); |
7352 | 7362 |
7353 // Used for flags such as --hydrogen-filter. | 7363 // Used for flags such as --hydrogen-filter. |
7354 bool PassesFilter(const char* raw_filter); | 7364 bool PassesFilter(const char* raw_filter); |
7355 | 7365 |
7356 // Position of the 'function' token in the script source. | 7366 // Position of the 'function' token in the script source. |
7357 inline int function_token_position() const; | 7367 inline int function_token_position() const; |
7358 inline void set_function_token_position(int function_token_position); | 7368 inline void set_function_token_position(int function_token_position); |
7359 | 7369 |
7360 // Position of this function in the script source. | 7370 // Position of this function in the script source. |
7361 inline int start_position() const; | 7371 inline int start_position() const; |
7362 inline void set_start_position(int start_position); | 7372 inline void set_start_position(int start_position); |
7363 | 7373 |
7364 // End position of this function in the script source. | |
7365 inline int end_position() const; | |
7366 inline void set_end_position(int end_position); | |
7367 | |
7368 // Is this function a named function expression in the source code. | 7374 // Is this function a named function expression in the source code. |
7369 DECL_BOOLEAN_ACCESSORS(is_named_expression) | 7375 DECL_BOOLEAN_ACCESSORS(is_named_expression) |
7370 | 7376 |
7371 // Is this function a top-level function (scripts, evals). | 7377 // Is this function a top-level function (scripts, evals). |
7372 DECL_BOOLEAN_ACCESSORS(is_toplevel) | 7378 DECL_BOOLEAN_ACCESSORS(is_toplevel) |
7373 | 7379 |
| 7380 // End position of this function in the script source. |
| 7381 inline int end_position() const; |
| 7382 inline void set_end_position(int end_position); |
| 7383 |
| 7384 // Indicates that the function should be skipped during stepping. |
| 7385 DECL_BOOLEAN_ACCESSORS(debug_is_blackboxed) |
| 7386 |
| 7387 // Indicates that |debug_is_blackboxed| has been computed and set. |
| 7388 DECL_BOOLEAN_ACCESSORS(computed_debug_is_blackboxed) |
| 7389 |
7374 // Bit field containing various information collected by the compiler to | 7390 // Bit field containing various information collected by the compiler to |
7375 // drive optimization. | 7391 // drive optimization. |
7376 inline int compiler_hints() const; | 7392 inline int compiler_hints() const; |
7377 inline void set_compiler_hints(int value); | 7393 inline void set_compiler_hints(int value); |
7378 | 7394 |
7379 inline int ast_node_count() const; | 7395 inline int ast_node_count() const; |
7380 inline void set_ast_node_count(int count); | 7396 inline void set_ast_node_count(int count); |
7381 | 7397 |
7382 inline int profiler_ticks() const; | 7398 inline int profiler_ticks() const; |
7383 inline void set_profiler_ticks(int ticks); | 7399 inline void set_profiler_ticks(int ticks); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7607 #if V8_HOST_ARCH_32_BIT | 7623 #if V8_HOST_ARCH_32_BIT |
7608 // Smi fields. | 7624 // Smi fields. |
7609 static const int kLengthOffset = kLastPointerFieldOffset + kPointerSize; | 7625 static const int kLengthOffset = kLastPointerFieldOffset + kPointerSize; |
7610 static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize; | 7626 static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize; |
7611 static const int kExpectedNofPropertiesOffset = | 7627 static const int kExpectedNofPropertiesOffset = |
7612 kFormalParameterCountOffset + kPointerSize; | 7628 kFormalParameterCountOffset + kPointerSize; |
7613 static const int kNumLiteralsOffset = | 7629 static const int kNumLiteralsOffset = |
7614 kExpectedNofPropertiesOffset + kPointerSize; | 7630 kExpectedNofPropertiesOffset + kPointerSize; |
7615 static const int kStartPositionAndTypeOffset = | 7631 static const int kStartPositionAndTypeOffset = |
7616 kNumLiteralsOffset + kPointerSize; | 7632 kNumLiteralsOffset + kPointerSize; |
7617 static const int kEndPositionOffset = | 7633 static const int kEndPositionAndIsBlackboxedOffset = |
7618 kStartPositionAndTypeOffset + kPointerSize; | 7634 kStartPositionAndTypeOffset + kPointerSize; |
7619 static const int kFunctionTokenPositionOffset = | 7635 static const int kFunctionTokenPositionOffset = |
7620 kEndPositionOffset + kPointerSize; | 7636 kEndPositionAndIsBlackboxedOffset + kPointerSize; |
7621 static const int kCompilerHintsOffset = | 7637 static const int kCompilerHintsOffset = |
7622 kFunctionTokenPositionOffset + kPointerSize; | 7638 kFunctionTokenPositionOffset + kPointerSize; |
7623 static const int kOptCountAndBailoutReasonOffset = | 7639 static const int kOptCountAndBailoutReasonOffset = |
7624 kCompilerHintsOffset + kPointerSize; | 7640 kCompilerHintsOffset + kPointerSize; |
7625 static const int kCountersOffset = | 7641 static const int kCountersOffset = |
7626 kOptCountAndBailoutReasonOffset + kPointerSize; | 7642 kOptCountAndBailoutReasonOffset + kPointerSize; |
7627 static const int kAstNodeCountOffset = | 7643 static const int kAstNodeCountOffset = |
7628 kCountersOffset + kPointerSize; | 7644 kCountersOffset + kPointerSize; |
7629 static const int kProfilerTicksOffset = | 7645 static const int kProfilerTicksOffset = |
7630 kAstNodeCountOffset + kPointerSize; | 7646 kAstNodeCountOffset + kPointerSize; |
(...skipping 12 matching lines...) Expand all Loading... |
7643 #if V8_TARGET_LITTLE_ENDIAN | 7659 #if V8_TARGET_LITTLE_ENDIAN |
7644 static const int kLengthOffset = kLastPointerFieldOffset + kPointerSize; | 7660 static const int kLengthOffset = kLastPointerFieldOffset + kPointerSize; |
7645 static const int kFormalParameterCountOffset = | 7661 static const int kFormalParameterCountOffset = |
7646 kLengthOffset + kIntSize; | 7662 kLengthOffset + kIntSize; |
7647 | 7663 |
7648 static const int kExpectedNofPropertiesOffset = | 7664 static const int kExpectedNofPropertiesOffset = |
7649 kFormalParameterCountOffset + kIntSize; | 7665 kFormalParameterCountOffset + kIntSize; |
7650 static const int kNumLiteralsOffset = | 7666 static const int kNumLiteralsOffset = |
7651 kExpectedNofPropertiesOffset + kIntSize; | 7667 kExpectedNofPropertiesOffset + kIntSize; |
7652 | 7668 |
7653 static const int kEndPositionOffset = | 7669 static const int kEndPositionAndIsBlackboxedOffset = |
7654 kNumLiteralsOffset + kIntSize; | 7670 kNumLiteralsOffset + kIntSize; |
7655 static const int kStartPositionAndTypeOffset = | 7671 static const int kStartPositionAndTypeOffset = |
7656 kEndPositionOffset + kIntSize; | 7672 kEndPositionAndIsBlackboxedOffset + kIntSize; |
7657 | 7673 |
7658 static const int kFunctionTokenPositionOffset = | 7674 static const int kFunctionTokenPositionOffset = |
7659 kStartPositionAndTypeOffset + kIntSize; | 7675 kStartPositionAndTypeOffset + kIntSize; |
7660 static const int kCompilerHintsOffset = | 7676 static const int kCompilerHintsOffset = |
7661 kFunctionTokenPositionOffset + kIntSize; | 7677 kFunctionTokenPositionOffset + kIntSize; |
7662 | 7678 |
7663 static const int kOptCountAndBailoutReasonOffset = | 7679 static const int kOptCountAndBailoutReasonOffset = |
7664 kCompilerHintsOffset + kIntSize; | 7680 kCompilerHintsOffset + kIntSize; |
7665 static const int kCountersOffset = | 7681 static const int kCountersOffset = |
7666 kOptCountAndBailoutReasonOffset + kIntSize; | 7682 kOptCountAndBailoutReasonOffset + kIntSize; |
7667 | 7683 |
7668 static const int kAstNodeCountOffset = | 7684 static const int kAstNodeCountOffset = |
7669 kCountersOffset + kIntSize; | 7685 kCountersOffset + kIntSize; |
7670 static const int kProfilerTicksOffset = | 7686 static const int kProfilerTicksOffset = |
7671 kAstNodeCountOffset + kIntSize; | 7687 kAstNodeCountOffset + kIntSize; |
7672 | 7688 |
7673 // Total size. | 7689 // Total size. |
7674 static const int kSize = kProfilerTicksOffset + kIntSize; | 7690 static const int kSize = kProfilerTicksOffset + kIntSize; |
7675 | 7691 |
7676 #elif V8_TARGET_BIG_ENDIAN | 7692 #elif V8_TARGET_BIG_ENDIAN |
7677 static const int kFormalParameterCountOffset = | 7693 static const int kFormalParameterCountOffset = |
7678 kLastPointerFieldOffset + kPointerSize; | 7694 kLastPointerFieldOffset + kPointerSize; |
7679 static const int kLengthOffset = kFormalParameterCountOffset + kIntSize; | 7695 static const int kLengthOffset = kFormalParameterCountOffset + kIntSize; |
7680 | 7696 |
7681 static const int kNumLiteralsOffset = kLengthOffset + kIntSize; | 7697 static const int kNumLiteralsOffset = kLengthOffset + kIntSize; |
7682 static const int kExpectedNofPropertiesOffset = kNumLiteralsOffset + kIntSize; | 7698 static const int kExpectedNofPropertiesOffset = kNumLiteralsOffset + kIntSize; |
7683 | 7699 |
7684 static const int kStartPositionAndTypeOffset = | 7700 static const int kStartPositionAndTypeOffset = |
7685 kExpectedNofPropertiesOffset + kIntSize; | 7701 kExpectedNofPropertiesOffset + kIntSize; |
7686 static const int kEndPositionOffset = kStartPositionAndTypeOffset + kIntSize; | 7702 static const int kEndPositionAndIsBlackboxedOffset = |
| 7703 kStartPositionAndTypeOffset + kIntSize; |
7687 | 7704 |
7688 static const int kCompilerHintsOffset = kEndPositionOffset + kIntSize; | 7705 static const int kCompilerHintsOffset = |
| 7706 kEndPositionAndIsBlackboxedOffset + kIntSize; |
7689 static const int kFunctionTokenPositionOffset = | 7707 static const int kFunctionTokenPositionOffset = |
7690 kCompilerHintsOffset + kIntSize; | 7708 kCompilerHintsOffset + kIntSize; |
7691 | 7709 |
7692 static const int kCountersOffset = kFunctionTokenPositionOffset + kIntSize; | 7710 static const int kCountersOffset = kFunctionTokenPositionOffset + kIntSize; |
7693 static const int kOptCountAndBailoutReasonOffset = kCountersOffset + kIntSize; | 7711 static const int kOptCountAndBailoutReasonOffset = kCountersOffset + kIntSize; |
7694 | 7712 |
7695 static const int kProfilerTicksOffset = | 7713 static const int kProfilerTicksOffset = |
7696 kOptCountAndBailoutReasonOffset + kIntSize; | 7714 kOptCountAndBailoutReasonOffset + kIntSize; |
7697 static const int kAstNodeCountOffset = kProfilerTicksOffset + kIntSize; | 7715 static const int kAstNodeCountOffset = kProfilerTicksOffset + kIntSize; |
7698 | 7716 |
7699 // Total size. | 7717 // Total size. |
7700 static const int kSize = kAstNodeCountOffset + kIntSize; | 7718 static const int kSize = kAstNodeCountOffset + kIntSize; |
7701 | 7719 |
7702 #else | 7720 #else |
7703 #error Unknown byte ordering | 7721 #error Unknown byte ordering |
7704 #endif // Big endian | 7722 #endif // Big endian |
7705 #endif // 64-bit | 7723 #endif // 64-bit |
7706 | 7724 |
7707 | 7725 |
7708 static const int kAlignedSize = POINTER_SIZE_ALIGN(kSize); | 7726 static const int kAlignedSize = POINTER_SIZE_ALIGN(kSize); |
7709 | 7727 |
7710 typedef FixedBodyDescriptor<kCodeOffset, | 7728 typedef FixedBodyDescriptor<kCodeOffset, |
7711 kLastPointerFieldOffset + kPointerSize, kSize> | 7729 kLastPointerFieldOffset + kPointerSize, kSize> |
7712 BodyDescriptor; | 7730 BodyDescriptor; |
7713 typedef FixedBodyDescriptor<kNameOffset, | 7731 typedef FixedBodyDescriptor<kNameOffset, |
7714 kLastPointerFieldOffset + kPointerSize, kSize> | 7732 kLastPointerFieldOffset + kPointerSize, kSize> |
7715 BodyDescriptorWeakCode; | 7733 BodyDescriptorWeakCode; |
7716 | 7734 |
7717 // Bit positions in start_position_and_type. | 7735 // Bit positions in start_position_and_type and |
7718 // The source code start position is in the 30 most significant bits of | 7736 // end_position_and_is_blackboxed. |
7719 // the start_position_and_type field. | 7737 // The source code position is in the 30 most significant bits of |
| 7738 // the field. |
7720 static const int kIsNamedExpressionBit = 0; | 7739 static const int kIsNamedExpressionBit = 0; |
7721 static const int kIsTopLevelBit = 1; | 7740 static const int kIsTopLevelBit = 1; |
7722 static const int kStartPositionShift = 2; | 7741 static const int kIsBlackboxedBit = 0; |
7723 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); | 7742 static const int kIsBlackboxedComputedBit = 1; |
| 7743 static const int kPositionShift = 2; |
| 7744 static const int kPositionMask = ~((1 << kPositionShift) - 1); |
7724 | 7745 |
7725 // Bit positions in compiler_hints. | 7746 // Bit positions in compiler_hints. |
7726 enum CompilerHints { | 7747 enum CompilerHints { |
7727 // byte 0 | 7748 // byte 0 |
7728 kAllowLazyCompilation, | 7749 kAllowLazyCompilation, |
7729 kMarkedForTierUp, | 7750 kMarkedForTierUp, |
7730 kOptimizationDisabled, | 7751 kOptimizationDisabled, |
7731 kHasDuplicateParameters, | 7752 kHasDuplicateParameters, |
7732 kNative, | 7753 kNative, |
7733 kStrictModeFunction, | 7754 kStrictModeFunction, |
(...skipping 3963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11697 } | 11718 } |
11698 }; | 11719 }; |
11699 | 11720 |
11700 | 11721 |
11701 } // NOLINT, false-positive due to second-order macros. | 11722 } // NOLINT, false-positive due to second-order macros. |
11702 } // NOLINT, false-positive due to second-order macros. | 11723 } // NOLINT, false-positive due to second-order macros. |
11703 | 11724 |
11704 #include "src/objects/object-macros-undef.h" | 11725 #include "src/objects/object-macros-undef.h" |
11705 | 11726 |
11706 #endif // V8_OBJECTS_H_ | 11727 #endif // V8_OBJECTS_H_ |
OLD | NEW |