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 5429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5440 static const int kUndefinedValueRootIndex = 5; | 5440 static const int kUndefinedValueRootIndex = 5; |
5441 static const int kNullValueRootIndex = 7; | 5441 static const int kNullValueRootIndex = 7; |
5442 static const int kTrueValueRootIndex = 8; | 5442 static const int kTrueValueRootIndex = 8; |
5443 static const int kFalseValueRootIndex = 9; | 5443 static const int kFalseValueRootIndex = 9; |
5444 static const int kEmptyStringRootIndex = 135; | 5444 static const int kEmptyStringRootIndex = 135; |
5445 | 5445 |
5446 static const int kNodeClassIdOffset = 1 * kApiPointerSize; | 5446 static const int kNodeClassIdOffset = 1 * kApiPointerSize; |
5447 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; | 5447 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; |
5448 static const int kNodeStateMask = 0xf; | 5448 static const int kNodeStateMask = 0xf; |
5449 static const int kNodeStateIsWeakValue = 2; | 5449 static const int kNodeStateIsWeakValue = 2; |
| 5450 static const int kNodeStateIsPendingValue = 3; |
5450 static const int kNodeStateIsNearDeathValue = 4; | 5451 static const int kNodeStateIsNearDeathValue = 4; |
5451 static const int kNodeIsIndependentShift = 4; | 5452 static const int kNodeIsIndependentShift = 4; |
5452 static const int kNodeIsPartiallyDependentShift = 5; | 5453 static const int kNodeIsPartiallyDependentShift = 5; |
5453 | 5454 |
5454 static const int kJSObjectType = 0xb1; | 5455 static const int kJSObjectType = 0xb1; |
5455 static const int kFirstNonstringType = 0x80; | 5456 static const int kFirstNonstringType = 0x80; |
5456 static const int kOddballType = 0x83; | 5457 static const int kOddballType = 0x83; |
5457 static const int kForeignType = 0x87; | 5458 static const int kForeignType = 0x87; |
5458 | 5459 |
5459 static const int kUndefinedOddballKind = 5; | 5460 static const int kUndefinedOddballKind = 5; |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5655 if (this->IsEmpty()) return false; | 5656 if (this->IsEmpty()) return false; |
5656 return I::GetNodeFlag(reinterpret_cast<internal::Object**>(this->val_), | 5657 return I::GetNodeFlag(reinterpret_cast<internal::Object**>(this->val_), |
5657 I::kNodeIsIndependentShift); | 5658 I::kNodeIsIndependentShift); |
5658 } | 5659 } |
5659 | 5660 |
5660 | 5661 |
5661 template <class T> | 5662 template <class T> |
5662 bool Persistent<T>::IsNearDeath() const { | 5663 bool Persistent<T>::IsNearDeath() const { |
5663 typedef internal::Internals I; | 5664 typedef internal::Internals I; |
5664 if (this->IsEmpty()) return false; | 5665 if (this->IsEmpty()) return false; |
5665 return I::GetNodeState(reinterpret_cast<internal::Object**>(this->val_)) == | 5666 uint8_t node_state = |
5666 I::kNodeStateIsNearDeathValue; | 5667 I::GetNodeState(reinterpret_cast<internal::Object**>(this->val_)); |
| 5668 return node_state == I::kNodeStateIsNearDeathValue || |
| 5669 node_state == I::kNodeStateIsPendingValue; |
5667 } | 5670 } |
5668 | 5671 |
5669 | 5672 |
5670 template <class T> | 5673 template <class T> |
5671 bool Persistent<T>::IsWeak() const { | 5674 bool Persistent<T>::IsWeak() const { |
5672 typedef internal::Internals I; | 5675 typedef internal::Internals I; |
5673 if (this->IsEmpty()) return false; | 5676 if (this->IsEmpty()) return false; |
5674 return I::GetNodeState(reinterpret_cast<internal::Object**>(this->val_)) == | 5677 return I::GetNodeState(reinterpret_cast<internal::Object**>(this->val_)) == |
5675 I::kNodeStateIsWeakValue; | 5678 I::kNodeStateIsWeakValue; |
5676 } | 5679 } |
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6527 | 6530 |
6528 | 6531 |
6529 } // namespace v8 | 6532 } // namespace v8 |
6530 | 6533 |
6531 | 6534 |
6532 #undef V8EXPORT | 6535 #undef V8EXPORT |
6533 #undef TYPE_CHECK | 6536 #undef TYPE_CHECK |
6534 | 6537 |
6535 | 6538 |
6536 #endif // V8_H_ | 6539 #endif // V8_H_ |
OLD | NEW |