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

Side by Side Diff: src/objects.h

Issue 57123002: Reland 21774: Generate KeyedLoadGeneric with Hydrogen (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Tweaks Created 6 years, 6 months 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/assert-scope.h" 9 #include "src/assert-scope.h"
10 #include "src/builtins.h" 10 #include "src/builtins.h"
(...skipping 6715 matching lines...) Expand 10 before | Expand all | Expand 10 after
6726 static const int kInObjectPropertiesByte = 1; 6726 static const int kInObjectPropertiesByte = 1;
6727 static const int kInObjectPropertiesOffset = 6727 static const int kInObjectPropertiesOffset =
6728 kInstanceSizesOffset + kInObjectPropertiesByte; 6728 kInstanceSizesOffset + kInObjectPropertiesByte;
6729 static const int kPreAllocatedPropertyFieldsByte = 2; 6729 static const int kPreAllocatedPropertyFieldsByte = 2;
6730 static const int kPreAllocatedPropertyFieldsOffset = 6730 static const int kPreAllocatedPropertyFieldsOffset =
6731 kInstanceSizesOffset + kPreAllocatedPropertyFieldsByte; 6731 kInstanceSizesOffset + kPreAllocatedPropertyFieldsByte;
6732 static const int kVisitorIdByte = 3; 6732 static const int kVisitorIdByte = 3;
6733 static const int kVisitorIdOffset = kInstanceSizesOffset + kVisitorIdByte; 6733 static const int kVisitorIdOffset = kInstanceSizesOffset + kVisitorIdByte;
6734 6734
6735 // Byte offsets within kInstanceAttributesOffset attributes. 6735 // Byte offsets within kInstanceAttributesOffset attributes.
6736 #if V8_TARGET_LITTLE_ENDIAN
6737 // Order instance type and bit field together such that they can be loaded
6738 // together as a 16-bit word with instance type in the lower 8 bits regardless
6739 // of endianess.
6736 static const int kInstanceTypeOffset = kInstanceAttributesOffset + 0; 6740 static const int kInstanceTypeOffset = kInstanceAttributesOffset + 0;
6737 static const int kUnusedPropertyFieldsOffset = kInstanceAttributesOffset + 1; 6741 static const int kBitFieldOffset = kInstanceAttributesOffset + 1;
6738 static const int kBitFieldOffset = kInstanceAttributesOffset + 2; 6742 #else
6739 static const int kBitField2Offset = kInstanceAttributesOffset + 3; 6743 static const int kBitFieldOffset = kInstanceAttributesOffset + 0;
6744 static const int kInstanceTypeOffset = kInstanceAttributesOffset + 1;
6745 #endif
6746 static const int kBitField2Offset = kInstanceAttributesOffset + 2;
6747 static const int kUnusedPropertyFieldsOffset = kInstanceAttributesOffset + 3;
6740 6748
6741 STATIC_ASSERT(kInstanceTypeOffset == Internals::kMapInstanceTypeOffset); 6749 STATIC_ASSERT(kInstanceTypeOffset == Internals::kMapInstanceTypeOffset);
6742 6750
6743 // Bit positions for bit field. 6751 // Bit positions for bit field.
6744 static const int kHasNonInstancePrototype = 0; 6752 static const int kHasNonInstancePrototype = 0;
6745 static const int kIsHiddenPrototype = 1; 6753 static const int kIsHiddenPrototype = 1;
6746 static const int kHasNamedInterceptor = 2; 6754 static const int kHasNamedInterceptor = 2;
6747 static const int kHasIndexedInterceptor = 3; 6755 static const int kHasIndexedInterceptor = 3;
6748 static const int kIsUndetectable = 4; 6756 static const int kIsUndetectable = 4;
6749 static const int kIsObserved = 5; 6757 static const int kIsObserved = 5;
(...skipping 2301 matching lines...) Expand 10 before | Expand all | Expand 10 after
9051 // Ecma-262: 9059 // Ecma-262:
9052 // 4.3.16 String Value 9060 // 4.3.16 String Value
9053 // A string value is a member of the type String and is a finite 9061 // A string value is a member of the type String and is a finite
9054 // ordered sequence of zero or more 16-bit unsigned integer values. 9062 // ordered sequence of zero or more 16-bit unsigned integer values.
9055 // 9063 //
9056 // All string values have a length field. 9064 // All string values have a length field.
9057 class String: public Name { 9065 class String: public Name {
9058 public: 9066 public:
9059 enum Encoding { ONE_BYTE_ENCODING, TWO_BYTE_ENCODING }; 9067 enum Encoding { ONE_BYTE_ENCODING, TWO_BYTE_ENCODING };
9060 9068
9069 // Array index strings this short can keep their index in the hash field.
9070 static const int kMaxCachedArrayIndexLength = 7;
9071
9072 // For strings which are array indexes the hash value has the string length
9073 // mixed into the hash, mainly to avoid a hash value of zero which would be
9074 // the case for the string '0'. 24 bits are used for the array index value.
9075 static const int kArrayIndexValueBits = 24;
9076 static const int kArrayIndexLengthBits =
9077 kBitsPerInt - kArrayIndexValueBits - kNofHashBitFields;
9078
9079 STATIC_ASSERT((kArrayIndexLengthBits > 0));
9080
9081 class ArrayIndexValueBits : public BitField<unsigned int, kNofHashBitFields,
9082 kArrayIndexValueBits> {};
Toon Verwaest 2014/06/10 11:33:44 Don't you need a // NOLINT here? Probably a good i
danno 2014/06/11 08:08:00 Done.
9083 class ArrayIndexLengthBits : public BitField<unsigned int,
9084 kNofHashBitFields + kArrayIndexValueBits,
9085 kArrayIndexLengthBits> {};
9086
9087 // Check that kMaxCachedArrayIndexLength + 1 is a power of two so we
9088 // could use a mask to test if the length of string is less than or equal to
9089 // kMaxCachedArrayIndexLength.
9090 STATIC_ASSERT(IS_POWER_OF_TWO(kMaxCachedArrayIndexLength + 1));
9091
9092 static const unsigned int kContainsCachedArrayIndexMask =
9093 (~kMaxCachedArrayIndexLength << ArrayIndexLengthBits::kShift) |
9094 kIsNotArrayIndexMask;
9095
9061 // Representation of the flat content of a String. 9096 // Representation of the flat content of a String.
9062 // A non-flat string doesn't have flat content. 9097 // A non-flat string doesn't have flat content.
9063 // A flat string has content that's encoded as a sequence of either 9098 // A flat string has content that's encoded as a sequence of either
9064 // ASCII chars or two-byte UC16. 9099 // ASCII chars or two-byte UC16.
9065 // Returned by String::GetFlatContent(). 9100 // Returned by String::GetFlatContent().
9066 class FlatContent { 9101 class FlatContent {
9067 public: 9102 public:
9068 // Returns true if the string is flat and this structure contains content. 9103 // Returns true if the string is flat and this structure contains content.
9069 bool IsFlat() { return state_ != NON_FLAT; } 9104 bool IsFlat() { return state_ != NON_FLAT; }
9070 // Returns true if the structure contains ASCII content. 9105 // Returns true if the structure contains ASCII content.
(...skipping 2173 matching lines...) Expand 10 before | Expand all | Expand 10 after
11244 } else { 11279 } else {
11245 value &= ~(1 << bit_position); 11280 value &= ~(1 << bit_position);
11246 } 11281 }
11247 return value; 11282 return value;
11248 } 11283 }
11249 }; 11284 };
11250 11285
11251 } } // namespace v8::internal 11286 } } // namespace v8::internal
11252 11287
11253 #endif // V8_OBJECTS_H_ 11288 #endif // V8_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698