Permalink
Browse files

Upgrade v8 to 1.3.17

  • Loading branch information...
1 parent 3558952 commit 50f45d14b475a42d304e7d9872f8d91ff3a013c2 @ry ry committed Oct 28, 2009
Showing with 9,070 additions and 2,021 deletions.
  1. +20 −1 deps/v8/ChangeLog
  2. +51 −12 deps/v8/include/v8.h
  3. +55 −5 deps/v8/src/api.cc
  4. +9 −0 deps/v8/src/api.h
  5. +6 −0 deps/v8/src/arm/assembler-arm-inl.h
  6. +8 −0 deps/v8/src/arm/assembler-arm.h
  7. +4 −0 deps/v8/src/arm/builtins-arm.cc
  8. +26 −30 deps/v8/src/arm/codegen-arm.cc
  9. +6 −3 deps/v8/src/arm/codegen-arm.h
  10. +538 −46 deps/v8/src/arm/fast-codegen-arm.cc
  11. +8 −7 deps/v8/src/arm/frames-arm.cc
  12. +1 −1 deps/v8/src/arm/frames-arm.h
  13. +14 −0 deps/v8/src/arm/ic-arm.cc
  14. +10 −9 deps/v8/src/arm/macro-assembler-arm.cc
  15. +4 −4 deps/v8/src/arm/macro-assembler-arm.h
  16. +7 −8 deps/v8/src/arm/regexp-macro-assembler-arm.cc
  17. +15 −0 deps/v8/src/arm/regexp-macro-assembler-arm.h
  18. +16 −18 deps/v8/src/arm/virtual-frame-arm.cc
  19. +25 −0 deps/v8/src/assembler.cc
  20. +8 −0 deps/v8/src/assembler.h
  21. +8 −0 deps/v8/src/ast.cc
  22. +2 −0 deps/v8/src/ast.h
  23. +3 −0 deps/v8/src/bootstrapper.cc
  24. +76 −0 deps/v8/src/builtins.cc
  25. +52 −38 deps/v8/src/builtins.h
  26. +37 −54 deps/v8/src/code-stubs.cc
  27. +46 −21 deps/v8/src/code-stubs.h
  28. +17 −1 deps/v8/src/codegen.cc
  29. +28 −1 deps/v8/src/codegen.h
  30. +202 −39 deps/v8/src/compiler.cc
  31. +1 −1 deps/v8/src/conversions-inl.h
  32. +1 −1 deps/v8/src/conversions.cc
  33. +1 −0 deps/v8/src/conversions.h
  34. +9 −1 deps/v8/src/debug-delay.js
  35. +12 −0 deps/v8/src/factory.cc
  36. +8 −1 deps/v8/src/factory.h
  37. +151 −46 deps/v8/src/fast-codegen.cc
  38. +24 −3 deps/v8/src/fast-codegen.h
  39. +2 −4 deps/v8/src/flag-definitions.h
  40. +12 −6 deps/v8/src/frames.cc
  41. +3 −22 deps/v8/src/frames.h
  42. +84 −17 deps/v8/src/global-handles.cc
  43. +18 −0 deps/v8/src/global-handles.h
  44. +17 −1 deps/v8/src/globals.h
  45. +16 −1 deps/v8/src/handles.cc
  46. +7 −3 deps/v8/src/handles.h
  47. +29 −15 deps/v8/src/heap-profiler.cc
  48. +3 −1 deps/v8/src/heap-profiler.h
  49. +223 −85 deps/v8/src/heap.cc
  50. +65 −19 deps/v8/src/heap.h
  51. +17 −1 deps/v8/src/ia32/assembler-ia32.cc
  52. +10 −0 deps/v8/src/ia32/assembler-ia32.h
  53. +45 −41 deps/v8/src/ia32/builtins-ia32.cc
  54. +163 −140 deps/v8/src/ia32/codegen-ia32.cc
  55. +21 −6 deps/v8/src/ia32/codegen-ia32.h
  56. +166 −106 deps/v8/src/ia32/disasm-ia32.cc
  57. +558 −26 deps/v8/src/ia32/fast-codegen-ia32.cc
  58. +4 −9 deps/v8/src/ia32/frames-ia32.cc
  59. +1 −1 deps/v8/src/ia32/frames-ia32.h
  60. +358 −9 deps/v8/src/ia32/ic-ia32.cc
  61. +109 −21 deps/v8/src/ia32/macro-assembler-ia32.cc
  62. +21 −4 deps/v8/src/ia32/macro-assembler-ia32.h
  63. +7 −13 deps/v8/src/ia32/regexp-macro-assembler-ia32.cc
  64. +29 −10 deps/v8/src/ia32/stub-cache-ia32.cc
  65. +67 −2 deps/v8/src/ic.cc
  66. +16 −0 deps/v8/src/ic.h
  67. +1 −0 deps/v8/src/list.h
  68. +4 −3 deps/v8/src/location.h
  69. +24 −8 deps/v8/src/log.cc
  70. +176 −0 deps/v8/src/objects-debug.cc
  71. +275 −11 deps/v8/src/objects-inl.h
  72. +350 −24 deps/v8/src/objects.cc
  73. +265 −8 deps/v8/src/objects.h
  74. +7 −0 deps/v8/src/platform-nullos.cc
  75. +6 −0 deps/v8/src/platform-posix.cc
  76. +31 −19 deps/v8/src/platform-win32.cc
  77. +1 −0 deps/v8/src/platform.h
  78. +0 −16 deps/v8/src/regexp-macro-assembler.h
  79. +156 −22 deps/v8/src/runtime.cc
  80. +4 −0 deps/v8/src/runtime.h
  81. +4 −1 deps/v8/src/runtime.js
  82. +508 −0 deps/v8/src/serialize.cc
  83. +229 −1 deps/v8/src/serialize.h
  84. +56 −0 deps/v8/src/snapshot-common.cc
  85. +3 −0 deps/v8/src/snapshot.h
  86. +7 −0 deps/v8/src/spaces-inl.h
  87. +23 −19 deps/v8/src/spaces.cc
  88. +14 −0 deps/v8/src/spaces.h
  89. +1 −1 deps/v8/src/string-stream.cc
  90. +6 −3 deps/v8/src/string.js
  91. +6 −1 deps/v8/src/stub-cache.cc
  92. +29 −28 deps/v8/src/third_party/valgrind/valgrind.h
  93. +4 −0 deps/v8/src/top.h
  94. +1 −0 deps/v8/src/v8-counters.h
  95. +1 −1 deps/v8/src/v8.cc
  96. +1 −1 deps/v8/src/v8.h
  97. +1 −1 deps/v8/src/version.cc
  98. +69 −17 deps/v8/src/x64/assembler-x64.cc
  99. +24 −3 deps/v8/src/x64/assembler-x64.h
  100. +41 −37 deps/v8/src/x64/builtins-x64.cc
  101. +331 −145 deps/v8/src/x64/codegen-x64.cc
  102. +68 −17 deps/v8/src/x64/codegen-x64.h
  103. +13 −0 deps/v8/src/x64/cpu-x64.cc
  104. +185 −180 deps/v8/src/x64/disasm-x64.cc
  105. +556 −27 deps/v8/src/x64/fast-codegen-x64.cc
  106. +5 −9 deps/v8/src/x64/frames-x64.cc
  107. +1 −1 deps/v8/src/x64/frames-x64.h
  108. +317 −9 deps/v8/src/x64/ic-x64.cc
  109. +56 −78 deps/v8/src/x64/macro-assembler-x64.cc
  110. +26 −17 deps/v8/src/x64/macro-assembler-x64.h
  111. +8 −15 deps/v8/src/x64/regexp-macro-assembler-x64.cc
  112. +1 −0 deps/v8/test/cctest/SConscript
  113. +3 −0 deps/v8/test/cctest/cctest.cc
  114. +136 −0 deps/v8/test/cctest/cctest.h
  115. +15 −0 deps/v8/test/cctest/cctest.status
  116. +424 −0 deps/v8/test/cctest/test-accessors.cc
  117. +473 −340 deps/v8/test/cctest/test-api.cc
  118. +0 −6 deps/v8/test/cctest/test-debug.cc
  119. +8 −14 deps/v8/test/cctest/test-log-stack-tracer.cc
  120. +2 −3 deps/v8/test/cctest/test-log.cc
  121. +9 −1 deps/v8/test/cctest/test-macro-assembler-x64.cc
  122. +0 −5 deps/v8/test/cctest/test-mark-compact.cc
  123. +70 −0 deps/v8/test/cctest/test-serialize.cc
  124. +10 −10 deps/v8/test/cctest/test-spaces.cc
  125. +55 −0 deps/v8/test/mjsunit/compiler/globals.js
  126. +33 −0 deps/v8/test/mjsunit/compiler/literals-assignment.js
  127. +17 −0 deps/v8/test/mjsunit/compiler/literals.js
  128. +39 −0 deps/v8/test/mjsunit/compiler/property-simple.js
  129. +90 −0 deps/v8/test/mjsunit/debug-version.js
  130. +69 −0 deps/v8/test/mjsunit/div-mod.js
  131. +4 −1 deps/v8/test/mjsunit/fuzz-natives.js
  132. +3 −0 deps/v8/test/mjsunit/mjsunit.status
  133. +28 −0 deps/v8/test/mjsunit/regress/regress-475.js
  134. +35 −0 deps/v8/test/mjsunit/regress/regress-483.js
  135. +64 −0 deps/v8/test/mjsunit/regress/regress-485.js
  136. +8 −4 deps/v8/tools/test.py
View
@@ -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.
@@ -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.
View
@@ -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;
@@ -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:
@@ -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)
*/
@@ -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:
@@ -2103,6 +2124,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.
*/
class V8EXPORT V8 {
@@ -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.
@@ -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);
View
@@ -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) {
@@ -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);
}
@@ -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.
@@ -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
}
@@ -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 =
@@ -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);
@@ -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);
}
View
@@ -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,
@@ -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
@@ -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);
@@ -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);
@@ -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.
Oops, something went wrong.

0 comments on commit 50f45d1

Please sign in to comment.