 Chromium Code Reviews
 Chromium Code Reviews Issue 2632503003:
  [runtime] Allocate space for computed property names  (Closed)
    
  
    Issue 2632503003:
  [runtime] Allocate space for computed property names  (Closed) 
  | 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 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1055 V(FrameArray) \ | 1055 V(FrameArray) \ | 
| 1056 V(TransitionArray) \ | 1056 V(TransitionArray) \ | 
| 1057 V(LiteralsArray) \ | 1057 V(LiteralsArray) \ | 
| 1058 V(TypeFeedbackMetadata) \ | 1058 V(TypeFeedbackMetadata) \ | 
| 1059 V(TypeFeedbackVector) \ | 1059 V(TypeFeedbackVector) \ | 
| 1060 V(DeoptimizationInputData) \ | 1060 V(DeoptimizationInputData) \ | 
| 1061 V(DeoptimizationOutputData) \ | 1061 V(DeoptimizationOutputData) \ | 
| 1062 V(DependentCode) \ | 1062 V(DependentCode) \ | 
| 1063 V(HandlerTable) \ | 1063 V(HandlerTable) \ | 
| 1064 V(FixedArray) \ | 1064 V(FixedArray) \ | 
| 1065 V(ConstantProperties) \ | |
| 1065 V(FixedDoubleArray) \ | 1066 V(FixedDoubleArray) \ | 
| 1066 V(WeakFixedArray) \ | 1067 V(WeakFixedArray) \ | 
| 1067 V(ArrayList) \ | 1068 V(ArrayList) \ | 
| 1068 V(RegExpMatchInfo) \ | 1069 V(RegExpMatchInfo) \ | 
| 1069 V(Context) \ | 1070 V(Context) \ | 
| 1070 V(ScriptContextTable) \ | 1071 V(ScriptContextTable) \ | 
| 1071 V(NativeContext) \ | 1072 V(NativeContext) \ | 
| 1072 V(ScopeInfo) \ | 1073 V(ScopeInfo) \ | 
| 1073 V(ModuleInfo) \ | 1074 V(ModuleInfo) \ | 
| 1074 V(JSBoundFunction) \ | 1075 V(JSBoundFunction) \ | 
| (...skipping 1832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2907 static inline void NoWriteBarrierSet(FixedArray* array, | 2908 static inline void NoWriteBarrierSet(FixedArray* array, | 
| 2908 int index, | 2909 int index, | 
| 2909 Object* value); | 2910 Object* value); | 
| 2910 | 2911 | 
| 2911 private: | 2912 private: | 
| 2912 STATIC_ASSERT(kHeaderSize == Internals::kFixedArrayHeaderSize); | 2913 STATIC_ASSERT(kHeaderSize == Internals::kFixedArrayHeaderSize); | 
| 2913 | 2914 | 
| 2914 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedArray); | 2915 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedArray); | 
| 2915 }; | 2916 }; | 
| 2916 | 2917 | 
| 2918 // ConstantProperties is a special FixedArray of constant properties that | |
| 2919 // provides access to the total number of properties (constant and | |
| 2920 // non-constant). | |
| 2921 // Usually, the number of properties is half the length of the | |
| 2922 // FixedArray (half because it consists of key-value pairs), but there could | |
| 2923 // have been non-constant property names for which we need to allocate space in | |
| 2924 // the property backing store as well. | |
| 2925 // The parser stores the total number after the last object in | |
| 2926 // the FixedArray. ConstantProperties simplifies access to this number. | |
| 
Toon Verwaest
2017/01/18 08:49:53
What about also adding name(i) and value(i) which
 
Franzi
2017/01/18 14:23:10
name() and value() looks nice. Thanks! Changed the
 | |
| 2927 class ConstantProperties : public FixedArray { | |
| 2928 public: | |
| 2929 // Number of constant and non-constant properties. | |
| 2930 int const number_of_properties(); | |
| 2931 // Actual size of the FixedArray, i.e., twice the number of constant | |
| 2932 // properties without the field that contains the total number. | |
| 2933 int const length(); | |
| 2934 | |
| 2935 DECLARE_CAST(ConstantProperties) | |
| 2936 | |
| 2937 private: | |
| 2938 bool const has_number_of_properties(); | |
| 2939 }; | |
| 2917 | 2940 | 
| 2918 // FixedDoubleArray describes fixed-sized arrays with element type double. | 2941 // FixedDoubleArray describes fixed-sized arrays with element type double. | 
| 2919 class FixedDoubleArray: public FixedArrayBase { | 2942 class FixedDoubleArray: public FixedArrayBase { | 
| 2920 public: | 2943 public: | 
| 2921 // Setter and getter for elements. | 2944 // Setter and getter for elements. | 
| 2922 inline double get_scalar(int index); | 2945 inline double get_scalar(int index); | 
| 2923 inline uint64_t get_representation(int index); | 2946 inline uint64_t get_representation(int index); | 
| 2924 static inline Handle<Object> get(FixedDoubleArray* array, int index, | 2947 static inline Handle<Object> get(FixedDoubleArray* array, int index, | 
| 2925 Isolate* isolate); | 2948 Isolate* isolate); | 
| 2926 inline void set(int index, double value); | 2949 inline void set(int index, double value); | 
| (...skipping 3463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6390 // of endianess. Also provide endian-independent offset to that 16-bit word. | 6413 // of endianess. Also provide endian-independent offset to that 16-bit word. | 
| 6391 static const int kInstanceTypeOffset = kInstanceAttributesOffset + 0; | 6414 static const int kInstanceTypeOffset = kInstanceAttributesOffset + 0; | 
| 6392 static const int kBitFieldOffset = kInstanceAttributesOffset + 1; | 6415 static const int kBitFieldOffset = kInstanceAttributesOffset + 1; | 
| 6393 #else | 6416 #else | 
| 6394 static const int kBitFieldOffset = kInstanceAttributesOffset + 0; | 6417 static const int kBitFieldOffset = kInstanceAttributesOffset + 0; | 
| 6395 static const int kInstanceTypeOffset = kInstanceAttributesOffset + 1; | 6418 static const int kInstanceTypeOffset = kInstanceAttributesOffset + 1; | 
| 6396 #endif | 6419 #endif | 
| 6397 static const int kInstanceTypeAndBitFieldOffset = | 6420 static const int kInstanceTypeAndBitFieldOffset = | 
| 6398 kInstanceAttributesOffset + 0; | 6421 kInstanceAttributesOffset + 0; | 
| 6399 static const int kBitField2Offset = kInstanceAttributesOffset + 2; | 6422 static const int kBitField2Offset = kInstanceAttributesOffset + 2; | 
| 6400 static const int kUnusedPropertyFieldsByte = 3; | |
| 
Toon Verwaest
2017/01/18 08:49:53
why remove this?
 
Franzi
2017/01/18 14:23:10
Noticed that it's unused. Any reason we need to ke
 | |
| 6401 static const int kUnusedPropertyFieldsOffset = kInstanceAttributesOffset + 3; | 6423 static const int kUnusedPropertyFieldsOffset = kInstanceAttributesOffset + 3; | 
| 6402 | 6424 | 
| 6403 STATIC_ASSERT(kInstanceTypeAndBitFieldOffset == | 6425 STATIC_ASSERT(kInstanceTypeAndBitFieldOffset == | 
| 6404 Internals::kMapInstanceTypeAndBitFieldOffset); | 6426 Internals::kMapInstanceTypeAndBitFieldOffset); | 
| 6405 | 6427 | 
| 6406 // Bit positions for bit field. | 6428 // Bit positions for bit field. | 
| 6407 static const int kHasNonInstancePrototype = 0; | 6429 static const int kHasNonInstancePrototype = 0; | 
| 6408 static const int kIsCallable = 1; | 6430 static const int kIsCallable = 1; | 
| 6409 static const int kHasNamedInterceptor = 2; | 6431 static const int kHasNamedInterceptor = 2; | 
| 6410 static const int kHasIndexedInterceptor = 3; | 6432 static const int kHasIndexedInterceptor = 3; | 
| (...skipping 5285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11696 } | 11718 } | 
| 11697 }; | 11719 }; | 
| 11698 | 11720 | 
| 11699 | 11721 | 
| 11700 } // NOLINT, false-positive due to second-order macros. | 11722 } // NOLINT, false-positive due to second-order macros. | 
| 11701 } // NOLINT, false-positive due to second-order macros. | 11723 } // NOLINT, false-positive due to second-order macros. | 
| 11702 | 11724 | 
| 11703 #include "src/objects/object-macros-undef.h" | 11725 #include "src/objects/object-macros-undef.h" | 
| 11704 | 11726 | 
| 11705 #endif // V8_OBJECTS_H_ | 11727 #endif // V8_OBJECTS_H_ | 
| OLD | NEW |