Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Upgrade V8 to 2.1.2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Mar 8, 2010
1 parent 40e42e8 commit c98b079
Show file tree
Hide file tree
Showing 46 changed files with 335 additions and 174 deletions.
1 change: 1 addition & 0 deletions deps/v8/SConstruct
Expand Up @@ -267,6 +267,7 @@ V8_EXTRA_FLAGS = {
'gcc': {
'all': {
'WARNINGFLAGS': ['-Wall',
'-Werror',
'-W',
'-Wno-unused-parameter',
'-Wnon-virtual-dtor']
Expand Down
16 changes: 16 additions & 0 deletions deps/v8/include/v8.h
Expand Up @@ -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
Expand Down Expand Up @@ -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();

Expand Down
23 changes: 15 additions & 8 deletions deps/v8/src/api.cc
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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<char, 128> buffer;
v8::internal::Version::GetString(buffer);
Expand Down Expand Up @@ -2852,13 +2857,6 @@ Persistent<Context> v8::Context::New(
i::Handle<i::Context> 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<ObjectTemplate> proxy_template = global_template;
i::Handle<i::FunctionTemplateInfo> proxy_constructor;
i::Handle<i::FunctionTemplateInfo> global_constructor;
Expand Down Expand Up @@ -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<v8::Value> obj) {
EnsureInitialized("v8::String::Utf8Value::Utf8Value()");
if (obj.IsEmpty()) {
Expand Down
5 changes: 1 addition & 4 deletions deps/v8/src/arm/codegen-arm.cc
Expand Up @@ -35,7 +35,7 @@
#include "register-allocator-inl.h"
#include "runtime.h"
#include "scopes.h"

#include "virtual-frame-inl.h"

namespace v8 {
namespace internal {
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/arm/codegen-arm.h
Expand Up @@ -203,7 +203,7 @@ class CodeGenerator: public AstVisitor {

// Accessors
inline bool is_eval();
Scope* scope();
inline Scope* scope();

// Generating deferred code.
void ProcessDeferred();
Expand Down
1 change: 1 addition & 0 deletions deps/v8/src/arm/fast-codegen-arm.cc
Expand Up @@ -29,6 +29,7 @@

#include "codegen-inl.h"
#include "fast-codegen.h"
#include "scopes.h"

namespace v8 {
namespace internal {
Expand Down
1 change: 1 addition & 0 deletions deps/v8/src/arm/full-codegen-arm.cc
Expand Up @@ -32,6 +32,7 @@
#include "debug.h"
#include "full-codegen.h"
#include "parser.h"
#include "scopes.h"

namespace v8 {
namespace internal {
Expand Down
1 change: 1 addition & 0 deletions deps/v8/src/arm/jump-target-arm.cc
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions deps/v8/src/arm/virtual-frame-arm.cc
Expand Up @@ -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 {
Expand Down
14 changes: 7 additions & 7 deletions deps/v8/src/arm/virtual-frame-arm.h
Expand Up @@ -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(); }
Expand Down Expand Up @@ -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<Object> value);
void Push(Smi* value) { Push(Handle<Object>(value)); }
inline void Push(Register reg, NumberInfo::Type info = NumberInfo::kUnknown);
inline void Push(Handle<Object> value);
inline void Push(Smi* value);

// Pushing a result invalidates it (its contents become owned by the frame).
void Push(Result* result) {
Expand All @@ -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;
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 0 additions & 4 deletions deps/v8/src/ast.h
Expand Up @@ -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<String> n) {
return !is_this() && name().is_identical_to(n);
}
Expand Down
3 changes: 3 additions & 0 deletions deps/v8/src/codegen-inl.h
Expand Up @@ -50,8 +50,11 @@ namespace v8 {
namespace internal {

Handle<Script> CodeGenerator::script() { return info_->script(); }

bool CodeGenerator::is_eval() { return info_->is_eval(); }

Scope* CodeGenerator::scope() { return info_->function()->scope(); }

} } // namespace v8::internal

#endif // V8_CODEGEN_INL_H_
1 change: 1 addition & 0 deletions deps/v8/src/codegen.cc
Expand Up @@ -39,6 +39,7 @@
#include "runtime.h"
#include "scopeinfo.h"
#include "stub-cache.h"
#include "virtual-frame-inl.h"

namespace v8 {
namespace internal {
Expand Down
1 change: 1 addition & 0 deletions deps/v8/src/full-codegen.cc
Expand Up @@ -30,6 +30,7 @@
#include "codegen-inl.h"
#include "compiler.h"
#include "full-codegen.h"
#include "scopes.h"
#include "stub-cache.h"
#include "debug.h"
#include "liveedit.h"
Expand Down
27 changes: 11 additions & 16 deletions deps/v8/src/heap.cc
Expand Up @@ -115,7 +115,7 @@ int Heap::gc_count_ = 0;

int Heap::always_allocate_scope_depth_ = 0;
int Heap::linear_allocation_scope_depth_ = 0;
bool Heap::context_disposed_pending_ = false;
int Heap::contexts_disposed_ = 0;

#ifdef DEBUG
bool Heap::allocation_allowed_ = true;
Expand Down Expand Up @@ -371,21 +371,8 @@ void Heap::CollectAllGarbage(bool force_compaction) {
}


void Heap::CollectAllGarbageIfContextDisposed() {
// If the garbage collector interface is exposed through the global
// gc() function, we avoid being clever about forcing GCs when
// contexts are disposed and leave it to the embedder to make
// informed decisions about when to force a collection.
if (!FLAG_expose_gc && context_disposed_pending_) {
HistogramTimerScope scope(&Counters::gc_context);
CollectAllGarbage(false);
}
context_disposed_pending_ = false;
}


void Heap::NotifyContextDisposed() {
context_disposed_pending_ = true;
contexts_disposed_++;
}


Expand Down Expand Up @@ -620,7 +607,8 @@ void Heap::MarkCompact(GCTracer* tracer) {
Shrink();

Counters::objs_since_last_full.Set(0);
context_disposed_pending_ = false;

contexts_disposed_ = 0;
}


Expand Down Expand Up @@ -3072,6 +3060,13 @@ bool Heap::IdleNotification() {
static int number_idle_notifications = 0;
static int last_gc_count = gc_count_;

if (!FLAG_expose_gc && (contexts_disposed_ > 0)) {
HistogramTimerScope scope(&Counters::gc_context);
CollectAllGarbage(false);
ASSERT(contexts_disposed_ == 0);
return false;
}

bool finished = false;

if (last_gc_count == gc_count_) {
Expand Down
8 changes: 3 additions & 5 deletions deps/v8/src/heap.h
Expand Up @@ -632,10 +632,6 @@ class Heap : public AllStatic {
// parameter is true.
static void CollectAllGarbage(bool force_compaction);

// Performs a full garbage collection if a context has been disposed
// since the last time the check was performed.
static void CollectAllGarbageIfContextDisposed();

// Notify the heap that a context has been disposed.
static void NotifyContextDisposed();

Expand Down Expand Up @@ -908,7 +904,9 @@ class Heap : public AllStatic {

static int always_allocate_scope_depth_;
static int linear_allocation_scope_depth_;
static bool context_disposed_pending_;

// For keeping track of context disposals.
static int contexts_disposed_;

#if defined(V8_TARGET_ARCH_X64)
static const int kMaxObjectSizeInNewSpace = 512*KB;
Expand Down
4 changes: 1 addition & 3 deletions deps/v8/src/ia32/codegen-ia32.cc
Expand Up @@ -39,6 +39,7 @@
#include "register-allocator-inl.h"
#include "runtime.h"
#include "scopes.h"
#include "virtual-frame-inl.h"

namespace v8 {
namespace internal {
Expand Down Expand Up @@ -116,9 +117,6 @@ CodeGenerator::CodeGenerator(MacroAssembler* masm)
}


Scope* CodeGenerator::scope() { return info_->function()->scope(); }


// Calling conventions:
// ebp: caller's frame pointer
// esp: stack pointer
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/ia32/codegen-ia32.h
Expand Up @@ -343,7 +343,7 @@ class CodeGenerator: public AstVisitor {

// Accessors
inline bool is_eval();
Scope* scope();
inline Scope* scope();

// Generating deferred code.
void ProcessDeferred();
Expand Down
1 change: 1 addition & 0 deletions deps/v8/src/ia32/full-codegen-ia32.cc
Expand Up @@ -32,6 +32,7 @@
#include "debug.h"
#include "full-codegen.h"
#include "parser.h"
#include "scopes.h"

namespace v8 {
namespace internal {
Expand Down
1 change: 1 addition & 0 deletions deps/v8/src/ia32/jump-target-ia32.cc
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions deps/v8/src/ia32/register-allocator-ia32.cc
Expand Up @@ -29,6 +29,7 @@

#include "codegen-inl.h"
#include "register-allocator-inl.h"
#include "virtual-frame-inl.h"

namespace v8 {
namespace internal {
Expand Down

0 comments on commit c98b079

Please sign in to comment.