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 8305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8316 static const int kForeignAddressOffset = HeapObject::kHeaderSize; | 8316 static const int kForeignAddressOffset = HeapObject::kHeaderSize; |
8317 static const int kSize = kForeignAddressOffset + kPointerSize; | 8317 static const int kSize = kForeignAddressOffset + kPointerSize; |
8318 | 8318 |
8319 STATIC_CHECK(kForeignAddressOffset == Internals::kForeignAddressOffset); | 8319 STATIC_CHECK(kForeignAddressOffset == Internals::kForeignAddressOffset); |
8320 | 8320 |
8321 private: | 8321 private: |
8322 DISALLOW_IMPLICIT_CONSTRUCTORS(Foreign); | 8322 DISALLOW_IMPLICIT_CONSTRUCTORS(Foreign); |
8323 }; | 8323 }; |
8324 | 8324 |
8325 | 8325 |
8326 class PropertyIndex; | |
8327 | |
8328 | |
8329 // The JSArray describes JavaScript Arrays | 8326 // The JSArray describes JavaScript Arrays |
8330 // Such an array can be in one of two modes: | 8327 // Such an array can be in one of two modes: |
8331 // - fast, backing storage is a FixedArray and length <= elements.length(); | 8328 // - fast, backing storage is a FixedArray and length <= elements.length(); |
8332 // Please note: push and pop can be used to grow and shrink the array. | 8329 // Please note: push and pop can be used to grow and shrink the array. |
8333 // - slow, backing storage is a HashTable with numbers as keys. | 8330 // - slow, backing storage is a HashTable with numbers as keys. |
8334 class JSArray: public JSObject { | 8331 class JSArray: public JSObject { |
8335 public: | 8332 public: |
8336 // [length]: The length property. | 8333 // [length]: The length property. |
8337 DECL_ACCESSORS(length, Object) | 8334 DECL_ACCESSORS(length, Object) |
8338 | 8335 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8372 #endif | 8369 #endif |
8373 DECLARE_VERIFIER(JSArray) | 8370 DECLARE_VERIFIER(JSArray) |
8374 | 8371 |
8375 // Number of element slots to pre-allocate for an empty array. | 8372 // Number of element slots to pre-allocate for an empty array. |
8376 static const int kPreallocatedArrayElements = 4; | 8373 static const int kPreallocatedArrayElements = 4; |
8377 | 8374 |
8378 // Layout description. | 8375 // Layout description. |
8379 static const int kLengthOffset = JSObject::kHeaderSize; | 8376 static const int kLengthOffset = JSObject::kHeaderSize; |
8380 static const int kSize = kLengthOffset + kPointerSize; | 8377 static const int kSize = kLengthOffset + kPointerSize; |
8381 | 8378 |
8382 static inline PropertyIndex ArrayLengthIndex(); | |
8383 STATIC_ASSERT(kLengthOffset % kPointerSize == 0); | |
8384 | |
8385 private: | 8379 private: |
8386 // Expand the fixed array backing of a fast-case JSArray to at least | 8380 // Expand the fixed array backing of a fast-case JSArray to at least |
8387 // the requested size. | 8381 // the requested size. |
8388 void Expand(int minimum_size_of_backing_fixed_array); | 8382 void Expand(int minimum_size_of_backing_fixed_array); |
8389 | 8383 |
8390 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArray); | 8384 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArray); |
8391 }; | 8385 }; |
8392 | 8386 |
8393 | 8387 |
8394 // JSRegExpResult is just a JSArray with a specific initial map. | 8388 // JSRegExpResult is just a JSArray with a specific initial map. |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9009 } else { | 9003 } else { |
9010 value &= ~(1 << bit_position); | 9004 value &= ~(1 << bit_position); |
9011 } | 9005 } |
9012 return value; | 9006 return value; |
9013 } | 9007 } |
9014 }; | 9008 }; |
9015 | 9009 |
9016 } } // namespace v8::internal | 9010 } } // namespace v8::internal |
9017 | 9011 |
9018 #endif // V8_OBJECTS_H_ | 9012 #endif // V8_OBJECTS_H_ |
OLD | NEW |