v8.h   v8.h 
skipping to change at line 2341 skipping to change at line 2341
Handle<Value> GetScriptId() const; Handle<Value> GetScriptId() const;
ScriptOrigin GetScriptOrigin() const; ScriptOrigin GetScriptOrigin() const;
V8_INLINE(static Function* Cast(Value* obj)); V8_INLINE(static Function* Cast(Value* obj));
static const int kLineOffsetNotFound; static const int kLineOffsetNotFound;
private: private:
Function(); Function();
static void CheckCast(Value* obj); static void CheckCast(Value* obj);
}; };
/**
* The contents of an |ArrayBuffer|. Externalization of |ArrayBuffer|
* populates an instance of this class with a pointer to data and byte leng
th.
*
* |ArrayBufferContents| is the owner of its data. When an instance of
* this class is destructed, the |Data| is freed.
*
* This API is experimental and may change significantly.
*/
class V8EXPORT ArrayBufferContents {
public:
ArrayBufferContents() : data_(NULL), byte_length_(0) {}
~ArrayBufferContents();
void* Data() const { return data_; }
size_t ByteLength() const { return byte_length_; }
private:
void* data_;
size_t byte_length_;
friend class ArrayBuffer;
};
#ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT
#define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2 #define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2
#endif #endif
/** /**
* An instance of the built-in ArrayBuffer constructor (ES6 draft 15.13.5). * An instance of the built-in ArrayBuffer constructor (ES6 draft 15.13.5).
* This API is experimental and may change significantly. * This API is experimental and may change significantly.
*/ */
class V8EXPORT ArrayBuffer : public Object { class V8EXPORT ArrayBuffer : public Object {
public: public:
/** /**
* Allocator that V8 uses to allocate |ArrayBuffer|'s memory.
* The allocator is a global V8 setting. It should be set with
* V8::SetArrayBufferAllocator prior to creation of a first ArrayBuffer.
*
* This API is experimental and may change significantly.
*/
class V8EXPORT Allocator { // NOLINT
public:
virtual ~Allocator() {}
/**
* Allocate |length| bytes. Return NULL if allocation is not successful
.
*/
virtual void* Allocate(size_t length) = 0;
/**
* Free the memory pointed to |data|. That memory is guaranteed to be
* previously allocated by |Allocate|.
*/
virtual void Free(void* data) = 0;
};
/**
* The contents of an |ArrayBuffer|. Externalization of |ArrayBuffer|
* returns an instance of this class, populated, with a pointer to data
* and byte length.
*
* The Data pointer of ArrayBuffer::Contents is always allocated with
* Allocator::Allocate that is set with V8::SetArrayBufferAllocator.
*
* This API is experimental and may change significantly.
*/
class V8EXPORT Contents { // NOLINT
public:
Contents() : data_(NULL), byte_length_(0) {}
void* Data() const { return data_; }
size_t ByteLength() const { return byte_length_; }
private:
void* data_;
size_t byte_length_;
friend class ArrayBuffer;
};
/**
* Data length in bytes. * Data length in bytes.
*/ */
size_t ByteLength() const; size_t ByteLength() const;
/** /**
* Create a new ArrayBuffer. Allocate |byte_length| bytes. * Create a new ArrayBuffer. Allocate |byte_length| bytes.
* Allocated memory will be owned by a created ArrayBuffer and * Allocated memory will be owned by a created ArrayBuffer and
* will be deallocated when it is garbage-collected, * will be deallocated when it is garbage-collected,
* unless the object is externalized. * unless the object is externalized.
*/ */
skipping to change at line 2411 skipping to change at line 2433
/** /**
* Neuters this ArrayBuffer and all its views (typed arrays). * Neuters this ArrayBuffer and all its views (typed arrays).
* Neutering sets the byte length of the buffer and all typed arrays to z ero, * Neutering sets the byte length of the buffer and all typed arrays to z ero,
* preventing JavaScript from ever accessing underlying backing store. * preventing JavaScript from ever accessing underlying backing store.
* ArrayBuffer should have been externalized. * ArrayBuffer should have been externalized.
*/ */
void Neuter(); void Neuter();
/** /**
* Pass the ownership of this ArrayBuffer's backing store to * Make this ArrayBuffer external. The pointer to underlying memory block
* a given ArrayBufferContents. * and byte length are returned as |Contents| structure. After ArrayBuffe
r
* had been etxrenalized, it does no longer owns the memory block. The ca
ller
* should take steps to free memory when it is no longer needed.
*
* The memory block is guaranteed to be allocated with |Allocator::Alloca
te|
* that has been set with V8::SetArrayBufferAllocator.
*/ */
void Externalize(ArrayBufferContents* contents); Contents Externalize();
V8_INLINE(static ArrayBuffer* Cast(Value* obj)); V8_INLINE(static ArrayBuffer* Cast(Value* obj));
static const int kInternalFieldCount = V8_ARRAY_BUFFER_INTERNAL_FIELD_COU NT; static const int kInternalFieldCount = V8_ARRAY_BUFFER_INTERNAL_FIELD_COU NT;
private: private:
ArrayBuffer(); ArrayBuffer();
static void CheckCast(Value* obj); static void CheckCast(Value* obj);
}; };
skipping to change at line 2796 skipping to change at line 2823
template <typename S> V8_INLINE(void Set(const Persistent<S>& handle)); template <typename S> V8_INLINE(void Set(const Persistent<S>& handle));
template <typename S> V8_INLINE(void Set(const Handle<S> handle)); template <typename S> V8_INLINE(void Set(const Handle<S> handle));
// Fast primitive setters // Fast primitive setters
V8_INLINE(void Set(bool value)); V8_INLINE(void Set(bool value));
V8_INLINE(void Set(double i)); V8_INLINE(void Set(double i));
V8_INLINE(void Set(int32_t i)); V8_INLINE(void Set(int32_t i));
V8_INLINE(void Set(uint32_t i)); V8_INLINE(void Set(uint32_t i));
// Fast JS primitive setters // Fast JS primitive setters
V8_INLINE(void SetNull()); V8_INLINE(void SetNull());
V8_INLINE(void SetUndefined()); V8_INLINE(void SetUndefined());
V8_INLINE(void SetEmptyString());
// Convenience getter for Isolate // Convenience getter for Isolate
V8_INLINE(Isolate* GetIsolate()); V8_INLINE(Isolate* GetIsolate());
private: private:
template<class F> friend class ReturnValue; template<class F> friend class ReturnValue;
template<class F> friend class FunctionCallbackInfo; template<class F> friend class FunctionCallbackInfo;
template<class F> friend class PropertyCallbackInfo; template<class F> friend class PropertyCallbackInfo;
V8_INLINE(internal::Object* GetDefaultValue()); V8_INLINE(internal::Object* GetDefaultValue());
V8_INLINE(explicit ReturnValue(internal::Object** slot)); V8_INLINE(explicit ReturnValue(internal::Object** slot));
internal::Object** value_; internal::Object** value_;
skipping to change at line 4094 skipping to change at line 4122
static void SetFatalErrorHandler(FatalErrorCallback that); static void SetFatalErrorHandler(FatalErrorCallback that);
/** /**
* Set the callback to invoke to check if code generation from * Set the callback to invoke to check if code generation from
* strings should be allowed. * strings should be allowed.
*/ */
static void SetAllowCodeGenerationFromStringsCallback( static void SetAllowCodeGenerationFromStringsCallback(
AllowCodeGenerationFromStringsCallback that); AllowCodeGenerationFromStringsCallback that);
/** /**
* Set allocator to use for ArrayBuffer memory.
* The allocator should be set only once. The allocator should be set
* before any code tha uses ArrayBuffers is executed.
* This allocator is used in all isolates.
*/
static void SetArrayBufferAllocator(ArrayBuffer::Allocator* allocator);
/**
* Ignore out-of-memory exceptions. * Ignore out-of-memory exceptions.
* *
* V8 running out of memory is treated as a fatal error by default. * V8 running out of memory is treated as a fatal error by default.
* This means that the fatal error handler is called and that V8 is * This means that the fatal error handler is called and that V8 is
* terminated. * terminated.
* *
* IgnoreOutOfMemoryException can be used to not treat an * IgnoreOutOfMemoryException can be used to not treat an
* out-of-memory situation as a fatal error. This way, the contexts * out-of-memory situation as a fatal error. This way, the contexts
* that did not cause the out of memory problem might be able to * that did not cause the out of memory problem might be able to
* continue execution. * continue execution.
skipping to change at line 5599 skipping to change at line 5635
*value_ = *I::GetRoot(GetIsolate(), I::kNullValueRootIndex); *value_ = *I::GetRoot(GetIsolate(), I::kNullValueRootIndex);
} }
template<typename T> template<typename T>
void ReturnValue<T>::SetUndefined() { void ReturnValue<T>::SetUndefined() {
typedef internal::Internals I; typedef internal::Internals I;
*value_ = *I::GetRoot(GetIsolate(), I::kUndefinedValueRootIndex); *value_ = *I::GetRoot(GetIsolate(), I::kUndefinedValueRootIndex);
} }
template<typename T> template<typename T>
void ReturnValue<T>::SetEmptyString() {
typedef internal::Internals I;
*value_ = *I::GetRoot(GetIsolate(), I::kEmptyStringRootIndex);
}
template<typename T>
Isolate* ReturnValue<T>::GetIsolate() { Isolate* ReturnValue<T>::GetIsolate() {
// Isolate is always the pointer below the default value on the stack. // Isolate is always the pointer below the default value on the stack.
return *reinterpret_cast<Isolate**>(&value_[-2]); return *reinterpret_cast<Isolate**>(&value_[-2]);
} }
template<typename T> template<typename T>
internal::Object* ReturnValue<T>::GetDefaultValue() { internal::Object* ReturnValue<T>::GetDefaultValue() {
// Default value is always the pointer below value_ on the stack. // Default value is always the pointer below value_ on the stack.
return value_[-1]; return value_[-1];
} }
 End of changes. 7 change blocks. 
28 lines changed or deleted 73 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/