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.0
Browse files Browse the repository at this point in the history
(With just one change: remove -Werror)
  • Loading branch information
ry committed Nov 18, 2009
1 parent 8195e0f commit 728d8a3
Show file tree
Hide file tree
Showing 212 changed files with 11,281 additions and 5,988 deletions.
1 change: 1 addition & 0 deletions deps/v8/AUTHORS
Expand Up @@ -19,3 +19,4 @@ Rafal Krypa <rafal@krypa.net>
Rene Rebe <rene@exactcode.de>
Ryan Dahl <coldredlemur@gmail.com>
Patrick Gansterer <paroga@paroga.com>
John Jozwiak <jjozwiak@codeaurora.org>
17 changes: 17 additions & 0 deletions deps/v8/ChangeLog
@@ -1,3 +1,20 @@
2009-11-18: Version 2.0.0

Added support for VFP on ARM.

Added TryCatch::ReThrow method to the API.

Reduced the size of snapshots and improved the snapshot load time.

Improved heap profiler support.

64-bit version now supported on Windows.

Fixed a number of debugger issues.

Fixed bugs.


2009-10-29: Version 1.3.18

Reverted a change which caused crashes in RegExp replace.
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/SConstruct
Expand Up @@ -272,7 +272,7 @@ V8_EXTRA_FLAGS = {
'WARNINGFLAGS': ['/W3']
},
'arch:x64': {
'WARNINGFLAGS': ['/W2']
'WARNINGFLAGS': ['/W3']
},
'arch:arm': {
'CPPDEFINES': ['V8_TARGET_ARCH_ARM'],
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/include/v8-debug.h
Expand Up @@ -218,7 +218,7 @@ class EXPORT Debug {

/**
* Register a callback function to be called when a debug message has been
* received and is ready to be precessed. For the debug messages to be
* received and is ready to be processed. For the debug messages to be
* processed V8 needs to be entered, and in certain embedding scenarios this
* callback can be used to make sure V8 is entered for the debug message to
* be processed. Note that debug messages will only be processed if there is
Expand Down
26 changes: 19 additions & 7 deletions deps/v8/include/v8.h
Expand Up @@ -129,8 +129,9 @@ class Data;

namespace internal {

class Object;
class Arguments;
class Object;
class Top;

}

Expand Down Expand Up @@ -2472,6 +2473,15 @@ class V8EXPORT TryCatch {
*/
bool CanContinue() const;

/**
* Throws the exception caught by this TryCatch in a way that avoids
* it being caught again by this same TryCatch. As with ThrowException
* it is illegal to execute any JavaScript operations after calling
* ReThrow; the caller must return immediately to where the exception
* is caught.
*/
Handle<Value> ReThrow();

/**
* Returns the exception caught by this try/catch block. If no exception has
* been caught an empty handle is returned.
Expand Down Expand Up @@ -2523,14 +2533,16 @@ class V8EXPORT TryCatch {
*/
void SetCaptureMessage(bool value);

public:
TryCatch* next_;
private:
void* next_;
void* exception_;
void* message_;
bool is_verbose_;
bool can_continue_;
bool capture_message_;
void* js_handler_;
bool is_verbose_ : 1;
bool can_continue_ : 1;
bool capture_message_ : 1;
bool rethrow_ : 1;

friend class v8::internal::Top;
};


Expand Down
1 change: 0 additions & 1 deletion deps/v8/src/SConscript
Expand Up @@ -264,7 +264,6 @@ def ConfigureObjectFiles():
else:
snapshot_cc = Command('snapshot.cc', [], [])
snapshot_obj = context.ConfigureObject(env, snapshot_cc, CPPPATH=['.'])
libraries_obj = context.ConfigureObject(env, libraries_empty_src, CPPPATH=['.'])
else:
snapshot_obj = empty_snapshot_obj
library_objs = [non_snapshot_files, libraries_obj, snapshot_obj]
Expand Down
9 changes: 8 additions & 1 deletion deps/v8/src/accessors.cc
Expand Up @@ -315,7 +315,14 @@ Object* Accessors::ScriptGetLineEnds(Object* object, void*) {
HandleScope scope;
Handle<Script> script(Script::cast(JSValue::cast(object)->value()));
InitScriptLineEnds(script);
return script->line_ends();
if (script->line_ends_js_array()->IsUndefined()) {
Handle<FixedArray> line_ends_fixed_array(
FixedArray::cast(script->line_ends_fixed_array()));
Handle<FixedArray> copy = Factory::CopyFixedArray(line_ends_fixed_array);
Handle<JSArray> js_array = Factory::NewJSArrayWithElements(copy);
script->set_line_ends_js_array(*js_array);
}
return script->line_ends_js_array();
}


Expand Down
6 changes: 3 additions & 3 deletions deps/v8/src/allocation.cc
Expand Up @@ -80,16 +80,16 @@ void AllStatic::operator delete(void* p) {


char* StrDup(const char* str) {
int length = strlen(str);
int length = StrLength(str);
char* result = NewArray<char>(length + 1);
memcpy(result, str, length * kCharSize);
result[length] = '\0';
return result;
}


char* StrNDup(const char* str, size_t n) {
size_t length = strlen(str);
char* StrNDup(const char* str, int n) {
int length = StrLength(str);
if (n < length) length = n;
char* result = NewArray<char>(length + 1);
memcpy(result, str, length * kCharSize);
Expand Down
54 changes: 35 additions & 19 deletions deps/v8/src/api.cc
Expand Up @@ -37,6 +37,7 @@
#include "platform.h"
#include "serialize.h"
#include "snapshot.h"
#include "utils.h"
#include "v8threads.h"
#include "version.h"

Expand Down Expand Up @@ -1191,19 +1192,26 @@ void Script::SetData(v8::Handle<Value> data) {


v8::TryCatch::TryCatch()
: next_(i::Top::try_catch_handler()),
: next_(i::Top::try_catch_handler_address()),
exception_(i::Heap::the_hole_value()),
message_(i::Smi::FromInt(0)),
is_verbose_(false),
can_continue_(true),
capture_message_(true),
js_handler_(NULL) {
rethrow_(false) {
i::Top::RegisterTryCatchHandler(this);
}


v8::TryCatch::~TryCatch() {
i::Top::UnregisterTryCatchHandler(this);
if (rethrow_) {
v8::HandleScope scope;
v8::Local<v8::Value> exc = v8::Local<v8::Value>::New(Exception());
i::Top::UnregisterTryCatchHandler(this);
v8::ThrowException(exc);
} else {
i::Top::UnregisterTryCatchHandler(this);
}
}


Expand All @@ -1217,6 +1225,13 @@ bool v8::TryCatch::CanContinue() const {
}


v8::Handle<v8::Value> v8::TryCatch::ReThrow() {
if (!HasCaught()) return v8::Local<v8::Value>();
rethrow_ = true;
return v8::Undefined();
}


v8::Local<Value> v8::TryCatch::Exception() const {
if (HasCaught()) {
// Check for out of memory exception.
Expand Down Expand Up @@ -2032,11 +2047,11 @@ Local<String> v8::Object::ObjectProtoToString() {
Local<String> str = Utils::ToLocal(class_name);
const char* postfix = "]";

size_t prefix_len = strlen(prefix);
size_t str_len = str->Length();
size_t postfix_len = strlen(postfix);
int prefix_len = i::StrLength(prefix);
int str_len = str->Length();
int postfix_len = i::StrLength(postfix);

size_t buf_len = prefix_len + str_len + postfix_len;
int buf_len = prefix_len + str_len + postfix_len;
char* buf = i::NewArray<char>(buf_len);

// Write prefix.
Expand Down Expand Up @@ -2621,11 +2636,8 @@ bool v8::V8::Initialize() {
if (i::V8::IsRunning()) return true;
ENTER_V8;
HandleScope scope;
if (i::Snapshot::Initialize()) {
return true;
} else {
return i::V8::Initialize(NULL);
}
if (i::Snapshot::Initialize()) return true;
return i::V8::Initialize(NULL);
}


Expand Down Expand Up @@ -2950,7 +2962,7 @@ Local<String> v8::String::New(const char* data, int length) {
LOG_API("String::New(char)");
if (length == 0) return Empty();
ENTER_V8;
if (length == -1) length = strlen(data);
if (length == -1) length = i::StrLength(data);
i::Handle<i::String> result =
i::Factory::NewStringFromUtf8(i::Vector<const char>(data, length));
return Utils::ToLocal(result);
Expand All @@ -2973,7 +2985,7 @@ Local<String> v8::String::NewUndetectable(const char* data, int length) {
EnsureInitialized("v8::String::NewUndetectable()");
LOG_API("String::NewUndetectable(char)");
ENTER_V8;
if (length == -1) length = strlen(data);
if (length == -1) length = i::StrLength(data);
i::Handle<i::String> result =
i::Factory::NewStringFromUtf8(i::Vector<const char>(data, length));
result->MarkAsUndetectable();
Expand Down Expand Up @@ -3041,7 +3053,8 @@ static void DisposeExternalString(v8::Persistent<v8::Value> obj,
v8::String::ExternalStringResource* resource =
reinterpret_cast<v8::String::ExternalStringResource*>(parameter);
if (resource != NULL) {
const size_t total_size = resource->length() * sizeof(*resource->data());
const int total_size =
static_cast<int>(resource->length() * sizeof(*resource->data()));
i::Counters::total_external_string_memory.Decrement(total_size);

// The object will continue to live in the JavaScript heap until the
Expand Down Expand Up @@ -3071,7 +3084,8 @@ static void DisposeExternalAsciiString(v8::Persistent<v8::Value> obj,
v8::String::ExternalAsciiStringResource* resource =
reinterpret_cast<v8::String::ExternalAsciiStringResource*>(parameter);
if (resource != NULL) {
const size_t total_size = resource->length() * sizeof(*resource->data());
const int total_size =
static_cast<int>(resource->length() * sizeof(*resource->data()));
i::Counters::total_external_string_memory.Decrement(total_size);

// The object will continue to live in the JavaScript heap until the
Expand All @@ -3093,7 +3107,8 @@ Local<String> v8::String::NewExternal(
EnsureInitialized("v8::String::NewExternal()");
LOG_API("String::NewExternal");
ENTER_V8;
const size_t total_size = resource->length() * sizeof(*resource->data());
const int total_size =
static_cast<int>(resource->length() * sizeof(*resource->data()));
i::Counters::total_external_string_memory.Increment(total_size);
i::Handle<i::String> result = NewExternalStringHandle(resource);
i::Handle<i::Object> handle = i::GlobalHandles::Create(*result);
Expand Down Expand Up @@ -3128,7 +3143,8 @@ Local<String> v8::String::NewExternal(
EnsureInitialized("v8::String::NewExternal()");
LOG_API("String::NewExternal");
ENTER_V8;
const size_t total_size = resource->length() * sizeof(*resource->data());
const int total_size =
static_cast<int>(resource->length() * sizeof(*resource->data()));
i::Counters::total_external_string_memory.Increment(total_size);
i::Handle<i::String> result = NewExternalAsciiStringHandle(resource);
i::Handle<i::Object> handle = i::GlobalHandles::Create(*result);
Expand Down Expand Up @@ -3250,7 +3266,7 @@ Local<String> v8::String::NewSymbol(const char* data, int length) {
EnsureInitialized("v8::String::NewSymbol()");
LOG_API("String::NewSymbol(char)");
ENTER_V8;
if (length == -1) length = strlen(data);
if (length == -1) length = i::StrLength(data);
i::Handle<i::String> result =
i::Factory::LookupSymbol(i::Vector<const char>(data, length));
return Utils::ToLocal(result);
Expand Down
9 changes: 9 additions & 0 deletions deps/v8/src/api.h
Expand Up @@ -125,6 +125,15 @@ static inline v8::internal::Handle<v8::internal::Object> FromCData(T obj) {
}


class ApiFunction {
public:
explicit ApiFunction(v8::internal::Address addr) : addr_(addr) { }
v8::internal::Address address() { return addr_; }
private:
v8::internal::Address addr_;
};


v8::Arguments::Arguments(v8::Local<v8::Value> data,
v8::Local<v8::Object> holder,
v8::Local<v8::Function> callee,
Expand Down
6 changes: 3 additions & 3 deletions deps/v8/src/arguments.h
Expand Up @@ -77,9 +77,9 @@ class Arguments BASE_EMBEDDED {
// can.
class CustomArguments : public Relocatable {
public:
inline CustomArguments(Object *data,
JSObject *self,
JSObject *holder) {
inline CustomArguments(Object* data,
JSObject* self,
JSObject* holder) {
values_[3] = self;
values_[2] = holder;
values_[1] = Smi::FromInt(0);
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/arm/assembler-arm-inl.h
Expand Up @@ -85,7 +85,7 @@ Object* RelocInfo::target_object() {
}


Handle<Object> RelocInfo::target_object_handle(Assembler *origin) {
Handle<Object> RelocInfo::target_object_handle(Assembler* origin) {
ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
return Memory::Object_Handle_at(Assembler::target_address_address_at(pc_));
}
Expand Down

0 comments on commit 728d8a3

Please sign in to comment.