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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 // - JSSet | 57 // - JSSet |
58 // - JSMap | 58 // - JSMap |
59 // - JSWeakMap | 59 // - JSWeakMap |
60 // - JSRegExp | 60 // - JSRegExp |
61 // - JSFunction | 61 // - JSFunction |
62 // - GlobalObject | 62 // - GlobalObject |
63 // - JSGlobalObject | 63 // - JSGlobalObject |
64 // - JSBuiltinsObject | 64 // - JSBuiltinsObject |
65 // - JSGlobalProxy | 65 // - JSGlobalProxy |
66 // - JSValue | 66 // - JSValue |
67 // - JSDate | |
67 // - JSMessageObject | 68 // - JSMessageObject |
68 // - JSProxy | 69 // - JSProxy |
69 // - JSFunctionProxy | 70 // - JSFunctionProxy |
70 // - FixedArrayBase | 71 // - FixedArrayBase |
71 // - ByteArray | 72 // - ByteArray |
72 // - FixedArray | 73 // - FixedArray |
73 // - DescriptorArray | 74 // - DescriptorArray |
74 // - HashTable | 75 // - HashTable |
75 // - Dictionary | 76 // - Dictionary |
76 // - SymbolTable | 77 // - SymbolTable |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
288 V(CODE_CACHE_TYPE) \ | 289 V(CODE_CACHE_TYPE) \ |
289 V(POLYMORPHIC_CODE_CACHE_TYPE) \ | 290 V(POLYMORPHIC_CODE_CACHE_TYPE) \ |
290 \ | 291 \ |
291 V(FIXED_ARRAY_TYPE) \ | 292 V(FIXED_ARRAY_TYPE) \ |
292 V(FIXED_DOUBLE_ARRAY_TYPE) \ | 293 V(FIXED_DOUBLE_ARRAY_TYPE) \ |
293 V(SHARED_FUNCTION_INFO_TYPE) \ | 294 V(SHARED_FUNCTION_INFO_TYPE) \ |
294 \ | 295 \ |
295 V(JS_MESSAGE_OBJECT_TYPE) \ | 296 V(JS_MESSAGE_OBJECT_TYPE) \ |
296 \ | 297 \ |
297 V(JS_VALUE_TYPE) \ | 298 V(JS_VALUE_TYPE) \ |
299 V(JS_DATE_TYPE) \ | |
298 V(JS_OBJECT_TYPE) \ | 300 V(JS_OBJECT_TYPE) \ |
299 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ | 301 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ |
300 V(JS_GLOBAL_OBJECT_TYPE) \ | 302 V(JS_GLOBAL_OBJECT_TYPE) \ |
301 V(JS_BUILTINS_OBJECT_TYPE) \ | 303 V(JS_BUILTINS_OBJECT_TYPE) \ |
302 V(JS_GLOBAL_PROXY_TYPE) \ | 304 V(JS_GLOBAL_PROXY_TYPE) \ |
303 V(JS_ARRAY_TYPE) \ | 305 V(JS_ARRAY_TYPE) \ |
304 V(JS_PROXY_TYPE) \ | 306 V(JS_PROXY_TYPE) \ |
305 V(JS_WEAK_MAP_TYPE) \ | 307 V(JS_WEAK_MAP_TYPE) \ |
306 V(JS_REGEXP_TYPE) \ | 308 V(JS_REGEXP_TYPE) \ |
307 \ | 309 \ |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
603 | 605 |
604 // All the following types are subtypes of JSReceiver, which corresponds to | 606 // All the following types are subtypes of JSReceiver, which corresponds to |
605 // objects in the JS sense. The first and the last type in this range are | 607 // objects in the JS sense. The first and the last type in this range are |
606 // the two forms of function. This organization enables using the same | 608 // the two forms of function. This organization enables using the same |
607 // compares for checking the JS_RECEIVER/SPEC_OBJECT range and the | 609 // compares for checking the JS_RECEIVER/SPEC_OBJECT range and the |
608 // NONCALLABLE_JS_OBJECT range. | 610 // NONCALLABLE_JS_OBJECT range. |
609 JS_FUNCTION_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE, FIRST_JS_PROXY_TYPE | 611 JS_FUNCTION_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE, FIRST_JS_PROXY_TYPE |
610 JS_PROXY_TYPE, // LAST_JS_PROXY_TYPE | 612 JS_PROXY_TYPE, // LAST_JS_PROXY_TYPE |
611 | 613 |
612 JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE | 614 JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE |
615 JS_DATE_TYPE, | |
613 JS_OBJECT_TYPE, | 616 JS_OBJECT_TYPE, |
614 JS_CONTEXT_EXTENSION_OBJECT_TYPE, | 617 JS_CONTEXT_EXTENSION_OBJECT_TYPE, |
615 JS_GLOBAL_OBJECT_TYPE, | 618 JS_GLOBAL_OBJECT_TYPE, |
616 JS_BUILTINS_OBJECT_TYPE, | 619 JS_BUILTINS_OBJECT_TYPE, |
617 JS_GLOBAL_PROXY_TYPE, | 620 JS_GLOBAL_PROXY_TYPE, |
618 JS_ARRAY_TYPE, | 621 JS_ARRAY_TYPE, |
619 JS_SET_TYPE, | 622 JS_SET_TYPE, |
620 JS_MAP_TYPE, | 623 JS_MAP_TYPE, |
621 JS_WEAK_MAP_TYPE, | 624 JS_WEAK_MAP_TYPE, |
622 | 625 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
796 V(FixedArray) \ | 799 V(FixedArray) \ |
797 V(FixedDoubleArray) \ | 800 V(FixedDoubleArray) \ |
798 V(Context) \ | 801 V(Context) \ |
799 V(GlobalContext) \ | 802 V(GlobalContext) \ |
800 V(ScopeInfo) \ | 803 V(ScopeInfo) \ |
801 V(JSFunction) \ | 804 V(JSFunction) \ |
802 V(Code) \ | 805 V(Code) \ |
803 V(Oddball) \ | 806 V(Oddball) \ |
804 V(SharedFunctionInfo) \ | 807 V(SharedFunctionInfo) \ |
805 V(JSValue) \ | 808 V(JSValue) \ |
809 V(JSDate) \ | |
806 V(JSMessageObject) \ | 810 V(JSMessageObject) \ |
807 V(StringWrapper) \ | 811 V(StringWrapper) \ |
808 V(Foreign) \ | 812 V(Foreign) \ |
809 V(Boolean) \ | 813 V(Boolean) \ |
810 V(JSArray) \ | 814 V(JSArray) \ |
811 V(JSProxy) \ | 815 V(JSProxy) \ |
812 V(JSFunctionProxy) \ | 816 V(JSFunctionProxy) \ |
813 V(JSSet) \ | 817 V(JSSet) \ |
814 V(JSMap) \ | 818 V(JSMap) \ |
815 V(JSWeakMap) \ | 819 V(JSWeakMap) \ |
(...skipping 5000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5816 | 5820 |
5817 static int OffsetOfCodeWithId(Builtins::JavaScript id) { | 5821 static int OffsetOfCodeWithId(Builtins::JavaScript id) { |
5818 return kJSBuiltinsCodeOffset + id * kPointerSize; | 5822 return kJSBuiltinsCodeOffset + id * kPointerSize; |
5819 } | 5823 } |
5820 | 5824 |
5821 private: | 5825 private: |
5822 DISALLOW_IMPLICIT_CONSTRUCTORS(JSBuiltinsObject); | 5826 DISALLOW_IMPLICIT_CONSTRUCTORS(JSBuiltinsObject); |
5823 }; | 5827 }; |
5824 | 5828 |
5825 | 5829 |
5826 // Representation for JS Wrapper objects, String, Number, Boolean, Date, etc. | 5830 // Representation for JS Wrapper objects, String, Number, Boolean, etc. |
5827 class JSValue: public JSObject { | 5831 class JSValue: public JSObject { |
5828 public: | 5832 public: |
5829 // [value]: the object being wrapped. | 5833 // [value]: the object being wrapped. |
5830 DECL_ACCESSORS(value, Object) | 5834 DECL_ACCESSORS(value, Object) |
5831 | 5835 |
5832 // Casting. | 5836 // Casting. |
5833 static inline JSValue* cast(Object* obj); | 5837 static inline JSValue* cast(Object* obj); |
5834 | 5838 |
5835 // Dispatched behavior. | 5839 // Dispatched behavior. |
5836 #ifdef OBJECT_PRINT | 5840 #ifdef OBJECT_PRINT |
5837 inline void JSValuePrint() { | 5841 inline void JSValuePrint() { |
5838 JSValuePrint(stdout); | 5842 JSValuePrint(stdout); |
5839 } | 5843 } |
5840 void JSValuePrint(FILE* out); | 5844 void JSValuePrint(FILE* out); |
5841 #endif | 5845 #endif |
5842 #ifdef DEBUG | 5846 #ifdef DEBUG |
5843 void JSValueVerify(); | 5847 void JSValueVerify(); |
5844 #endif | 5848 #endif |
5845 | 5849 |
5846 // Layout description. | 5850 // Layout description. |
5847 static const int kValueOffset = JSObject::kHeaderSize; | 5851 static const int kValueOffset = JSObject::kHeaderSize; |
5848 static const int kSize = kValueOffset + kPointerSize; | 5852 static const int kSize = kValueOffset + kPointerSize; |
5849 | 5853 |
5850 private: | 5854 private: |
5851 DISALLOW_IMPLICIT_CONSTRUCTORS(JSValue); | 5855 DISALLOW_IMPLICIT_CONSTRUCTORS(JSValue); |
5852 }; | 5856 }; |
5853 | 5857 |
5854 | 5858 |
5859 // Representation for JS date objects. | |
5860 class JSDate: public JSObject { | |
ulan
2012/01/25 13:08:48
As we discussed offline, all these fields could be
rossberg
2012/01/25 15:48:37
Yeah, I don't want to optimize this prematurely. T
| |
5861 public: | |
5862 // If one component is NaN, all of them are, indicating a NaN time value. | |
5863 // [value]: the time value. Transitional, will disappear. | |
ulan
2012/01/25 13:08:48
As we discussed offline, the [value] should stay s
rossberg
2012/01/25 15:48:37
Done.
| |
5864 DECL_ACCESSORS(value, Object) | |
5865 // [year]: caches year. | |
5866 DECL_ACCESSORS(year, Object) | |
5867 // [day]: caches month. | |
5868 DECL_ACCESSORS(month, Object) | |
5869 // [day]: caches day. | |
5870 DECL_ACCESSORS(day, Object) | |
5871 // [day]: caches hours. | |
ulan
2012/01/25 13:08:48
[day] -> [hour] in the comment.
rossberg
2012/01/25 15:48:37
Done. (And for month above.)
| |
5872 DECL_ACCESSORS(hour, Object) | |
5873 // [min]: caches minutes. | |
5874 DECL_ACCESSORS(min, Object) | |
5875 // [sec]: caches seconds. | |
5876 DECL_ACCESSORS(sec, Object) | |
5877 // [ms]: caches milliseconds. | |
5878 DECL_ACCESSORS(ms, Object) | |
5879 | |
5880 // Casting. | |
5881 static inline JSDate* cast(Object* obj); | |
5882 | |
5883 // Dispatched behavior. | |
5884 #ifdef OBJECT_PRINT | |
5885 inline void JSDatePrint() { | |
5886 JSDatePrint(stdout); | |
5887 } | |
5888 void JSDatePrint(FILE* out); | |
5889 #endif | |
5890 #ifdef DEBUG | |
5891 void JSDateVerify(); | |
5892 #endif | |
5893 | |
5894 // Layout description. | |
5895 static const int kValueOffset = JSObject::kHeaderSize; // transitional | |
5896 static const int kYearOffset = kValueOffset + kPointerSize; | |
5897 static const int kMonthOffset = kYearOffset + kPointerSize; | |
5898 static const int kDayOffset = kMonthOffset + kPointerSize; | |
5899 static const int kHourOffset = kDayOffset + kPointerSize; | |
5900 static const int kMinOffset = kHourOffset + kPointerSize; | |
5901 static const int kSecOffset = kMinOffset + kPointerSize; | |
5902 static const int kMsOffset = kSecOffset + kPointerSize; | |
5903 static const int kSize = kMsOffset + kPointerSize; | |
5904 | |
5905 private: | |
5906 DISALLOW_IMPLICIT_CONSTRUCTORS(JSDate); | |
5907 }; | |
5908 | |
5909 | |
5855 // Representation of message objects used for error reporting through | 5910 // Representation of message objects used for error reporting through |
5856 // the API. The messages are formatted in JavaScript so this object is | 5911 // the API. The messages are formatted in JavaScript so this object is |
5857 // a real JavaScript object. The information used for formatting the | 5912 // a real JavaScript object. The information used for formatting the |
5858 // error messages are not directly accessible from JavaScript to | 5913 // error messages are not directly accessible from JavaScript to |
5859 // prevent leaking information to user code called during error | 5914 // prevent leaking information to user code called during error |
5860 // formatting. | 5915 // formatting. |
5861 class JSMessageObject: public JSObject { | 5916 class JSMessageObject: public JSObject { |
5862 public: | 5917 public: |
5863 // [type]: the type of error message. | 5918 // [type]: the type of error message. |
5864 DECL_ACCESSORS(type, String) | 5919 DECL_ACCESSORS(type, String) |
(...skipping 2329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8194 } else { | 8249 } else { |
8195 value &= ~(1 << bit_position); | 8250 value &= ~(1 << bit_position); |
8196 } | 8251 } |
8197 return value; | 8252 return value; |
8198 } | 8253 } |
8199 }; | 8254 }; |
8200 | 8255 |
8201 } } // namespace v8::internal | 8256 } } // namespace v8::internal |
8202 | 8257 |
8203 #endif // V8_OBJECTS_H_ | 8258 #endif // V8_OBJECTS_H_ |
OLD | NEW |