OLD | NEW |
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 875 matching lines...) Loading... |
886 INLINE(bool IsTrue()); | 886 INLINE(bool IsTrue()); |
887 INLINE(bool IsFalse()); | 887 INLINE(bool IsFalse()); |
888 inline bool IsArgumentsMarker(); | 888 inline bool IsArgumentsMarker(); |
889 inline bool NonFailureIsHeapObject(); | 889 inline bool NonFailureIsHeapObject(); |
890 | 890 |
891 // Filler objects (fillers and free space objects). | 891 // Filler objects (fillers and free space objects). |
892 inline bool IsFiller(); | 892 inline bool IsFiller(); |
893 | 893 |
894 // Extract the number. | 894 // Extract the number. |
895 inline double Number(); | 895 inline double Number(); |
| 896 inline bool IsNaN(); |
896 | 897 |
897 // Returns true if the object is of the correct type to be used as a | 898 // Returns true if the object is of the correct type to be used as a |
898 // implementation of a JSObject's elements. | 899 // implementation of a JSObject's elements. |
899 inline bool HasValidElements(); | 900 inline bool HasValidElements(); |
900 | 901 |
901 inline bool HasSpecificClassOf(String* name); | 902 inline bool HasSpecificClassOf(String* name); |
902 | 903 |
903 MUST_USE_RESULT MaybeObject* ToObject(); // ECMA-262 9.9. | 904 MUST_USE_RESULT MaybeObject* ToObject(); // ECMA-262 9.9. |
904 Object* ToBoolean(); // ECMA-262 9.2. | 905 Object* ToBoolean(); // ECMA-262 9.2. |
905 | 906 |
(...skipping 5120 matching lines...) Loading... |
6026 DISALLOW_IMPLICIT_CONSTRUCTORS(JSValue); | 6027 DISALLOW_IMPLICIT_CONSTRUCTORS(JSValue); |
6027 }; | 6028 }; |
6028 | 6029 |
6029 | 6030 |
6030 // Representation for JS date objects. | 6031 // Representation for JS date objects. |
6031 class JSDate: public JSObject { | 6032 class JSDate: public JSObject { |
6032 public: | 6033 public: |
6033 // If one component is NaN, all of them are, indicating a NaN time value. | 6034 // If one component is NaN, all of them are, indicating a NaN time value. |
6034 // [value]: the time value. | 6035 // [value]: the time value. |
6035 DECL_ACCESSORS(value, Object) | 6036 DECL_ACCESSORS(value, Object) |
| 6037 // [local]: the offset for the local time value. |
| 6038 DECL_ACCESSORS(local, Object) |
6036 // [year]: caches year. Either undefined, smi, or NaN. | 6039 // [year]: caches year. Either undefined, smi, or NaN. |
6037 DECL_ACCESSORS(year, Object) | 6040 DECL_ACCESSORS(year, Object) |
6038 // [month]: caches month. Either undefined, smi, or NaN. | 6041 // [month]: caches month. Either undefined, smi, or NaN. |
6039 DECL_ACCESSORS(month, Object) | 6042 DECL_ACCESSORS(month, Object) |
6040 // [day]: caches day. Either undefined, smi, or NaN. | 6043 // [day]: caches day. Either undefined, smi, or NaN. |
6041 DECL_ACCESSORS(day, Object) | 6044 DECL_ACCESSORS(day, Object) |
6042 // [hour]: caches hours. Either undefined, smi, or NaN. | 6045 // [hour]: caches hours. Either undefined, smi, or NaN. |
6043 DECL_ACCESSORS(hour, Object) | 6046 DECL_ACCESSORS(hour, Object) |
6044 // [min]: caches minutes. Either undefined, smi, or NaN. | 6047 // [min]: caches minutes. Either undefined, smi, or NaN. |
6045 DECL_ACCESSORS(min, Object) | 6048 DECL_ACCESSORS(min, Object) |
6046 // [sec]: caches seconds. Either undefined, smi, or NaN. | 6049 // [sec]: caches seconds. Either undefined, smi, or NaN. |
6047 DECL_ACCESSORS(sec, Object) | 6050 DECL_ACCESSORS(sec, Object) |
6048 // [ms]: caches milliseconds. Either undefined, smi, or NaN. | 6051 // [weekday]: caches day of week. Either undefined, smi, or NaN. |
6049 DECL_ACCESSORS(ms, Object) | 6052 DECL_ACCESSORS(weekday, Object) |
6050 | 6053 |
6051 // Casting. | 6054 // Casting. |
6052 static inline JSDate* cast(Object* obj); | 6055 static inline JSDate* cast(Object* obj); |
6053 | 6056 |
6054 // Dispatched behavior. | 6057 // Dispatched behavior. |
6055 #ifdef OBJECT_PRINT | 6058 #ifdef OBJECT_PRINT |
6056 inline void JSDatePrint() { | 6059 inline void JSDatePrint() { |
6057 JSDatePrint(stdout); | 6060 JSDatePrint(stdout); |
6058 } | 6061 } |
6059 void JSDatePrint(FILE* out); | 6062 void JSDatePrint(FILE* out); |
6060 #endif | 6063 #endif |
6061 #ifdef DEBUG | 6064 #ifdef DEBUG |
6062 void JSDateVerify(); | 6065 void JSDateVerify(); |
6063 #endif | 6066 #endif |
6064 | 6067 |
6065 // Layout description. | 6068 // Layout description. |
6066 static const int kValueOffset = JSObject::kHeaderSize; | 6069 static const int kValueOffset = JSObject::kHeaderSize; |
6067 static const int kYearOffset = kValueOffset + kPointerSize; | 6070 static const int kLocalOffset = kValueOffset + kPointerSize; |
| 6071 static const int kYearOffset = kLocalOffset + kPointerSize; |
6068 static const int kMonthOffset = kYearOffset + kPointerSize; | 6072 static const int kMonthOffset = kYearOffset + kPointerSize; |
6069 static const int kDayOffset = kMonthOffset + kPointerSize; | 6073 static const int kDayOffset = kMonthOffset + kPointerSize; |
6070 static const int kHourOffset = kDayOffset + kPointerSize; | 6074 static const int kHourOffset = kDayOffset + kPointerSize; |
6071 static const int kMinOffset = kHourOffset + kPointerSize; | 6075 static const int kMinOffset = kHourOffset + kPointerSize; |
6072 static const int kSecOffset = kMinOffset + kPointerSize; | 6076 static const int kSecOffset = kMinOffset + kPointerSize; |
6073 static const int kMsOffset = kSecOffset + kPointerSize; | 6077 static const int kWeekdayOffset = kSecOffset + kPointerSize; |
6074 static const int kSize = kMsOffset + kPointerSize; | 6078 static const int kSize = kWeekdayOffset + kPointerSize; |
6075 | 6079 |
6076 // Index of first field not requiring a write barrier. | 6080 // Index of first field not requiring a write barrier. |
6077 static const int kFirstBarrierFree = 1; // year | 6081 static const int kFirstBarrierFree = 2; // year |
6078 | 6082 |
6079 private: | 6083 private: |
6080 DISALLOW_IMPLICIT_CONSTRUCTORS(JSDate); | 6084 DISALLOW_IMPLICIT_CONSTRUCTORS(JSDate); |
6081 }; | 6085 }; |
6082 | 6086 |
6083 | 6087 |
6084 // Representation of message objects used for error reporting through | 6088 // Representation of message objects used for error reporting through |
6085 // the API. The messages are formatted in JavaScript so this object is | 6089 // the API. The messages are formatted in JavaScript so this object is |
6086 // a real JavaScript object. The information used for formatting the | 6090 // a real JavaScript object. The information used for formatting the |
6087 // error messages are not directly accessible from JavaScript to | 6091 // error messages are not directly accessible from JavaScript to |
(...skipping 2436 matching lines...) Loading... |
8524 } else { | 8528 } else { |
8525 value &= ~(1 << bit_position); | 8529 value &= ~(1 << bit_position); |
8526 } | 8530 } |
8527 return value; | 8531 return value; |
8528 } | 8532 } |
8529 }; | 8533 }; |
8530 | 8534 |
8531 } } // namespace v8::internal | 8535 } } // namespace v8::internal |
8532 | 8536 |
8533 #endif // V8_OBJECTS_H_ | 8537 #endif // V8_OBJECTS_H_ |
OLD | NEW |