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

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: Feedback addressed 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 6720 matching lines...) Expand 10 before | Expand all | Expand 10 after
6731 static const int kInObjectPropertiesByte = 1; 6731 static const int kInObjectPropertiesByte = 1;
6732 static const int kInObjectPropertiesOffset = 6732 static const int kInObjectPropertiesOffset =
6733 kInstanceSizesOffset + kInObjectPropertiesByte; 6733 kInstanceSizesOffset + kInObjectPropertiesByte;
6734 static const int kPreAllocatedPropertyFieldsByte = 2; 6734 static const int kPreAllocatedPropertyFieldsByte = 2;
6735 static const int kPreAllocatedPropertyFieldsOffset = 6735 static const int kPreAllocatedPropertyFieldsOffset =
6736 kInstanceSizesOffset + kPreAllocatedPropertyFieldsByte; 6736 kInstanceSizesOffset + kPreAllocatedPropertyFieldsByte;
6737 static const int kVisitorIdByte = 3; 6737 static const int kVisitorIdByte = 3;
6738 static const int kVisitorIdOffset = kInstanceSizesOffset + kVisitorIdByte; 6738 static const int kVisitorIdOffset = kInstanceSizesOffset + kVisitorIdByte;
6739 6739
6740 // Byte offsets within kInstanceAttributesOffset attributes. 6740 // Byte offsets within kInstanceAttributesOffset attributes.
6741 #if V8_TARGET_LITTLE_ENDIAN
6742 // Order instance type and bit field together such that they can be loaded
6743 // together as a 16-bit word with instance type in the lower 8 bits regardless
6744 // of endianess.
6741 static const int kInstanceTypeOffset = kInstanceAttributesOffset + 0; 6745 static const int kInstanceTypeOffset = kInstanceAttributesOffset + 0;
6742 static const int kUnusedPropertyFieldsOffset = kInstanceAttributesOffset + 1; 6746 static const int kBitFieldOffset = kInstanceAttributesOffset + 1;
6743 static const int kBitFieldOffset = kInstanceAttributesOffset + 2; 6747 #else
6744 static const int kBitField2Offset = kInstanceAttributesOffset + 3; 6748 static const int kBitFieldOffset = kInstanceAttributesOffset + 0;
6749 static const int kInstanceTypeOffset = kInstanceAttributesOffset + 1;
6750 #endif
6751 static const int kBitField2Offset = kInstanceAttributesOffset + 2;
6752 static const int kUnusedPropertyFieldsOffset = kInstanceAttributesOffset + 3;
6745 6753
6746 STATIC_ASSERT(kInstanceTypeOffset == Internals::kMapInstanceTypeOffset); 6754 STATIC_ASSERT(kInstanceTypeOffset == Internals::kMapInstanceTypeOffset);
6747 6755
6748 // Bit positions for bit field. 6756 // Bit positions for bit field.
6749 static const int kHasNonInstancePrototype = 0; 6757 static const int kHasNonInstancePrototype = 0;
6750 static const int kIsHiddenPrototype = 1; 6758 static const int kIsHiddenPrototype = 1;
6751 static const int kHasNamedInterceptor = 2; 6759 static const int kHasNamedInterceptor = 2;
6752 static const int kHasIndexedInterceptor = 3; 6760 static const int kHasIndexedInterceptor = 3;
6753 static const int kIsUndetectable = 4; 6761 static const int kIsUndetectable = 4;
6754 static const int kIsObserved = 5; 6762 static const int kIsObserved = 5;
(...skipping 2301 matching lines...) Expand 10 before | Expand all | Expand 10 after
9056 // Ecma-262: 9064 // Ecma-262:
9057 // 4.3.16 String Value 9065 // 4.3.16 String Value
9058 // A string value is a member of the type String and is a finite 9066 // A string value is a member of the type String and is a finite
9059 // ordered sequence of zero or more 16-bit unsigned integer values. 9067 // ordered sequence of zero or more 16-bit unsigned integer values.
9060 // 9068 //
9061 // All string values have a length field. 9069 // All string values have a length field.
9062 class String: public Name { 9070 class String: public Name {
9063 public: 9071 public:
9064 enum Encoding { ONE_BYTE_ENCODING, TWO_BYTE_ENCODING }; 9072 enum Encoding { ONE_BYTE_ENCODING, TWO_BYTE_ENCODING };
9065 9073
9074 // Array index strings this short can keep their index in the hash field.
9075 static const int kMaxCachedArrayIndexLength = 7;
9076
9077 // For strings which are array indexes the hash value has the string length
9078 // mixed into the hash, mainly to avoid a hash value of zero which would be
9079 // the case for the string '0'. 24 bits are used for the array index value.
9080 static const int kArrayIndexValueBits = 24;
9081 static const int kArrayIndexLengthBits =
9082 kBitsPerInt - kArrayIndexValueBits - kNofHashBitFields;
9083
9084 STATIC_ASSERT((kArrayIndexLengthBits > 0));
9085
9086 class ArrayIndexValueBits : public BitField<unsigned int, kNofHashBitFields,
9087 kArrayIndexValueBits> {}; // NOLINT
9088 class ArrayIndexLengthBits : public BitField<unsigned int,
9089 kNofHashBitFields + kArrayIndexValueBits,
9090 kArrayIndexLengthBits> {}; // NOLINT
9091
9092 // Check that kMaxCachedArrayIndexLength + 1 is a power of two so we
9093 // could use a mask to test if the length of string is less than or equal to
9094 // kMaxCachedArrayIndexLength.
9095 STATIC_ASSERT(IS_POWER_OF_TWO(kMaxCachedArrayIndexLength + 1));
9096
9097 static const unsigned int kContainsCachedArrayIndexMask =
9098 (~kMaxCachedArrayIndexLength << ArrayIndexLengthBits::kShift) |
9099 kIsNotArrayIndexMask;
9100
9066 // Representation of the flat content of a String. 9101 // Representation of the flat content of a String.
9067 // A non-flat string doesn't have flat content. 9102 // A non-flat string doesn't have flat content.
9068 // A flat string has content that's encoded as a sequence of either 9103 // A flat string has content that's encoded as a sequence of either
9069 // ASCII chars or two-byte UC16. 9104 // ASCII chars or two-byte UC16.
9070 // Returned by String::GetFlatContent(). 9105 // Returned by String::GetFlatContent().
9071 class FlatContent { 9106 class FlatContent {
9072 public: 9107 public:
9073 // Returns true if the string is flat and this structure contains content. 9108 // Returns true if the string is flat and this structure contains content.
9074 bool IsFlat() { return state_ != NON_FLAT; } 9109 bool IsFlat() { return state_ != NON_FLAT; }
9075 // Returns true if the structure contains ASCII content. 9110 // Returns true if the structure contains ASCII content.
(...skipping 2173 matching lines...) Expand 10 before | Expand all | Expand 10 after
11249 } else { 11284 } else {
11250 value &= ~(1 << bit_position); 11285 value &= ~(1 << bit_position);
11251 } 11286 }
11252 return value; 11287 return value;
11253 } 11288 }
11254 }; 11289 };
11255 11290
11256 } } // namespace v8::internal 11291 } } // namespace v8::internal
11257 11292
11258 #endif // V8_OBJECTS_H_ 11293 #endif // V8_OBJECTS_H_
OLDNEW
« src/hydrogen.cc ('K') | « src/isolate.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698