summaryrefslogtreecommitdiffstats
path: root/src/v8/0011-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2011-08-16 10:50:00 +0200
committerQt by Nokia <qt-info@nokia.com>2011-08-29 10:16:01 +0200
commit9830cb8e5992a352ec6508491ab52e8f2a9da877 (patch)
tree9baa3969878a1e070c56c9a3a67143c2d96ee5d6 /src/v8/0011-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch
parent13b3545e833f6175f686c9776e1510db3f3f11eb (diff)
Add QtV8 library to QtBase
This adds Aaron's copy of V8 to src/3rdparty/v8 (as a git submodule), and builds it as a "normal" Qt library (without any dependencies on Qt itself). The library can be added to a project with QT += v8-private V8 API headers are available as private includes, e.g. #include <private/v8.h> The API is private because we're exposing a third-party API directly, and we don't want to (and cannot) make source or binary compatibility guarantees for it. Since we want the V8 public API headers to be private headers in Qt, syncqt and sync.profile were extended to understand a new configuration option, the @allmoduleheadersprivate array, that tells syncqt whether all the library headers should be treated as private even though they don't follow the _p.h Qt convention. The V8 project files, patches and autotests are copied from the QtDeclarative repository. The next step after this commit is to remove QtDeclarative's copy of V8 and link with QtV8 instead. Task-number: QTBUG-20963 Change-Id: Ib8820362cdbc8fa662a5e97db841656cf38d1b62 Reviewed-on: http://codereview.qt.nokia.com/3092 Reviewed-by: Kent Hansen <kent.hansen@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/v8/0011-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch')
-rw-r--r--src/v8/0011-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/v8/0011-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch b/src/v8/0011-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch
new file mode 100644
index 0000000000..9c0e68352f
--- /dev/null
+++ b/src/v8/0011-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch
@@ -0,0 +1,63 @@
+From f22d0312faeb93ced8747d9aae8c6d77e11b4aba Mon Sep 17 00:00:00 2001
+From: Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+Date: Tue, 7 Dec 2010 11:56:42 +0100
+Subject: [PATCH 11/13] QtScript/V8: Add new v8 api to check if a value is an error.
+
+New function v8::Value::IsError was created.
+
+This API is experimental and added only for the purposes of our
+research.
+---
+ include/v8.h | 5 +++++
+ src/api.cc | 6 ++++++
+ src/heap.h | 1 +
+ 3 files changed, 12 insertions(+), 0 deletions(-)
+
+diff --git a/include/v8.h b/include/v8.h
+index 84462b5..08b0ec2 100644
+--- a/include/v8.h
++++ b/include/v8.h
+@@ -937,6 +937,11 @@ class Value : public Data {
+ */
+ V8EXPORT bool IsRegExp() const;
+
++ /**
++ * Returns true if this value is an Error.
++ */
++ V8EXPORT bool IsError() const;
++
+ V8EXPORT Local<Boolean> ToBoolean() const;
+ V8EXPORT Local<Number> ToNumber() const;
+ V8EXPORT Local<String> ToString() const;
+diff --git a/src/api.cc b/src/api.cc
+index 1a585d6..bd435eb 100644
+--- a/src/api.cc
++++ b/src/api.cc
+@@ -2108,6 +2108,12 @@ bool Value::IsRegExp() const {
+ return obj->IsJSRegExp();
+ }
+
++bool Value::IsError() const {
++ if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsError()")) return false;
++ i::Handle<i::Object> obj = Utils::OpenHandle(this);
++ return obj->HasSpecificClassOf(HEAP->Error_symbol());
++}
++
+
+ Local<String> Value::ToString() const {
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
+diff --git a/src/heap.h b/src/heap.h
+index 8cbf378..db90bb9 100644
+--- a/src/heap.h
++++ b/src/heap.h
+@@ -169,6 +169,7 @@ inline Heap* _inline_get_heap_();
+ V(string_symbol, "string") \
+ V(String_symbol, "String") \
+ V(Date_symbol, "Date") \
++ V(Error_symbol, "Error") \
+ V(this_symbol, "this") \
+ V(to_string_symbol, "toString") \
+ V(char_at_symbol, "CharAt") \
+--
+1.7.2.3
+