Reviewers: Sven Panne,
Description:
test for new style property handlers
[email protected]
BUG=
Please review this at https://codereview.chromium.org/15769014/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M include/v8.h
M test/cctest/test-api.cc
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index
28a63f092efb5a7831ccd5a891a9cffddbf4f655..5f0df5bf067ab1f8af695f644079725d277e8fbe
100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -2811,7 +2811,10 @@ class V8EXPORT Template : public Data {
template<typename T>
class ReturnValue {
public:
- V8_INLINE(explicit ReturnValue(internal::Object** slot));
+ template <class S> V8_INLINE(ReturnValue(const ReturnValue<S>& that))
+ : value_(that.value_) {
+ TYPE_CHECK(T, S);
+ };
// Handle setters
template <typename S> V8_INLINE(void Set(const Persistent<S>& handle));
template <typename S> V8_INLINE(void Set(const Handle<S> handle));
@@ -2825,7 +2828,12 @@ class ReturnValue {
V8_INLINE(void SetUndefined());
// Convenience getter for Isolate
V8_INLINE(Isolate* GetIsolate());
+
private:
+ template<class F> friend class ReturnValue;
+ template<class F> friend class FunctionCallbackInfo;
+ template<class F> friend class PropertyCallbackInfo;
+ V8_INLINE(explicit ReturnValue(internal::Object** slot));
internal::Object** value_;
};
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index
cb3a38eee8e95f66dc294dce3dc5197050bc630e..66a208bb5e0f60cda51e76389c9d9505e654097c
100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -2007,88 +2007,90 @@ THREADED_TEST(IndexedPropertyHandlerGetter) {
v8::Handle<v8::Object> bottom;
-static v8::Handle<Value> CheckThisIndexedPropertyHandler(
+static void CheckThisIndexedPropertyHandler(
uint32_t index,
- const AccessorInfo& info) {
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
+ CheckReturnValue(info);
ApiTestFuzzer::Fuzz();
CHECK(info.This()->Equals(bottom));
- return v8::Handle<Value>();
}
-static v8::Handle<Value> CheckThisNamedPropertyHandler(
+static void CheckThisNamedPropertyHandler(
Local<String> name,
- const AccessorInfo& info) {
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
+ CheckReturnValue(info);
ApiTestFuzzer::Fuzz();
CHECK(info.This()->Equals(bottom));
- return v8::Handle<Value>();
}
-
-v8::Handle<Value> CheckThisIndexedPropertySetter(uint32_t index,
- Local<Value> value,
- const AccessorInfo& info)
{
+void CheckThisIndexedPropertySetter(
+ uint32_t index,
+ Local<Value> value,
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
+ CheckReturnValue(info);
ApiTestFuzzer::Fuzz();
CHECK(info.This()->Equals(bottom));
- return v8::Handle<Value>();
}
-v8::Handle<Value> CheckThisNamedPropertySetter(Local<String> property,
- Local<Value> value,
- const AccessorInfo& info) {
+void CheckThisNamedPropertySetter(
+ Local<String> property,
+ Local<Value> value,
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
+ CheckReturnValue(info);
ApiTestFuzzer::Fuzz();
CHECK(info.This()->Equals(bottom));
- return v8::Handle<Value>();
}
-v8::Handle<v8::Integer> CheckThisIndexedPropertyQuery(
+void CheckThisIndexedPropertyQuery(
uint32_t index,
- const AccessorInfo& info) {
+ const v8::PropertyCallbackInfo<v8::Integer>& info) {
+ CheckReturnValue(info);
ApiTestFuzzer::Fuzz();
CHECK(info.This()->Equals(bottom));
- return v8::Handle<v8::Integer>();
}
-v8::Handle<v8::Integer> CheckThisNamedPropertyQuery(Local<String> property,
- const AccessorInfo&
info) {
+void CheckThisNamedPropertyQuery(
+ Local<String> property,
+ const v8::PropertyCallbackInfo<v8::Integer>& info) {
+ CheckReturnValue(info);
ApiTestFuzzer::Fuzz();
CHECK(info.This()->Equals(bottom));
- return v8::Handle<v8::Integer>();
}
-v8::Handle<v8::Boolean> CheckThisIndexedPropertyDeleter(
+void CheckThisIndexedPropertyDeleter(
uint32_t index,
- const AccessorInfo& info) {
+ const v8::PropertyCallbackInfo<v8::Boolean>& info) {
+ CheckReturnValue(info);
ApiTestFuzzer::Fuzz();
CHECK(info.This()->Equals(bottom));
- return v8::Handle<v8::Boolean>();
}
-v8::Handle<v8::Boolean> CheckThisNamedPropertyDeleter(
+void CheckThisNamedPropertyDeleter(
Local<String> property,
- const AccessorInfo& info) {
+ const v8::PropertyCallbackInfo<v8::Boolean>& info) {
+ CheckReturnValue(info);
ApiTestFuzzer::Fuzz();
CHECK(info.This()->Equals(bottom));
- return v8::Handle<v8::Boolean>();
}
-v8::Handle<v8::Array> CheckThisIndexedPropertyEnumerator(
- const AccessorInfo& info) {
+void CheckThisIndexedPropertyEnumerator(
+ const v8::PropertyCallbackInfo<v8::Array>& info) {
+ CheckReturnValue(info);
ApiTestFuzzer::Fuzz();
CHECK(info.This()->Equals(bottom));
- return v8::Handle<v8::Array>();
}
-v8::Handle<v8::Array> CheckThisNamedPropertyEnumerator(
- const AccessorInfo& info) {
+void CheckThisNamedPropertyEnumerator(
+ const v8::PropertyCallbackInfo<v8::Array>& info) {
+ CheckReturnValue(info);
ApiTestFuzzer::Fuzz();
CHECK(info.This()->Equals(bottom));
- return v8::Handle<v8::Array>();
}
--
--
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.