Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: include/v8.h

Issue 6529032: Merge 6168:6800 from bleeding_edge to experimental/gc branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « SConstruct ('k') | src/SConscript » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
===================================================================
--- include/v8.h (revision 6800)
+++ include/v8.h (working copy)
@@ -462,7 +462,6 @@
void Leave();
-
internal::Object** prev_next_;
internal::Object** prev_limit_;
@@ -2515,6 +2514,7 @@
size_t total_heap_size() { return total_heap_size_; }
size_t total_heap_size_executable() { return total_heap_size_executable_; }
size_t used_heap_size() { return used_heap_size_; }
+ size_t heap_size_limit() { return heap_size_limit_; }
private:
void set_total_heap_size(size_t size) { total_heap_size_ = size; }
@@ -2522,10 +2522,12 @@
total_heap_size_executable_ = size;
}
void set_used_heap_size(size_t size) { used_heap_size_ = size; }
+ void set_heap_size_limit(size_t size) { heap_size_limit_ = size; }
size_t total_heap_size_;
size_t total_heap_size_executable_;
size_t used_heap_size_;
+ size_t heap_size_limit_;
friend class V8;
};
@@ -3050,7 +3052,22 @@
*/
class V8EXPORT Context {
public:
- /** Returns the global object of the context. */
+ /**
+ * Returns the global proxy object or global object itself for
+ * detached contexts.
+ *
+ * Global proxy object is a thin wrapper whose prototype points to
+ * actual context's global object with the properties like Object, etc.
+ * This is done that way for security reasons (for more details see
+ * https://wiki.mozilla.org/Gecko:SplitWindow).
+ *
+ * Please note that changes to global proxy object prototype most probably
+ * would break VM---v8 expects only global object as a prototype of
+ * global proxy object.
+ *
+ * If DetachGlobal() has been invoked, Global() would return actual global
+ * object until global is reattached with ReattachGlobal().
+ */
Local<Object> Global();
/**
@@ -3350,10 +3367,10 @@
const int kSmiTagSize = 1;
const intptr_t kSmiTagMask = (1 << kSmiTagSize) - 1;
-template <size_t ptr_size> struct SmiConstants;
+template <size_t ptr_size> struct SmiTagging;
// Smi constants for 32-bit systems.
-template <> struct SmiConstants<4> {
+template <> struct SmiTagging<4> {
static const int kSmiShiftSize = 0;
static const int kSmiValueSize = 31;
static inline int SmiToInt(internal::Object* value) {
@@ -3361,10 +3378,15 @@
// Throw away top 32 bits and shift down (requires >> to be sign extending).
return static_cast<int>(reinterpret_cast<intptr_t>(value)) >> shift_bits;
}
+
+ // For 32-bit systems any 2 bytes aligned pointer can be encoded as smi
+ // with a plain reinterpret_cast.
+ static const uintptr_t kEncodablePointerMask = 0x1;
+ static const int kPointerToSmiShift = 0;
};
// Smi constants for 64-bit systems.
-template <> struct SmiConstants<8> {
+template <> struct SmiTagging<8> {
static const int kSmiShiftSize = 31;
static const int kSmiValueSize = 32;
static inline int SmiToInt(internal::Object* value) {
@@ -3372,10 +3394,26 @@
// Shift down and throw away top 32 bits.
return static_cast<int>(reinterpret_cast<intptr_t>(value) >> shift_bits);
}
+
+ // To maximize the range of pointers that can be encoded
+ // in the available 32 bits, we require them to be 8 bytes aligned.
+ // This gives 2 ^ (32 + 3) = 32G address space covered.
+ // It might be not enough to cover stack allocated objects on some platforms.
+ static const int kPointerAlignment = 3;
+
+ static const uintptr_t kEncodablePointerMask =
+ ~(uintptr_t(0xffffffff) << kPointerAlignment);
+
+ static const int kPointerToSmiShift =
+ kSmiTagSize + kSmiShiftSize - kPointerAlignment;
};
-const int kSmiShiftSize = SmiConstants<kApiPointerSize>::kSmiShiftSize;
-const int kSmiValueSize = SmiConstants<kApiPointerSize>::kSmiValueSize;
+typedef SmiTagging<kApiPointerSize> PlatformSmiTagging;
+const int kSmiShiftSize = PlatformSmiTagging::kSmiShiftSize;
+const int kSmiValueSize = PlatformSmiTagging::kSmiValueSize;
+const uintptr_t kEncodablePointerMask =
+ PlatformSmiTagging::kEncodablePointerMask;
+const int kPointerToSmiShift = PlatformSmiTagging::kPointerToSmiShift;
template <size_t ptr_size> struct InternalConstants;
@@ -3409,7 +3447,7 @@
static const int kFullStringRepresentationMask = 0x07;
static const int kExternalTwoByteRepresentationTag = 0x02;
- static const int kJSObjectType = 0x9f;
+ static const int kJSObjectType = 0xa0;
static const int kFirstNonstringType = 0x80;
static const int kProxyType = 0x85;
@@ -3423,7 +3461,7 @@
}
static inline int SmiValue(internal::Object* value) {
- return SmiConstants<kApiPointerSize>::SmiToInt(value);
+ return PlatformSmiTagging::SmiToInt(value);
}
static inline int GetInstanceType(internal::Object* obj) {
@@ -3432,9 +3470,14 @@
return ReadField<uint8_t>(map, kMapInstanceTypeOffset);
}
+ static inline void* GetExternalPointerFromSmi(internal::Object* value) {
+ const uintptr_t address = reinterpret_cast<uintptr_t>(value);
+ return reinterpret_cast<void*>(address >> kPointerToSmiShift);
+ }
+
static inline void* GetExternalPointer(internal::Object* obj) {
if (HasSmiTag(obj)) {
- return obj;
+ return GetExternalPointerFromSmi(obj);
} else if (GetInstanceType(obj) == kProxyType) {
return ReadField<void*>(obj, kProxyProxyOffset);
} else {
« no previous file with comments | « SConstruct ('k') | src/SConscript » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698