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 8335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8346 | 8346 |
8347 static const int kForeignAddressOffset = HeapObject::kHeaderSize; | 8347 static const int kForeignAddressOffset = HeapObject::kHeaderSize; |
8348 static const int kSize = kForeignAddressOffset + kPointerSize; | 8348 static const int kSize = kForeignAddressOffset + kPointerSize; |
8349 | 8349 |
8350 STATIC_CHECK(kForeignAddressOffset == Internals::kForeignAddressOffset); | 8350 STATIC_CHECK(kForeignAddressOffset == Internals::kForeignAddressOffset); |
8351 | 8351 |
8352 private: | 8352 private: |
8353 DISALLOW_IMPLICIT_CONSTRUCTORS(Foreign); | 8353 DISALLOW_IMPLICIT_CONSTRUCTORS(Foreign); |
8354 }; | 8354 }; |
8355 | 8355 |
8356 | 8356 class PropertyIndex; |
Jakob Kummerow
2012/11/16 12:57:10
nit: two empty lines between top-level definitions
Massi
2012/11/19 12:26:15
Done.
| |
8357 // The JSArray describes JavaScript Arrays | 8357 // The JSArray describes JavaScript Arrays |
8358 // Such an array can be in one of two modes: | 8358 // Such an array can be in one of two modes: |
8359 // - fast, backing storage is a FixedArray and length <= elements.length(); | 8359 // - fast, backing storage is a FixedArray and length <= elements.length(); |
8360 // Please note: push and pop can be used to grow and shrink the array. | 8360 // Please note: push and pop can be used to grow and shrink the array. |
8361 // - slow, backing storage is a HashTable with numbers as keys. | 8361 // - slow, backing storage is a HashTable with numbers as keys. |
8362 class JSArray: public JSObject { | 8362 class JSArray: public JSObject { |
8363 public: | 8363 public: |
8364 // [length]: The length property. | 8364 // [length]: The length property. |
8365 DECL_ACCESSORS(length, Object) | 8365 DECL_ACCESSORS(length, Object) |
8366 | 8366 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8399 #endif | 8399 #endif |
8400 DECLARE_VERIFIER(JSArray) | 8400 DECLARE_VERIFIER(JSArray) |
8401 | 8401 |
8402 // Number of element slots to pre-allocate for an empty array. | 8402 // Number of element slots to pre-allocate for an empty array. |
8403 static const int kPreallocatedArrayElements = 4; | 8403 static const int kPreallocatedArrayElements = 4; |
8404 | 8404 |
8405 // Layout description. | 8405 // Layout description. |
8406 static const int kLengthOffset = JSObject::kHeaderSize; | 8406 static const int kLengthOffset = JSObject::kHeaderSize; |
8407 static const int kSize = kLengthOffset + kPointerSize; | 8407 static const int kSize = kLengthOffset + kPointerSize; |
8408 | 8408 |
8409 static inline PropertyIndex ArrayLengthIndex(); | |
8410 STATIC_ASSERT(kLengthOffset % kPointerSize == 0); | |
8411 | |
8409 private: | 8412 private: |
8410 // Expand the fixed array backing of a fast-case JSArray to at least | 8413 // Expand the fixed array backing of a fast-case JSArray to at least |
8411 // the requested size. | 8414 // the requested size. |
8412 void Expand(int minimum_size_of_backing_fixed_array); | 8415 void Expand(int minimum_size_of_backing_fixed_array); |
8413 | 8416 |
8414 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArray); | 8417 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArray); |
8415 }; | 8418 }; |
8416 | 8419 |
8417 | 8420 |
8418 // JSRegExpResult is just a JSArray with a specific initial map. | 8421 // JSRegExpResult is just a JSArray with a specific initial map. |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9033 } else { | 9036 } else { |
9034 value &= ~(1 << bit_position); | 9037 value &= ~(1 << bit_position); |
9035 } | 9038 } |
9036 return value; | 9039 return value; |
9037 } | 9040 } |
9038 }; | 9041 }; |
9039 | 9042 |
9040 } } // namespace v8::internal | 9043 } } // namespace v8::internal |
9041 | 9044 |
9042 #endif // V8_OBJECTS_H_ | 9045 #endif // V8_OBJECTS_H_ |
OLD | NEW |