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 2732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2743 V8_INLINE(void Set(const Handle<T> handle)); | 2743 V8_INLINE(void Set(const Handle<T> handle)); |
2744 // Fast primitive setters | 2744 // Fast primitive setters |
2745 V8_INLINE(void Set(Isolate* isolate, bool value)); | 2745 V8_INLINE(void Set(Isolate* isolate, bool value)); |
2746 V8_INLINE(void Set(Isolate* isolate, double i)); | 2746 V8_INLINE(void Set(Isolate* isolate, double i)); |
2747 V8_INLINE(void Set(Isolate* isolate, int32_t i)); | 2747 V8_INLINE(void Set(Isolate* isolate, int32_t i)); |
2748 V8_INLINE(void Set(Isolate* isolate, uint32_t i)); | 2748 V8_INLINE(void Set(Isolate* isolate, uint32_t i)); |
2749 // Fast JS primitive setters | 2749 // Fast JS primitive setters |
2750 V8_INLINE(void SetNull(Isolate* isolate)); | 2750 V8_INLINE(void SetNull(Isolate* isolate)); |
2751 V8_INLINE(void SetUndefined(Isolate* isolate)); | 2751 V8_INLINE(void SetUndefined(Isolate* isolate)); |
2752 private: | 2752 private: |
| 2753 V8_INLINE(void SetTrue(Isolate* isolate)); |
| 2754 V8_INLINE(void SetFalse(Isolate* isolate)); |
2753 internal::Object** value_; | 2755 internal::Object** value_; |
2754 }; | 2756 }; |
2755 | 2757 |
2756 | 2758 |
2757 /** | 2759 /** |
2758 * The argument information given to function call callbacks. This | 2760 * The argument information given to function call callbacks. This |
2759 * class provides access to information about the context of the call, | 2761 * class provides access to information about the context of the call, |
2760 * including the receiver, the number and values of arguments, and | 2762 * including the receiver, the number and values of arguments, and |
2761 * the holder of the function. | 2763 * the holder of the function. |
2762 */ | 2764 */ |
(...skipping 2910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5673 typedef internal::Internals I; | 5675 typedef internal::Internals I; |
5674 if (V8_LIKELY(I::IsValidSmi(i))) { | 5676 if (V8_LIKELY(I::IsValidSmi(i))) { |
5675 *value_ = I::IntToSmi(i); | 5677 *value_ = I::IntToSmi(i); |
5676 return; | 5678 return; |
5677 } | 5679 } |
5678 Set(Integer::NewFromUnsigned(i, isolate)); | 5680 Set(Integer::NewFromUnsigned(i, isolate)); |
5679 } | 5681 } |
5680 | 5682 |
5681 template<typename T> | 5683 template<typename T> |
5682 void ReturnValue<T>::Set(Isolate* isolate, bool value) { | 5684 void ReturnValue<T>::Set(Isolate* isolate, bool value) { |
5683 typedef internal::Internals I; | 5685 if (value) { |
5684 *value_ = *I::GetRoot( | 5686 SetTrue(isolate); |
5685 isolate, value ? I::kTrueValueRootIndex : I::kFalseValueRootIndex); | 5687 } else { |
| 5688 SetFalse(isolate); |
| 5689 } |
5686 } | 5690 } |
5687 | 5691 |
5688 template<typename T> | 5692 template<typename T> |
| 5693 void ReturnValue<T>::SetTrue(Isolate* isolate) { |
| 5694 typedef internal::Internals I; |
| 5695 *value_ = *I::GetRoot(isolate, I::kTrueValueRootIndex); |
| 5696 } |
| 5697 |
| 5698 template<typename T> |
| 5699 void ReturnValue<T>::SetFalse(Isolate* isolate) { |
| 5700 typedef internal::Internals I; |
| 5701 *value_ = *I::GetRoot(isolate, I::kFalseValueRootIndex); |
| 5702 } |
| 5703 |
| 5704 template<typename T> |
5689 void ReturnValue<T>::SetNull(Isolate* isolate) { | 5705 void ReturnValue<T>::SetNull(Isolate* isolate) { |
5690 typedef internal::Internals I; | 5706 typedef internal::Internals I; |
5691 *value_ = *I::GetRoot(isolate, I::kNullValueRootIndex); | 5707 *value_ = *I::GetRoot(isolate, I::kNullValueRootIndex); |
5692 } | 5708 } |
5693 | 5709 |
5694 template<typename T> | 5710 template<typename T> |
5695 void ReturnValue<T>::SetUndefined(Isolate* isolate) { | 5711 void ReturnValue<T>::SetUndefined(Isolate* isolate) { |
5696 typedef internal::Internals I; | 5712 typedef internal::Internals I; |
5697 *value_ = *I::GetRoot(isolate, I::kUndefinedValueRootIndex); | 5713 *value_ = *I::GetRoot(isolate, I::kUndefinedValueRootIndex); |
5698 } | 5714 } |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6270 | 6286 |
6271 | 6287 |
6272 } // namespace v8 | 6288 } // namespace v8 |
6273 | 6289 |
6274 | 6290 |
6275 #undef V8EXPORT | 6291 #undef V8EXPORT |
6276 #undef TYPE_CHECK | 6292 #undef TYPE_CHECK |
6277 | 6293 |
6278 | 6294 |
6279 #endif // V8_H_ | 6295 #endif // V8_H_ |
OLD | NEW |