OLD | NEW |
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 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 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 | 749 |
750 bool BooleanValue() const; | 750 bool BooleanValue() const; |
751 double NumberValue() const; | 751 double NumberValue() const; |
752 int64_t IntegerValue() const; | 752 int64_t IntegerValue() const; |
753 uint32_t Uint32Value() const; | 753 uint32_t Uint32Value() const; |
754 int32_t Int32Value() const; | 754 int32_t Int32Value() const; |
755 | 755 |
756 /** JS == */ | 756 /** JS == */ |
757 bool Equals(Handle<Value> that) const; | 757 bool Equals(Handle<Value> that) const; |
758 bool StrictEquals(Handle<Value> that) const; | 758 bool StrictEquals(Handle<Value> that) const; |
759 | 759 |
760 private: | 760 private: |
761 inline bool QuickIsString() const; | 761 inline bool QuickIsString() const; |
762 bool FullIsString() const; | 762 bool FullIsString() const; |
763 }; | 763 }; |
764 | 764 |
765 | 765 |
766 /** | 766 /** |
767 * The superclass of primitive values. See ECMA-262 4.3.2. | 767 * The superclass of primitive values. See ECMA-262 4.3.2. |
768 */ | 768 */ |
769 class V8EXPORT Primitive : public Value { }; | 769 class V8EXPORT Primitive : public Value { }; |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1029 const uint16_t* operator*() const { return str_; } | 1029 const uint16_t* operator*() const { return str_; } |
1030 int length() const { return length_; } | 1030 int length() const { return length_; } |
1031 private: | 1031 private: |
1032 uint16_t* str_; | 1032 uint16_t* str_; |
1033 int length_; | 1033 int length_; |
1034 | 1034 |
1035 // Disallow copying and assigning. | 1035 // Disallow copying and assigning. |
1036 Value(const Value&); | 1036 Value(const Value&); |
1037 void operator=(const Value&); | 1037 void operator=(const Value&); |
1038 }; | 1038 }; |
1039 | 1039 |
1040 private: | 1040 private: |
1041 void VerifyExternalStringResource(ExternalStringResource* val) const; | 1041 void VerifyExternalStringResource(ExternalStringResource* val) const; |
1042 static void CheckCast(v8::Value* obj); | 1042 static void CheckCast(v8::Value* obj); |
1043 }; | 1043 }; |
1044 | 1044 |
1045 | 1045 |
1046 /** | 1046 /** |
1047 * A JavaScript number value (ECMA-262, 4.3.20) | 1047 * A JavaScript number value (ECMA-262, 4.3.20) |
1048 */ | 1048 */ |
1049 class V8EXPORT Number : public Primitive { | 1049 class V8EXPORT Number : public Primitive { |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 | 1187 |
1188 /** Gets the number of internal fields for this Object. */ | 1188 /** Gets the number of internal fields for this Object. */ |
1189 int InternalFieldCount(); | 1189 int InternalFieldCount(); |
1190 /** Gets the value in an internal field. */ | 1190 /** Gets the value in an internal field. */ |
1191 inline Local<Value> GetInternalField(int index); | 1191 inline Local<Value> GetInternalField(int index); |
1192 /** Sets the value in an internal field. */ | 1192 /** Sets the value in an internal field. */ |
1193 void SetInternalField(int index, Handle<Value> value); | 1193 void SetInternalField(int index, Handle<Value> value); |
1194 | 1194 |
1195 /** Gets a native pointer from an internal field. */ | 1195 /** Gets a native pointer from an internal field. */ |
1196 inline void* GetPointerFromInternalField(int index); | 1196 inline void* GetPointerFromInternalField(int index); |
1197 | 1197 |
1198 /** Sets a native pointer in an internal field. */ | 1198 /** Sets a native pointer in an internal field. */ |
1199 void SetPointerInInternalField(int index, void* value); | 1199 void SetPointerInInternalField(int index, void* value); |
1200 | 1200 |
1201 // Testers for local properties. | 1201 // Testers for local properties. |
1202 bool HasRealNamedProperty(Handle<String> key); | 1202 bool HasRealNamedProperty(Handle<String> key); |
1203 bool HasRealIndexedProperty(uint32_t index); | 1203 bool HasRealIndexedProperty(uint32_t index); |
1204 bool HasRealNamedCallbackProperty(Handle<String> key); | 1204 bool HasRealNamedCallbackProperty(Handle<String> key); |
1205 | 1205 |
1206 /** | 1206 /** |
1207 * If result.IsEmpty() no real property was located in the prototype chain. | 1207 * If result.IsEmpty() no real property was located in the prototype chain. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1240 | 1240 |
1241 /** | 1241 /** |
1242 * Access hidden properties on JavaScript objects. These properties are | 1242 * Access hidden properties on JavaScript objects. These properties are |
1243 * hidden from the executing JavaScript and only accessible through the V8 | 1243 * hidden from the executing JavaScript and only accessible through the V8 |
1244 * C++ API. Hidden properties introduced by V8 internally (for example the | 1244 * C++ API. Hidden properties introduced by V8 internally (for example the |
1245 * identity hash) are prefixed with "v8::". | 1245 * identity hash) are prefixed with "v8::". |
1246 */ | 1246 */ |
1247 bool SetHiddenValue(Handle<String> key, Handle<Value> value); | 1247 bool SetHiddenValue(Handle<String> key, Handle<Value> value); |
1248 Local<Value> GetHiddenValue(Handle<String> key); | 1248 Local<Value> GetHiddenValue(Handle<String> key); |
1249 bool DeleteHiddenValue(Handle<String> key); | 1249 bool DeleteHiddenValue(Handle<String> key); |
1250 | 1250 |
1251 /** | 1251 /** |
1252 * Returns true if this is an instance of an api function (one | 1252 * Returns true if this is an instance of an api function (one |
1253 * created from a function created from a function template) and has | 1253 * created from a function created from a function template) and has |
1254 * been modified since it was created. Note that this method is | 1254 * been modified since it was created. Note that this method is |
1255 * conservative and may return true for objects that haven't actually | 1255 * conservative and may return true for objects that haven't actually |
1256 * been modified. | 1256 * been modified. |
1257 */ | 1257 */ |
1258 bool IsDirty(); | 1258 bool IsDirty(); |
1259 | 1259 |
1260 /** | 1260 /** |
(...skipping 13 matching lines...) Expand all Loading... |
1274 | 1274 |
1275 static Local<Object> New(); | 1275 static Local<Object> New(); |
1276 static inline Object* Cast(Value* obj); | 1276 static inline Object* Cast(Value* obj); |
1277 private: | 1277 private: |
1278 Object(); | 1278 Object(); |
1279 static void CheckCast(Value* obj); | 1279 static void CheckCast(Value* obj); |
1280 Local<Value> CheckedGetInternalField(int index); | 1280 Local<Value> CheckedGetInternalField(int index); |
1281 | 1281 |
1282 /** | 1282 /** |
1283 * If quick access to the internal field is possible this method | 1283 * If quick access to the internal field is possible this method |
1284 * returns the value. Otherwise an empty handle is returned. | 1284 * returns the value. Otherwise an empty handle is returned. |
1285 */ | 1285 */ |
1286 inline Local<Value> UncheckedGetInternalField(int index); | 1286 inline Local<Value> UncheckedGetInternalField(int index); |
1287 }; | 1287 }; |
1288 | 1288 |
1289 | 1289 |
1290 /** | 1290 /** |
1291 * An instance of the built-in array constructor (ECMA-262, 15.4.2). | 1291 * An instance of the built-in array constructor (ECMA-262, 15.4.2). |
1292 */ | 1292 */ |
1293 class V8EXPORT Array : public Object { | 1293 class V8EXPORT Array : public Object { |
1294 public: | 1294 public: |
(...skipping 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2713 | 2713 |
2714 | 2714 |
2715 namespace internal { | 2715 namespace internal { |
2716 | 2716 |
2717 | 2717 |
2718 // Tag information for HeapObject. | 2718 // Tag information for HeapObject. |
2719 const int kHeapObjectTag = 1; | 2719 const int kHeapObjectTag = 1; |
2720 const int kHeapObjectTagSize = 2; | 2720 const int kHeapObjectTagSize = 2; |
2721 const intptr_t kHeapObjectTagMask = (1 << kHeapObjectTagSize) - 1; | 2721 const intptr_t kHeapObjectTagMask = (1 << kHeapObjectTagSize) - 1; |
2722 | 2722 |
2723 #ifdef V8_LONG_SMI | 2723 #ifdef V8_TARGET_ARCH_X64 |
2724 #ifndef V8_TARGET_ARCH_X64 | |
2725 #error "Large smis on non-64-bit platform." | |
2726 #endif | |
2727 // Tag information for Smi. | 2724 // Tag information for Smi. |
2728 const int kSmiTag = 0; | 2725 const int kSmiTag = 0; |
2729 const int kSmiTagSize = 1; | 2726 const int kSmiTagSize = 1; |
2730 const intptr_t kSmiTagMask = (1 << kSmiTagSize) - 1; | 2727 const intptr_t kSmiTagMask = (1 << kSmiTagSize) - 1; |
2731 const int kSmiShiftSize = 31; | 2728 const int kSmiShiftSize = 31; |
2732 const int kSmiValueSize = 32; | 2729 const int kSmiValueSize = 32; |
2733 #else | 2730 #else |
2734 // Tag information for Smi. | 2731 // Tag information for Smi. |
2735 const int kSmiTag = 0; | 2732 const int kSmiTag = 0; |
2736 const int kSmiTagSize = 1; | 2733 const int kSmiTagSize = 1; |
(...skipping 30 matching lines...) Expand all Loading... |
2767 static inline bool HasHeapObjectTag(internal::Object* value) { | 2764 static inline bool HasHeapObjectTag(internal::Object* value) { |
2768 return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) == | 2765 return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) == |
2769 kHeapObjectTag); | 2766 kHeapObjectTag); |
2770 } | 2767 } |
2771 | 2768 |
2772 static inline bool HasSmiTag(internal::Object* value) { | 2769 static inline bool HasSmiTag(internal::Object* value) { |
2773 return ((reinterpret_cast<intptr_t>(value) & kSmiTagMask) == kSmiTag); | 2770 return ((reinterpret_cast<intptr_t>(value) & kSmiTagMask) == kSmiTag); |
2774 } | 2771 } |
2775 | 2772 |
2776 static inline int SmiValue(internal::Object* value) { | 2773 static inline int SmiValue(internal::Object* value) { |
2777 #ifdef V8_LONG_SMI | 2774 #ifdef V8_TARGET_ARCH_X64 |
2778 int shift_bits = kSmiTagSize + kSmiShiftSize; | 2775 int shift_bits = kSmiTagSize + kSmiShiftSize; |
2779 // Shift down and throw away top 32 bits. | 2776 // Shift down and throw away top 32 bits. |
2780 return static_cast<int>(reinterpret_cast<intptr_t>(value) >> shift_bits); | 2777 return static_cast<int>(reinterpret_cast<intptr_t>(value) >> shift_bits); |
2781 #else | 2778 #else |
2782 int shift_bits = kSmiTagSize + kSmiShiftSize; | 2779 int shift_bits = kSmiTagSize + kSmiShiftSize; |
2783 // Throw away top 32 bits and shift down (requires >> to be sign extending). | 2780 // Throw away top 32 bits and shift down (requires >> to be sign extending). |
2784 return static_cast<int>(reinterpret_cast<intptr_t>(value)) >> shift_bits; | 2781 return static_cast<int>(reinterpret_cast<intptr_t>(value)) >> shift_bits; |
2785 #endif | 2782 #endif |
2786 } | 2783 } |
2787 | 2784 |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3132 | 3129 |
3133 } // namespace v8 | 3130 } // namespace v8 |
3134 | 3131 |
3135 | 3132 |
3136 #undef V8EXPORT | 3133 #undef V8EXPORT |
3137 #undef V8EXPORT_INLINE | 3134 #undef V8EXPORT_INLINE |
3138 #undef TYPE_CHECK | 3135 #undef TYPE_CHECK |
3139 | 3136 |
3140 | 3137 |
3141 #endif // V8_H_ | 3138 #endif // V8_H_ |
OLD | NEW |