Version 2.5.5
Added more aggressive GC of external objects in near out-of-memory situations.
Fixed a bug that gave the incorrect result for String.split called on the empty string (issue 924).
git-svn-id: http://v8.googlecode.com/svn/trunk@5780 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/include/v8.h b/include/v8.h
index c7e4552..8c730df 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -38,23 +38,9 @@
#ifndef V8_H_
#define V8_H_
-#include <stdio.h>
+#include "v8stdint.h"
#ifdef _WIN32
-// When compiling on MinGW stdint.h is available.
-#ifdef __MINGW32__
-#include <stdint.h>
-#else // __MINGW32__
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-typedef short int16_t; // NOLINT
-typedef unsigned short uint16_t; // NOLINT
-typedef int int32_t;
-typedef unsigned int uint32_t;
-typedef __int64 int64_t;
-typedef unsigned __int64 uint64_t;
-// intptr_t and friends are defined in crtdefs.h through stdio.h.
-#endif // __MINGW32__
// Setup for Windows DLL export/import. When building the V8 DLL the
// BUILDING_V8_SHARED needs to be defined. When building a program which uses
@@ -76,8 +62,6 @@
#else // _WIN32
-#include <stdint.h>
-
// Setup for Linux shared library export. There is no need to distinguish
// between building or using the V8 shared library, but we should not
// export symbols when we are building a static library.
@@ -127,7 +111,6 @@
class Object;
class Heap;
class Top;
-
}
@@ -476,10 +459,10 @@
level = 0;
}
};
-
+
void Leave();
-
+
internal::Object** prev_next_;
internal::Object** prev_limit_;
@@ -1055,7 +1038,7 @@
*/
V8EXPORT bool IsExternalAscii() const;
- class V8EXPORT ExternalStringResourceBase {
+ class V8EXPORT ExternalStringResourceBase { // NOLINT
public:
virtual ~ExternalStringResourceBase() {}
@@ -3260,8 +3243,8 @@
/**
* An interface for exporting data from V8, using "push" model.
*/
-class V8EXPORT OutputStream {
-public:
+class V8EXPORT OutputStream { // NOLINT
+ public:
enum OutputEncoding {
kAscii = 0 // 7-bit ASCII.
};
@@ -3291,6 +3274,8 @@
namespace internal {
+const int kPointerSize = sizeof(void*); // NOLINT
+const int kIntSize = sizeof(int); // NOLINT
// Tag information for HeapObject.
const int kHeapObjectTag = 1;
@@ -3326,19 +3311,19 @@
}
};
-const int kSmiShiftSize = SmiConstants<sizeof(void*)>::kSmiShiftSize;
-const int kSmiValueSize = SmiConstants<sizeof(void*)>::kSmiValueSize;
+const int kSmiShiftSize = SmiConstants<kPointerSize>::kSmiShiftSize;
+const int kSmiValueSize = SmiConstants<kPointerSize>::kSmiValueSize;
template <size_t ptr_size> struct InternalConstants;
// Internal constants for 32-bit systems.
template <> struct InternalConstants<4> {
- static const int kStringResourceOffset = 3 * sizeof(void*);
+ static const int kStringResourceOffset = 3 * kPointerSize;
};
// Internal constants for 64-bit systems.
template <> struct InternalConstants<8> {
- static const int kStringResourceOffset = 3 * sizeof(void*);
+ static const int kStringResourceOffset = 3 * kPointerSize;
};
/**
@@ -3352,12 +3337,12 @@
// These values match non-compiler-dependent values defined within
// the implementation of v8.
static const int kHeapObjectMapOffset = 0;
- static const int kMapInstanceTypeOffset = sizeof(void*) + sizeof(int);
+ static const int kMapInstanceTypeOffset = kPointerSize + kIntSize;
static const int kStringResourceOffset =
- InternalConstants<sizeof(void*)>::kStringResourceOffset;
+ InternalConstants<kPointerSize>::kStringResourceOffset;
- static const int kProxyProxyOffset = sizeof(void*);
- static const int kJSObjectHeaderSize = 3 * sizeof(void*);
+ static const int kProxyProxyOffset = kPointerSize;
+ static const int kJSObjectHeaderSize = 3 * kPointerSize;
static const int kFullStringRepresentationMask = 0x07;
static const int kExternalTwoByteRepresentationTag = 0x02;
@@ -3375,7 +3360,7 @@
}
static inline int SmiValue(internal::Object* value) {
- return SmiConstants<sizeof(void*)>::SmiToInt(value);
+ return SmiConstants<kPointerSize>::SmiToInt(value);
}
static inline int GetInstanceType(internal::Object* obj) {
@@ -3404,10 +3389,9 @@
uint8_t* addr = reinterpret_cast<uint8_t*>(ptr) + offset - kHeapObjectTag;
return *reinterpret_cast<T*>(addr);
}
-
};
-}
+} // namespace internal
template <class T>
@@ -3567,7 +3551,7 @@
// If the object is a plain JSObject, which is the common case,
// we know where to find the internal fields and can return the
// value directly.
- int offset = I::kJSObjectHeaderSize + (sizeof(void*) * index);
+ int offset = I::kJSObjectHeaderSize + (internal::kPointerSize * index);
O* value = I::ReadField<O*>(obj, offset);
O** result = HandleScope::CreateHandle(value);
return Local<Value>(reinterpret_cast<Value*>(result));
@@ -3603,7 +3587,7 @@
// If the object is a plain JSObject, which is the common case,
// we know where to find the internal fields and can return the
// value directly.
- int offset = I::kJSObjectHeaderSize + (sizeof(void*) * index);
+ int offset = I::kJSObjectHeaderSize + (internal::kPointerSize * index);
O* value = I::ReadField<O*>(obj, offset);
return I::GetExternalPointer(value);
}