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

Unified Diff: src/property-details.h

Issue 61623004: Add signed/unsigned 8-bit and 16-bit Representations (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review feedback and prepare to land Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/x64/macro-assembler-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/property-details.h
diff --git a/src/property-details.h b/src/property-details.h
index 659fbd1da6e2b5829cb0d3d5a0e4d305c106ba9b..92e4f81c01cb1e6b5f28eee3e5ce74aadd6d18a3 100644
--- a/src/property-details.h
+++ b/src/property-details.h
@@ -82,7 +82,10 @@ class Representation {
public:
enum Kind {
kNone,
- kByte,
+ kInteger8,
+ kUInteger8,
+ kInteger16,
+ kUInteger16,
kSmi,
kInteger32,
kDouble,
@@ -96,7 +99,12 @@ class Representation {
static Representation None() { return Representation(kNone); }
static Representation Tagged() { return Representation(kTagged); }
- static Representation Byte() { return Representation(kByte); }
+ static Representation Integer8() { return Representation(kInteger8); }
+ static Representation UInteger8() { return Representation(kUInteger8); }
+ static Representation Integer16() { return Representation(kInteger16); }
+ static Representation UInteger16() {
+ return Representation(kUInteger16);
+ }
static Representation Smi() { return Representation(kSmi); }
static Representation Integer32() { return Representation(kInteger32); }
static Representation Double() { return Representation(kDouble); }
@@ -126,6 +134,8 @@ class Representation {
ASSERT(kind_ != kExternal);
ASSERT(other.kind_ != kExternal);
if (IsHeapObject()) return other.IsDouble() || other.IsNone();
+ if (kind_ == kUInteger8 && other.kind_ == kInteger8) return false;
+ if (kind_ == kUInteger16 && other.kind_ == kInteger16) return false;
return kind_ > other.kind_;
}
@@ -139,9 +149,26 @@ class Representation {
return Representation::Tagged();
}
+ int size() const {
+ ASSERT(!IsNone());
+ if (IsInteger8() || IsUInteger8()) {
+ return sizeof(uint8_t);
+ }
+ if (IsInteger16() || IsUInteger16()) {
+ return sizeof(uint16_t);
+ }
+ if (IsInteger32()) {
+ return sizeof(uint32_t);
+ }
+ return kPointerSize;
+ }
+
Kind kind() const { return static_cast<Kind>(kind_); }
bool IsNone() const { return kind_ == kNone; }
- bool IsByte() const { return kind_ == kByte; }
+ bool IsInteger8() const { return kind_ == kInteger8; }
+ bool IsUInteger8() const { return kind_ == kUInteger8; }
+ bool IsInteger16() const { return kind_ == kInteger16; }
+ bool IsUInteger16() const { return kind_ == kUInteger16; }
bool IsTagged() const { return kind_ == kTagged; }
bool IsSmi() const { return kind_ == kSmi; }
bool IsSmiOrTagged() const { return IsSmi() || IsTagged(); }
@@ -151,7 +178,9 @@ class Representation {
bool IsHeapObject() const { return kind_ == kHeapObject; }
bool IsExternal() const { return kind_ == kExternal; }
bool IsSpecialization() const {
- return IsByte() || IsSmi() || IsInteger32() || IsDouble();
+ return IsInteger8() || IsUInteger8() ||
+ IsInteger16() || IsUInteger16() ||
+ IsSmi() || IsInteger32() || IsDouble();
}
const char* Mnemonic() const;
@@ -256,8 +285,8 @@ class PropertyDetails BASE_EMBEDDED {
// Bit fields for fast objects.
class DescriptorPointer: public BitField<uint32_t, 6, 11> {};
- class RepresentationField: public BitField<uint32_t, 17, 3> {};
- class FieldIndexField: public BitField<uint32_t, 20, 11> {};
+ class RepresentationField: public BitField<uint32_t, 17, 4> {};
+ class FieldIndexField: public BitField<uint32_t, 21, 10> {};
static const int kInitialIndex = 1;
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/x64/macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698