Skip to content

Commit

Permalink
Upgrade v8 to 1.3.17
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Oct 28, 2009
1 parent 3558952 commit 50f45d1
Show file tree
Hide file tree
Showing 136 changed files with 9,070 additions and 2,021 deletions.
21 changes: 20 additions & 1 deletion deps/v8/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
2009-10-28: Version 1.3.17

Added API method to get simple heap statistics.

Improved heap profiler support.

Fixed the implementation of the resource constraint API so it
works when using snapshots.

Fixed a number of issues in the Windows 64-bit version.

Optimized calls to API getters.

Added valgrind notification on code modification to the 64-bit version.

Fixed issue where we logged shared library addresses on Windows at
startup and never used them.


2009-10-16: Version 1.3.16

X64: Convert smis to holding 32 bits of payload.
Expand Down Expand Up @@ -41,7 +60,7 @@
Ensure V8 is initialized before locking and unlocking threads.

Implemented a new JavaScript minifier for compressing the source of
the built-in JavaScript. This Remove non-Open Source code from Douglas
the built-in JavaScript. This removes non-Open Source code from Douglas
Crockford from the project.

Added a missing optimization in StringCharAt.
Expand Down
63 changes: 51 additions & 12 deletions deps/v8/include/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,8 @@ class V8EXPORT HandleScope {
void* operator new(size_t size);
void operator delete(void*, size_t);

// This Data class is accessible internally through a typedef in the
// ImplementationUtilities class.
// This Data class is accessible internally as HandleScopeData through a
// typedef in the ImplementationUtilities class.
class V8EXPORT Data {
public:
int extensions;
Expand Down Expand Up @@ -1069,7 +1069,7 @@ class V8EXPORT Number : public Primitive {
class V8EXPORT Integer : public Number {
public:
static Local<Integer> New(int32_t value);
static inline Local<Integer> NewFromUnsigned(uint32_t value);
static Local<Integer> NewFromUnsigned(uint32_t value);
int64_t Value() const;
static inline Integer* Cast(v8::Value* obj);
private:
Expand Down Expand Up @@ -1126,6 +1126,16 @@ enum PropertyAttribute {
DontDelete = 1 << 2
};

enum ExternalArrayType {
kExternalByteArray = 1,
kExternalUnsignedByteArray,
kExternalShortArray,
kExternalUnsignedShortArray,
kExternalIntArray,
kExternalUnsignedIntArray,
kExternalFloatArray
};

/**
* A JavaScript object (ECMA-262, 4.3.3)
*/
Expand Down Expand Up @@ -1278,6 +1288,17 @@ class V8EXPORT Object : public Value {
*/
void SetIndexedPropertiesToPixelData(uint8_t* data, int length);

/**
* Set the backing store of the indexed properties to be managed by the
* embedding layer. Access to the indexed properties will follow the rules
* spelled out for the CanvasArray subtypes in the WebGL specification.
* Note: The embedding program still owns the data and needs to ensure that
* the backing store is preserved while V8 has a reference.
*/
void SetIndexedPropertiesToExternalArrayData(void* data,
ExternalArrayType array_type,
int number_of_elements);

static Local<Object> New();
static inline Object* Cast(Value* obj);
private:
Expand Down Expand Up @@ -2102,6 +2123,29 @@ enum ProfilerModules {
};


/**
* Collection of V8 heap information.
*
* Instances of this class can be passed to v8::V8::HeapStatistics to
* get heap statistics from V8.
*/
class V8EXPORT HeapStatistics {
public:
HeapStatistics();
size_t total_heap_size() { return total_heap_size_; }
size_t used_heap_size() { return used_heap_size_; }

private:
void set_total_heap_size(size_t size) { total_heap_size_ = size; }
void set_used_heap_size(size_t size) { used_heap_size_ = size; }

size_t total_heap_size_;
size_t used_heap_size_;

friend class V8;
};


/**
* Container class for static utility functions.
*/
Expand Down Expand Up @@ -2352,6 +2396,10 @@ class V8EXPORT V8 {
*/
static bool Dispose();

/**
* Get statistics about the heap memory usage.
*/
static void GetHeapStatistics(HeapStatistics* heap_statistics);

/**
* Optional notification that the embedder is idle.
Expand Down Expand Up @@ -3069,15 +3117,6 @@ Number* Number::Cast(v8::Value* value) {
}


Local<Integer> Integer::NewFromUnsigned(uint32_t value) {
bool fits_into_int32_t = (value & (1 << 31)) == 0;
if (fits_into_int32_t) {
return Integer::New(static_cast<int32_t>(value));
}
return Local<Integer>::Cast(Number::New(value));
}


Integer* Integer::Cast(v8::Value* value) {
#ifdef V8_ENABLE_CHECKS
CheckCast(value);
Expand Down
60 changes: 55 additions & 5 deletions deps/v8/src/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,10 @@ ResourceConstraints::ResourceConstraints()


bool SetResourceConstraints(ResourceConstraints* constraints) {
int semispace_size = constraints->max_young_space_size();
int young_space_size = constraints->max_young_space_size();
int old_gen_size = constraints->max_old_space_size();
if (semispace_size != 0 || old_gen_size != 0) {
bool result = i::Heap::ConfigureHeap(semispace_size, old_gen_size);
if (young_space_size != 0 || old_gen_size != 0) {
bool result = i::Heap::ConfigureHeap(young_space_size / 2, old_gen_size);
if (!result) return false;
}
if (constraints->stack_limit() != NULL) {
Expand Down Expand Up @@ -2306,6 +2306,30 @@ void v8::Object::SetIndexedPropertiesToPixelData(uint8_t* data, int length) {
}


void v8::Object::SetIndexedPropertiesToExternalArrayData(
void* data,
ExternalArrayType array_type,
int length) {
ON_BAILOUT("v8::SetIndexedPropertiesToExternalArrayData()", return);
ENTER_V8;
HandleScope scope;
if (!ApiCheck(length <= i::ExternalArray::kMaxLength,
"v8::Object::SetIndexedPropertiesToExternalArrayData()",
"length exceeds max acceptable value")) {
return;
}
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
if (!ApiCheck(!self->IsJSArray(),
"v8::Object::SetIndexedPropertiesToExternalArrayData()",
"JSArray is not supported")) {
return;
}
i::Handle<i::ExternalArray> array =
i::Factory::NewExternalArray(length, array_type, data);
self->set_elements(*array);
}


Local<v8::Object> Function::NewInstance() const {
return NewInstance(0, NULL);
}
Expand Down Expand Up @@ -2611,6 +2635,15 @@ bool v8::V8::Dispose() {
}


HeapStatistics::HeapStatistics(): total_heap_size_(0), used_heap_size_(0) { }


void v8::V8::GetHeapStatistics(HeapStatistics* heap_statistics) {
heap_statistics->set_total_heap_size(i::Heap::CommittedMemory());
heap_statistics->set_used_heap_size(i::Heap::SizeOfObjects());
}


bool v8::V8::IdleNotification() {
// Returning true tells the caller that it need not
// continue to call IdleNotification.
Expand All @@ -2620,10 +2653,8 @@ bool v8::V8::IdleNotification() {


void v8::V8::LowMemoryNotification() {
#if defined(ANDROID)
if (!i::V8::IsRunning()) return;
i::Heap::CollectAllGarbage(true);
#endif
}


Expand Down Expand Up @@ -3152,6 +3183,10 @@ Local<v8::Object> v8::Object::New() {
Local<v8::Value> v8::Date::New(double time) {
EnsureInitialized("v8::Date::New()");
LOG_API("Date::New");
if (isnan(time)) {
// Introduce only canonical NaN value into the VM, to avoid signaling NaNs.
time = i::OS::nan_value();
}
ENTER_V8;
EXCEPTION_PREAMBLE();
i::Handle<i::Object> obj =
Expand Down Expand Up @@ -3224,6 +3259,10 @@ Local<String> v8::String::NewSymbol(const char* data, int length) {

Local<Number> v8::Number::New(double value) {
EnsureInitialized("v8::Number::New()");
if (isnan(value)) {
// Introduce only canonical NaN value into the VM, to avoid signaling NaNs.
value = i::OS::nan_value();
}
ENTER_V8;
i::Handle<i::Object> result = i::Factory::NewNumber(value);
return Utils::NumberToLocal(result);
Expand All @@ -3241,6 +3280,17 @@ Local<Integer> v8::Integer::New(int32_t value) {
}


Local<Integer> Integer::NewFromUnsigned(uint32_t value) {
bool fits_into_int32_t = (value & (1 << 31)) == 0;
if (fits_into_int32_t) {
return Integer::New(static_cast<int32_t>(value));
}
ENTER_V8;
i::Handle<i::Object> result = i::Factory::NewNumber(value);
return Utils::IntegerToLocal(result);
}


void V8::IgnoreOutOfMemoryException() {
thread_local.set_ignore_out_of_memory(true);
}
Expand Down
9 changes: 9 additions & 0 deletions deps/v8/src/api.h
Original file line number Diff line number Diff line change
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: 6 additions & 0 deletions deps/v8/src/arm/assembler-arm-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,12 @@ Address Assembler::target_address_at(Address pc) {
}


void Assembler::set_target_at(Address constant_pool_entry,
Address target) {
Memory::Address_at(constant_pool_entry) = target;
}


void Assembler::set_target_address_at(Address pc, Address target) {
Memory::Address_at(target_address_address_at(pc)) = target;
// Intuitively, we would think it is necessary to flush the instruction cache
Expand Down
8 changes: 8 additions & 0 deletions deps/v8/src/arm/assembler-arm.h
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,14 @@ class Assembler : public Malloced {
INLINE(static Address target_address_at(Address pc));
INLINE(static void set_target_address_at(Address pc, Address target));

// Modify the code target address in a constant pool entry.
inline static void set_target_at(Address constant_pool_entry, Address target);

// Here we are patching the address in the constant pool, not the actual call
// instruction. The address in the constant pool is the same size as a
// pointer.
static const int kCallTargetSize = kPointerSize;

// Size of an instruction.
static const int kInstrSize = sizeof(Instr);

Expand Down
4 changes: 4 additions & 0 deletions deps/v8/src/arm/builtins-arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,8 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
const int kGlobalIndex =
Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize;
__ ldr(r2, FieldMemOperand(cp, kGlobalIndex));
__ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalContextOffset));
__ ldr(r2, FieldMemOperand(r2, kGlobalIndex));
__ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalReceiverOffset));

__ bind(&patch_receiver);
Expand Down Expand Up @@ -1107,6 +1109,8 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
const int kGlobalOffset =
Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize;
__ ldr(r0, FieldMemOperand(cp, kGlobalOffset));
__ ldr(r0, FieldMemOperand(r0, GlobalObject::kGlobalContextOffset));
__ ldr(r0, FieldMemOperand(r0, kGlobalOffset));
__ ldr(r0, FieldMemOperand(r0, GlobalObject::kGlobalReceiverOffset));

// Push the receiver.
Expand Down
Loading

0 comments on commit 50f45d1

Please sign in to comment.