OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 1949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1960 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver); | 1960 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver); |
1961 }; | 1961 }; |
1962 | 1962 |
1963 | 1963 |
1964 // The JSObject describes real heap allocated JavaScript objects with | 1964 // The JSObject describes real heap allocated JavaScript objects with |
1965 // properties. | 1965 // properties. |
1966 // Note that the map of JSObject changes during execution to enable inline | 1966 // Note that the map of JSObject changes during execution to enable inline |
1967 // caching. | 1967 // caching. |
1968 class JSObject: public JSReceiver { | 1968 class JSObject: public JSReceiver { |
1969 public: | 1969 public: |
| 1970 static MUST_USE_RESULT MaybeHandle<JSObject> New( |
| 1971 Handle<JSFunction> constructor, Handle<JSReceiver> new_target, |
| 1972 Handle<AllocationSite> site = Handle<AllocationSite>::null()); |
| 1973 |
1970 // [properties]: Backing storage for properties. | 1974 // [properties]: Backing storage for properties. |
1971 // properties is a FixedArray in the fast case and a Dictionary in the | 1975 // properties is a FixedArray in the fast case and a Dictionary in the |
1972 // slow case. | 1976 // slow case. |
1973 DECL_ACCESSORS(properties, FixedArray) // Get and set fast properties. | 1977 DECL_ACCESSORS(properties, FixedArray) // Get and set fast properties. |
1974 inline void initialize_properties(); | 1978 inline void initialize_properties(); |
1975 inline bool HasFastProperties(); | 1979 inline bool HasFastProperties(); |
1976 // Gets slow properties for non-global objects. | 1980 // Gets slow properties for non-global objects. |
1977 inline NameDictionary* property_dictionary(); | 1981 inline NameDictionary* property_dictionary(); |
1978 // Gets global object properties. | 1982 // Gets global object properties. |
1979 inline GlobalDictionary* global_dictionary(); | 1983 inline GlobalDictionary* global_dictionary(); |
(...skipping 5543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7523 private: | 7527 private: |
7524 DISALLOW_IMPLICIT_CONSTRUCTORS(JSValue); | 7528 DISALLOW_IMPLICIT_CONSTRUCTORS(JSValue); |
7525 }; | 7529 }; |
7526 | 7530 |
7527 | 7531 |
7528 class DateCache; | 7532 class DateCache; |
7529 | 7533 |
7530 // Representation for JS date objects. | 7534 // Representation for JS date objects. |
7531 class JSDate: public JSObject { | 7535 class JSDate: public JSObject { |
7532 public: | 7536 public: |
| 7537 static MUST_USE_RESULT MaybeHandle<JSDate> New(Handle<JSFunction> constructor, |
| 7538 Handle<JSReceiver> new_target, |
| 7539 double tv); |
| 7540 |
7533 // If one component is NaN, all of them are, indicating a NaN time value. | 7541 // If one component is NaN, all of them are, indicating a NaN time value. |
7534 // [value]: the time value. | 7542 // [value]: the time value. |
7535 DECL_ACCESSORS(value, Object) | 7543 DECL_ACCESSORS(value, Object) |
7536 // [year]: caches year. Either undefined, smi, or NaN. | 7544 // [year]: caches year. Either undefined, smi, or NaN. |
7537 DECL_ACCESSORS(year, Object) | 7545 DECL_ACCESSORS(year, Object) |
7538 // [month]: caches month. Either undefined, smi, or NaN. | 7546 // [month]: caches month. Either undefined, smi, or NaN. |
7539 DECL_ACCESSORS(month, Object) | 7547 DECL_ACCESSORS(month, Object) |
7540 // [day]: caches day. Either undefined, smi, or NaN. | 7548 // [day]: caches day. Either undefined, smi, or NaN. |
7541 DECL_ACCESSORS(day, Object) | 7549 DECL_ACCESSORS(day, Object) |
7542 // [weekday]: caches day of week. Either undefined, smi, or NaN. | 7550 // [weekday]: caches day of week. Either undefined, smi, or NaN. |
7543 DECL_ACCESSORS(weekday, Object) | 7551 DECL_ACCESSORS(weekday, Object) |
7544 // [hour]: caches hours. Either undefined, smi, or NaN. | 7552 // [hour]: caches hours. Either undefined, smi, or NaN. |
7545 DECL_ACCESSORS(hour, Object) | 7553 DECL_ACCESSORS(hour, Object) |
7546 // [min]: caches minutes. Either undefined, smi, or NaN. | 7554 // [min]: caches minutes. Either undefined, smi, or NaN. |
7547 DECL_ACCESSORS(min, Object) | 7555 DECL_ACCESSORS(min, Object) |
7548 // [sec]: caches seconds. Either undefined, smi, or NaN. | 7556 // [sec]: caches seconds. Either undefined, smi, or NaN. |
7549 DECL_ACCESSORS(sec, Object) | 7557 DECL_ACCESSORS(sec, Object) |
7550 // [cache stamp]: sample of the date cache stamp at the | 7558 // [cache stamp]: sample of the date cache stamp at the |
7551 // moment when chached fields were cached. | 7559 // moment when chached fields were cached. |
7552 DECL_ACCESSORS(cache_stamp, Object) | 7560 DECL_ACCESSORS(cache_stamp, Object) |
7553 | 7561 |
7554 DECLARE_CAST(JSDate) | 7562 DECLARE_CAST(JSDate) |
7555 | 7563 |
| 7564 // Returns the time value (UTC) identifying the current time. |
| 7565 static double CurrentTimeValue(Isolate* isolate); |
| 7566 |
7556 // Returns the date field with the specified index. | 7567 // Returns the date field with the specified index. |
7557 // See FieldIndex for the list of date fields. | 7568 // See FieldIndex for the list of date fields. |
7558 static Object* GetField(Object* date, Smi* index); | 7569 static Object* GetField(Object* date, Smi* index); |
7559 | 7570 |
7560 void SetValue(Object* value, bool is_value_nan); | 7571 void SetValue(Object* value, bool is_value_nan); |
7561 | 7572 |
7562 // ES6 section 20.3.4.45 Date.prototype [ @@toPrimitive ] | 7573 // ES6 section 20.3.4.45 Date.prototype [ @@toPrimitive ] |
7563 static MUST_USE_RESULT MaybeHandle<Object> ToPrimitive( | 7574 static MUST_USE_RESULT MaybeHandle<Object> ToPrimitive( |
7564 Handle<JSReceiver> receiver, Handle<Object> hint); | 7575 Handle<JSReceiver> receiver, Handle<Object> hint); |
7565 | 7576 |
(...skipping 3153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10719 } | 10730 } |
10720 return value; | 10731 return value; |
10721 } | 10732 } |
10722 }; | 10733 }; |
10723 | 10734 |
10724 | 10735 |
10725 } // NOLINT, false-positive due to second-order macros. | 10736 } // NOLINT, false-positive due to second-order macros. |
10726 } // NOLINT, false-positive due to second-order macros. | 10737 } // NOLINT, false-positive due to second-order macros. |
10727 | 10738 |
10728 #endif // V8_OBJECTS_H_ | 10739 #endif // V8_OBJECTS_H_ |
OLD | NEW |