summaryrefslogtreecommitdiff
path: root/deps/v8/include/v8.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/include/v8.h')
-rw-r--r--deps/v8/include/v8.h213
1 files changed, 26 insertions, 187 deletions
diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h
index 9024531992..33179f5bf0 100644
--- a/deps/v8/include/v8.h
+++ b/deps/v8/include/v8.h
@@ -1,4 +1,4 @@
-// Copyright 2012 the V8 project authors. All rights reserved.
+// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -107,7 +107,6 @@ class Data;
class AccessorInfo;
class StackTrace;
class StackFrame;
-class Isolate;
namespace internal {
@@ -863,13 +862,13 @@ class Value : public Data {
* Returns true if this value is the undefined value. See ECMA-262
* 4.3.10.
*/
- inline bool IsUndefined() const;
+ V8EXPORT bool IsUndefined() const;
/**
* Returns true if this value is the null value. See ECMA-262
* 4.3.11.
*/
- inline bool IsNull() const;
+ V8EXPORT bool IsNull() const;
/**
* Returns true if this value is true.
@@ -983,11 +982,7 @@ class Value : public Data {
V8EXPORT bool StrictEquals(Handle<Value> that) const;
private:
- inline bool QuickIsUndefined() const;
- inline bool QuickIsNull() const;
inline bool QuickIsString() const;
- V8EXPORT bool FullIsUndefined() const;
- V8EXPORT bool FullIsNull() const;
V8EXPORT bool FullIsString() const;
};
@@ -1084,7 +1079,6 @@ class String : public Primitive {
* A zero length string.
*/
V8EXPORT static v8::Local<v8::String> Empty();
- inline static v8::Local<v8::String> Empty(Isolate* isolate);
/**
* Returns true if the string is external
@@ -1242,7 +1236,8 @@ class String : public Primitive {
* this function should not otherwise delete or modify the resource. Neither
* should the underlying buffer be deallocated or modified except through the
* destructor of the external string resource.
- */ V8EXPORT static Local<String> NewExternal(
+ */
+ V8EXPORT static Local<String> NewExternal(
ExternalAsciiStringResource* resource);
/**
@@ -1973,13 +1968,10 @@ class Arguments {
inline Local<Object> Holder() const;
inline bool IsConstructCall() const;
inline Local<Value> Data() const;
- inline Isolate* GetIsolate() const;
-
private:
- static const int kIsolateIndex = 0;
- static const int kDataIndex = -1;
- static const int kCalleeIndex = -2;
- static const int kHolderIndex = -3;
+ static const int kDataIndex = 0;
+ static const int kCalleeIndex = -1;
+ static const int kHolderIndex = -2;
friend class ImplementationUtilities;
inline Arguments(internal::Object** implicit_args,
@@ -2001,11 +1993,9 @@ class V8EXPORT AccessorInfo {
public:
inline AccessorInfo(internal::Object** args)
: args_(args) { }
- inline Isolate* GetIsolate() const;
inline Local<Value> Data() const;
inline Local<Object> This() const;
inline Local<Object> Holder() const;
-
private:
internal::Object** args_;
};
@@ -2562,11 +2552,6 @@ Handle<Primitive> V8EXPORT Null();
Handle<Boolean> V8EXPORT True();
Handle<Boolean> V8EXPORT False();
-inline Handle<Primitive> Undefined(Isolate* isolate);
-inline Handle<Primitive> Null(Isolate* isolate);
-inline Handle<Boolean> True(Isolate* isolate);
-inline Handle<Boolean> False(Isolate* isolate);
-
/**
* A set of constraints that specifies the limits of the runtime's memory use.
@@ -2817,13 +2802,13 @@ class V8EXPORT Isolate {
/**
* Associate embedder-specific data with the isolate
*/
- inline void SetData(void* data);
+ void SetData(void* data);
/**
- * Retrieve embedder-specific data from the isolate.
+ * Retrive embedder-specific data from the isolate.
* Returns NULL if SetData has never been called.
*/
- inline void* GetData();
+ void* GetData();
private:
Isolate();
@@ -3168,8 +3153,7 @@ class V8EXPORT V8 {
* that is kept alive by JavaScript objects.
* \returns the adjusted value.
*/
- static intptr_t AdjustAmountOfExternalAllocatedMemory(
- intptr_t change_in_bytes);
+ static int AdjustAmountOfExternalAllocatedMemory(int change_in_bytes);
/**
* Suspends recording of tick samples in the profiler.
@@ -3752,12 +3736,6 @@ class V8EXPORT Locker {
/**
- * A struct for exporting HeapStats data from V8, using "push" model.
- */
-struct HeapStatsUpdate;
-
-
-/**
* An interface for exporting data from V8, using "push" model.
*/
class V8EXPORT OutputStream { // NOLINT
@@ -3782,14 +3760,6 @@ class V8EXPORT OutputStream { // NOLINT
* will not be called in case writing was aborted.
*/
virtual WriteResult WriteAsciiChunk(char* data, int size) = 0;
- /**
- * Writes the next chunk of heap stats data into the stream. Writing
- * can be stopped by returning kAbort as function result. EndOfStream
- * will not be called in case writing was aborted.
- */
- virtual WriteResult WriteHeapStatsChunk(HeapStatsUpdate* data, int count) {
- return kAbort;
- };
};
@@ -3878,6 +3848,18 @@ const uintptr_t kEncodablePointerMask =
PlatformSmiTagging::kEncodablePointerMask;
const int kPointerToSmiShift = PlatformSmiTagging::kPointerToSmiShift;
+template <size_t ptr_size> struct InternalConstants;
+
+// Internal constants for 32-bit systems.
+template <> struct InternalConstants<4> {
+ static const int kStringResourceOffset = 3 * kApiPointerSize;
+};
+
+// Internal constants for 64-bit systems.
+template <> struct InternalConstants<8> {
+ static const int kStringResourceOffset = 3 * kApiPointerSize;
+};
+
/**
* This class exports constants and functionality from within v8 that
* is necessary to implement inline functions in the v8 api. Don't
@@ -3889,31 +3871,18 @@ class Internals {
// the implementation of v8.
static const int kHeapObjectMapOffset = 0;
static const int kMapInstanceTypeOffset = 1 * kApiPointerSize + kApiIntSize;
- static const int kStringResourceOffset = 3 * kApiPointerSize;
+ static const int kStringResourceOffset =
+ InternalConstants<kApiPointerSize>::kStringResourceOffset;
- static const int kOddballKindOffset = 3 * kApiPointerSize;
static const int kForeignAddressOffset = kApiPointerSize;
static const int kJSObjectHeaderSize = 3 * kApiPointerSize;
static const int kFullStringRepresentationMask = 0x07;
static const int kExternalTwoByteRepresentationTag = 0x02;
- static const int kIsolateStateOffset = 0;
- static const int kIsolateEmbedderDataOffset = 1 * kApiPointerSize;
- static const int kIsolateRootsOffset = 3 * kApiPointerSize;
- static const int kUndefinedValueRootIndex = 5;
- static const int kNullValueRootIndex = 7;
- static const int kTrueValueRootIndex = 8;
- static const int kFalseValueRootIndex = 9;
- static const int kEmptySymbolRootIndex = 128;
-
static const int kJSObjectType = 0xaa;
static const int kFirstNonstringType = 0x80;
- static const int kOddballType = 0x82;
static const int kForeignType = 0x85;
- static const int kUndefinedOddballKind = 5;
- static const int kNullOddballKind = 3;
-
static inline bool HasHeapObjectTag(internal::Object* value) {
return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) ==
kHeapObjectTag);
@@ -3933,11 +3902,6 @@ class Internals {
return ReadField<uint8_t>(map, kMapInstanceTypeOffset);
}
- static inline int GetOddballKind(internal::Object* obj) {
- typedef internal::Object O;
- return SmiValue(ReadField<O*>(obj, kOddballKindOffset));
- }
-
static inline void* GetExternalPointerFromSmi(internal::Object* value) {
const uintptr_t address = reinterpret_cast<uintptr_t>(value);
return reinterpret_cast<void*>(address >> kPointerToSmiShift);
@@ -3958,28 +3922,6 @@ class Internals {
return representation == kExternalTwoByteRepresentationTag;
}
- static inline bool IsInitialized(v8::Isolate* isolate) {
- uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + kIsolateStateOffset;
- return *reinterpret_cast<int*>(addr) == 1;
- }
-
- static inline void SetEmbedderData(v8::Isolate* isolate, void* data) {
- uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) +
- kIsolateEmbedderDataOffset;
- *reinterpret_cast<void**>(addr) = data;
- }
-
- static inline void* GetEmbedderData(v8::Isolate* isolate) {
- uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) +
- kIsolateEmbedderDataOffset;
- return *reinterpret_cast<void**>(addr);
- }
-
- static inline internal::Object** GetRoot(v8::Isolate* isolate, int index) {
- uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + kIsolateRootsOffset;
- return reinterpret_cast<internal::Object**>(addr + index * kApiPointerSize);
- }
-
template <typename T>
static inline T ReadField(Object* ptr, int offset) {
uint8_t* addr = reinterpret_cast<uint8_t*>(ptr) + offset - kHeapObjectTag;
@@ -4106,11 +4048,6 @@ Local<Value> Arguments::Data() const {
}
-Isolate* Arguments::GetIsolate() const {
- return *reinterpret_cast<Isolate**>(&implicit_args_[kIsolateIndex]);
-}
-
-
bool Arguments::IsConstructCall() const {
return is_construct_call_;
}
@@ -4223,15 +4160,6 @@ String* String::Cast(v8::Value* value) {
}
-Local<String> String::Empty(Isolate* isolate) {
- typedef internal::Object* S;
- typedef internal::Internals I;
- if (!I::IsInitialized(isolate)) return Empty();
- S* slot = I::GetRoot(isolate, I::kEmptySymbolRootIndex);
- return Local<String>(reinterpret_cast<String*>(slot));
-}
-
-
String::ExternalStringResource* String::GetExternalStringResource() const {
typedef internal::Object O;
typedef internal::Internals I;
@@ -4250,42 +4178,6 @@ String::ExternalStringResource* String::GetExternalStringResource() const {
}
-bool Value::IsUndefined() const {
-#ifdef V8_ENABLE_CHECKS
- return FullIsUndefined();
-#else
- return QuickIsUndefined();
-#endif
-}
-
-bool Value::QuickIsUndefined() const {
- typedef internal::Object O;
- typedef internal::Internals I;
- O* obj = *reinterpret_cast<O**>(const_cast<Value*>(this));
- if (!I::HasHeapObjectTag(obj)) return false;
- if (I::GetInstanceType(obj) != I::kOddballType) return false;
- return (I::GetOddballKind(obj) == I::kUndefinedOddballKind);
-}
-
-
-bool Value::IsNull() const {
-#ifdef V8_ENABLE_CHECKS
- return FullIsNull();
-#else
- return QuickIsNull();
-#endif
-}
-
-bool Value::QuickIsNull() const {
- typedef internal::Object O;
- typedef internal::Internals I;
- O* obj = *reinterpret_cast<O**>(const_cast<Value*>(this));
- if (!I::HasHeapObjectTag(obj)) return false;
- if (I::GetInstanceType(obj) != I::kOddballType) return false;
- return (I::GetOddballKind(obj) == I::kNullOddballKind);
-}
-
-
bool Value::IsString() const {
#ifdef V8_ENABLE_CHECKS
return FullIsString();
@@ -4391,11 +4283,6 @@ External* External::Cast(v8::Value* value) {
}
-Isolate* AccessorInfo::GetIsolate() const {
- return *reinterpret_cast<Isolate**>(&args_[-3]);
-}
-
-
Local<Value> AccessorInfo::Data() const {
return Local<Value>(reinterpret_cast<Value*>(&args_[-2]));
}
@@ -4411,54 +4298,6 @@ Local<Object> AccessorInfo::Holder() const {
}
-Handle<Primitive> Undefined(Isolate* isolate) {
- typedef internal::Object* S;
- typedef internal::Internals I;
- if (!I::IsInitialized(isolate)) return Undefined();
- S* slot = I::GetRoot(isolate, I::kUndefinedValueRootIndex);
- return Handle<Primitive>(reinterpret_cast<Primitive*>(slot));
-}
-
-
-Handle<Primitive> Null(Isolate* isolate) {
- typedef internal::Object* S;
- typedef internal::Internals I;
- if (!I::IsInitialized(isolate)) return Null();
- S* slot = I::GetRoot(isolate, I::kNullValueRootIndex);
- return Handle<Primitive>(reinterpret_cast<Primitive*>(slot));
-}
-
-
-Handle<Boolean> True(Isolate* isolate) {
- typedef internal::Object* S;
- typedef internal::Internals I;
- if (!I::IsInitialized(isolate)) return True();
- S* slot = I::GetRoot(isolate, I::kTrueValueRootIndex);
- return Handle<Boolean>(reinterpret_cast<Boolean*>(slot));
-}
-
-
-Handle<Boolean> False(Isolate* isolate) {
- typedef internal::Object* S;
- typedef internal::Internals I;
- if (!I::IsInitialized(isolate)) return False();
- S* slot = I::GetRoot(isolate, I::kFalseValueRootIndex);
- return Handle<Boolean>(reinterpret_cast<Boolean*>(slot));
-}
-
-
-void Isolate::SetData(void* data) {
- typedef internal::Internals I;
- I::SetEmbedderData(this, data);
-}
-
-
-void* Isolate::GetData() {
- typedef internal::Internals I;
- return I::GetEmbedderData(this);
-}
-
-
/**
* \example shell.cc
* A simple shell that takes a list of expressions on the