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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
398 V(ALLOCATION_SITE_TYPE) \ | 398 V(ALLOCATION_SITE_TYPE) \ |
399 V(SCRIPT_TYPE) \ | 399 V(SCRIPT_TYPE) \ |
400 V(CODE_CACHE_TYPE) \ | 400 V(CODE_CACHE_TYPE) \ |
401 V(POLYMORPHIC_CODE_CACHE_TYPE) \ | 401 V(POLYMORPHIC_CODE_CACHE_TYPE) \ |
402 V(TYPE_FEEDBACK_INFO_TYPE) \ | 402 V(TYPE_FEEDBACK_INFO_TYPE) \ |
403 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ | 403 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ |
404 V(BOX_TYPE) \ | 404 V(BOX_TYPE) \ |
405 \ | 405 \ |
406 V(FIXED_ARRAY_TYPE) \ | 406 V(FIXED_ARRAY_TYPE) \ |
407 V(FIXED_DOUBLE_ARRAY_TYPE) \ | 407 V(FIXED_DOUBLE_ARRAY_TYPE) \ |
408 V(CONSTANT_POOL_ARRAY_TYPE) \ | |
408 V(SHARED_FUNCTION_INFO_TYPE) \ | 409 V(SHARED_FUNCTION_INFO_TYPE) \ |
409 \ | 410 \ |
410 V(JS_MESSAGE_OBJECT_TYPE) \ | 411 V(JS_MESSAGE_OBJECT_TYPE) \ |
411 \ | 412 \ |
412 V(JS_VALUE_TYPE) \ | 413 V(JS_VALUE_TYPE) \ |
413 V(JS_DATE_TYPE) \ | 414 V(JS_DATE_TYPE) \ |
414 V(JS_OBJECT_TYPE) \ | 415 V(JS_OBJECT_TYPE) \ |
415 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ | 416 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ |
416 V(JS_GENERATOR_OBJECT_TYPE) \ | 417 V(JS_GENERATOR_OBJECT_TYPE) \ |
417 V(JS_MODULE_TYPE) \ | 418 V(JS_MODULE_TYPE) \ |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
718 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE | 719 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE |
719 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE, | 720 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE, |
720 EXTERNAL_SHORT_ARRAY_TYPE, | 721 EXTERNAL_SHORT_ARRAY_TYPE, |
721 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE, | 722 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE, |
722 EXTERNAL_INT_ARRAY_TYPE, | 723 EXTERNAL_INT_ARRAY_TYPE, |
723 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE, | 724 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE, |
724 EXTERNAL_FLOAT_ARRAY_TYPE, | 725 EXTERNAL_FLOAT_ARRAY_TYPE, |
725 EXTERNAL_DOUBLE_ARRAY_TYPE, | 726 EXTERNAL_DOUBLE_ARRAY_TYPE, |
726 EXTERNAL_PIXEL_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE | 727 EXTERNAL_PIXEL_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE |
727 FIXED_DOUBLE_ARRAY_TYPE, | 728 FIXED_DOUBLE_ARRAY_TYPE, |
729 CONSTANT_POOL_ARRAY_TYPE, | |
728 FILLER_TYPE, // LAST_DATA_TYPE | 730 FILLER_TYPE, // LAST_DATA_TYPE |
729 | 731 |
730 // Structs. | 732 // Structs. |
731 DECLARED_ACCESSOR_DESCRIPTOR_TYPE, | 733 DECLARED_ACCESSOR_DESCRIPTOR_TYPE, |
732 DECLARED_ACCESSOR_INFO_TYPE, | 734 DECLARED_ACCESSOR_INFO_TYPE, |
733 EXECUTABLE_ACCESSOR_INFO_TYPE, | 735 EXECUTABLE_ACCESSOR_INFO_TYPE, |
734 ACCESSOR_PAIR_TYPE, | 736 ACCESSOR_PAIR_TYPE, |
735 ACCESS_CHECK_INFO_TYPE, | 737 ACCESS_CHECK_INFO_TYPE, |
736 INTERCEPTOR_INFO_TYPE, | 738 INTERCEPTOR_INFO_TYPE, |
737 CALL_HANDLER_INFO_TYPE, | 739 CALL_HANDLER_INFO_TYPE, |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1003 V(JSModule) \ | 1005 V(JSModule) \ |
1004 V(Map) \ | 1006 V(Map) \ |
1005 V(DescriptorArray) \ | 1007 V(DescriptorArray) \ |
1006 V(TransitionArray) \ | 1008 V(TransitionArray) \ |
1007 V(DeoptimizationInputData) \ | 1009 V(DeoptimizationInputData) \ |
1008 V(DeoptimizationOutputData) \ | 1010 V(DeoptimizationOutputData) \ |
1009 V(DependentCode) \ | 1011 V(DependentCode) \ |
1010 V(TypeFeedbackCells) \ | 1012 V(TypeFeedbackCells) \ |
1011 V(FixedArray) \ | 1013 V(FixedArray) \ |
1012 V(FixedDoubleArray) \ | 1014 V(FixedDoubleArray) \ |
1015 V(ConstantPoolArray) \ | |
1013 V(Context) \ | 1016 V(Context) \ |
1014 V(NativeContext) \ | 1017 V(NativeContext) \ |
1015 V(ScopeInfo) \ | 1018 V(ScopeInfo) \ |
1016 V(JSFunction) \ | 1019 V(JSFunction) \ |
1017 V(Code) \ | 1020 V(Code) \ |
1018 V(Oddball) \ | 1021 V(Oddball) \ |
1019 V(SharedFunctionInfo) \ | 1022 V(SharedFunctionInfo) \ |
1020 V(JSValue) \ | 1023 V(JSValue) \ |
1021 V(JSDate) \ | 1024 V(JSDate) \ |
1022 V(JSMessageObject) \ | 1025 V(JSMessageObject) \ |
(...skipping 1991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3014 | 3017 |
3015 // Dispatched behavior. | 3018 // Dispatched behavior. |
3016 DECLARE_PRINTER(FixedDoubleArray) | 3019 DECLARE_PRINTER(FixedDoubleArray) |
3017 DECLARE_VERIFIER(FixedDoubleArray) | 3020 DECLARE_VERIFIER(FixedDoubleArray) |
3018 | 3021 |
3019 private: | 3022 private: |
3020 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedDoubleArray); | 3023 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedDoubleArray); |
3021 }; | 3024 }; |
3022 | 3025 |
3023 | 3026 |
3027 // ConstantPoolArray describes fixed-sized arrays constant pool entires. | |
ulan
2013/09/27 12:39:10
Did you mean:
fixed-sized arrays _with_ constant p
rmcilroy
2013/10/01 11:21:52
Done.
| |
3028 // The format of the pool is: | |
3029 // [0]: Field holding the first index which is a pointer entry | |
3030 // [1]: Field holding the first index which is a int32 entry | |
3031 // [2] ... [first_ptr_index() - 1]: 64 bit entries | |
3032 // [first_ptr_index()] ... [first_int32_index() - 1]: pointer entries | |
3033 // [first_int32_index()] ... [length]: 32 bit entries | |
ulan
2013/09/27 12:39:10
[length-1] ?
rmcilroy
2013/10/01 11:21:52
Done.
| |
3034 class ConstantPoolArray: public FixedArrayBase { | |
3035 public: | |
3036 // Getters for the field storing the first index for different type entries. | |
3037 inline int first_ptr_index(); | |
3038 inline int first_int64_index(); | |
3039 inline int first_int32_index(); | |
3040 | |
3041 // Getters for counts of different type entries. | |
3042 inline int count_of_ptr_entries(); | |
3043 inline int count_of_int64_entries(); | |
3044 inline int count_of_int32_entries(); | |
3045 | |
3046 // Setter and getter for pool elements. | |
3047 inline Object* get_ptr_entry(int index); | |
3048 inline int64_t get_int64_entry(int index); | |
3049 inline int32_t get_int32_entry(int index); | |
3050 inline double get_int64_entry_as_double(int index); | |
3051 | |
3052 MUST_USE_RESULT inline MaybeObject* get(int index); | |
3053 | |
3054 inline void set(int index, Object* value); | |
3055 inline void set(int index, int64_t value); | |
3056 inline void set(int index, double value); | |
3057 inline void set(int index, int32_t value); | |
3058 | |
3059 // Set up initial state. | |
3060 inline void SetEntryCounts(int number_of_int64_entries, | |
3061 int number_of_ptr_entries, | |
3062 int number_of_int32_entries); | |
3063 | |
3064 // Copy operations | |
3065 MUST_USE_RESULT inline MaybeObject* Copy(); | |
3066 | |
3067 // Garbage collection support. | |
3068 inline static int SizeFor(int number_of_int64_entries, | |
3069 int number_of_ptr_entries, | |
3070 int number_of_int32_entries) { | |
3071 return RoundUp(OffsetAt(number_of_int64_entries, | |
3072 number_of_ptr_entries, | |
3073 number_of_int32_entries), | |
3074 kPointerSize); | |
3075 } | |
3076 | |
3077 // Code Generation support. | |
3078 inline int OffsetOfElementAt(int index) { | |
3079 ASSERT(index < length()); | |
3080 if (index >= first_int32_index()) { | |
3081 return OffsetAt(count_of_int64_entries(), count_of_ptr_entries(), | |
3082 index - first_int32_index()); | |
3083 } else if (index >= first_ptr_index()) { | |
3084 return OffsetAt(count_of_int64_entries(), index - first_ptr_index(), 0); | |
3085 } else { | |
3086 return OffsetAt(index, 0, 0); | |
3087 } | |
3088 } | |
3089 | |
3090 // Casting. | |
3091 static inline ConstantPoolArray* cast(Object* obj); | |
3092 | |
3093 // Layout description. | |
3094 static const int kFirstPointerIndexOffset = FixedArray::kHeaderSize; | |
3095 static const int kFirstInt32IndexOffset = | |
3096 kFirstPointerIndexOffset + kPointerSize; | |
3097 static const int kFirstOffset = kFirstInt32IndexOffset + kPointerSize; | |
3098 | |
3099 // Dispatched behavior. | |
3100 inline void ConstantPoolIterateBody(ObjectVisitor* v); | |
3101 | |
3102 DECLARE_PRINTER(ConstantPoolArray) | |
3103 DECLARE_VERIFIER(ConstantPoolArray) | |
3104 | |
3105 private: | |
3106 inline void set_first_ptr_index(int value); | |
3107 inline void set_first_int32_index(int value); | |
3108 | |
3109 inline static int OffsetAt(int number_of_int64_entries, | |
3110 int number_of_ptr_entries, | |
3111 int number_of_int32_entries) { | |
3112 return kFirstOffset | |
3113 + (number_of_int64_entries * kInt64Size) | |
3114 + (number_of_ptr_entries * kPointerSize) | |
3115 + (number_of_int32_entries * kInt32Size); | |
3116 } | |
3117 | |
3118 DISALLOW_IMPLICIT_CONSTRUCTORS(ConstantPoolArray); | |
3119 }; | |
3120 | |
3121 | |
3024 // DescriptorArrays are fixed arrays used to hold instance descriptors. | 3122 // DescriptorArrays are fixed arrays used to hold instance descriptors. |
3025 // The format of the these objects is: | 3123 // The format of the these objects is: |
3026 // [0]: Number of descriptors | 3124 // [0]: Number of descriptors |
3027 // [1]: Either Smi(0) if uninitialized, or a pointer to small fixed array: | 3125 // [1]: Either Smi(0) if uninitialized, or a pointer to small fixed array: |
3028 // [0]: pointer to fixed array with enum cache | 3126 // [0]: pointer to fixed array with enum cache |
3029 // [1]: either Smi(0) or pointer to fixed array with indices | 3127 // [1]: either Smi(0) or pointer to fixed array with indices |
3030 // [2]: first key | 3128 // [2]: first key |
3031 // [2 + number of descriptors * kDescriptorSize]: start of slack | 3129 // [2 + number of descriptors * kDescriptorSize]: start of slack |
3032 class DescriptorArray: public FixedArray { | 3130 class DescriptorArray: public FixedArray { |
3033 public: | 3131 public: |
(...skipping 7199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10233 } else { | 10331 } else { |
10234 value &= ~(1 << bit_position); | 10332 value &= ~(1 << bit_position); |
10235 } | 10333 } |
10236 return value; | 10334 return value; |
10237 } | 10335 } |
10238 }; | 10336 }; |
10239 | 10337 |
10240 } } // namespace v8::internal | 10338 } } // namespace v8::internal |
10241 | 10339 |
10242 #endif // V8_OBJECTS_H_ | 10340 #endif // V8_OBJECTS_H_ |
OLD | NEW |