Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(447)

Side by Side Diff: src/objects.h

Issue 11299004: Use the property load IC for accessing the array length. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added comments. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mips/lithium-codegen-mips.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 8336 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
8357 class PropertyIndex;
8358
8359
8357 // The JSArray describes JavaScript Arrays 8360 // The JSArray describes JavaScript Arrays
8358 // Such an array can be in one of two modes: 8361 // Such an array can be in one of two modes:
8359 // - fast, backing storage is a FixedArray and length <= elements.length(); 8362 // - 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. 8363 // 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. 8364 // - slow, backing storage is a HashTable with numbers as keys.
8362 class JSArray: public JSObject { 8365 class JSArray: public JSObject {
8363 public: 8366 public:
8364 // [length]: The length property. 8367 // [length]: The length property.
8365 DECL_ACCESSORS(length, Object) 8368 DECL_ACCESSORS(length, Object)
8366 8369
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
8399 #endif 8402 #endif
8400 DECLARE_VERIFIER(JSArray) 8403 DECLARE_VERIFIER(JSArray)
8401 8404
8402 // Number of element slots to pre-allocate for an empty array. 8405 // Number of element slots to pre-allocate for an empty array.
8403 static const int kPreallocatedArrayElements = 4; 8406 static const int kPreallocatedArrayElements = 4;
8404 8407
8405 // Layout description. 8408 // Layout description.
8406 static const int kLengthOffset = JSObject::kHeaderSize; 8409 static const int kLengthOffset = JSObject::kHeaderSize;
8407 static const int kSize = kLengthOffset + kPointerSize; 8410 static const int kSize = kLengthOffset + kPointerSize;
8408 8411
8412 static inline PropertyIndex ArrayLengthIndex();
8413 STATIC_ASSERT(kLengthOffset % kPointerSize == 0);
8414
8409 private: 8415 private:
8410 // Expand the fixed array backing of a fast-case JSArray to at least 8416 // Expand the fixed array backing of a fast-case JSArray to at least
8411 // the requested size. 8417 // the requested size.
8412 void Expand(int minimum_size_of_backing_fixed_array); 8418 void Expand(int minimum_size_of_backing_fixed_array);
8413 8419
8414 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArray); 8420 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArray);
8415 }; 8421 };
8416 8422
8417 8423
8418 // JSRegExpResult is just a JSArray with a specific initial map. 8424 // JSRegExpResult is just a JSArray with a specific initial map.
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
9033 } else { 9039 } else {
9034 value &= ~(1 << bit_position); 9040 value &= ~(1 << bit_position);
9035 } 9041 }
9036 return value; 9042 return value;
9037 } 9043 }
9038 }; 9044 };
9039 9045
9040 } } // namespace v8::internal 9046 } } // namespace v8::internal
9041 9047
9042 #endif // V8_OBJECTS_H_ 9048 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/mips/lithium-codegen-mips.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698