diff --git a/deps/v8/SConstruct b/deps/v8/SConstruct index 5483663fd6..0b038039ef 100644 --- a/deps/v8/SConstruct +++ b/deps/v8/SConstruct @@ -267,6 +267,7 @@ V8_EXTRA_FLAGS = { 'gcc': { 'all': { 'WARNINGFLAGS': ['-Wall', + '-Werror', '-W', '-Wno-unused-parameter', '-Wnon-virtual-dtor'] diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h index 13f8191703..69b93c69c0 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -2441,6 +2441,16 @@ class V8EXPORT V8 { */ static void TerminateExecution(); + /** + * Is V8 terminating JavaScript execution. + * + * Returns true if JavaScript execution is currently terminating + * because of a call to TerminateExecution. In that case there are + * still JavaScript frames on the stack and the termination + * exception is still active. + */ + static bool IsExecutionTerminating(); + /** * Releases any resources used by v8 and stops any utility threads * that may be running. Note that disposing v8 is permanent, it @@ -2473,6 +2483,12 @@ class V8EXPORT V8 { */ static void LowMemoryNotification(); + /** + * Optional notification that a context has been disposed. V8 uses + * these notifications to guide the garbage collection heuristic. + */ + static void ContextDisposedNotification(); + private: V8(); diff --git a/deps/v8/src/api.cc b/deps/v8/src/api.cc index dbb3d8b741..22d2f4bc78 100644 --- a/deps/v8/src/api.cc +++ b/deps/v8/src/api.cc @@ -438,7 +438,6 @@ bool V8::IsGlobalWeak(i::Object** obj) { void V8::DisposeGlobal(i::Object** obj) { LOG_API("DisposeGlobal"); if (!i::V8::IsRunning()) return; - if ((*obj)->IsGlobalContext()) i::Heap::NotifyContextDisposed(); i::GlobalHandles::Destroy(obj); } @@ -2821,6 +2820,12 @@ void v8::V8::LowMemoryNotification() { } +void v8::V8::ContextDisposedNotification() { + if (!i::V8::IsRunning()) return; + i::Heap::NotifyContextDisposed(); +} + + const char* v8::V8::GetVersion() { static v8::internal::EmbeddedVector buffer; v8::internal::Version::GetString(buffer); @@ -2852,13 +2857,6 @@ Persistent v8::Context::New( i::Handle env; { ENTER_V8; -#if defined(ANDROID) - // On mobile device, full GC is expensive, leave it to the system to - // decide when should make a full GC. -#else - // Give the heap a chance to cleanup if we've disposed contexts. - i::Heap::CollectAllGarbageIfContextDisposed(); -#endif v8::Handle proxy_template = global_template; i::Handle proxy_constructor; i::Handle global_constructor; @@ -3561,6 +3559,15 @@ void V8::TerminateExecution() { } +bool V8::IsExecutionTerminating() { + if (!i::V8::IsRunning()) return false; + if (i::Top::has_scheduled_exception()) { + return i::Top::scheduled_exception() == i::Heap::termination_exception(); + } + return false; +} + + String::Utf8Value::Utf8Value(v8::Handle obj) { EnsureInitialized("v8::String::Utf8Value::Utf8Value()"); if (obj.IsEmpty()) { diff --git a/deps/v8/src/arm/codegen-arm.cc b/deps/v8/src/arm/codegen-arm.cc index 95c50f262f..6644d02487 100644 --- a/deps/v8/src/arm/codegen-arm.cc +++ b/deps/v8/src/arm/codegen-arm.cc @@ -35,7 +35,7 @@ #include "register-allocator-inl.h" #include "runtime.h" #include "scopes.h" - +#include "virtual-frame-inl.h" namespace v8 { namespace internal { @@ -133,9 +133,6 @@ CodeGenerator::CodeGenerator(MacroAssembler* masm) } -Scope* CodeGenerator::scope() { return info_->function()->scope(); } - - // Calling conventions: // fp: caller's frame pointer // sp: stack pointer diff --git a/deps/v8/src/arm/codegen-arm.h b/deps/v8/src/arm/codegen-arm.h index 1a2e5525a2..2bc482ed5e 100644 --- a/deps/v8/src/arm/codegen-arm.h +++ b/deps/v8/src/arm/codegen-arm.h @@ -203,7 +203,7 @@ class CodeGenerator: public AstVisitor { // Accessors inline bool is_eval(); - Scope* scope(); + inline Scope* scope(); // Generating deferred code. void ProcessDeferred(); diff --git a/deps/v8/src/arm/fast-codegen-arm.cc b/deps/v8/src/arm/fast-codegen-arm.cc index aa7128fcae..0d322d1a3e 100644 --- a/deps/v8/src/arm/fast-codegen-arm.cc +++ b/deps/v8/src/arm/fast-codegen-arm.cc @@ -29,6 +29,7 @@ #include "codegen-inl.h" #include "fast-codegen.h" +#include "scopes.h" namespace v8 { namespace internal { diff --git a/deps/v8/src/arm/full-codegen-arm.cc b/deps/v8/src/arm/full-codegen-arm.cc index 4896373802..c37e29f63c 100644 --- a/deps/v8/src/arm/full-codegen-arm.cc +++ b/deps/v8/src/arm/full-codegen-arm.cc @@ -32,6 +32,7 @@ #include "debug.h" #include "full-codegen.h" #include "parser.h" +#include "scopes.h" namespace v8 { namespace internal { diff --git a/deps/v8/src/arm/jump-target-arm.cc b/deps/v8/src/arm/jump-target-arm.cc index 3315f8381c..a84060d570 100644 --- a/deps/v8/src/arm/jump-target-arm.cc +++ b/deps/v8/src/arm/jump-target-arm.cc @@ -30,6 +30,7 @@ #include "codegen-inl.h" #include "jump-target-inl.h" #include "register-allocator-inl.h" +#include "virtual-frame-inl.h" namespace v8 { namespace internal { diff --git a/deps/v8/src/arm/virtual-frame-arm.cc b/deps/v8/src/arm/virtual-frame-arm.cc index 0f7c597120..6e1a47fb6e 100644 --- a/deps/v8/src/arm/virtual-frame-arm.cc +++ b/deps/v8/src/arm/virtual-frame-arm.cc @@ -30,6 +30,7 @@ #include "codegen-inl.h" #include "register-allocator-inl.h" #include "scopes.h" +#include "virtual-frame-inl.h" namespace v8 { namespace internal { diff --git a/deps/v8/src/arm/virtual-frame-arm.h b/deps/v8/src/arm/virtual-frame-arm.h index a45cfc6e16..f69bddf55f 100644 --- a/deps/v8/src/arm/virtual-frame-arm.h +++ b/deps/v8/src/arm/virtual-frame-arm.h @@ -62,7 +62,7 @@ class VirtualFrame : public ZoneObject { VirtualFrame(); // Construct a virtual frame as a clone of an existing one. - explicit VirtualFrame(VirtualFrame* original); + explicit inline VirtualFrame(VirtualFrame* original); CodeGenerator* cgen() { return CodeGeneratorScope::Current(); } MacroAssembler* masm() { return cgen()->masm(); } @@ -344,9 +344,9 @@ class VirtualFrame : public ZoneObject { void EmitPushMultiple(int count, int src_regs); // Push an element on the virtual frame. - void Push(Register reg, NumberInfo::Type info = NumberInfo::kUnknown); - void Push(Handle value); - void Push(Smi* value) { Push(Handle(value)); } + inline void Push(Register reg, NumberInfo::Type info = NumberInfo::kUnknown); + inline void Push(Handle value); + inline void Push(Smi* value); // Pushing a result invalidates it (its contents become owned by the frame). void Push(Result* result) { @@ -362,7 +362,7 @@ class VirtualFrame : public ZoneObject { // Nip removes zero or more elements from immediately below the top // of the frame, leaving the previous top-of-frame value on top of // the frame. Nip(k) is equivalent to x = Pop(), Drop(k), Push(x). - void Nip(int num_dropped); + inline void Nip(int num_dropped); private: static const int kLocal0Offset = JavaScriptFrameConstants::kLocal0Offset; @@ -457,7 +457,7 @@ class VirtualFrame : public ZoneObject { // Push a copy of a frame slot (typically a local or parameter) on top of // the frame. - void PushFrameSlotAt(int index); + inline void PushFrameSlotAt(int index); // Push a the value of a frame slot (typically a local or parameter) on // top of the frame and invalidate the slot. @@ -500,7 +500,7 @@ class VirtualFrame : public ZoneObject { // Register counts are correctly updated. int InvalidateFrameSlotAt(int index); - bool Equals(VirtualFrame* other); + inline bool Equals(VirtualFrame* other); // Classes that need raw access to the elements_ array. friend class DeferredCode; diff --git a/deps/v8/src/ast.h b/deps/v8/src/ast.h index 927a9f5035..f2171cc3ef 100644 --- a/deps/v8/src/ast.h +++ b/deps/v8/src/ast.h @@ -931,10 +931,6 @@ class VariableProxy: public Expression { return var()->is_global() || var()->rewrite()->IsLeaf(); } - // Reading from a mutable variable is a side effect, but 'this' is - // immutable. - virtual bool IsTrivial() { return is_this(); } - bool IsVariable(Handle n) { return !is_this() && name().is_identical_to(n); } diff --git a/deps/v8/src/codegen-inl.h b/deps/v8/src/codegen-inl.h index da8cbf7034..6534e7fd63 100644 --- a/deps/v8/src/codegen-inl.h +++ b/deps/v8/src/codegen-inl.h @@ -50,8 +50,11 @@ namespace v8 { namespace internal { Handle