OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
786 V(ExternalPixelArray) \ | 786 V(ExternalPixelArray) \ |
787 V(ByteArray) \ | 787 V(ByteArray) \ |
788 V(FreeSpace) \ | 788 V(FreeSpace) \ |
789 V(JSReceiver) \ | 789 V(JSReceiver) \ |
790 V(JSObject) \ | 790 V(JSObject) \ |
791 V(JSContextExtensionObject) \ | 791 V(JSContextExtensionObject) \ |
792 V(Map) \ | 792 V(Map) \ |
793 V(DescriptorArray) \ | 793 V(DescriptorArray) \ |
794 V(DeoptimizationInputData) \ | 794 V(DeoptimizationInputData) \ |
795 V(DeoptimizationOutputData) \ | 795 V(DeoptimizationOutputData) \ |
796 V(CacheCells) \ | |
796 V(FixedArray) \ | 797 V(FixedArray) \ |
797 V(FixedDoubleArray) \ | 798 V(FixedDoubleArray) \ |
798 V(Context) \ | 799 V(Context) \ |
799 V(GlobalContext) \ | 800 V(GlobalContext) \ |
800 V(ScopeInfo) \ | 801 V(ScopeInfo) \ |
801 V(JSFunction) \ | 802 V(JSFunction) \ |
802 V(Code) \ | 803 V(Code) \ |
803 V(Oddball) \ | 804 V(Oddball) \ |
804 V(SharedFunctionInfo) \ | 805 V(SharedFunctionInfo) \ |
805 V(JSValue) \ | 806 V(JSValue) \ |
(...skipping 3127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3933 | 3934 |
3934 // Casting. | 3935 // Casting. |
3935 static inline DeoptimizationOutputData* cast(Object* obj); | 3936 static inline DeoptimizationOutputData* cast(Object* obj); |
3936 | 3937 |
3937 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER) | 3938 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER) |
3938 void DeoptimizationOutputDataPrint(FILE* out); | 3939 void DeoptimizationOutputDataPrint(FILE* out); |
3939 #endif | 3940 #endif |
3940 }; | 3941 }; |
3941 | 3942 |
3942 | 3943 |
3944 // Forward declaration. | |
3945 class JSGlobalPropertyCell; | |
3946 | |
3947 // CacheCells is a fixed array used to hold the association between | |
3948 // cache cells and AST ids for code generated by the full compiler. | |
3949 // The format of the these objects is | |
3950 // [i * 2]: Global property cell of ith cache cell. | |
3951 // [i * 2 + 1]: Ast ID for ith cache cell. | |
3952 class CacheCells: public FixedArray { | |
Michael Starzinger
2012/01/27 13:03:51
As discussed offline, this was renamed to "TypeFee
| |
3953 public: | |
3954 int CellCount() { return length() / 2; } | |
3955 static int LengthOfFixedArray(int cell_count) { return cell_count * 2; } | |
3956 | |
3957 // Accessors for AST ids associated with cache values. | |
3958 inline Smi* AstId(int index); | |
3959 inline void SetAstId(int index, Smi* id); | |
3960 | |
3961 // Accessors for global property cells holding the cache values. | |
3962 inline JSGlobalPropertyCell* Cell(int index); | |
3963 inline void SetCell(int index, JSGlobalPropertyCell* cell); | |
3964 | |
3965 // The object that indicates an uninitialized cache. | |
3966 static inline Handle<Object> UninitializedSentinel(Isolate* isolate); | |
3967 | |
3968 // The object that indicates a megamorphic state. | |
3969 static inline Handle<Object> MegamorphicSentinel(Isolate* isolate); | |
3970 | |
3971 // A raw version of the uninitialized sentinel that's safe to read during | |
3972 // garbage collection (e.g., for patching the cache). | |
3973 static inline Object* RawUninitializedSentinel(Heap* heap); | |
3974 | |
3975 // Casting. | |
3976 static inline CacheCells* cast(Object* obj); | |
3977 }; | |
3978 | |
3979 | |
3980 // Forward declaration. | |
3943 class SafepointEntry; | 3981 class SafepointEntry; |
3944 | 3982 |
3945 | |
3946 // Code describes objects with on-the-fly generated machine code. | 3983 // Code describes objects with on-the-fly generated machine code. |
3947 class Code: public HeapObject { | 3984 class Code: public HeapObject { |
3948 public: | 3985 public: |
3949 // Opaque data type for encapsulating code flags like kind, inline | 3986 // Opaque data type for encapsulating code flags like kind, inline |
3950 // cache state, and arguments count. | 3987 // cache state, and arguments count. |
3951 // FLAGS_MIN_VALUE and FLAGS_MAX_VALUE are specified to ensure that | 3988 // FLAGS_MIN_VALUE and FLAGS_MAX_VALUE are specified to ensure that |
3952 // enumeration type has correct value range (see Issue 830 for more details). | 3989 // enumeration type has correct value range (see Issue 830 for more details). |
3953 enum Flags { | 3990 enum Flags { |
3954 FLAGS_MIN_VALUE = kMinInt, | 3991 FLAGS_MIN_VALUE = kMinInt, |
3955 FLAGS_MAX_VALUE = kMaxInt | 3992 FLAGS_MAX_VALUE = kMaxInt |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4006 // [relocation_info]: Code relocation information | 4043 // [relocation_info]: Code relocation information |
4007 DECL_ACCESSORS(relocation_info, ByteArray) | 4044 DECL_ACCESSORS(relocation_info, ByteArray) |
4008 void InvalidateRelocation(); | 4045 void InvalidateRelocation(); |
4009 | 4046 |
4010 // [handler_table]: Fixed array containing offsets of exception handlers. | 4047 // [handler_table]: Fixed array containing offsets of exception handlers. |
4011 DECL_ACCESSORS(handler_table, FixedArray) | 4048 DECL_ACCESSORS(handler_table, FixedArray) |
4012 | 4049 |
4013 // [deoptimization_data]: Array containing data for deopt. | 4050 // [deoptimization_data]: Array containing data for deopt. |
4014 DECL_ACCESSORS(deoptimization_data, FixedArray) | 4051 DECL_ACCESSORS(deoptimization_data, FixedArray) |
4015 | 4052 |
4053 // [cache_cells]: Array containing cache cells used for type feedback. | |
4054 DECL_ACCESSORS(cache_cells, CacheCells) | |
4055 | |
4016 // [code_flushing_candidate]: Field only used during garbage | 4056 // [code_flushing_candidate]: Field only used during garbage |
4017 // collection to hold code flushing candidates. The contents of this | 4057 // collection to hold code flushing candidates. The contents of this |
4018 // field does not have to be traced during garbage collection since | 4058 // field does not have to be traced during garbage collection since |
4019 // it is only used by the garbage collector itself. | 4059 // it is only used by the garbage collector itself. |
4020 DECL_ACCESSORS(next_code_flushing_candidate, Object) | 4060 DECL_ACCESSORS(next_code_flushing_candidate, Object) |
4021 | 4061 |
4022 // Unchecked accessors to be used during GC. | 4062 // Unchecked accessors to be used during GC. |
4023 inline ByteArray* unchecked_relocation_info(); | 4063 inline ByteArray* unchecked_relocation_info(); |
4024 inline FixedArray* unchecked_deoptimization_data(); | 4064 inline FixedArray* unchecked_deoptimization_data(); |
4025 | 4065 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4115 inline void set_binary_op_result_type(byte value); | 4155 inline void set_binary_op_result_type(byte value); |
4116 | 4156 |
4117 // [compare state]: For kind COMPARE_IC, tells what state the stub is in. | 4157 // [compare state]: For kind COMPARE_IC, tells what state the stub is in. |
4118 inline byte compare_state(); | 4158 inline byte compare_state(); |
4119 inline void set_compare_state(byte value); | 4159 inline void set_compare_state(byte value); |
4120 | 4160 |
4121 // [to_boolean_foo]: For kind TO_BOOLEAN_IC tells what state the stub is in. | 4161 // [to_boolean_foo]: For kind TO_BOOLEAN_IC tells what state the stub is in. |
4122 inline byte to_boolean_state(); | 4162 inline byte to_boolean_state(); |
4123 inline void set_to_boolean_state(byte value); | 4163 inline void set_to_boolean_state(byte value); |
4124 | 4164 |
4125 // For kind STUB, major_key == CallFunction, tells whether there is | |
4126 // a function cache in the instruction stream. | |
4127 inline bool has_function_cache(); | |
4128 inline void set_has_function_cache(bool flag); | |
4129 | |
4130 // Get the safepoint entry for the given pc. | 4165 // Get the safepoint entry for the given pc. |
4131 SafepointEntry GetSafepointEntry(Address pc); | 4166 SafepointEntry GetSafepointEntry(Address pc); |
4132 | 4167 |
4133 // Mark this code object as not having a stack check table. Assumes kind | 4168 // Mark this code object as not having a stack check table. Assumes kind |
4134 // is FUNCTION. | 4169 // is FUNCTION. |
4135 void SetNoStackCheckTable(); | 4170 void SetNoStackCheckTable(); |
4136 | 4171 |
4137 // Find the first map in an IC stub. | 4172 // Find the first map in an IC stub. |
4138 Map* FindFirstMap(); | 4173 Map* FindFirstMap(); |
4139 | 4174 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4234 // Max loop nesting marker used to postpose OSR. We don't take loop | 4269 // Max loop nesting marker used to postpose OSR. We don't take loop |
4235 // nesting that is deeper than 5 levels into account. | 4270 // nesting that is deeper than 5 levels into account. |
4236 static const int kMaxLoopNestingMarker = 6; | 4271 static const int kMaxLoopNestingMarker = 6; |
4237 | 4272 |
4238 // Layout description. | 4273 // Layout description. |
4239 static const int kInstructionSizeOffset = HeapObject::kHeaderSize; | 4274 static const int kInstructionSizeOffset = HeapObject::kHeaderSize; |
4240 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize; | 4275 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize; |
4241 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize; | 4276 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize; |
4242 static const int kDeoptimizationDataOffset = | 4277 static const int kDeoptimizationDataOffset = |
4243 kHandlerTableOffset + kPointerSize; | 4278 kHandlerTableOffset + kPointerSize; |
4279 static const int kCacheCellsOffset = kDeoptimizationDataOffset + kPointerSize; | |
4244 static const int kNextCodeFlushingCandidateOffset = | 4280 static const int kNextCodeFlushingCandidateOffset = |
4245 kDeoptimizationDataOffset + kPointerSize; | 4281 kCacheCellsOffset + kPointerSize; |
4246 static const int kFlagsOffset = | 4282 static const int kFlagsOffset = |
4247 kNextCodeFlushingCandidateOffset + kPointerSize; | 4283 kNextCodeFlushingCandidateOffset + kPointerSize; |
4248 | 4284 |
4249 static const int kKindSpecificFlagsOffset = kFlagsOffset + kIntSize; | 4285 static const int kKindSpecificFlagsOffset = kFlagsOffset + kIntSize; |
4250 static const int kKindSpecificFlagsSize = 2 * kIntSize; | 4286 static const int kKindSpecificFlagsSize = 2 * kIntSize; |
4251 | 4287 |
4252 static const int kHeaderPaddingStart = kKindSpecificFlagsOffset + | 4288 static const int kHeaderPaddingStart = kKindSpecificFlagsOffset + |
4253 kKindSpecificFlagsSize; | 4289 kKindSpecificFlagsSize; |
4254 | 4290 |
4255 // Add padding to align the instruction start following right after | 4291 // Add padding to align the instruction start following right after |
4256 // the Code object header. | 4292 // the Code object header. |
4257 static const int kHeaderSize = | 4293 static const int kHeaderSize = |
4258 (kHeaderPaddingStart + kCodeAlignmentMask) & ~kCodeAlignmentMask; | 4294 (kHeaderPaddingStart + kCodeAlignmentMask) & ~kCodeAlignmentMask; |
4259 | 4295 |
4260 // Byte offsets within kKindSpecificFlagsOffset. | 4296 // Byte offsets within kKindSpecificFlagsOffset. |
4261 static const int kStubMajorKeyOffset = kKindSpecificFlagsOffset; | 4297 static const int kStubMajorKeyOffset = kKindSpecificFlagsOffset; |
4262 static const int kOptimizableOffset = kKindSpecificFlagsOffset; | 4298 static const int kOptimizableOffset = kKindSpecificFlagsOffset; |
4263 static const int kStackSlotsOffset = kKindSpecificFlagsOffset; | 4299 static const int kStackSlotsOffset = kKindSpecificFlagsOffset; |
4264 static const int kCheckTypeOffset = kKindSpecificFlagsOffset; | 4300 static const int kCheckTypeOffset = kKindSpecificFlagsOffset; |
4265 | 4301 |
4266 static const int kUnaryOpTypeOffset = kStubMajorKeyOffset + 1; | 4302 static const int kUnaryOpTypeOffset = kStubMajorKeyOffset + 1; |
4267 static const int kBinaryOpTypeOffset = kStubMajorKeyOffset + 1; | 4303 static const int kBinaryOpTypeOffset = kStubMajorKeyOffset + 1; |
4268 static const int kCompareStateOffset = kStubMajorKeyOffset + 1; | 4304 static const int kCompareStateOffset = kStubMajorKeyOffset + 1; |
4269 static const int kToBooleanTypeOffset = kStubMajorKeyOffset + 1; | 4305 static const int kToBooleanTypeOffset = kStubMajorKeyOffset + 1; |
4270 static const int kHasFunctionCacheOffset = kStubMajorKeyOffset + 1; | |
4271 | 4306 |
4272 static const int kFullCodeFlags = kOptimizableOffset + 1; | 4307 static const int kFullCodeFlags = kOptimizableOffset + 1; |
4273 class FullCodeFlagsHasDeoptimizationSupportField: | 4308 class FullCodeFlagsHasDeoptimizationSupportField: |
4274 public BitField<bool, 0, 1> {}; // NOLINT | 4309 public BitField<bool, 0, 1> {}; // NOLINT |
4275 class FullCodeFlagsHasDebugBreakSlotsField: public BitField<bool, 1, 1> {}; | 4310 class FullCodeFlagsHasDebugBreakSlotsField: public BitField<bool, 1, 1> {}; |
4276 class FullCodeFlagsIsCompiledOptimizable: public BitField<bool, 2, 1> {}; | 4311 class FullCodeFlagsIsCompiledOptimizable: public BitField<bool, 2, 1> {}; |
4277 | 4312 |
4278 static const int kBinaryOpReturnTypeOffset = kBinaryOpTypeOffset + 1; | 4313 static const int kBinaryOpReturnTypeOffset = kBinaryOpTypeOffset + 1; |
4279 | 4314 |
4280 static const int kAllowOSRAtLoopNestingLevelOffset = kFullCodeFlags + 1; | 4315 static const int kAllowOSRAtLoopNestingLevelOffset = kFullCodeFlags + 1; |
(...skipping 1370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5651 static const int kContextOffset = JSObject::kHeaderSize; | 5686 static const int kContextOffset = JSObject::kHeaderSize; |
5652 static const int kSize = kContextOffset + kPointerSize; | 5687 static const int kSize = kContextOffset + kPointerSize; |
5653 | 5688 |
5654 private: | 5689 private: |
5655 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalProxy); | 5690 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalProxy); |
5656 }; | 5691 }; |
5657 | 5692 |
5658 | 5693 |
5659 // Forward declaration. | 5694 // Forward declaration. |
5660 class JSBuiltinsObject; | 5695 class JSBuiltinsObject; |
5661 class JSGlobalPropertyCell; | |
5662 | 5696 |
5663 // Common super class for JavaScript global objects and the special | 5697 // Common super class for JavaScript global objects and the special |
5664 // builtins global objects. | 5698 // builtins global objects. |
5665 class GlobalObject: public JSObject { | 5699 class GlobalObject: public JSObject { |
5666 public: | 5700 public: |
5667 // [builtins]: the object holding the runtime routines written in JS. | 5701 // [builtins]: the object holding the runtime routines written in JS. |
5668 DECL_ACCESSORS(builtins, JSBuiltinsObject) | 5702 DECL_ACCESSORS(builtins, JSBuiltinsObject) |
5669 | 5703 |
5670 // [global context]: the global context corresponding to this global object. | 5704 // [global context]: the global context corresponding to this global object. |
5671 DECL_ACCESSORS(global_context, Context) | 5705 DECL_ACCESSORS(global_context, Context) |
(...skipping 2482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8154 } else { | 8188 } else { |
8155 value &= ~(1 << bit_position); | 8189 value &= ~(1 << bit_position); |
8156 } | 8190 } |
8157 return value; | 8191 return value; |
8158 } | 8192 } |
8159 }; | 8193 }; |
8160 | 8194 |
8161 } } // namespace v8::internal | 8195 } } // namespace v8::internal |
8162 | 8196 |
8163 #endif // V8_OBJECTS_H_ | 8197 #endif // V8_OBJECTS_H_ |
OLD | NEW |