OLD | NEW |
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 <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 9198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9209 | 9209 |
9210 // The Oddball describes objects null, undefined, true, and false. | 9210 // The Oddball describes objects null, undefined, true, and false. |
9211 class Oddball: public HeapObject { | 9211 class Oddball: public HeapObject { |
9212 public: | 9212 public: |
9213 // [to_string]: Cached to_string computed at startup. | 9213 // [to_string]: Cached to_string computed at startup. |
9214 DECL_ACCESSORS(to_string, String) | 9214 DECL_ACCESSORS(to_string, String) |
9215 | 9215 |
9216 // [to_number]: Cached to_number computed at startup. | 9216 // [to_number]: Cached to_number computed at startup. |
9217 DECL_ACCESSORS(to_number, Object) | 9217 DECL_ACCESSORS(to_number, Object) |
9218 | 9218 |
| 9219 // [typeof]: Cached type_of computed at startup. |
| 9220 DECL_ACCESSORS(type_of, String) |
| 9221 |
9219 inline byte kind() const; | 9222 inline byte kind() const; |
9220 inline void set_kind(byte kind); | 9223 inline void set_kind(byte kind); |
9221 | 9224 |
9222 DECLARE_CAST(Oddball) | 9225 DECLARE_CAST(Oddball) |
9223 | 9226 |
9224 // Dispatched behavior. | 9227 // Dispatched behavior. |
9225 DECLARE_VERIFIER(Oddball) | 9228 DECLARE_VERIFIER(Oddball) |
9226 | 9229 |
9227 // Initialize the fields. | 9230 // Initialize the fields. |
9228 static void Initialize(Isolate* isolate, | 9231 static void Initialize(Isolate* isolate, Handle<Oddball> oddball, |
9229 Handle<Oddball> oddball, | 9232 const char* to_string, Handle<Object> to_number, |
9230 const char* to_string, | 9233 const char* type_of, byte kind); |
9231 Handle<Object> to_number, | |
9232 byte kind); | |
9233 | 9234 |
9234 // Layout description. | 9235 // Layout description. |
9235 static const int kToStringOffset = HeapObject::kHeaderSize; | 9236 static const int kToStringOffset = HeapObject::kHeaderSize; |
9236 static const int kToNumberOffset = kToStringOffset + kPointerSize; | 9237 static const int kToNumberOffset = kToStringOffset + kPointerSize; |
9237 static const int kKindOffset = kToNumberOffset + kPointerSize; | 9238 static const int kTypeOfOffset = kToNumberOffset + kPointerSize; |
| 9239 static const int kKindOffset = kTypeOfOffset + kPointerSize; |
9238 static const int kSize = kKindOffset + kPointerSize; | 9240 static const int kSize = kKindOffset + kPointerSize; |
9239 | 9241 |
9240 static const byte kFalse = 0; | 9242 static const byte kFalse = 0; |
9241 static const byte kTrue = 1; | 9243 static const byte kTrue = 1; |
9242 static const byte kNotBooleanMask = ~1; | 9244 static const byte kNotBooleanMask = ~1; |
9243 static const byte kTheHole = 2; | 9245 static const byte kTheHole = 2; |
9244 static const byte kNull = 3; | 9246 static const byte kNull = 3; |
9245 static const byte kArgumentMarker = 4; | 9247 static const byte kArgumentMarker = 4; |
9246 static const byte kUndefined = 5; | 9248 static const byte kUndefined = 5; |
9247 static const byte kUninitialized = 6; | 9249 static const byte kUninitialized = 6; |
9248 static const byte kOther = 7; | 9250 static const byte kOther = 7; |
9249 static const byte kException = 8; | 9251 static const byte kException = 8; |
9250 | 9252 |
9251 typedef FixedBodyDescriptor<kToStringOffset, | 9253 typedef FixedBodyDescriptor<kToStringOffset, kTypeOfOffset + kPointerSize, |
9252 kToNumberOffset + kPointerSize, | |
9253 kSize> BodyDescriptor; | 9254 kSize> BodyDescriptor; |
9254 | 9255 |
9255 STATIC_ASSERT(kKindOffset == Internals::kOddballKindOffset); | 9256 STATIC_ASSERT(kKindOffset == Internals::kOddballKindOffset); |
9256 STATIC_ASSERT(kNull == Internals::kNullOddballKind); | 9257 STATIC_ASSERT(kNull == Internals::kNullOddballKind); |
9257 STATIC_ASSERT(kUndefined == Internals::kUndefinedOddballKind); | 9258 STATIC_ASSERT(kUndefined == Internals::kUndefinedOddballKind); |
9258 | 9259 |
9259 private: | 9260 private: |
9260 DISALLOW_IMPLICIT_CONSTRUCTORS(Oddball); | 9261 DISALLOW_IMPLICIT_CONSTRUCTORS(Oddball); |
9261 }; | 9262 }; |
9262 | 9263 |
(...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10560 } else { | 10561 } else { |
10561 value &= ~(1 << bit_position); | 10562 value &= ~(1 << bit_position); |
10562 } | 10563 } |
10563 return value; | 10564 return value; |
10564 } | 10565 } |
10565 }; | 10566 }; |
10566 | 10567 |
10567 } } // namespace v8::internal | 10568 } } // namespace v8::internal |
10568 | 10569 |
10569 #endif // V8_OBJECTS_H_ | 10570 #endif // V8_OBJECTS_H_ |
OLD | NEW |