Revision: 15188
Author: [email protected]
Date: Tue Jun 18 00:39:15 2013
Log: added type checks on fast return values
[email protected]
BUG=
Review URL: https://codereview.chromium.org/16939003
http://code.google.com/p/v8/source/detail?r=15188
Modified:
/branches/bleeding_edge/include/v8.h
=======================================
--- /branches/bleeding_edge/include/v8.h Fri Jun 14 05:53:19 2013
+++ /branches/bleeding_edge/include/v8.h Tue Jun 18 00:39:15 2013
@@ -5712,11 +5712,13 @@
template<typename T>
void ReturnValue<T>::Set(double i) {
+ TYPE_CHECK(T, Number);
Set(Number::New(GetIsolate(), i));
}
template<typename T>
void ReturnValue<T>::Set(int32_t i) {
+ TYPE_CHECK(T, Integer);
typedef internal::Internals I;
if (V8_LIKELY(I::IsValidSmi(i))) {
*value_ = I::IntToSmi(i);
@@ -5727,6 +5729,7 @@
template<typename T>
void ReturnValue<T>::Set(uint32_t i) {
+ TYPE_CHECK(T, Integer);
typedef internal::Internals I;
// Can't simply use INT32_MAX here for whatever reason.
bool fits_into_int32_t = (i & (1 << 31)) == 0;
@@ -5739,6 +5742,7 @@
template<typename T>
void ReturnValue<T>::Set(bool value) {
+ TYPE_CHECK(T, Boolean);
typedef internal::Internals I;
int root_index;
if (value) {
@@ -5751,18 +5755,21 @@
template<typename T>
void ReturnValue<T>::SetNull() {
+ TYPE_CHECK(T, Primitive);
typedef internal::Internals I;
*value_ = *I::GetRoot(GetIsolate(), I::kNullValueRootIndex);
}
template<typename T>
void ReturnValue<T>::SetUndefined() {
+ TYPE_CHECK(T, Primitive);
typedef internal::Internals I;
*value_ = *I::GetRoot(GetIsolate(), I::kUndefinedValueRootIndex);
}
template<typename T>
void ReturnValue<T>::SetEmptyString() {
+ TYPE_CHECK(T, String);
typedef internal::Internals I;
*value_ = *I::GetRoot(GetIsolate(), I::kEmptyStringRootIndex);
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.