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 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1462 bool BooleanValue() const; | 1462 bool BooleanValue() const; |
1463 double NumberValue() const; | 1463 double NumberValue() const; |
1464 int64_t IntegerValue() const; | 1464 int64_t IntegerValue() const; |
1465 uint32_t Uint32Value() const; | 1465 uint32_t Uint32Value() const; |
1466 int32_t Int32Value() const; | 1466 int32_t Int32Value() const; |
1467 | 1467 |
1468 /** JS == */ | 1468 /** JS == */ |
1469 bool Equals(Handle<Value> that) const; | 1469 bool Equals(Handle<Value> that) const; |
1470 bool StrictEquals(Handle<Value> that) const; | 1470 bool StrictEquals(Handle<Value> that) const; |
1471 | 1471 |
| 1472 template <class T> V8_INLINE(static Value* Cast(T* value)); |
| 1473 |
1472 private: | 1474 private: |
1473 V8_INLINE(bool QuickIsUndefined() const); | 1475 V8_INLINE(bool QuickIsUndefined() const); |
1474 V8_INLINE(bool QuickIsNull() const); | 1476 V8_INLINE(bool QuickIsNull() const); |
1475 V8_INLINE(bool QuickIsString() const); | 1477 V8_INLINE(bool QuickIsString() const); |
1476 bool FullIsUndefined() const; | 1478 bool FullIsUndefined() const; |
1477 bool FullIsNull() const; | 1479 bool FullIsNull() const; |
1478 bool FullIsString() const; | 1480 bool FullIsString() const; |
1479 }; | 1481 }; |
1480 | 1482 |
1481 | 1483 |
(...skipping 4498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5980 | 5982 |
5981 bool Value::QuickIsString() const { | 5983 bool Value::QuickIsString() const { |
5982 typedef internal::Object O; | 5984 typedef internal::Object O; |
5983 typedef internal::Internals I; | 5985 typedef internal::Internals I; |
5984 O* obj = *reinterpret_cast<O**>(const_cast<Value*>(this)); | 5986 O* obj = *reinterpret_cast<O**>(const_cast<Value*>(this)); |
5985 if (!I::HasHeapObjectTag(obj)) return false; | 5987 if (!I::HasHeapObjectTag(obj)) return false; |
5986 return (I::GetInstanceType(obj) < I::kFirstNonstringType); | 5988 return (I::GetInstanceType(obj) < I::kFirstNonstringType); |
5987 } | 5989 } |
5988 | 5990 |
5989 | 5991 |
| 5992 template <class T> Value* Value::Cast(T* value) { |
| 5993 return static_cast<Value*>(value); |
| 5994 } |
| 5995 |
| 5996 |
5990 Symbol* Symbol::Cast(v8::Value* value) { | 5997 Symbol* Symbol::Cast(v8::Value* value) { |
5991 #ifdef V8_ENABLE_CHECKS | 5998 #ifdef V8_ENABLE_CHECKS |
5992 CheckCast(value); | 5999 CheckCast(value); |
5993 #endif | 6000 #endif |
5994 return static_cast<Symbol*>(value); | 6001 return static_cast<Symbol*>(value); |
5995 } | 6002 } |
5996 | 6003 |
5997 | 6004 |
5998 Number* Number::Cast(v8::Value* value) { | 6005 Number* Number::Cast(v8::Value* value) { |
5999 #ifdef V8_ENABLE_CHECKS | 6006 #ifdef V8_ENABLE_CHECKS |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6284 | 6291 |
6285 | 6292 |
6286 } // namespace v8 | 6293 } // namespace v8 |
6287 | 6294 |
6288 | 6295 |
6289 #undef V8EXPORT | 6296 #undef V8EXPORT |
6290 #undef TYPE_CHECK | 6297 #undef TYPE_CHECK |
6291 | 6298 |
6292 | 6299 |
6293 #endif // V8_H_ | 6300 #endif // V8_H_ |
OLD | NEW |