| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 2726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2737 inline void set_instruction_size(int value); | 2737 inline void set_instruction_size(int value); |
| 2738 | 2738 |
| 2739 // [relocation_info]: Code relocation information | 2739 // [relocation_info]: Code relocation information |
| 2740 DECL_ACCESSORS(relocation_info, ByteArray) | 2740 DECL_ACCESSORS(relocation_info, ByteArray) |
| 2741 | 2741 |
| 2742 // Unchecked accessor to be used during GC. | 2742 // Unchecked accessor to be used during GC. |
| 2743 inline ByteArray* unchecked_relocation_info(); | 2743 inline ByteArray* unchecked_relocation_info(); |
| 2744 | 2744 |
| 2745 inline int relocation_size(); | 2745 inline int relocation_size(); |
| 2746 | 2746 |
| 2747 // [sinfo_size]: Size of scope information. | |
| 2748 inline int sinfo_size(); | |
| 2749 inline void set_sinfo_size(int value); | |
| 2750 | |
| 2751 // [flags]: Various code flags. | 2747 // [flags]: Various code flags. |
| 2752 inline Flags flags(); | 2748 inline Flags flags(); |
| 2753 inline void set_flags(Flags flags); | 2749 inline void set_flags(Flags flags); |
| 2754 | 2750 |
| 2755 // [flags]: Access to specific code flags. | 2751 // [flags]: Access to specific code flags. |
| 2756 inline Kind kind(); | 2752 inline Kind kind(); |
| 2757 inline InlineCacheState ic_state(); // Only valid for IC stubs. | 2753 inline InlineCacheState ic_state(); // Only valid for IC stubs. |
| 2758 inline InLoopFlag ic_in_loop(); // Only valid for IC stubs. | 2754 inline InLoopFlag ic_in_loop(); // Only valid for IC stubs. |
| 2759 inline PropertyType type(); // Only valid for monomorphic IC stubs. | 2755 inline PropertyType type(); // Only valid for monomorphic IC stubs. |
| 2760 inline int arguments_count(); // Only valid for call IC stubs. | 2756 inline int arguments_count(); // Only valid for call IC stubs. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2809 | 2805 |
| 2810 // Returns the address of the first relocation info (read backwards!). | 2806 // Returns the address of the first relocation info (read backwards!). |
| 2811 inline byte* relocation_start(); | 2807 inline byte* relocation_start(); |
| 2812 | 2808 |
| 2813 // Code entry point. | 2809 // Code entry point. |
| 2814 inline byte* entry(); | 2810 inline byte* entry(); |
| 2815 | 2811 |
| 2816 // Returns true if pc is inside this object's instructions. | 2812 // Returns true if pc is inside this object's instructions. |
| 2817 inline bool contains(byte* pc); | 2813 inline bool contains(byte* pc); |
| 2818 | 2814 |
| 2819 // Returns the address of the scope information. | |
| 2820 inline byte* sinfo_start(); | |
| 2821 | |
| 2822 // Relocate the code by delta bytes. Called to signal that this code | 2815 // Relocate the code by delta bytes. Called to signal that this code |
| 2823 // object has been moved by delta bytes. | 2816 // object has been moved by delta bytes. |
| 2824 void Relocate(intptr_t delta); | 2817 void Relocate(intptr_t delta); |
| 2825 | 2818 |
| 2826 // Migrate code described by desc. | 2819 // Migrate code described by desc. |
| 2827 void CopyFrom(const CodeDesc& desc); | 2820 void CopyFrom(const CodeDesc& desc); |
| 2828 | 2821 |
| 2829 // Returns the object size for a given body and sinfo size (Used for | 2822 // Returns the object size for a given body (used for allocation). |
| 2830 // allocation). | 2823 static int SizeFor(int body_size) { |
| 2831 static int SizeFor(int body_size, int sinfo_size) { | |
| 2832 ASSERT_SIZE_TAG_ALIGNED(body_size); | 2824 ASSERT_SIZE_TAG_ALIGNED(body_size); |
| 2833 ASSERT_SIZE_TAG_ALIGNED(sinfo_size); | 2825 return RoundUp(kHeaderSize + body_size, kCodeAlignment); |
| 2834 return RoundUp(kHeaderSize + body_size + sinfo_size, kCodeAlignment); | |
| 2835 } | 2826 } |
| 2836 | 2827 |
| 2837 // Calculate the size of the code object to report for log events. This takes | 2828 // Calculate the size of the code object to report for log events. This takes |
| 2838 // the layout of the code object into account. | 2829 // the layout of the code object into account. |
| 2839 int ExecutableSize() { | 2830 int ExecutableSize() { |
| 2840 // Check that the assumptions about the layout of the code object holds. | 2831 // Check that the assumptions about the layout of the code object holds. |
| 2841 ASSERT_EQ(static_cast<int>(instruction_start() - address()), | 2832 ASSERT_EQ(static_cast<int>(instruction_start() - address()), |
| 2842 Code::kHeaderSize); | 2833 Code::kHeaderSize); |
| 2843 return instruction_size() + Code::kHeaderSize; | 2834 return instruction_size() + Code::kHeaderSize; |
| 2844 } | 2835 } |
| 2845 | 2836 |
| 2846 // Locating source position. | 2837 // Locating source position. |
| 2847 int SourcePosition(Address pc); | 2838 int SourcePosition(Address pc); |
| 2848 int SourceStatementPosition(Address pc); | 2839 int SourceStatementPosition(Address pc); |
| 2849 | 2840 |
| 2850 // Casting. | 2841 // Casting. |
| 2851 static inline Code* cast(Object* obj); | 2842 static inline Code* cast(Object* obj); |
| 2852 | 2843 |
| 2853 // Dispatched behavior. | 2844 // Dispatched behavior. |
| 2854 int CodeSize() { return SizeFor(body_size(), sinfo_size()); } | 2845 int CodeSize() { return SizeFor(body_size()); } |
| 2855 void CodeIterateBody(ObjectVisitor* v); | 2846 void CodeIterateBody(ObjectVisitor* v); |
| 2856 #ifdef DEBUG | 2847 #ifdef DEBUG |
| 2857 void CodePrint(); | 2848 void CodePrint(); |
| 2858 void CodeVerify(); | 2849 void CodeVerify(); |
| 2859 #endif | 2850 #endif |
| 2860 // Code entry points are aligned to 32 bytes. | 2851 // Code entry points are aligned to 32 bytes. |
| 2861 static const int kCodeAlignmentBits = 5; | 2852 static const int kCodeAlignmentBits = 5; |
| 2862 static const int kCodeAlignment = 1 << kCodeAlignmentBits; | 2853 static const int kCodeAlignment = 1 << kCodeAlignmentBits; |
| 2863 static const int kCodeAlignmentMask = kCodeAlignment - 1; | 2854 static const int kCodeAlignmentMask = kCodeAlignment - 1; |
| 2864 | 2855 |
| 2865 // Layout description. | 2856 // Layout description. |
| 2866 static const int kInstructionSizeOffset = HeapObject::kHeaderSize; | 2857 static const int kInstructionSizeOffset = HeapObject::kHeaderSize; |
| 2867 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize; | 2858 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize; |
| 2868 static const int kSInfoSizeOffset = kRelocationInfoOffset + kPointerSize; | 2859 static const int kFlagsOffset = kRelocationInfoOffset + kPointerSize; |
| 2869 static const int kFlagsOffset = kSInfoSizeOffset + kIntSize; | |
| 2870 static const int kKindSpecificFlagsOffset = kFlagsOffset + kIntSize; | 2860 static const int kKindSpecificFlagsOffset = kFlagsOffset + kIntSize; |
| 2871 // Add padding to align the instruction start following right after | 2861 // Add padding to align the instruction start following right after |
| 2872 // the Code object header. | 2862 // the Code object header. |
| 2873 static const int kHeaderSize = | 2863 static const int kHeaderSize = |
| 2874 (kKindSpecificFlagsOffset + kIntSize + kCodeAlignmentMask) & | 2864 (kKindSpecificFlagsOffset + kIntSize + kCodeAlignmentMask) & |
| 2875 ~kCodeAlignmentMask; | 2865 ~kCodeAlignmentMask; |
| 2876 | 2866 |
| 2877 // Byte offsets within kKindSpecificFlagsOffset. | 2867 // Byte offsets within kKindSpecificFlagsOffset. |
| 2878 static const int kStubMajorKeyOffset = kKindSpecificFlagsOffset + 1; | 2868 static const int kStubMajorKeyOffset = kKindSpecificFlagsOffset + 1; |
| 2879 | 2869 |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3266 // SharedFunctionInfo describes the JSFunction information that can be | 3256 // SharedFunctionInfo describes the JSFunction information that can be |
| 3267 // shared by multiple instances of the function. | 3257 // shared by multiple instances of the function. |
| 3268 class SharedFunctionInfo: public HeapObject { | 3258 class SharedFunctionInfo: public HeapObject { |
| 3269 public: | 3259 public: |
| 3270 // [name]: Function name. | 3260 // [name]: Function name. |
| 3271 DECL_ACCESSORS(name, Object) | 3261 DECL_ACCESSORS(name, Object) |
| 3272 | 3262 |
| 3273 // [code]: Function code. | 3263 // [code]: Function code. |
| 3274 DECL_ACCESSORS(code, Code) | 3264 DECL_ACCESSORS(code, Code) |
| 3275 | 3265 |
| 3266 // [scope_info]: Scope info. |
| 3267 DECL_ACCESSORS(scope_info, Object) |
| 3268 |
| 3276 // [construct stub]: Code stub for constructing instances of this function. | 3269 // [construct stub]: Code stub for constructing instances of this function. |
| 3277 DECL_ACCESSORS(construct_stub, Code) | 3270 DECL_ACCESSORS(construct_stub, Code) |
| 3278 | 3271 |
| 3279 // Returns if this function has been compiled to native code yet. | 3272 // Returns if this function has been compiled to native code yet. |
| 3280 inline bool is_compiled(); | 3273 inline bool is_compiled(); |
| 3281 | 3274 |
| 3282 // [length]: The function length - usually the number of declared parameters. | 3275 // [length]: The function length - usually the number of declared parameters. |
| 3283 // Use up to 2^30 parameters. | 3276 // Use up to 2^30 parameters. |
| 3284 inline int length(); | 3277 inline int length(); |
| 3285 inline void set_length(int value); | 3278 inline void set_length(int value); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3419 // Casting. | 3412 // Casting. |
| 3420 static inline SharedFunctionInfo* cast(Object* obj); | 3413 static inline SharedFunctionInfo* cast(Object* obj); |
| 3421 | 3414 |
| 3422 // Constants. | 3415 // Constants. |
| 3423 static const int kDontAdaptArgumentsSentinel = -1; | 3416 static const int kDontAdaptArgumentsSentinel = -1; |
| 3424 | 3417 |
| 3425 // Layout description. | 3418 // Layout description. |
| 3426 // Pointer fields. | 3419 // Pointer fields. |
| 3427 static const int kNameOffset = HeapObject::kHeaderSize; | 3420 static const int kNameOffset = HeapObject::kHeaderSize; |
| 3428 static const int kCodeOffset = kNameOffset + kPointerSize; | 3421 static const int kCodeOffset = kNameOffset + kPointerSize; |
| 3429 static const int kConstructStubOffset = kCodeOffset + kPointerSize; | 3422 static const int kScopeInfoOffset = kCodeOffset + kPointerSize; |
| 3423 static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize; |
| 3430 static const int kInstanceClassNameOffset = | 3424 static const int kInstanceClassNameOffset = |
| 3431 kConstructStubOffset + kPointerSize; | 3425 kConstructStubOffset + kPointerSize; |
| 3432 static const int kFunctionDataOffset = | 3426 static const int kFunctionDataOffset = |
| 3433 kInstanceClassNameOffset + kPointerSize; | 3427 kInstanceClassNameOffset + kPointerSize; |
| 3434 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; | 3428 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; |
| 3435 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; | 3429 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; |
| 3436 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; | 3430 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; |
| 3437 static const int kThisPropertyAssignmentsOffset = | 3431 static const int kThisPropertyAssignmentsOffset = |
| 3438 kInferredNameOffset + kPointerSize; | 3432 kInferredNameOffset + kPointerSize; |
| 3439 #if V8_HOST_ARCH_32_BIT | 3433 #if V8_HOST_ARCH_32_BIT |
| (...skipping 1917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5357 } else { | 5351 } else { |
| 5358 value &= ~(1 << bit_position); | 5352 value &= ~(1 << bit_position); |
| 5359 } | 5353 } |
| 5360 return value; | 5354 return value; |
| 5361 } | 5355 } |
| 5362 }; | 5356 }; |
| 5363 | 5357 |
| 5364 } } // namespace v8::internal | 5358 } } // namespace v8::internal |
| 5365 | 5359 |
| 5366 #endif // V8_OBJECTS_H_ | 5360 #endif // V8_OBJECTS_H_ |
| OLD | NEW |