Update V8

Change-Id: Ie6157e0baa55271707b3e00ed80b67ab79f4f570
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
This commit is contained in:
Kai Koehne 2011-11-17 16:33:41 +01:00 committed by Qt by Nokia
parent 44b6bb3560
commit e8fd6f2fd1
13 changed files with 382 additions and 78 deletions

2
src/3rdparty/v8 vendored

@ -1 +1 @@
Subproject commit 03d5b0219d5bdd14012c97906de9074d80d6e2de
Subproject commit d28b6a024826aaa48a8b3e69c096d01c91aff2c9

View File

@ -1,7 +1,7 @@
From 0a86a97f554c4aaa727da1c4481ca6368c68bf85 Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Tue, 4 Oct 2011 15:04:21 +1000
Subject: [PATCH 01/11] Add hashing and comparison methods to v8::String
Subject: [PATCH 01/12] Add hashing and comparison methods to v8::String
This allows us to more rapidly search for a v8::String inside a hash
of QStrings.
@ -303,7 +303,7 @@ index 9a87ac5..2946d02 100644
class SubStringAsciiSymbolKey : public HashTableKey {
diff --git a/src/objects.h b/src/objects.h
index f7d2180..d96e5f9 100644
index f7d21802..d96e5f9 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -6201,6 +6201,9 @@ class String: public HeapObject {
@ -332,5 +332,5 @@ index f7d2180..d96e5f9 100644
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(SeqString);
--
1.7.6
1.7.7.3

View File

@ -1,7 +1,7 @@
From 20eca1d4ce4c56b599a052d496f4660f9ca9c978 Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Thu, 27 Oct 2011 11:31:56 +0100
Subject: [PATCH 02/11] Add a "fallback" mode for named property interceptors
Subject: [PATCH 02/12] Add a "fallback" mode for named property interceptors
By default interceptors are called before the normal property
resolution on objects. When an interceptor is installed as a
@ -357,5 +357,5 @@ index 9c23c2c..0e256c1 100644
return isolate->heap()->undefined_value();
}
--
1.7.6
1.7.7.3

View File

@ -1,7 +1,7 @@
From 74974cee335e6c22ea99fd9a4bbb9c7fa7323d80 Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Tue, 4 Oct 2011 16:06:09 +1000
Subject: [PATCH 03/11] Generalize external object resources
Subject: [PATCH 03/12] Generalize external object resources
V8 was already able to manage and finalize an external string
resource. This change generalizes that mechanism to handle a
@ -591,5 +591,5 @@ index ed40061..c38d461 100644
--
1.7.6
1.7.7.3

View File

@ -1,7 +1,7 @@
From b4bb5845077f9b2ad4359360d2e071ed992ede10 Mon Sep 17 00:00:00 2001
From ae1c497cf2235df9d73d3c5d3c2b40bcde7e534f Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Thu, 27 Oct 2011 13:34:16 +0100
Subject: [PATCH 04/11] Introduce a QML compilation mode
Subject: [PATCH 04/12] Introduce a QML compilation mode
In QML mode, there is a second global object - known as the QML
global object. During property resolution, if a property is not
@ -15,54 +15,56 @@ closures etc. created during the run will retain a reference to this
object, so different objects can be passed in different script
runs.
---
include/v8.h | 19 ++++++++--
src/api.cc | 52 ++++++++++++++++++++++++-----
include/v8.h | 19 +++++++--
src/api.cc | 52 +++++++++++++++++++----
src/arm/code-stubs-arm.cc | 4 ++
src/arm/full-codegen-arm.cc | 28 +++++++++-------
src/arm/full-codegen-arm.cc | 28 +++++++-----
src/arm/lithium-arm.cc | 4 +-
src/arm/lithium-arm.h | 12 ++++++-
src/arm/lithium-codegen-arm.cc | 9 +++--
src/arm/macro-assembler-arm.h | 5 +++
src/ast-inl.h | 5 +++
src/ast.cc | 5 +++
src/arm/lithium-arm.h | 12 +++++-
src/arm/lithium-codegen-arm.cc | 9 ++--
src/arm/macro-assembler-arm.h | 5 ++
src/ast-inl.h | 5 ++
src/ast.cc | 5 ++
src/ast.h | 1 +
src/code-stubs.h | 2 +-
src/compiler.cc | 15 +++++++-
src/compiler.h | 16 +++++++--
src/contexts.cc | 35 +++++++++++++++++++
src/compiler.cc | 15 ++++++-
src/compiler.h | 16 ++++++-
src/contexts.cc | 35 ++++++++++++++++
src/contexts.h | 4 ++
src/execution.cc | 31 ++++++++++++++---
src/execution.cc | 31 ++++++++++++--
src/execution.h | 8 ++++
src/full-codegen.cc | 3 +-
src/full-codegen.h | 1 +
src/heap.cc | 4 ++
src/hydrogen-instructions.cc | 5 +++
src/hydrogen-instructions.h | 21 ++++++++++--
src/hydrogen-instructions.cc | 5 ++
src/hydrogen-instructions.h | 21 ++++++++-
src/hydrogen.cc | 4 ++
src/ia32/code-stubs-ia32.cc | 5 +++
src/ia32/full-codegen-ia32.cc | 28 +++++++++-------
src/ia32/lithium-codegen-ia32.cc | 9 +++--
src/ia32/code-stubs-ia32.cc | 5 ++
src/ia32/full-codegen-ia32.cc | 28 +++++++-----
src/ia32/lithium-codegen-ia32.cc | 9 ++--
src/ia32/lithium-ia32.cc | 4 +-
src/ia32/lithium-ia32.h | 12 +++++-
src/ia32/macro-assembler-ia32.h | 3 ++
src/ia32/macro-assembler-ia32.h | 3 +
src/objects-inl.h | 2 +
src/objects.h | 4 ++
src/parser.cc | 28 +++++++++++++--
src/parser.h | 4 ++-
src/prettyprinter.cc | 3 ++
src/runtime.cc | 68 +++++++++++++++++++++++++-------------
src/objects.h | 7 +++
src/parser.cc | 28 +++++++++++--
src/parser.h | 4 +-
src/prettyprinter.cc | 3 +
src/runtime.cc | 84 +++++++++++++++++++++++++-------------
src/runtime.h | 8 ++--
src/scopes.cc | 63 +++++++++++++++++++++++++++++++++++
src/scopeinfo.cc | 28 ++++++++++---
src/scopeinfo.h | 1 +
src/scopes.cc | 63 ++++++++++++++++++++++++++++
src/scopes.h | 8 ++++
src/variables.cc | 3 +-
src/variables.h | 5 +++
src/variables.h | 5 ++
src/x64/code-stubs-x64.cc | 4 ++
src/x64/full-codegen-x64.cc | 28 +++++++++-------
src/x64/lithium-codegen-x64.cc | 9 +++--
src/x64/full-codegen-x64.cc | 28 +++++++-----
src/x64/lithium-codegen-x64.cc | 9 ++--
src/x64/lithium-x64.cc | 4 +-
src/x64/lithium-x64.h | 12 +++++++
src/x64/macro-assembler-x64.h | 5 +++
47 files changed, 494 insertions(+), 118 deletions(-)
src/x64/lithium-x64.h | 12 +++++
src/x64/macro-assembler-x64.h | 5 ++
49 files changed, 531 insertions(+), 129 deletions(-)
diff --git a/include/v8.h b/include/v8.h
index 3ef4dd6..193e2fe 100644
@ -1272,10 +1274,20 @@ index 6a80c9c..2e83fb7 100644
BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints,
name_should_print_as_anonymous,
diff --git a/src/objects.h b/src/objects.h
index c38d461..73e7f8b 100644
index c38d461..b71eaac 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -4929,6 +4929,9 @@ class SharedFunctionInfo: public HeapObject {
@@ -3120,6 +3120,9 @@ class SerializedScopeInfo : public FixedArray {
// Is this scope a strict mode scope?
bool IsStrictMode();
+ // Is this scope a qml mode scope?
+ bool IsQmlMode();
+
// Return the number of stack slots for code.
int NumberOfStackSlots();
@@ -4929,6 +4932,9 @@ class SharedFunctionInfo: public HeapObject {
inline StrictModeFlag strict_mode_flag();
inline void set_strict_mode_flag(StrictModeFlag strict_mode_flag);
@ -1285,7 +1297,7 @@ index c38d461..73e7f8b 100644
// False if the function definitely does not allocate an arguments object.
DECL_BOOLEAN_ACCESSORS(uses_arguments)
@@ -5150,6 +5153,7 @@ class SharedFunctionInfo: public HeapObject {
@@ -5150,6 +5156,7 @@ class SharedFunctionInfo: public HeapObject {
kCodeAgeShift,
kOptimizationDisabled = kCodeAgeShift + kCodeAgeSize,
kStrictModeFunction,
@ -1421,7 +1433,7 @@ index 37c76ce..73812fd 100644
PrintLiteralIndented(buf.start(), value, true);
}
diff --git a/src/runtime.cc b/src/runtime.cc
index 0e256c1..5746c20 100644
index 0e256c1..b64e66b 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -1307,19 +1307,23 @@ static Failure* ThrowRedeclarationError(Isolate* isolate,
@ -1601,7 +1613,56 @@ index 0e256c1..5746c20 100644
}
@@ -12034,6 +12053,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) {
@@ -11220,10 +11239,12 @@ class ScopeIterator {
ZoneScope zone_scope(isolate, DELETE_ON_EXIT);
Handle<Script> script(Script::cast(shared_info->script()));
Scope* scope;
- if (index >= 0) {
+ if (index >= 0 || shared_info->qml_mode()) {
// Global code
CompilationInfo info(script);
info.MarkAsGlobal();
+ if (shared_info->qml_mode())
+ info.MarkAsQmlMode();
bool result = ParserApi::Parse(&info);
ASSERT(result);
result = Scope::Analyze(&info);
@@ -11253,7 +11274,6 @@ class ScopeIterator {
ScopeType scope_type = Type();
if (scope_type == ScopeTypeGlobal) {
// The global scope is always the last in the chain.
- ASSERT(context_->IsGlobalContext());
context_ = Handle<Context>();
return;
}
@@ -11277,7 +11297,7 @@ class ScopeIterator {
!scope_info->HasContext());
return ScopeTypeLocal;
case GLOBAL_SCOPE:
- ASSERT(context_->IsGlobalContext());
+ ASSERT(context_->IsGlobalContext() || scope_info->IsQmlMode());
return ScopeTypeGlobal;
case WITH_SCOPE:
ASSERT(context_->IsWithContext());
@@ -11315,10 +11335,15 @@ class ScopeIterator {
switch (Type()) {
case ScopeIterator::ScopeTypeGlobal:
return Handle<JSObject>(CurrentContext()->global());
- case ScopeIterator::ScopeTypeLocal:
+ case ScopeIterator::ScopeTypeLocal: {
+ Handle<SerializedScopeInfo> scope_info = nested_scope_chain_.last();
+ if (scope_info->IsQmlMode())
+ ASSERT(nested_scope_chain_.length() == 2);
+ else
+ ASSERT(nested_scope_chain_.length() == 1);
// Materialize the content of the local scope into a JSObject.
- ASSERT(nested_scope_chain_.length() == 1);
return MaterializeLocalScope(isolate_, frame_, inlined_frame_index_);
+ }
case ScopeIterator::ScopeTypeWith:
// Return the with object.
return Handle<JSObject>(JSObject::cast(CurrentContext()->extension()));
@@ -12034,6 +12059,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) {
Handle<JSFunction> function(JSFunction::cast(frame->function()));
Handle<SerializedScopeInfo> scope_info(function->shared()->scope_info());
ScopeInfo<> sinfo(*scope_info);
@ -1609,7 +1670,7 @@ index 0e256c1..5746c20 100644
// Traverse the saved contexts chain to find the active context for the
// selected frame.
@@ -12107,7 +12127,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) {
@@ -12107,7 +12133,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) {
Compiler::CompileEval(function_source,
context,
context->IsGlobalContext(),
@ -1619,7 +1680,7 @@ index 0e256c1..5746c20 100644
if (shared.is_null()) return Failure::Exception();
Handle<JSFunction> compiled_function =
isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context);
@@ -12117,7 +12138,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) {
@@ -12117,7 +12144,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) {
Handle<Object> receiver(frame->receiver(), isolate);
Handle<Object> evaluation_function =
Execution::Call(compiled_function, receiver, 0, NULL,
@ -1629,7 +1690,7 @@ index 0e256c1..5746c20 100644
if (has_pending_exception) return Failure::Exception();
Handle<Object> arguments = GetArgumentsObject(isolate,
@@ -12198,7 +12220,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluateGlobal) {
@@ -12198,7 +12226,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluateGlobal) {
// Currently, the eval code will be executed in non-strict mode,
// even in the strict code context.
Handle<SharedFunctionInfo> shared =
@ -1664,6 +1725,102 @@ index 67fc628..aada06d 100644
F(InitializeConstContextSlot, 3, 1) \
F(OptimizeObjectForAddingMultipleProperties, 2, 1) \
\
diff --git a/src/scopeinfo.cc b/src/scopeinfo.cc
index 8ea5f1e..a61b787 100644
--- a/src/scopeinfo.cc
+++ b/src/scopeinfo.cc
@@ -51,6 +51,7 @@ ScopeInfo<Allocator>::ScopeInfo(Scope* scope)
: function_name_(FACTORY->empty_symbol()),
calls_eval_(scope->calls_eval()),
is_strict_mode_(scope->is_strict_mode()),
+ is_qml_mode_(scope->is_qml_mode()),
type_(scope->type()),
parameters_(scope->num_parameters()),
stack_slots_(scope->num_stack_slots()),
@@ -153,6 +154,8 @@ ScopeInfo<Allocator>::ScopeInfo(Scope* scope)
//
// - is strict mode scope
//
+// - is qml mode scope
+//
// - scope type
//
// - number of variables in the context object (smi) (= function context
@@ -252,6 +255,7 @@ ScopeInfo<Allocator>::ScopeInfo(SerializedScopeInfo* data)
p = ReadObject(p, &function_name_);
p = ReadBool(p, &calls_eval_);
p = ReadBool(p, &is_strict_mode_);
+ p = ReadBool(p, &is_qml_mode_);
p = ReadInt(p, &type_);
p = ReadList<Allocator>(p, &context_slots_, &context_modes_);
p = ReadList<Allocator>(p, &parameters_);
@@ -307,9 +311,9 @@ static Object** WriteList(Object** p,
template<class Allocator>
Handle<SerializedScopeInfo> ScopeInfo<Allocator>::Serialize() {
- // function name, calls eval, is_strict_mode, scope type,
+ // function name, calls eval, is_strict_mode, is_qml_mode, scope type,
// length for 3 tables:
- const int extra_slots = 1 + 1 + 1 + 1 + 3;
+ const int extra_slots = 1 + 1 + 1 + 1 + 1 + 3;
int length = extra_slots +
context_slots_.length() * 2 +
parameters_.length() +
@@ -324,6 +328,7 @@ Handle<SerializedScopeInfo> ScopeInfo<Allocator>::Serialize() {
p = WriteObject(p, function_name_);
p = WriteBool(p, calls_eval_);
p = WriteBool(p, is_strict_mode_);
+ p = WriteBool(p, is_qml_mode_);
p = WriteInt(p, type_);
p = WriteList(p, &context_slots_, &context_modes_);
p = WriteList(p, &parameters_);
@@ -372,8 +377,8 @@ SerializedScopeInfo* SerializedScopeInfo::Empty() {
Object** SerializedScopeInfo::ContextEntriesAddr() {
ASSERT(length() > 0);
- // +4 for function name, calls eval, strict mode, scope type.
- return data_start() + 4;
+ // +5 for function name, calls eval, strict mode, qml mode, scope type.
+ return data_start() + 5;
}
@@ -417,10 +422,21 @@ bool SerializedScopeInfo::IsStrictMode() {
}
+bool SerializedScopeInfo::IsQmlMode() {
+ if (length() > 0) {
+ Object** p = data_start() + 3; // +3 for function name, calls eval, strict mode.
+ bool qml_mode;
+ p = ReadBool(p, &qml_mode);
+ return qml_mode;
+ }
+ return false;
+}
+
+
ScopeType SerializedScopeInfo::Type() {
ASSERT(length() > 0);
- // +3 for function name, calls eval, strict mode.
- Object** p = data_start() + 3;
+ // +4 for function name, calls eval, strict mode, qml mode.
+ Object** p = data_start() + 4;
ScopeType type;
p = ReadInt(p, &type);
return type;
diff --git a/src/scopeinfo.h b/src/scopeinfo.h
index eeb3047..2ca4503 100644
--- a/src/scopeinfo.h
+++ b/src/scopeinfo.h
@@ -88,6 +88,7 @@ class ScopeInfo BASE_EMBEDDED {
Handle<String> function_name_;
bool calls_eval_;
bool is_strict_mode_;
+ bool is_qml_mode_;
ScopeType type_;
List<Handle<String>, Allocator > parameters_;
List<Handle<String>, Allocator > stack_slots_;
diff --git a/src/scopes.cc b/src/scopes.cc
index 3167c4d..6503d07 100644
--- a/src/scopes.cc
@ -1766,7 +1923,7 @@ index 3167c4d..6503d07 100644
case DYNAMIC_LOOKUP:
diff --git a/src/scopes.h b/src/scopes.h
index a141887..41e5f5c 100644
index a1418874..41e5f5c 100644
--- a/src/scopes.h
+++ b/src/scopes.h
@@ -228,6 +228,11 @@ class Scope: public ZoneObject {
@ -2059,5 +2216,5 @@ index f5f81b1..5caa6cf 100644
static inline Operand StackSpaceOperand(int index) {
#ifdef _WIN64
--
1.7.6
1.7.7.3

View File

@ -1,7 +1,7 @@
From fcb6d710f3c3aadfc66a9f60e54ddd00144fe64e Mon Sep 17 00:00:00 2001
From d01b0fc24542eb6128bcbd3a8a02da9659b8433e Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Fri, 14 Oct 2011 17:03:06 +1000
Subject: [PATCH 05/11] Allow access to the calling script data
Subject: [PATCH 05/12] Allow access to the calling script data
---
include/v8.h | 1 +
@ -44,5 +44,5 @@ index 2d3d97a..54df40d 100644
v8::Local<v8::Object> Context::Global() {
if (IsDeadCheck(i::Isolate::Current(), "v8::Context::Global()")) {
--
1.7.6
1.7.7.3

View File

@ -1,7 +1,7 @@
From 5d7801496ea41f9d1cf4260cd2b0508929ebde76 Mon Sep 17 00:00:00 2001
From 59b3da4073971aa725eea8f303f37948dc3bb376 Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Thu, 27 Oct 2011 13:40:00 +0100
Subject: [PATCH 06/11] Add custom object compare callback
Subject: [PATCH 06/12] Add custom object compare callback
A global custom object comparison callback can be set with:
V8::SetUserObjectComparisonCallbackFunction()
@ -390,10 +390,10 @@ index f5b6bee..6a4eff9 100644
// Resume inobject slack tracking.
set_initial_map(map);
diff --git a/src/objects.h b/src/objects.h
index 73e7f8b..9dcacac 100644
index b71eaac..3137437 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -4255,6 +4255,11 @@ class Map: public HeapObject {
@@ -4258,6 +4258,11 @@ class Map: public HeapObject {
inline void set_has_external_resource(bool value);
inline bool has_external_resource();
@ -405,7 +405,7 @@ index 73e7f8b..9dcacac 100644
// [prototype]: implicit prototype object.
DECL_ACCESSORS(prototype, Object)
@@ -4502,7 +4507,7 @@ class Map: public HeapObject {
@@ -4505,7 +4510,7 @@ class Map: public HeapObject {
static const int kIsExtensible = 0;
static const int kFunctionWithPrototype = 1;
static const int kStringWrapperSafeForDefaultValueOf = 2;
@ -414,7 +414,7 @@ index 73e7f8b..9dcacac 100644
// No bits can be used after kElementsKindFirstBit, they are all reserved for
// storing ElementKind.
static const int kElementsKindShift = 4;
@@ -4521,6 +4526,7 @@ class Map: public HeapObject {
@@ -4524,6 +4529,7 @@ class Map: public HeapObject {
static const int kIsShared = 0;
static const int kNamedInterceptorIsFallback = 1;
static const int kHasInstanceCallHandler = 2;
@ -422,7 +422,7 @@ index 73e7f8b..9dcacac 100644
// Layout of the default cache. It holds alternating name and code objects.
static const int kCodeCacheEntrySize = 2;
@@ -7553,6 +7559,7 @@ class ObjectTemplateInfo: public TemplateInfo {
@@ -7556,6 +7562,7 @@ class ObjectTemplateInfo: public TemplateInfo {
DECL_ACCESSORS(constructor, Object)
DECL_ACCESSORS(internal_field_count, Object)
DECL_ACCESSORS(has_external_resource, Object)
@ -430,7 +430,7 @@ index 73e7f8b..9dcacac 100644
static inline ObjectTemplateInfo* cast(Object* obj);
@@ -7570,7 +7577,8 @@ class ObjectTemplateInfo: public TemplateInfo {
@@ -7573,7 +7580,8 @@ class ObjectTemplateInfo: public TemplateInfo {
static const int kInternalFieldCountOffset =
kConstructorOffset + kPointerSize;
static const int kHasExternalResourceOffset = kInternalFieldCountOffset + kPointerSize;
@ -441,7 +441,7 @@ index 73e7f8b..9dcacac 100644
diff --git a/src/runtime.cc b/src/runtime.cc
index 5746c20..542e62b 100644
index b64e66b..8010169 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -7095,6 +7095,29 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringEquals) {
@ -544,5 +544,5 @@ index f30221f..ff8337f 100644
ASSERT(GetCondition() == equal);
__ subq(rax, rdx);
--
1.7.6
1.7.7.3

View File

@ -1,7 +1,7 @@
From b733a2fec5c51b7d7219505b89f34715603bd49c Mon Sep 17 00:00:00 2001
From 519fec2ddc92193760dc2a6599f91ff4eb11563c Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Fri, 9 Sep 2011 14:16:12 +1000
Subject: [PATCH 07/11] Allow a script to be flagged as "native"
Subject: [PATCH 07/12] Allow a script to be flagged as "native"
Native scripts do not appear in backtraces, or in the source and
line number when exceptions are thrown from within them. This is
@ -42,5 +42,5 @@ index 4902e72..cabca74 100644
}
if (!script_name.is_null()) {
--
1.7.6
1.7.7.3

View File

@ -1,7 +1,7 @@
From 35ec23697719708e18a42c40fd80719247ca62e4 Mon Sep 17 00:00:00 2001
From de3e14564f163d808a3d10397a3018e6aaeb727b 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 08/11] QtScript/V8: Add new v8 api to check if a value is an
Subject: [PATCH 08/12] QtScript/V8: Add new v8 api to check if a value is an
error.
New function v8::Value::IsError was created.
@ -60,5 +60,5 @@ index 5e90964..6166cde 100644
V(to_string_symbol, "toString") \
V(char_at_symbol, "CharAt") \
--
1.7.6
1.7.7.3

View File

@ -1,7 +1,7 @@
From 5d8ee260641b6a6b7f50b68c7746f7ee7fe01de5 Mon Sep 17 00:00:00 2001
From 7084bd94a99db246baa4f1d050a6f23cfd6adc14 Mon Sep 17 00:00:00 2001
From: Kent Hansen <kent.hansen@nokia.com>
Date: Fri, 2 Sep 2011 12:03:09 +0200
Subject: [PATCH 09/11] Fix deprecated Python code
Subject: [PATCH 09/12] Fix deprecated Python code
Needed to make the scripts run on Python 3, which is the
default python interpreter on some newer distros.
@ -47,5 +47,5 @@ index 646bf14..395441b 100644
if identifier_second_char != 0:
new_identifier = (
--
1.7.6
1.7.7.3

View File

@ -1,7 +1,7 @@
From 994dc4b9cb86604c04e02b3b2884eaa389bb62af Mon Sep 17 00:00:00 2001
From 04779c9a6f99fc097af68cf75a27b1d6a76c3e9d Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Thu, 25 Aug 2011 11:09:58 +1000
Subject: [PATCH 10/11] Remove execute flag from v8-debug.h
Subject: [PATCH 10/12] Remove execute flag from v8-debug.h
---
0 files changed, 0 insertions(+), 0 deletions(-)
@ -11,5 +11,5 @@ diff --git a/include/v8-debug.h b/include/v8-debug.h
old mode 100755
new mode 100644
--
1.7.6
1.7.7.3

View File

@ -1,7 +1,7 @@
From 03d5b0219d5bdd14012c97906de9074d80d6e2de Mon Sep 17 00:00:00 2001
From eb7bb4628dc4480210818e371934a76ae1f7fb91 Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Fri, 27 May 2011 13:04:15 +1000
Subject: [PATCH 11/11] Fix warnings
Subject: [PATCH 11/12] Fix warnings
---
include/v8.h | 16 ++++++++--------
@ -42,5 +42,5 @@ index d995e54..a7b5c8a 100644
} // namespace internal
--
1.7.6
1.7.7.3

View File

@ -0,0 +1,147 @@
From d28b6a024826aaa48a8b3e69c096d01c91aff2c9 Mon Sep 17 00:00:00 2001
From: Kai Koehne <kai.koehne@nokia.com>
Date: Thu, 10 Nov 2011 16:00:37 +0100
Subject: [PATCH 12/12] Add flag to avoid breakpoint relocation
Add a flag that prevents v8 from relocating breakpoints across
line boundaries.
---
src/debug.cc | 29 +++++++++++++++++++---
src/flag-definitions.h | 1 +
test/cctest/test-debug.cc | 59 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 85 insertions(+), 4 deletions(-)
diff --git a/src/debug.cc b/src/debug.cc
index dc9f297..d32574b 100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -1131,6 +1131,17 @@ Handle<DebugInfo> Debug::GetDebugInfo(Handle<SharedFunctionInfo> shared) {
return Handle<DebugInfo>(DebugInfo::cast(shared->debug_info()));
}
+static bool ContainsLineBreak(String *string, int from, int to)
+{
+ ASSERT(from >= 0);
+ ASSERT(from <= to);
+ const int end = (string->length() < to) ? string->length() : to;
+ for (int pos = from; pos < end; ++pos) {
+ if (string->Get(pos) == '\n')
+ return true;
+ }
+ return false;
+}
void Debug::SetBreakPoint(Handle<SharedFunctionInfo> shared,
Handle<Object> break_point_object,
@@ -1151,12 +1162,22 @@ void Debug::SetBreakPoint(Handle<SharedFunctionInfo> shared,
// Find the break point and change it.
BreakLocationIterator it(debug_info, SOURCE_BREAK_LOCATIONS);
it.FindBreakLocationFromPosition(*source_position);
- it.SetBreakPoint(break_point_object);
- *source_position = it.position();
+ bool acceptBreak = true;
+ if (!FLAG_breakpoint_relocation) {
+ if (String *sourceStr = String::cast(shared->GetSourceCode())) {
+ acceptBreak = !ContainsLineBreak(sourceStr, *source_position, it.position());
+ }
+ }
+
+ if (acceptBreak) {
+ it.SetBreakPoint(break_point_object);
- // At least one active break point now.
- ASSERT(debug_info->GetBreakPointCount() > 0);
+ *source_position = it.position();
+
+ // At least one active break point now.
+ ASSERT(debug_info->GetBreakPointCount() > 0);
+ }
}
diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index ee6ef01..fe64a96 100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -233,6 +233,7 @@ DEFINE_bool(trace_debug_json, false, "trace debugging JSON request/response")
DEFINE_bool(debugger_auto_break, true,
"automatically set the debug break flag when debugger commands are "
"in the queue")
+DEFINE_bool(breakpoint_relocation, true, "relocate breakpoints to the next executable line")
DEFINE_bool(enable_liveedit, true, "enable liveedit experimental feature")
// execution.cc
diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc
index cf723ba..7e51c34 100644
--- a/test/cctest/test-debug.cc
+++ b/test/cctest/test-debug.cc
@@ -2305,6 +2305,65 @@ TEST(ScriptBreakPointTopLevelCrash) {
CheckDebuggerUnloaded();
}
+// Test that breakpoint_relocation flag is honored
+TEST(ScriptBreakPointNoRelocation) {
+ i::FLAG_breakpoint_relocation = false;
+
+ v8::HandleScope scope;
+ DebugLocalContext env;
+ env.ExposeDebug();
+
+ // Create a function for checking the function when hitting a break point.
+ frame_function_name = CompileFunction(&env,
+ frame_function_name_source,
+ "frame_function_name");
+
+ v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount,
+ v8::Undefined());
+
+ v8::Local<v8::String> script1 = v8::String::New(
+ "a = 0 // line 0\n"
+ " // line 1\n"
+ " // line 2\n"
+ " // line 3\n"
+ "function f() { // line 4\n"
+ " return 0; // line 5\n"
+ "} // line 6");
+
+ // Set the script break point on the empty line
+ SetScriptBreakPointByNameFromJS("test.html", 2, -1);
+
+ // Compile the script and call the function.
+ v8::ScriptOrigin origin(v8::String::New("test.html"), v8::Integer::New(0));
+ v8::Script::Compile(script1, &origin)->Run();
+ v8::Local<v8::Function> f
+ = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
+ f->Call(env->Global(), 0, NULL);
+
+ // Check that a break point was not hit
+ CHECK_EQ(0, break_point_hit_count);
+
+ v8::Local<v8::String> script2 = v8::String::New(
+ "a = 0 // line 0\n"
+ "function g() { // line 1\n"
+ " return 0; // line 2\n"
+ "} // line 3\n"
+ "function f() { // line 4\n"
+ " return 0; // line 5\n"
+ "} // line 6");
+
+ // Compile the script and call the new function
+ v8::Script::Compile(script2, &origin)->Run();
+ v8::Local<v8::Function> g
+ = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("g")));
+ g->Call(env->Global(), 0, NULL);
+
+ // Check that a break point was not hit
+ CHECK_EQ(1, break_point_hit_count);
+
+ v8::Debug::SetDebugEventListener(NULL);
+ CheckDebuggerUnloaded();
+}
// Test that it is possible to remove the last break point for a function
// inside the break handling of that break point.
--
1.7.7.3