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 5664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5675 if (V8_LIKELY(I::IsValidSmi(i))) { | 5675 if (V8_LIKELY(I::IsValidSmi(i))) { |
5676 *value_ = I::IntToSmi(i); | 5676 *value_ = I::IntToSmi(i); |
5677 return; | 5677 return; |
5678 } | 5678 } |
5679 Set(Integer::New(i, GetIsolate())); | 5679 Set(Integer::New(i, GetIsolate())); |
5680 } | 5680 } |
5681 | 5681 |
5682 template<typename T> | 5682 template<typename T> |
5683 void ReturnValue<T>::Set(uint32_t i) { | 5683 void ReturnValue<T>::Set(uint32_t i) { |
5684 typedef internal::Internals I; | 5684 typedef internal::Internals I; |
5685 if (V8_LIKELY(I::IsValidSmi(i))) { | 5685 if (V8_LIKELY(i <= INT32_MAX)) { |
5686 *value_ = I::IntToSmi(i); | 5686 Set(static_cast<int32_t>(i)); |
5687 return; | 5687 return; |
5688 } | 5688 } |
5689 Set(Integer::NewFromUnsigned(i, GetIsolate())); | 5689 Set(Integer::NewFromUnsigned(i, GetIsolate())); |
5690 } | 5690 } |
5691 | 5691 |
5692 template<typename T> | 5692 template<typename T> |
5693 void ReturnValue<T>::Set(bool value) { | 5693 void ReturnValue<T>::Set(bool value) { |
5694 typedef internal::Internals I; | 5694 typedef internal::Internals I; |
5695 int root_index; | 5695 int root_index; |
5696 if (value) { | 5696 if (value) { |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6292 | 6292 |
6293 | 6293 |
6294 } // namespace v8 | 6294 } // namespace v8 |
6295 | 6295 |
6296 | 6296 |
6297 #undef V8EXPORT | 6297 #undef V8EXPORT |
6298 #undef TYPE_CHECK | 6298 #undef TYPE_CHECK |
6299 | 6299 |
6300 | 6300 |
6301 #endif // V8_H_ | 6301 #endif // V8_H_ |
OLD | NEW |