v8-preparser.h   v8-preparser.h 
skipping to change at line 31 skipping to change at line 31
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef PREPARSER_H #ifndef PREPARSER_H
#define PREPARSER_H #define PREPARSER_H
#include "v8.h"
#include "v8stdint.h" #include "v8stdint.h"
#ifdef _WIN32
// Setup for Windows DLL export/import. When building the V8 DLL the
// BUILDING_V8_SHARED needs to be defined. When building a program which us
es
// the V8 DLL USING_V8_SHARED needs to be defined. When either building the
V8
// static library or building a program which uses the V8 static library ne
ither
// BUILDING_V8_SHARED nor USING_V8_SHARED should be defined.
#if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
#error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check t
he\
build configuration to ensure that at most one of these is set
#endif
#ifdef BUILDING_V8_SHARED
#define V8EXPORT __declspec(dllexport)
#elif USING_V8_SHARED
#define V8EXPORT __declspec(dllimport)
#else
#define V8EXPORT
#endif // BUILDING_V8_SHARED
#else // _WIN32
// 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.
#if defined(__GNUC__) && ((__GNUC__ >= 4) || \
(__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(V8_SHARED)
#define V8EXPORT __attribute__ ((visibility("default")))
#else
#define V8EXPORT
#endif
#endif // _WIN32
namespace v8 { namespace v8 {
// The result of preparsing is either a stack overflow error, or an opaque // The result of preparsing is either a stack overflow error, or an opaque
// blob of data that can be passed back into the parser. // blob of data that can be passed back into the parser.
class V8_EXPORT PreParserData { class V8EXPORT PreParserData {
public: public:
PreParserData(size_t size, const uint8_t* data) PreParserData(size_t size, const uint8_t* data)
: data_(data), size_(size) { } : data_(data), size_(size) { }
// Create a PreParserData value where stack_overflow reports true. // Create a PreParserData value where stack_overflow reports true.
static PreParserData StackOverflow() { return PreParserData(0, NULL); } static PreParserData StackOverflow() { return PreParserData(0, NULL); }
// Whether the pre-parser stopped due to a stack overflow. // Whether the pre-parser stopped due to a stack overflow.
// If this is the case, size() and data() should not be used. // If this is the case, size() and data() should not be used.
bool stack_overflow() { return size_ == 0u; } bool stack_overflow() { return size_ == 0u; }
skipping to change at line 62 skipping to change at line 95
// Pointer to the data. // Pointer to the data.
const uint8_t* data() const { return data_; } const uint8_t* data() const { return data_; }
private: private:
const uint8_t* const data_; const uint8_t* const data_;
const size_t size_; const size_t size_;
}; };
// Interface for a stream of Unicode characters. // Interface for a stream of Unicode characters.
class V8_EXPORT UnicodeInputStream { // NOLINT - V8_EXPORT is not a class name. class V8EXPORT UnicodeInputStream { // NOLINT - Thinks V8EXPORT is class n ame.
public: public:
virtual ~UnicodeInputStream(); virtual ~UnicodeInputStream();
// Returns the next Unicode code-point in the input, or a negative value when // Returns the next Unicode code-point in the input, or a negative value when
// there is no more input in the stream. // there is no more input in the stream.
virtual int32_t Next() = 0; virtual int32_t Next() = 0;
}; };
// Preparse a JavaScript program. The source code is provided as a // Preparse a JavaScript program. The source code is provided as a
// UnicodeInputStream. The max_stack_size limits the amount of stack // UnicodeInputStream. The max_stack_size limits the amount of stack
// space that the preparser is allowed to use. If the preparser uses // space that the preparser is allowed to use. If the preparser uses
// more stack space than the limit provided, the result's stack_overflow() // more stack space than the limit provided, the result's stack_overflow()
// method will return true. Otherwise the result contains preparser // method will return true. Otherwise the result contains preparser
// data that can be used by the V8 parser to speed up parsing. // data that can be used by the V8 parser to speed up parsing.
PreParserData V8_EXPORT Preparse(UnicodeInputStream* input, PreParserData V8EXPORT Preparse(UnicodeInputStream* input,
size_t max_stack_size); size_t max_stack_size);
} // namespace v8. } // namespace v8.
#undef V8EXPORT
#endif // PREPARSER_H #endif // PREPARSER_H
 End of changes. 6 change blocks. 
4 lines changed or deleted 43 lines changed or added


 v8-profiler.h   v8-profiler.h 
skipping to change at line 33 skipping to change at line 33
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef V8_V8_PROFILER_H_ #ifndef V8_V8_PROFILER_H_
#define V8_V8_PROFILER_H_ #define V8_V8_PROFILER_H_
#include "v8.h" #include "v8.h"
#ifdef _WIN32
// Setup for Windows DLL export/import. See v8.h in this directory for
// information on how to build/use V8 as a DLL.
#if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
#error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check t
he\
build configuration to ensure that at most one of these is set
#endif
#ifdef BUILDING_V8_SHARED
#define V8EXPORT __declspec(dllexport)
#elif USING_V8_SHARED
#define V8EXPORT __declspec(dllimport)
#else
#define V8EXPORT
#endif
#else // _WIN32
// Setup for Linux shared library export. See v8.h in this directory for
// information on how to build/use V8 as shared library.
#if defined(__GNUC__) && ((__GNUC__ >= 4) || \
(__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(V8_SHARED)
#define V8EXPORT __attribute__ ((visibility("default")))
#else
#define V8EXPORT
#endif
#endif // _WIN32
/** /**
* Profiler support for the V8 JavaScript engine. * Profiler support for the V8 JavaScript engine.
*/ */
namespace v8 { namespace v8 {
typedef uint32_t SnapshotObjectId; typedef uint32_t SnapshotObjectId;
/** /**
* CpuProfileNode represents a node in a call graph. * CpuProfileNode represents a node in a call graph.
*/ */
class V8_EXPORT CpuProfileNode { class V8EXPORT CpuProfileNode {
public: public:
/** Returns function name (empty string for anonymous functions.) */ /** Returns function name (empty string for anonymous functions.) */
Handle<String> GetFunctionName() const; Handle<String> GetFunctionName() const;
/** Returns id of the script where function is located. */ /** Returns id of the script where function is located. */
int GetScriptId() const; int GetScriptId() const;
/** Returns resource name for script from where the function originates. */ /** Returns resource name for script from where the function originates. */
Handle<String> GetScriptResourceName() const; Handle<String> GetScriptResourceName() const;
/** /**
* Returns the number, 1-based, of the line where the function originates . * Returns the number, 1-based, of the line where the function originates .
* kNoLineNumberInfo if no line number information is available. * kNoLineNumberInfo if no line number information is available.
*/ */
int GetLineNumber() const; int GetLineNumber() const;
/** /**
* Returns total (self + children) execution time of the function, * Returns total (self + children) execution time of the function,
* in milliseconds, estimated by samples count. * in milliseconds, estimated by samples count.
*/ */
V8_DEPRECATED(double GetTotalTime() const); double GetTotalTime() const;
/** /**
* Returns self execution time of the function, in milliseconds, * Returns self execution time of the function, in milliseconds,
* estimated by samples count. * estimated by samples count.
*/ */
V8_DEPRECATED(double GetSelfTime() const); double GetSelfTime() const;
/** Returns the count of samples where function exists. */ /** Returns the count of samples where function exists. */
V8_DEPRECATED(double GetTotalSamplesCount() const); double GetTotalSamplesCount() const;
/** DEPRECATED. Please use GetHitCount instead. /** Returns the count of samples where function was currently executing.
* Returns the count of samples where function was currently executing. */
*/
double GetSelfSamplesCount() const; double GetSelfSamplesCount() const;
/**
* Returns the count of samples where the function was currently executi
ng.
*/
unsigned GetHitCount() const;
/** Returns function entry UID. */ /** Returns function entry UID. */
unsigned GetCallUid() const; unsigned GetCallUid() const;
/** Returns id of the node. The id is unique within the tree */ /** Returns id of the node. The id is unique within the tree */
unsigned GetNodeId() const; unsigned GetNodeId() const;
/** Returns child nodes count of the node. */ /** Returns child nodes count of the node. */
int GetChildrenCount() const; int GetChildrenCount() const;
/** Retrieves a child node by index. */ /** Retrieves a child node by index. */
const CpuProfileNode* GetChild(int index) const; const CpuProfileNode* GetChild(int index) const;
static const int kNoLineNumberInfo = Message::kNoLineNumberInfo; static const int kNoLineNumberInfo = Message::kNoLineNumberInfo;
}; };
/** /**
* CpuProfile contains a CPU profile in a form of top-down call tree * CpuProfile contains a CPU profile in a form of top-down call tree
* (from main() down to functions that do all the work). * (from main() down to functions that do all the work).
*/ */
class V8_EXPORT CpuProfile { class V8EXPORT CpuProfile {
public: public:
/** Returns CPU profile UID (assigned by the profiler.) */ /** Returns CPU profile UID (assigned by the profiler.) */
unsigned GetUid() const; unsigned GetUid() const;
/** Returns CPU profile title. */ /** Returns CPU profile title. */
Handle<String> GetTitle() const; Handle<String> GetTitle() const;
/** Returns the root node of the top down call tree. */ /** Returns the root node of the top down call tree. */
const CpuProfileNode* GetTopDownRoot() const; const CpuProfileNode* GetTopDownRoot() const;
skipping to change at line 128 skipping to change at line 150
*/ */
int GetSamplesCount() const; int GetSamplesCount() const;
/** /**
* Returns profile node corresponding to the top frame the sample at * Returns profile node corresponding to the top frame the sample at
* the given index. * the given index.
*/ */
const CpuProfileNode* GetSample(int index) const; const CpuProfileNode* GetSample(int index) const;
/** /**
* Returns time when the profile recording started (in microseconds
* since the Epoch).
*/
int64_t GetStartTime() const;
/**
* Returns time when the profile recording was stopped (in microseconds
* since the Epoch).
*/
int64_t GetEndTime() const;
/**
* Deletes the profile and removes it from CpuProfiler's list. * Deletes the profile and removes it from CpuProfiler's list.
* All pointers to nodes previously returned become invalid. * All pointers to nodes previously returned become invalid.
* Profiles with the same uid but obtained using different * Profiles with the same uid but obtained using different
* security token are not deleted, but become inaccessible * security token are not deleted, but become inaccessible
* using FindProfile method. It is embedder's responsibility * using FindProfile method. It is embedder's responsibility
* to call Delete on these profiles. * to call Delete on these profiles.
*/ */
void Delete(); void Delete();
}; };
/** /**
* Interface for controlling CPU profiling. Instance of the * Interface for controlling CPU profiling. Instance of the
* profiler can be retrieved using v8::Isolate::GetCpuProfiler. * profiler can be retrieved using v8::Isolate::GetCpuProfiler.
*/ */
class V8_EXPORT CpuProfiler { class V8EXPORT CpuProfiler {
public: public:
/** /**
* A note on security tokens usage. As scripts from different * A note on security tokens usage. As scripts from different
* origins can run inside a single V8 instance, it is possible to * origins can run inside a single V8 instance, it is possible to
* have functions from different security contexts intermixed in a * have functions from different security contexts intermixed in a
* single CPU profile. To avoid exposing function names belonging to * single CPU profile. To avoid exposing function names belonging to
* other contexts, filtering by security token is performed while * other contexts, filtering by security token is performed while
* obtaining profiling results. * obtaining profiling results.
*/ */
skipping to change at line 200 skipping to change at line 210
*/ */
const CpuProfile* StopCpuProfiling(Handle<String> title); const CpuProfile* StopCpuProfiling(Handle<String> title);
/** /**
* Deletes all existing profiles, also cancelling all profiling * Deletes all existing profiles, also cancelling all profiling
* activity. All previously returned pointers to profiles and their * activity. All previously returned pointers to profiles and their
* contents become invalid after this call. * contents become invalid after this call.
*/ */
void DeleteAllCpuProfiles(); void DeleteAllCpuProfiles();
/**
* Tells the profiler whether the embedder is idle.
*/
void SetIdle(bool is_idle);
private: private:
CpuProfiler(); CpuProfiler();
~CpuProfiler(); ~CpuProfiler();
CpuProfiler(const CpuProfiler&); CpuProfiler(const CpuProfiler&);
CpuProfiler& operator=(const CpuProfiler&); CpuProfiler& operator=(const CpuProfiler&);
}; };
class HeapGraphNode; class HeapGraphNode;
/** /**
* HeapSnapshotEdge represents a directed connection between heap * HeapSnapshotEdge represents a directed connection between heap
* graph nodes: from retainers to retained nodes. * graph nodes: from retainers to retained nodes.
*/ */
class V8_EXPORT HeapGraphEdge { class V8EXPORT HeapGraphEdge {
public: public:
enum Type { enum Type {
kContextVariable = 0, // A variable from a function context. kContextVariable = 0, // A variable from a function context.
kElement = 1, // An element of an array. kElement = 1, // An element of an array.
kProperty = 2, // A named object property. kProperty = 2, // A named object property.
kInternal = 3, // A link that can't be accessed from JS, kInternal = 3, // A link that can't be accessed from JS,
// thus, its name isn't a real property name // thus, its name isn't a real property name
// (e.g. parts of a ConsString). // (e.g. parts of a ConsString).
kHidden = 4, // A link that is needed for proper sizes kHidden = 4, // A link that is needed for proper sizes
// calculation, but may be hidden from user. // calculation, but may be hidden from user.
skipping to change at line 253 skipping to change at line 258
/** Returns origin node. */ /** Returns origin node. */
const HeapGraphNode* GetFromNode() const; const HeapGraphNode* GetFromNode() const;
/** Returns destination node. */ /** Returns destination node. */
const HeapGraphNode* GetToNode() const; const HeapGraphNode* GetToNode() const;
}; };
/** /**
* HeapGraphNode represents a node in a heap graph. * HeapGraphNode represents a node in a heap graph.
*/ */
class V8_EXPORT HeapGraphNode { class V8EXPORT HeapGraphNode {
public: public:
enum Type { enum Type {
kHidden = 0, // Hidden node, may be filtered when shown to user. kHidden = 0, // Hidden node, may be filtered when shown to user.
kArray = 1, // An array of elements. kArray = 1, // An array of elements.
kString = 2, // A string. kString = 2, // A string.
kObject = 3, // A JS object (except for arrays and strings). kObject = 3, // A JS object (except for arrays and strings).
kCode = 4, // Compiled code. kCode = 4, // Compiled code.
kClosure = 5, // Function closure. kClosure = 5, // Function closure.
kRegExp = 6, // RegExp. kRegExp = 6, // RegExp.
kHeapNumber = 7, // Number stored in the heap. kHeapNumber = 7, // Number stored in the heap.
skipping to change at line 304 skipping to change at line 309
/** /**
* Finds and returns a value from the heap corresponding to this node, * Finds and returns a value from the heap corresponding to this node,
* if the value is still reachable. * if the value is still reachable.
*/ */
Handle<Value> GetHeapValue() const; Handle<Value> GetHeapValue() const;
}; };
/** /**
* HeapSnapshots record the state of the JS heap at some moment. * HeapSnapshots record the state of the JS heap at some moment.
*/ */
class V8_EXPORT HeapSnapshot { class V8EXPORT HeapSnapshot {
public: public:
enum SerializationFormat { enum SerializationFormat {
kJSON = 0 // See format description near 'Serialize' method. kJSON = 0 // See format description near 'Serialize' method.
}; };
/** Returns heap snapshot UID (assigned by the profiler.) */ /** Returns heap snapshot UID (assigned by the profiler.) */
unsigned GetUid() const; unsigned GetUid() const;
/** Returns heap snapshot title. */ /** Returns heap snapshot title. */
Handle<String> GetTitle() const; Handle<String> GetTitle() const;
skipping to change at line 373 skipping to change at line 378
*/ */
void Serialize(OutputStream* stream, SerializationFormat format) const; void Serialize(OutputStream* stream, SerializationFormat format) const;
}; };
class RetainedObjectInfo; class RetainedObjectInfo;
/** /**
* Interface for controlling heap profiling. Instance of the * Interface for controlling heap profiling. Instance of the
* profiler can be retrieved using v8::Isolate::GetHeapProfiler. * profiler can be retrieved using v8::Isolate::GetHeapProfiler.
*/ */
class V8_EXPORT HeapProfiler { class V8EXPORT HeapProfiler {
public: public:
/** /**
* Callback function invoked for obtaining RetainedObjectInfo for * Callback function invoked for obtaining RetainedObjectInfo for
* the given JavaScript wrapper object. It is prohibited to enter V8 * the given JavaScript wrapper object. It is prohibited to enter V8
* while the callback is running: only getters on the handle and * while the callback is running: only getters on the handle and
* GetPointerFromInternalField on the objects are allowed. * GetPointerFromInternalField on the objects are allowed.
*/ */
typedef RetainedObjectInfo* (*WrapperInfoCallback) typedef RetainedObjectInfo* (*WrapperInfoCallback)
(uint16_t class_id, Handle<Value> wrapper); (uint16_t class_id, Handle<Value> wrapper);
skipping to change at line 510 skipping to change at line 515
* objects for heap snapshots, he can do it in a GC prologue * objects for heap snapshots, he can do it in a GC prologue
* handler, and / or by assigning wrapper class ids in the following way: * handler, and / or by assigning wrapper class ids in the following way:
* *
* 1. Bind a callback to class id by calling SetWrapperClassInfoProvider. * 1. Bind a callback to class id by calling SetWrapperClassInfoProvider.
* 2. Call SetWrapperClassId on certain persistent handles. * 2. Call SetWrapperClassId on certain persistent handles.
* *
* V8 takes ownership of RetainedObjectInfo instances passed to it and * V8 takes ownership of RetainedObjectInfo instances passed to it and
* keeps them alive only during snapshot collection. Afterwards, they * keeps them alive only during snapshot collection. Afterwards, they
* are freed by calling the Dispose class function. * are freed by calling the Dispose class function.
*/ */
class V8_EXPORT RetainedObjectInfo { // NOLINT class V8EXPORT RetainedObjectInfo { // NOLINT
public: public:
/** Called by V8 when it no longer needs an instance. */ /** Called by V8 when it no longer needs an instance. */
virtual void Dispose() = 0; virtual void Dispose() = 0;
/** Returns whether two instances are equivalent. */ /** Returns whether two instances are equivalent. */
virtual bool IsEquivalent(RetainedObjectInfo* other) = 0; virtual bool IsEquivalent(RetainedObjectInfo* other) = 0;
/** /**
* Returns hash value for the instance. Equivalent instances * Returns hash value for the instance. Equivalent instances
* must have the same hash value. * must have the same hash value.
skipping to change at line 573 skipping to change at line 578
struct HeapStatsUpdate { struct HeapStatsUpdate {
HeapStatsUpdate(uint32_t index, uint32_t count, uint32_t size) HeapStatsUpdate(uint32_t index, uint32_t count, uint32_t size)
: index(index), count(count), size(size) { } : index(index), count(count), size(size) { }
uint32_t index; // Index of the time interval that was changed. uint32_t index; // Index of the time interval that was changed.
uint32_t count; // New value of count field for the interval with this i ndex. uint32_t count; // New value of count field for the interval with this i ndex.
uint32_t size; // New value of size field for the interval with this ind ex. uint32_t size; // New value of size field for the interval with this ind ex.
}; };
} // namespace v8 } // namespace v8
#undef V8EXPORT
#endif // V8_V8_PROFILER_H_ #endif // V8_V8_PROFILER_H_
 End of changes. 17 change blocks. 
37 lines changed or deleted 45 lines changed or added


 v8-testing.h   v8-testing.h 
skipping to change at line 33 skipping to change at line 33
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef V8_V8_TEST_H_ #ifndef V8_V8_TEST_H_
#define V8_V8_TEST_H_ #define V8_V8_TEST_H_
#include "v8.h" #include "v8.h"
#ifdef _WIN32
// Setup for Windows DLL export/import. See v8.h in this directory for
// information on how to build/use V8 as a DLL.
#if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
#error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check t
he\
build configuration to ensure that at most one of these is set
#endif
#ifdef BUILDING_V8_SHARED
#define V8EXPORT __declspec(dllexport)
#elif USING_V8_SHARED
#define V8EXPORT __declspec(dllimport)
#else
#define V8EXPORT
#endif
#else // _WIN32
// Setup for Linux shared library export. See v8.h in this directory for
// information on how to build/use V8 as shared library.
#if defined(__GNUC__) && ((__GNUC__ >= 4) || \
(__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(V8_SHARED)
#define V8EXPORT __attribute__ ((visibility("default")))
#else
#define V8EXPORT
#endif
#endif // _WIN32
/** /**
* Testing support for the V8 JavaScript engine. * Testing support for the V8 JavaScript engine.
*/ */
namespace v8 { namespace v8 {
class V8_EXPORT Testing { class V8EXPORT Testing {
public: public:
enum StressType { enum StressType {
kStressTypeOpt, kStressTypeOpt,
kStressTypeDeopt kStressTypeDeopt
}; };
/** /**
* Set the type of stressing to do. The default if not set is kStressType Opt. * Set the type of stressing to do. The default if not set is kStressType Opt.
*/ */
static void SetStressRunType(StressType type); static void SetStressRunType(StressType type);
skipping to change at line 70 skipping to change at line 99
static void PrepareStressRun(int run); static void PrepareStressRun(int run);
/** /**
* Force deoptimization of all functions. * Force deoptimization of all functions.
*/ */
static void DeoptimizeAll(); static void DeoptimizeAll();
}; };
} // namespace v8 } // namespace v8
#undef V8_EXPORT #undef V8EXPORT
#endif // V8_V8_TEST_H_ #endif // V8_V8_TEST_H_
 End of changes. 3 change blocks. 
2 lines changed or deleted 32 lines changed or added


 v8.h   v8.h 
skipping to change at line 43 skipping to change at line 43
* V8 header file, include/v8.h. * V8 header file, include/v8.h.
* *
* For other documentation see http://code.google.com/apis/v8/ * For other documentation see http://code.google.com/apis/v8/
*/ */
#ifndef V8_H_ #ifndef V8_H_
#define V8_H_ #define V8_H_
#include "v8stdint.h" #include "v8stdint.h"
// We reserve the V8_* prefix for macros defined in V8 public API and
// assume there are no name conflicts with the embedder's code.
#ifdef _WIN32 #ifdef _WIN32
// Setup for Windows DLL export/import. When building the V8 DLL the // Setup for Windows DLL export/import. When building the V8 DLL the
// BUILDING_V8_SHARED needs to be defined. When building a program which us es // BUILDING_V8_SHARED needs to be defined. When building a program which us es
// the V8 DLL USING_V8_SHARED needs to be defined. When either building the V8 // the V8 DLL USING_V8_SHARED needs to be defined. When either building the V8
// static library or building a program which uses the V8 static library ne ither // static library or building a program which uses the V8 static library ne ither
// BUILDING_V8_SHARED nor USING_V8_SHARED should be defined. // BUILDING_V8_SHARED nor USING_V8_SHARED should be defined.
#if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED) #if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
#error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check t he\ #error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check t he\
build configuration to ensure that at most one of these is set build configuration to ensure that at most one of these is set
#endif #endif
#ifdef BUILDING_V8_SHARED #ifdef BUILDING_V8_SHARED
#define V8_EXPORT __declspec(dllexport) #define V8EXPORT __declspec(dllexport)
#elif USING_V8_SHARED #elif USING_V8_SHARED
#define V8_EXPORT __declspec(dllimport) #define V8EXPORT __declspec(dllimport)
#else #else
#define V8_EXPORT #define V8EXPORT
#endif // BUILDING_V8_SHARED #endif // BUILDING_V8_SHARED
#else // _WIN32 #else // _WIN32
// Setup for Linux shared library export. // Setup for Linux shared library export.
#if defined(__GNUC__) && ((__GNUC__ >= 4) || \ #if defined(__GNUC__) && ((__GNUC__ >= 4) || \
(__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(V8_SHARED) (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(V8_SHARED)
#ifdef BUILDING_V8_SHARED #ifdef BUILDING_V8_SHARED
#define V8_EXPORT __attribute__ ((visibility("default"))) #define V8EXPORT __attribute__ ((visibility("default")))
#else #else
#define V8_EXPORT #define V8EXPORT
#endif #endif
#else #else
#define V8_EXPORT #define V8EXPORT
#endif #endif
#endif // _WIN32 #endif // _WIN32
#if defined(__GNUC__) && !defined(DEBUG) #if defined(__GNUC__) && !defined(DEBUG)
#define V8_INLINE(declarator) inline __attribute__((always_inline)) declara tor #define V8_INLINE(declarator) inline __attribute__((always_inline)) declara tor
#elif defined(_MSC_VER) && !defined(DEBUG) #elif defined(_MSC_VER) && !defined(DEBUG)
#define V8_INLINE(declarator) __forceinline declarator #define V8_INLINE(declarator) __forceinline declarator
#else #else
#define V8_INLINE(declarator) inline declarator #define V8_INLINE(declarator) inline declarator
skipping to change at line 386 skipping to change at line 383
friend class Context; friend class Context;
friend class HandleScope; friend class HandleScope;
#ifndef V8_USE_UNSAFE_HANDLES #ifndef V8_USE_UNSAFE_HANDLES
V8_INLINE(static Handle<T> New(Isolate* isolate, T* that)); V8_INLINE(static Handle<T> New(Isolate* isolate, T* that));
#endif #endif
T* val_; T* val_;
}; };
// A value which will never be returned by Local::Eternalize
// Useful for static initialization
const int kUninitializedEternalIndex = -1;
/** /**
* A light-weight stack-allocated object handle. All operations * A light-weight stack-allocated object handle. All operations
* that return objects from within v8 return them in local handles. They * that return objects from within v8 return them in local handles. They
* are created within HandleScopes, and all local handles allocated within a * are created within HandleScopes, and all local handles allocated within a
* handle scope are destroyed when the handle scope is destroyed. Hence it * handle scope are destroyed when the handle scope is destroyed. Hence it
* is not necessary to explicitly deallocate local handles. * is not necessary to explicitly deallocate local handles.
*/ */
// TODO(dcarney): deprecate entire class // TODO(dcarney): deprecate entire class
template <class T> class Local : public Handle<T> { template <class T> class Local : public Handle<T> {
public: public:
skipping to change at line 434 skipping to change at line 427
template <class S> V8_INLINE(Local(Handle<S> that)) template <class S> V8_INLINE(Local(Handle<S> that))
: Handle<T>(reinterpret_cast<T*>(*that)) { : Handle<T>(reinterpret_cast<T*>(*that)) {
TYPE_CHECK(T, S); TYPE_CHECK(T, S);
} }
#endif #endif
template <class S> V8_INLINE(Local<S> As()) { template <class S> V8_INLINE(Local<S> As()) {
return Local<S>::Cast(*this); return Local<S>::Cast(*this);
} }
// Keep this Local alive for the lifetime of the Isolate.
// It remains retrievable via the returned index,
V8_INLINE(int Eternalize(Isolate* isolate));
V8_INLINE(static Local<T> GetEternal(Isolate* isolate, int index));
/** /**
* Create a local handle for the content of another handle. * Create a local handle for the content of another handle.
* The referee is kept alive by the local handle even when * The referee is kept alive by the local handle even when
* the original handle is destroyed/disposed. * the original handle is destroyed/disposed.
*/ */
V8_INLINE(static Local<T> New(Handle<T> that)); V8_INLINE(static Local<T> New(Handle<T> that));
V8_INLINE(static Local<T> New(Isolate* isolate, Handle<T> that)); V8_INLINE(static Local<T> New(Isolate* isolate, Handle<T> that));
#ifndef V8_USE_UNSAFE_HANDLES #ifndef V8_USE_UNSAFE_HANDLES
// TODO(dcarney): remove before cutover // TODO(dcarney): remove before cutover
V8_INLINE(static Local<T> New(Isolate* isolate, const Persistent<T>& that )); V8_INLINE(static Local<T> New(Isolate* isolate, const Persistent<T>& that ));
skipping to change at line 809 skipping to change at line 797
* deleted or another handle scope is created. If there is already a * deleted or another handle scope is created. If there is already a
* handle scope and a new one is created, all allocations will take * handle scope and a new one is created, all allocations will take
* place in the new handle scope until it is deleted. After that, * place in the new handle scope until it is deleted. After that,
* new handles will again be allocated in the original handle scope. * new handles will again be allocated in the original handle scope.
* *
* After the handle scope of a local handle has been deleted the * After the handle scope of a local handle has been deleted the
* garbage collector will no longer track the object stored in the * garbage collector will no longer track the object stored in the
* handle and may deallocate it. The behavior of accessing a handle * handle and may deallocate it. The behavior of accessing a handle
* for which the handle scope has been deleted is undefined. * for which the handle scope has been deleted is undefined.
*/ */
class V8_EXPORT HandleScope { class V8EXPORT HandleScope {
public: public:
// TODO(svenpanne) Deprecate me when Chrome is fixed! // TODO(svenpanne) Deprecate me when Chrome is fixed!
HandleScope(); HandleScope();
HandleScope(Isolate* isolate); HandleScope(Isolate* isolate);
~HandleScope(); ~HandleScope();
/** /**
* Closes the handle scope and returns the value as a handle in the * Closes the handle scope and returns the value as a handle in the
skipping to change at line 848 skipping to change at line 836
private: private:
// Make it hard to create heap-allocated or illegal handle scopes by // Make it hard to create heap-allocated or illegal handle scopes by
// disallowing certain operations. // disallowing certain operations.
HandleScope(const HandleScope&); HandleScope(const HandleScope&);
void operator=(const HandleScope&); void operator=(const HandleScope&);
void* operator new(size_t size); void* operator new(size_t size);
void operator delete(void*, size_t); void operator delete(void*, size_t);
// This Data class is accessible internally as HandleScopeData through a // This Data class is accessible internally as HandleScopeData through a
// typedef in the ImplementationUtilities class. // typedef in the ImplementationUtilities class.
class V8_EXPORT Data { class V8EXPORT Data {
public: public:
internal::Object** next; internal::Object** next;
internal::Object** limit; internal::Object** limit;
int level; int level;
V8_INLINE(void Initialize()) { V8_INLINE(void Initialize()) {
next = limit = NULL; next = limit = NULL;
level = 0; level = 0;
} }
}; };
skipping to change at line 879 skipping to change at line 867
internal::Object** RawClose(internal::Object** value); internal::Object** RawClose(internal::Object** value);
friend class ImplementationUtilities; friend class ImplementationUtilities;
}; };
// --- Special objects --- // --- Special objects ---
/** /**
* The superclass of values and API object templates. * The superclass of values and API object templates.
*/ */
class V8_EXPORT Data { class V8EXPORT Data {
private: private:
Data(); Data();
}; };
/** /**
* Pre-compilation data that can be associated with a script. This * Pre-compilation data that can be associated with a script. This
* data can be calculated for a script in advance of actually * data can be calculated for a script in advance of actually
* compiling it, and can be stored between compilations. When script * compiling it, and can be stored between compilations. When script
* data is given to the compile method compilation will be faster. * data is given to the compile method compilation will be faster.
*/ */
class V8_EXPORT ScriptData { // NOLINT class V8EXPORT ScriptData { // NOLINT
public: public:
virtual ~ScriptData() { } virtual ~ScriptData() { }
/** /**
* Pre-compiles the specified script (context-independent). * Pre-compiles the specified script (context-independent).
* *
* \param input Pointer to UTF-8 script source code. * \param input Pointer to UTF-8 script source code.
* \param length Length of UTF-8 script source code. * \param length Length of UTF-8 script source code.
*/ */
static ScriptData* PreCompile(const char* input, int length); static ScriptData* PreCompile(const char* input, int length);
skipping to change at line 966 skipping to change at line 954
private: private:
Handle<Value> resource_name_; Handle<Value> resource_name_;
Handle<Integer> resource_line_offset_; Handle<Integer> resource_line_offset_;
Handle<Integer> resource_column_offset_; Handle<Integer> resource_column_offset_;
Handle<Boolean> resource_is_shared_cross_origin_; Handle<Boolean> resource_is_shared_cross_origin_;
}; };
/** /**
* A compiled JavaScript script. * A compiled JavaScript script.
*/ */
class V8_EXPORT Script { class V8EXPORT Script {
public: public:
/** /**
* Compiles the specified script (context-independent). * Compiles the specified script (context-independent).
* *
* \param source Script source code. * \param source Script source code.
* \param origin Script origin, owned by caller, no references are kept * \param origin Script origin, owned by caller, no references are kept
* when New() returns * when New() returns
* \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompil e() * \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompil e()
* using pre_data speeds compilation if it's done multiple times. * using pre_data speeds compilation if it's done multiple times.
* Owned by caller, no references are kept when New() returns. * Owned by caller, no references are kept when New() returns.
skipping to change at line 1083 skipping to change at line 1071
* -1 will be returned if no information available. * -1 will be returned if no information available.
*/ */
int GetLineNumber(int code_pos); int GetLineNumber(int code_pos);
static const int kNoScriptId = 0; static const int kNoScriptId = 0;
}; };
/** /**
* An error message. * An error message.
*/ */
class V8_EXPORT Message { class V8EXPORT Message {
public: public:
Local<String> Get() const; Local<String> Get() const;
Local<String> GetSourceLine() const; Local<String> GetSourceLine() const;
/** /**
* Returns the resource name for the script from where the function causi ng * Returns the resource name for the script from where the function causi ng
* the error originates. * the error originates.
*/ */
Handle<Value> GetScriptResourceName() const; Handle<Value> GetScriptResourceName() const;
skipping to change at line 1154 skipping to change at line 1142
static const int kNoLineNumberInfo = 0; static const int kNoLineNumberInfo = 0;
static const int kNoColumnInfo = 0; static const int kNoColumnInfo = 0;
}; };
/** /**
* Representation of a JavaScript stack trace. The information collected is a * Representation of a JavaScript stack trace. The information collected is a
* snapshot of the execution stack and the information remains valid after * snapshot of the execution stack and the information remains valid after
* execution continues. * execution continues.
*/ */
class V8_EXPORT StackTrace { class V8EXPORT StackTrace {
public: public:
/** /**
* Flags that determine what information is placed captured for each * Flags that determine what information is placed captured for each
* StackFrame when grabbing the current stack trace. * StackFrame when grabbing the current stack trace.
*/ */
enum StackTraceOptions { enum StackTraceOptions {
kLineNumber = 1, kLineNumber = 1,
kColumnOffset = 1 << 1 | kLineNumber, kColumnOffset = 1 << 1 | kLineNumber,
kScriptName = 1 << 2, kScriptName = 1 << 2,
kFunctionName = 1 << 3, kFunctionName = 1 << 3,
skipping to change at line 1202 skipping to change at line 1190
* StackFrame. * StackFrame.
*/ */
static Local<StackTrace> CurrentStackTrace( static Local<StackTrace> CurrentStackTrace(
int frame_limit, int frame_limit,
StackTraceOptions options = kOverview); StackTraceOptions options = kOverview);
}; };
/** /**
* A single JavaScript stack frame. * A single JavaScript stack frame.
*/ */
class V8_EXPORT StackFrame { class V8EXPORT StackFrame {
public: public:
/** /**
* Returns the number, 1-based, of the line for the associate function ca ll. * Returns the number, 1-based, of the line for the associate function ca ll.
* This method will return Message::kNoLineNumberInfo if it is unable to * This method will return Message::kNoLineNumberInfo if it is unable to
* retrieve the line number, or if kLineNumber was not passed as an optio n * retrieve the line number, or if kLineNumber was not passed as an optio n
* when capturing the StackTrace. * when capturing the StackTrace.
*/ */
int GetLineNumber() const; int GetLineNumber() const;
/** /**
skipping to change at line 1253 skipping to change at line 1241
*/ */
bool IsEval() const; bool IsEval() const;
/** /**
* Returns whether or not the associated function is called as a * Returns whether or not the associated function is called as a
* constructor via "new". * constructor via "new".
*/ */
bool IsConstructor() const; bool IsConstructor() const;
}; };
/**
* A JSON Parser.
*/
class V8_EXPORT JSON {
public:
/**
* Tries to parse the string |json_string| and returns it as value if
* successful.
*
* \param json_string The string to parse.
* \return The corresponding value if successfully parsed.
*/
static Local<Value> Parse(Local<String> json_string);
};
// --- Value --- // --- Value ---
/** /**
* The superclass of all JavaScript values and objects. * The superclass of all JavaScript values and objects.
*/ */
class V8_EXPORT Value : public Data { class V8EXPORT Value : public Data {
public: public:
/** /**
* Returns true if this value is the undefined value. See ECMA-262 * Returns true if this value is the undefined value. See ECMA-262
* 4.3.10. * 4.3.10.
*/ */
V8_INLINE(bool IsUndefined() const); V8_INLINE(bool IsUndefined() const);
/** /**
* Returns true if this value is the null value. See ECMA-262 * Returns true if this value is the null value. See ECMA-262
* 4.3.11. * 4.3.11.
skipping to change at line 1502 skipping to change at line 1475
V8_INLINE(bool QuickIsNull() const); V8_INLINE(bool QuickIsNull() const);
V8_INLINE(bool QuickIsString() const); V8_INLINE(bool QuickIsString() const);
bool FullIsUndefined() const; bool FullIsUndefined() const;
bool FullIsNull() const; bool FullIsNull() const;
bool FullIsString() const; bool FullIsString() const;
}; };
/** /**
* The superclass of primitive values. See ECMA-262 4.3.2. * The superclass of primitive values. See ECMA-262 4.3.2.
*/ */
class V8_EXPORT Primitive : public Value { }; class V8EXPORT Primitive : public Value { };
/** /**
* A primitive boolean value (ECMA-262, 4.3.14). Either the true * A primitive boolean value (ECMA-262, 4.3.14). Either the true
* or false value. * or false value.
*/ */
class V8_EXPORT Boolean : public Primitive { class V8EXPORT Boolean : public Primitive {
public: public:
bool Value() const; bool Value() const;
V8_INLINE(static Handle<Boolean> New(bool value)); V8_INLINE(static Handle<Boolean> New(bool value));
}; };
/** /**
* A JavaScript string value (ECMA-262, 4.3.17). * A JavaScript string value (ECMA-262, 4.3.17).
*/ */
class V8_EXPORT String : public Primitive { class V8EXPORT String : public Primitive {
public: public:
enum Encoding { enum Encoding {
UNKNOWN_ENCODING = 0x1, UNKNOWN_ENCODING = 0x1,
TWO_BYTE_ENCODING = 0x0, TWO_BYTE_ENCODING = 0x0,
ASCII_ENCODING = 0x4, ASCII_ENCODING = 0x4,
ONE_BYTE_ENCODING = 0x4 ONE_BYTE_ENCODING = 0x4
}; };
/** /**
* Returns the number of characters in this string. * Returns the number of characters in this string.
*/ */
skipping to change at line 1623 skipping to change at line 1596
/** /**
* Returns true if the string is external * Returns true if the string is external
*/ */
bool IsExternal() const; bool IsExternal() const;
/** /**
* Returns true if the string is both external and ASCII * Returns true if the string is both external and ASCII
*/ */
bool IsExternalAscii() const; bool IsExternalAscii() const;
class V8_EXPORT ExternalStringResourceBase { // NOLINT class V8EXPORT ExternalStringResourceBase { // NOLINT
public: public:
virtual ~ExternalStringResourceBase() {} virtual ~ExternalStringResourceBase() {}
protected: protected:
ExternalStringResourceBase() {} ExternalStringResourceBase() {}
/** /**
* Internally V8 will call this Dispose method when the external string * Internally V8 will call this Dispose method when the external string
* resource is no longer needed. The default implementation will use th e * resource is no longer needed. The default implementation will use th e
* delete operator. This method can be overridden in subclasses to * delete operator. This method can be overridden in subclasses to
skipping to change at line 1652 skipping to change at line 1625
friend class v8::internal::Heap; friend class v8::internal::Heap;
}; };
/** /**
* An ExternalStringResource is a wrapper around a two-byte string * An ExternalStringResource is a wrapper around a two-byte string
* buffer that resides outside V8's heap. Implement an * buffer that resides outside V8's heap. Implement an
* ExternalStringResource to manage the life cycle of the underlying * ExternalStringResource to manage the life cycle of the underlying
* buffer. Note that the string data must be immutable. * buffer. Note that the string data must be immutable.
*/ */
class V8_EXPORT ExternalStringResource class V8EXPORT ExternalStringResource
: public ExternalStringResourceBase { : public ExternalStringResourceBase {
public: public:
/** /**
* Override the destructor to manage the life cycle of the underlying * Override the destructor to manage the life cycle of the underlying
* buffer. * buffer.
*/ */
virtual ~ExternalStringResource() {} virtual ~ExternalStringResource() {}
/** /**
* The string data from the underlying buffer. * The string data from the underlying buffer.
skipping to change at line 1686 skipping to change at line 1659
* An ExternalAsciiStringResource is a wrapper around an ASCII * An ExternalAsciiStringResource is a wrapper around an ASCII
* string buffer that resides outside V8's heap. Implement an * string buffer that resides outside V8's heap. Implement an
* ExternalAsciiStringResource to manage the life cycle of the * ExternalAsciiStringResource to manage the life cycle of the
* underlying buffer. Note that the string data must be immutable * underlying buffer. Note that the string data must be immutable
* and that the data must be strict (7-bit) ASCII, not Latin-1 or * and that the data must be strict (7-bit) ASCII, not Latin-1 or
* UTF-8, which would require special treatment internally in the * UTF-8, which would require special treatment internally in the
* engine and, in the case of UTF-8, do not allow efficient indexing. * engine and, in the case of UTF-8, do not allow efficient indexing.
* Use String::New or convert to 16 bit data for non-ASCII. * Use String::New or convert to 16 bit data for non-ASCII.
*/ */
class V8_EXPORT ExternalAsciiStringResource class V8EXPORT ExternalAsciiStringResource
: public ExternalStringResourceBase { : public ExternalStringResourceBase {
public: public:
/** /**
* Override the destructor to manage the life cycle of the underlying * Override the destructor to manage the life cycle of the underlying
* buffer. * buffer.
*/ */
virtual ~ExternalAsciiStringResource() {} virtual ~ExternalAsciiStringResource() {}
/** The string data from the underlying buffer.*/ /** The string data from the underlying buffer.*/
virtual const char* data() const = 0; virtual const char* data() const = 0;
/** The number of ASCII characters in the string.*/ /** The number of ASCII characters in the string.*/
skipping to change at line 1839 skipping to change at line 1812
V8_INLINE(static Local<String> NewUndetectable( V8_INLINE(static Local<String> NewUndetectable(
const uint16_t* data, int length = -1)); const uint16_t* data, int length = -1));
/** /**
* Converts an object to a UTF-8-encoded character array. Useful if * Converts an object to a UTF-8-encoded character array. Useful if
* you want to print the object. If conversion to a string fails * you want to print the object. If conversion to a string fails
* (e.g. due to an exception in the toString() method of the object) * (e.g. due to an exception in the toString() method of the object)
* then the length() method returns 0 and the * operator returns * then the length() method returns 0 and the * operator returns
* NULL. * NULL.
*/ */
class V8_EXPORT Utf8Value { class V8EXPORT Utf8Value {
public: public:
explicit Utf8Value(Handle<v8::Value> obj); explicit Utf8Value(Handle<v8::Value> obj);
~Utf8Value(); ~Utf8Value();
char* operator*() { return str_; } char* operator*() { return str_; }
const char* operator*() const { return str_; } const char* operator*() const { return str_; }
int length() const { return length_; } int length() const { return length_; }
private: private:
char* str_; char* str_;
int length_; int length_;
skipping to change at line 1862 skipping to change at line 1835
void operator=(const Utf8Value&); void operator=(const Utf8Value&);
}; };
/** /**
* Converts an object to an ASCII string. * Converts an object to an ASCII string.
* Useful if you want to print the object. * Useful if you want to print the object.
* If conversion to a string fails (eg. due to an exception in the toStri ng() * If conversion to a string fails (eg. due to an exception in the toStri ng()
* method of the object) then the length() method returns 0 and the * ope rator * method of the object) then the length() method returns 0 and the * ope rator
* returns NULL. * returns NULL.
*/ */
class V8_EXPORT AsciiValue { class V8EXPORT AsciiValue {
public: public:
// TODO(dcarney): deprecate // TODO(dcarney): deprecate
explicit AsciiValue(Handle<v8::Value> obj); explicit AsciiValue(Handle<v8::Value> obj);
~AsciiValue(); ~AsciiValue();
char* operator*() { return str_; } char* operator*() { return str_; }
const char* operator*() const { return str_; } const char* operator*() const { return str_; }
int length() const { return length_; } int length() const { return length_; }
private: private:
char* str_; char* str_;
int length_; int length_;
skipping to change at line 1885 skipping to change at line 1858
AsciiValue(const AsciiValue&); AsciiValue(const AsciiValue&);
void operator=(const AsciiValue&); void operator=(const AsciiValue&);
}; };
/** /**
* Converts an object to a two-byte string. * Converts an object to a two-byte string.
* If conversion to a string fails (eg. due to an exception in the toStri ng() * If conversion to a string fails (eg. due to an exception in the toStri ng()
* method of the object) then the length() method returns 0 and the * ope rator * method of the object) then the length() method returns 0 and the * ope rator
* returns NULL. * returns NULL.
*/ */
class V8_EXPORT Value { class V8EXPORT Value {
public: public:
explicit Value(Handle<v8::Value> obj); explicit Value(Handle<v8::Value> obj);
~Value(); ~Value();
uint16_t* operator*() { return str_; } uint16_t* operator*() { return str_; }
const uint16_t* operator*() const { return str_; } const uint16_t* operator*() const { return str_; }
int length() const { return length_; } int length() const { return length_; }
private: private:
uint16_t* str_; uint16_t* str_;
int length_; int length_;
skipping to change at line 1913 skipping to change at line 1886
Encoding encoding) const; Encoding encoding) const;
void VerifyExternalStringResource(ExternalStringResource* val) const; void VerifyExternalStringResource(ExternalStringResource* val) const;
static void CheckCast(v8::Value* obj); static void CheckCast(v8::Value* obj);
}; };
/** /**
* A JavaScript symbol (ECMA-262 edition 6) * A JavaScript symbol (ECMA-262 edition 6)
* *
* This is an experimental feature. Use at your own risk. * This is an experimental feature. Use at your own risk.
*/ */
class V8_EXPORT Symbol : public Primitive { class V8EXPORT Symbol : public Primitive {
public: public:
// Returns the print name string of the symbol, or undefined if none. // Returns the print name string of the symbol, or undefined if none.
Local<Value> Name() const; Local<Value> Name() const;
// Create a symbol without a print name. // Create a symbol without a print name.
static Local<Symbol> New(Isolate* isolate); static Local<Symbol> New(Isolate* isolate);
// Create a symbol with a print name. // Create a symbol with a print name.
static Local<Symbol> New(Isolate *isolate, const char* data, int length = -1); static Local<Symbol> New(Isolate *isolate, const char* data, int length = -1);
V8_INLINE(static Symbol* Cast(v8::Value* obj)); V8_INLINE(static Symbol* Cast(v8::Value* obj));
private: private:
Symbol(); Symbol();
static void CheckCast(v8::Value* obj); static void CheckCast(v8::Value* obj);
}; };
/** /**
* A JavaScript number value (ECMA-262, 4.3.20) * A JavaScript number value (ECMA-262, 4.3.20)
*/ */
class V8_EXPORT Number : public Primitive { class V8EXPORT Number : public Primitive {
public: public:
double Value() const; double Value() const;
static Local<Number> New(double value); static Local<Number> New(double value);
static Local<Number> New(Isolate* isolate, double value); static Local<Number> New(Isolate* isolate, double value);
V8_INLINE(static Number* Cast(v8::Value* obj)); V8_INLINE(static Number* Cast(v8::Value* obj));
private: private:
Number(); Number();
static void CheckCast(v8::Value* obj); static void CheckCast(v8::Value* obj);
}; };
/** /**
* A JavaScript value representing a signed integer. * A JavaScript value representing a signed integer.
*/ */
class V8_EXPORT Integer : public Number { class V8EXPORT Integer : public Number {
public: public:
static Local<Integer> New(int32_t value); static Local<Integer> New(int32_t value);
static Local<Integer> NewFromUnsigned(uint32_t value); static Local<Integer> NewFromUnsigned(uint32_t value);
static Local<Integer> New(int32_t value, Isolate*); static Local<Integer> New(int32_t value, Isolate*);
static Local<Integer> NewFromUnsigned(uint32_t value, Isolate*); static Local<Integer> NewFromUnsigned(uint32_t value, Isolate*);
int64_t Value() const; int64_t Value() const;
V8_INLINE(static Integer* Cast(v8::Value* obj)); V8_INLINE(static Integer* Cast(v8::Value* obj));
private: private:
Integer(); Integer();
static void CheckCast(v8::Value* obj); static void CheckCast(v8::Value* obj);
}; };
/** /**
* A JavaScript value representing a 32-bit signed integer. * A JavaScript value representing a 32-bit signed integer.
*/ */
class V8_EXPORT Int32 : public Integer { class V8EXPORT Int32 : public Integer {
public: public:
int32_t Value() const; int32_t Value() const;
private: private:
Int32(); Int32();
}; };
/** /**
* A JavaScript value representing a 32-bit unsigned integer. * A JavaScript value representing a 32-bit unsigned integer.
*/ */
class V8_EXPORT Uint32 : public Integer { class V8EXPORT Uint32 : public Integer {
public: public:
uint32_t Value() const; uint32_t Value() const;
private: private:
Uint32(); Uint32();
}; };
enum PropertyAttribute { enum PropertyAttribute {
None = 0, None = 0,
ReadOnly = 1 << 0, ReadOnly = 1 << 0,
DontEnum = 1 << 1, DontEnum = 1 << 1,
skipping to change at line 2041 skipping to change at line 2014
enum AccessControl { enum AccessControl {
DEFAULT = 0, DEFAULT = 0,
ALL_CAN_READ = 1, ALL_CAN_READ = 1,
ALL_CAN_WRITE = 1 << 1, ALL_CAN_WRITE = 1 << 1,
PROHIBITS_OVERWRITING = 1 << 2 PROHIBITS_OVERWRITING = 1 << 2
}; };
/** /**
* A JavaScript object (ECMA-262, 4.3.3) * A JavaScript object (ECMA-262, 4.3.3)
*/ */
class V8_EXPORT Object : public Value { class V8EXPORT Object : public Value {
public: public:
bool Set(Handle<Value> key, bool Set(Handle<Value> key,
Handle<Value> value, Handle<Value> value,
PropertyAttribute attribs = None); PropertyAttribute attribs = None);
bool Set(uint32_t index, Handle<Value> value); bool Set(uint32_t index, Handle<Value> value);
// Sets a local property on this object bypassing interceptors and // Sets a local property on this object bypassing interceptors and
// overriding accessors or read-only properties. // overriding accessors or read-only properties.
// //
skipping to change at line 2312 skipping to change at line 2285
private: private:
Object(); Object();
static void CheckCast(Value* obj); static void CheckCast(Value* obj);
Local<Value> SlowGetInternalField(int index); Local<Value> SlowGetInternalField(int index);
void* SlowGetAlignedPointerFromInternalField(int index); void* SlowGetAlignedPointerFromInternalField(int index);
}; };
/** /**
* An instance of the built-in array constructor (ECMA-262, 15.4.2). * An instance of the built-in array constructor (ECMA-262, 15.4.2).
*/ */
class V8_EXPORT Array : public Object { class V8EXPORT Array : public Object {
public: public:
uint32_t Length() const; uint32_t Length() const;
/** /**
* Clones an element at index |index|. Returns an empty * Clones an element at index |index|. Returns an empty
* handle if cloning fails (for any reason). * handle if cloning fails (for any reason).
*/ */
Local<Object> CloneElementAt(uint32_t index); Local<Object> CloneElementAt(uint32_t index);
/** /**
skipping to change at line 2337 skipping to change at line 2310
V8_INLINE(static Array* Cast(Value* obj)); V8_INLINE(static Array* Cast(Value* obj));
private: private:
Array(); Array();
static void CheckCast(Value* obj); static void CheckCast(Value* obj);
}; };
/** /**
* A JavaScript function object (ECMA-262, 15.3). * A JavaScript function object (ECMA-262, 15.3).
*/ */
class V8_EXPORT Function : public Object { class V8EXPORT Function : public Object {
public: public:
Local<Object> NewInstance() const; Local<Object> NewInstance() const;
Local<Object> NewInstance(int argc, Handle<Value> argv[]) const; Local<Object> NewInstance(int argc, Handle<Value> argv[]) const;
Local<Value> Call(Handle<Object> recv, int argc, Handle<Value> argv[]); Local<Value> Call(Handle<Object> recv, int argc, Handle<Value> argv[]);
void SetName(Handle<String> name); void SetName(Handle<String> name);
Handle<Value> GetName() const; Handle<Value> GetName() const;
/** /**
* Name inferred from variable or property assignment of this function. * Name inferred from variable or property assignment of this function.
* Used to facilitate debugging and profiling of JavaScript code written * Used to facilitate debugging and profiling of JavaScript code written
skipping to change at line 2393 skipping to change at line 2366
#ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT
// The number of required internal fields can be defined by embedder. // The number of required internal fields can be defined by embedder.
#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 V8_EXPORT ArrayBuffer : public Object { class V8EXPORT ArrayBuffer : public Object {
public: public:
/** /**
* Allocator that V8 uses to allocate |ArrayBuffer|'s memory. * Allocator that V8 uses to allocate |ArrayBuffer|'s memory.
* The allocator is a global V8 setting. It should be set with * The allocator is a global V8 setting. It should be set with
* V8::SetArrayBufferAllocator prior to creation of a first ArrayBuffer. * V8::SetArrayBufferAllocator prior to creation of a first ArrayBuffer.
* *
* This API is experimental and may change significantly. * This API is experimental and may change significantly.
*/ */
class V8_EXPORT Allocator { // NOLINT class V8EXPORT Allocator { // NOLINT
public: public:
virtual ~Allocator() {} virtual ~Allocator() {}
/** /**
* Allocate |length| bytes. Return NULL if allocation is not successful . * Allocate |length| bytes. Return NULL if allocation is not successful .
* Memory should be initialized to zeroes. * Memory should be initialized to zeroes.
*/ */
virtual void* Allocate(size_t length) = 0; virtual void* Allocate(size_t length) = 0;
/** /**
skipping to change at line 2449 skipping to change at line 2422
/** /**
* The contents of an |ArrayBuffer|. Externalization of |ArrayBuffer| * The contents of an |ArrayBuffer|. Externalization of |ArrayBuffer|
* returns an instance of this class, populated, with a pointer to data * returns an instance of this class, populated, with a pointer to data
* and byte length. * and byte length.
* *
* The Data pointer of ArrayBuffer::Contents is always allocated with * The Data pointer of ArrayBuffer::Contents is always allocated with
* Allocator::Allocate that is set with V8::SetArrayBufferAllocator. * Allocator::Allocate that is set with V8::SetArrayBufferAllocator.
* *
* This API is experimental and may change significantly. * This API is experimental and may change significantly.
*/ */
class V8_EXPORT Contents { // NOLINT class V8EXPORT Contents { // NOLINT
public: public:
Contents() : data_(NULL), byte_length_(0) {} Contents() : data_(NULL), byte_length_(0) {}
void* Data() const { return data_; } void* Data() const { return data_; }
size_t ByteLength() const { return byte_length_; } size_t ByteLength() const { return byte_length_; }
private: private:
void* data_; void* data_;
size_t byte_length_; size_t byte_length_;
skipping to change at line 2529 skipping to change at line 2502
// The number of required internal fields can be defined by embedder. // The number of required internal fields can be defined by embedder.
#define V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT 2 #define V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT 2
#endif #endif
/** /**
* A base class for an instance of one of "views" over ArrayBuffer, * A base class for an instance of one of "views" over ArrayBuffer,
* including TypedArrays and DataView (ES6 draft 15.13). * including TypedArrays and DataView (ES6 draft 15.13).
* *
* This API is experimental and may change significantly. * This API is experimental and may change significantly.
*/ */
class V8_EXPORT ArrayBufferView : public Object { class V8EXPORT ArrayBufferView : public Object {
public: public:
/** /**
* Returns underlying ArrayBuffer. * Returns underlying ArrayBuffer.
*/ */
Local<ArrayBuffer> Buffer(); Local<ArrayBuffer> Buffer();
/** /**
* Byte offset in |Buffer|. * Byte offset in |Buffer|.
*/ */
size_t ByteOffset(); size_t ByteOffset();
/** /**
skipping to change at line 2563 skipping to change at line 2536
private: private:
ArrayBufferView(); ArrayBufferView();
static void CheckCast(Value* obj); static void CheckCast(Value* obj);
}; };
/** /**
* A base class for an instance of TypedArray series of constructors * A base class for an instance of TypedArray series of constructors
* (ES6 draft 15.13.6). * (ES6 draft 15.13.6).
* This API is experimental and may change significantly. * This API is experimental and may change significantly.
*/ */
class V8_EXPORT TypedArray : public ArrayBufferView { class V8EXPORT TypedArray : public ArrayBufferView {
public: public:
/** /**
* Number of elements in this typed array * Number of elements in this typed array
* (e.g. for Int16Array, |ByteLength|/2). * (e.g. for Int16Array, |ByteLength|/2).
*/ */
size_t Length(); size_t Length();
V8_INLINE(static TypedArray* Cast(Value* obj)); V8_INLINE(static TypedArray* Cast(Value* obj));
private: private:
TypedArray(); TypedArray();
static void CheckCast(Value* obj); static void CheckCast(Value* obj);
}; };
/** /**
* An instance of Uint8Array constructor (ES6 draft 15.13.6). * An instance of Uint8Array constructor (ES6 draft 15.13.6).
* This API is experimental and may change significantly. * This API is experimental and may change significantly.
*/ */
class V8_EXPORT Uint8Array : public TypedArray { class V8EXPORT Uint8Array : public TypedArray {
public: public:
static Local<Uint8Array> New(Handle<ArrayBuffer> array_buffer, static Local<Uint8Array> New(Handle<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length); size_t byte_offset, size_t length);
V8_INLINE(static Uint8Array* Cast(Value* obj)); V8_INLINE(static Uint8Array* Cast(Value* obj));
private: private:
Uint8Array(); Uint8Array();
static void CheckCast(Value* obj); static void CheckCast(Value* obj);
}; };
/** /**
* An instance of Uint8ClampedArray constructor (ES6 draft 15.13.6). * An instance of Uint8ClampedArray constructor (ES6 draft 15.13.6).
* This API is experimental and may change significantly. * This API is experimental and may change significantly.
*/ */
class V8_EXPORT Uint8ClampedArray : public TypedArray { class V8EXPORT Uint8ClampedArray : public TypedArray {
public: public:
static Local<Uint8ClampedArray> New(Handle<ArrayBuffer> array_buffer, static Local<Uint8ClampedArray> New(Handle<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length); size_t byte_offset, size_t length);
V8_INLINE(static Uint8ClampedArray* Cast(Value* obj)); V8_INLINE(static Uint8ClampedArray* Cast(Value* obj));
private: private:
Uint8ClampedArray(); Uint8ClampedArray();
static void CheckCast(Value* obj); static void CheckCast(Value* obj);
}; };
/** /**
* An instance of Int8Array constructor (ES6 draft 15.13.6). * An instance of Int8Array constructor (ES6 draft 15.13.6).
* This API is experimental and may change significantly. * This API is experimental and may change significantly.
*/ */
class V8_EXPORT Int8Array : public TypedArray { class V8EXPORT Int8Array : public TypedArray {
public: public:
static Local<Int8Array> New(Handle<ArrayBuffer> array_buffer, static Local<Int8Array> New(Handle<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length); size_t byte_offset, size_t length);
V8_INLINE(static Int8Array* Cast(Value* obj)); V8_INLINE(static Int8Array* Cast(Value* obj));
private: private:
Int8Array(); Int8Array();
static void CheckCast(Value* obj); static void CheckCast(Value* obj);
}; };
/** /**
* An instance of Uint16Array constructor (ES6 draft 15.13.6). * An instance of Uint16Array constructor (ES6 draft 15.13.6).
* This API is experimental and may change significantly. * This API is experimental and may change significantly.
*/ */
class V8_EXPORT Uint16Array : public TypedArray { class V8EXPORT Uint16Array : public TypedArray {
public: public:
static Local<Uint16Array> New(Handle<ArrayBuffer> array_buffer, static Local<Uint16Array> New(Handle<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length); size_t byte_offset, size_t length);
V8_INLINE(static Uint16Array* Cast(Value* obj)); V8_INLINE(static Uint16Array* Cast(Value* obj));
private: private:
Uint16Array(); Uint16Array();
static void CheckCast(Value* obj); static void CheckCast(Value* obj);
}; };
/** /**
* An instance of Int16Array constructor (ES6 draft 15.13.6). * An instance of Int16Array constructor (ES6 draft 15.13.6).
* This API is experimental and may change significantly. * This API is experimental and may change significantly.
*/ */
class V8_EXPORT Int16Array : public TypedArray { class V8EXPORT Int16Array : public TypedArray {
public: public:
static Local<Int16Array> New(Handle<ArrayBuffer> array_buffer, static Local<Int16Array> New(Handle<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length); size_t byte_offset, size_t length);
V8_INLINE(static Int16Array* Cast(Value* obj)); V8_INLINE(static Int16Array* Cast(Value* obj));
private: private:
Int16Array(); Int16Array();
static void CheckCast(Value* obj); static void CheckCast(Value* obj);
}; };
/** /**
* An instance of Uint32Array constructor (ES6 draft 15.13.6). * An instance of Uint32Array constructor (ES6 draft 15.13.6).
* This API is experimental and may change significantly. * This API is experimental and may change significantly.
*/ */
class V8_EXPORT Uint32Array : public TypedArray { class V8EXPORT Uint32Array : public TypedArray {
public: public:
static Local<Uint32Array> New(Handle<ArrayBuffer> array_buffer, static Local<Uint32Array> New(Handle<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length); size_t byte_offset, size_t length);
V8_INLINE(static Uint32Array* Cast(Value* obj)); V8_INLINE(static Uint32Array* Cast(Value* obj));
private: private:
Uint32Array(); Uint32Array();
static void CheckCast(Value* obj); static void CheckCast(Value* obj);
}; };
/** /**
* An instance of Int32Array constructor (ES6 draft 15.13.6). * An instance of Int32Array constructor (ES6 draft 15.13.6).
* This API is experimental and may change significantly. * This API is experimental and may change significantly.
*/ */
class V8_EXPORT Int32Array : public TypedArray { class V8EXPORT Int32Array : public TypedArray {
public: public:
static Local<Int32Array> New(Handle<ArrayBuffer> array_buffer, static Local<Int32Array> New(Handle<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length); size_t byte_offset, size_t length);
V8_INLINE(static Int32Array* Cast(Value* obj)); V8_INLINE(static Int32Array* Cast(Value* obj));
private: private:
Int32Array(); Int32Array();
static void CheckCast(Value* obj); static void CheckCast(Value* obj);
}; };
/** /**
* An instance of Float32Array constructor (ES6 draft 15.13.6). * An instance of Float32Array constructor (ES6 draft 15.13.6).
* This API is experimental and may change significantly. * This API is experimental and may change significantly.
*/ */
class V8_EXPORT Float32Array : public TypedArray { class V8EXPORT Float32Array : public TypedArray {
public: public:
static Local<Float32Array> New(Handle<ArrayBuffer> array_buffer, static Local<Float32Array> New(Handle<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length); size_t byte_offset, size_t length);
V8_INLINE(static Float32Array* Cast(Value* obj)); V8_INLINE(static Float32Array* Cast(Value* obj));
private: private:
Float32Array(); Float32Array();
static void CheckCast(Value* obj); static void CheckCast(Value* obj);
}; };
/** /**
* An instance of Float64Array constructor (ES6 draft 15.13.6). * An instance of Float64Array constructor (ES6 draft 15.13.6).
* This API is experimental and may change significantly. * This API is experimental and may change significantly.
*/ */
class V8_EXPORT Float64Array : public TypedArray { class V8EXPORT Float64Array : public TypedArray {
public: public:
static Local<Float64Array> New(Handle<ArrayBuffer> array_buffer, static Local<Float64Array> New(Handle<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length); size_t byte_offset, size_t length);
V8_INLINE(static Float64Array* Cast(Value* obj)); V8_INLINE(static Float64Array* Cast(Value* obj));
private: private:
Float64Array(); Float64Array();
static void CheckCast(Value* obj); static void CheckCast(Value* obj);
}; };
/** /**
* An instance of DataView constructor (ES6 draft 15.13.7). * An instance of DataView constructor (ES6 draft 15.13.7).
* This API is experimental and may change significantly. * This API is experimental and may change significantly.
*/ */
class V8_EXPORT DataView : public ArrayBufferView { class V8EXPORT DataView : public ArrayBufferView {
public: public:
static Local<DataView> New(Handle<ArrayBuffer> array_buffer, static Local<DataView> New(Handle<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length); size_t byte_offset, size_t length);
V8_INLINE(static DataView* Cast(Value* obj)); V8_INLINE(static DataView* Cast(Value* obj));
private: private:
DataView(); DataView();
static void CheckCast(Value* obj); static void CheckCast(Value* obj);
}; };
/** /**
* An instance of the built-in Date constructor (ECMA-262, 15.9). * An instance of the built-in Date constructor (ECMA-262, 15.9).
*/ */
class V8_EXPORT Date : public Object { class V8EXPORT Date : public Object {
public: public:
static Local<Value> New(double time); static Local<Value> New(double time);
// Deprecated, use Date::ValueOf() instead. // Deprecated, use Date::ValueOf() instead.
// TODO(svenpanne) Actually deprecate when Chrome is adapted. // TODO(svenpanne) Actually deprecate when Chrome is adapted.
double NumberValue() const { return ValueOf(); } double NumberValue() const { return ValueOf(); }
/** /**
* A specialization of Value::NumberValue that is more efficient * A specialization of Value::NumberValue that is more efficient
* because we know the structure of this object. * because we know the structure of this object.
skipping to change at line 2768 skipping to change at line 2741
*/ */
static void DateTimeConfigurationChangeNotification(); static void DateTimeConfigurationChangeNotification();
private: private:
static void CheckCast(v8::Value* obj); static void CheckCast(v8::Value* obj);
}; };
/** /**
* A Number object (ECMA-262, 4.3.21). * A Number object (ECMA-262, 4.3.21).
*/ */
class V8_EXPORT NumberObject : public Object { class V8EXPORT NumberObject : public Object {
public: public:
static Local<Value> New(double value); static Local<Value> New(double value);
// Deprecated, use NumberObject::ValueOf() instead. // Deprecated, use NumberObject::ValueOf() instead.
// TODO(svenpanne) Actually deprecate when Chrome is adapted. // TODO(svenpanne) Actually deprecate when Chrome is adapted.
double NumberValue() const { return ValueOf(); } double NumberValue() const { return ValueOf(); }
/** /**
* Returns the Number held by the object. * Returns the Number held by the object.
*/ */
skipping to change at line 2790 skipping to change at line 2763
V8_INLINE(static NumberObject* Cast(v8::Value* obj)); V8_INLINE(static NumberObject* Cast(v8::Value* obj));
private: private:
static void CheckCast(v8::Value* obj); static void CheckCast(v8::Value* obj);
}; };
/** /**
* A Boolean object (ECMA-262, 4.3.15). * A Boolean object (ECMA-262, 4.3.15).
*/ */
class V8_EXPORT BooleanObject : public Object { class V8EXPORT BooleanObject : public Object {
public: public:
static Local<Value> New(bool value); static Local<Value> New(bool value);
// Deprecated, use BooleanObject::ValueOf() instead. // Deprecated, use BooleanObject::ValueOf() instead.
// TODO(svenpanne) Actually deprecate when Chrome is adapted. // TODO(svenpanne) Actually deprecate when Chrome is adapted.
bool BooleanValue() const { return ValueOf(); } bool BooleanValue() const { return ValueOf(); }
/** /**
* Returns the Boolean held by the object. * Returns the Boolean held by the object.
*/ */
skipping to change at line 2812 skipping to change at line 2785
V8_INLINE(static BooleanObject* Cast(v8::Value* obj)); V8_INLINE(static BooleanObject* Cast(v8::Value* obj));
private: private:
static void CheckCast(v8::Value* obj); static void CheckCast(v8::Value* obj);
}; };
/** /**
* A String object (ECMA-262, 4.3.18). * A String object (ECMA-262, 4.3.18).
*/ */
class V8_EXPORT StringObject : public Object { class V8EXPORT StringObject : public Object {
public: public:
static Local<Value> New(Handle<String> value); static Local<Value> New(Handle<String> value);
// Deprecated, use StringObject::ValueOf() instead. // Deprecated, use StringObject::ValueOf() instead.
// TODO(svenpanne) Actually deprecate when Chrome is adapted. // TODO(svenpanne) Actually deprecate when Chrome is adapted.
Local<String> StringValue() const { return ValueOf(); } Local<String> StringValue() const { return ValueOf(); }
/** /**
* Returns the String held by the object. * Returns the String held by the object.
*/ */
skipping to change at line 2836 skipping to change at line 2809
private: private:
static void CheckCast(v8::Value* obj); static void CheckCast(v8::Value* obj);
}; };
/** /**
* A Symbol object (ECMA-262 edition 6). * A Symbol object (ECMA-262 edition 6).
* *
* This is an experimental feature. Use at your own risk. * This is an experimental feature. Use at your own risk.
*/ */
class V8_EXPORT SymbolObject : public Object { class V8EXPORT SymbolObject : public Object {
public: public:
static Local<Value> New(Isolate* isolate, Handle<Symbol> value); static Local<Value> New(Isolate* isolate, Handle<Symbol> value);
// Deprecated, use SymbolObject::ValueOf() instead. // Deprecated, use SymbolObject::ValueOf() instead.
// TODO(svenpanne) Actually deprecate when Chrome is adapted. // TODO(svenpanne) Actually deprecate when Chrome is adapted.
Local<Symbol> SymbolValue() const { return ValueOf(); } Local<Symbol> SymbolValue() const { return ValueOf(); }
/** /**
* Returns the Symbol held by the object. * Returns the Symbol held by the object.
*/ */
skipping to change at line 2858 skipping to change at line 2831
V8_INLINE(static SymbolObject* Cast(v8::Value* obj)); V8_INLINE(static SymbolObject* Cast(v8::Value* obj));
private: private:
static void CheckCast(v8::Value* obj); static void CheckCast(v8::Value* obj);
}; };
/** /**
* An instance of the built-in RegExp constructor (ECMA-262, 15.10). * An instance of the built-in RegExp constructor (ECMA-262, 15.10).
*/ */
class V8_EXPORT RegExp : public Object { class V8EXPORT RegExp : public Object {
public: public:
/** /**
* Regular expression flag bits. They can be or'ed to enable a set * Regular expression flag bits. They can be or'ed to enable a set
* of flags. * of flags.
*/ */
enum Flags { enum Flags {
kNone = 0, kNone = 0,
kGlobal = 1, kGlobal = 1,
kIgnoreCase = 2, kIgnoreCase = 2,
kMultiline = 4 kMultiline = 4
skipping to change at line 2904 skipping to change at line 2877
V8_INLINE(static RegExp* Cast(v8::Value* obj)); V8_INLINE(static RegExp* Cast(v8::Value* obj));
private: private:
static void CheckCast(v8::Value* obj); static void CheckCast(v8::Value* obj);
}; };
/** /**
* A JavaScript value that wraps a C++ void*. This type of value is mainly used * A JavaScript value that wraps a C++ void*. This type of value is mainly used
* to associate C++ data structures with JavaScript objects. * to associate C++ data structures with JavaScript objects.
*/ */
class V8_EXPORT External : public Value { class V8EXPORT External : public Value {
public: public:
static Local<External> New(void* value); static Local<External> New(void* value);
V8_INLINE(static External* Cast(Value* obj)); V8_INLINE(static External* Cast(Value* obj));
void* Value() const; void* Value() const;
private: private:
static void CheckCast(v8::Value* obj); static void CheckCast(v8::Value* obj);
}; };
// --- Templates --- // --- Templates ---
/** /**
* The superclass of object and function templates. * The superclass of object and function templates.
*/ */
class V8_EXPORT Template : public Data { class V8EXPORT Template : public Data {
public: public:
/** Adds a property to each instance created by this template.*/ /** Adds a property to each instance created by this template.*/
void Set(Handle<String> name, Handle<Data> value, void Set(Handle<String> name, Handle<Data> value,
PropertyAttribute attributes = None); PropertyAttribute attributes = None);
V8_INLINE(void Set(const char* name, Handle<Data> value)); V8_INLINE(void Set(const char* name, Handle<Data> value));
private: private:
Template(); Template();
friend class ObjectTemplate; friend class ObjectTemplate;
friend class FunctionTemplate; friend class FunctionTemplate;
skipping to change at line 3003 skipping to change at line 2976
V8_INLINE(FunctionCallbackInfo(internal::Object** implicit_args, V8_INLINE(FunctionCallbackInfo(internal::Object** implicit_args,
internal::Object** values, internal::Object** values,
int length, int length,
bool is_construct_call)); bool is_construct_call));
internal::Object** implicit_args_; internal::Object** implicit_args_;
internal::Object** values_; internal::Object** values_;
int length_; int length_;
bool is_construct_call_; bool is_construct_call_;
}; };
class V8_EXPORT Arguments : public FunctionCallbackInfo<Value> { class V8EXPORT Arguments : public FunctionCallbackInfo<Value> {
private: private:
friend class internal::FunctionCallbackArguments; friend class internal::FunctionCallbackArguments;
V8_INLINE(Arguments(internal::Object** implicit_args, V8_INLINE(Arguments(internal::Object** implicit_args,
internal::Object** values, internal::Object** values,
int length, int length,
bool is_construct_call)); bool is_construct_call));
}; };
/** /**
* The information passed to a property callback about the context * The information passed to a property callback about the context
skipping to change at line 3043 skipping to change at line 3016
static const int kDataIndex = -2; static const int kDataIndex = -2;
static const int kReturnValueIndex = -3; static const int kReturnValueIndex = -3;
static const int kReturnValueDefaultValueIndex = -4; static const int kReturnValueDefaultValueIndex = -4;
static const int kIsolateIndex = -5; static const int kIsolateIndex = -5;
V8_INLINE(PropertyCallbackInfo(internal::Object** args)) V8_INLINE(PropertyCallbackInfo(internal::Object** args))
: args_(args) { } : args_(args) { }
internal::Object** args_; internal::Object** args_;
}; };
class V8_EXPORT AccessorInfo : public PropertyCallbackInfo<Value> { class V8EXPORT AccessorInfo : public PropertyCallbackInfo<Value> {
private: private:
friend class internal::PropertyCallbackArguments; friend class internal::PropertyCallbackArguments;
V8_INLINE(AccessorInfo(internal::Object** args)) V8_INLINE(AccessorInfo(internal::Object** args))
: PropertyCallbackInfo<Value>(args) { } : PropertyCallbackInfo<Value>(args) { }
}; };
typedef Handle<Value> (*InvocationCallback)(const Arguments& args); typedef Handle<Value> (*InvocationCallback)(const Arguments& args);
typedef void (*FunctionCallback)(const FunctionCallbackInfo<Value>& info); typedef void (*FunctionCallback)(const FunctionCallbackInfo<Value>& info);
/** /**
skipping to change at line 3277 skipping to change at line 3250
* *
* The Child function and Child instance will have the following * The Child function and Child instance will have the following
* properties: * properties:
* *
* \code * \code
* child_func.prototype.__proto__ == function.prototype; * child_func.prototype.__proto__ == function.prototype;
* child_instance.instance_accessor calls 'InstanceAccessorCallback' * child_instance.instance_accessor calls 'InstanceAccessorCallback'
* child_instance.instance_property == 3; * child_instance.instance_property == 3;
* \endcode * \endcode
*/ */
class V8_EXPORT FunctionTemplate : public Template { class V8EXPORT FunctionTemplate : public Template {
public: public:
/** Creates a function template.*/ /** Creates a function template.*/
V8_DEPRECATED(static Local<FunctionTemplate> New( V8_DEPRECATED(static Local<FunctionTemplate> New(
InvocationCallback callback, InvocationCallback callback,
Handle<Value> data = Handle<Value>(), Handle<Value> data = Handle<Value>(),
Handle<Signature> signature = Handle<Signature>(), Handle<Signature> signature = Handle<Signature>(),
int length = 0)); int length = 0));
static Local<FunctionTemplate> New( static Local<FunctionTemplate> New(
FunctionCallback callback = 0, FunctionCallback callback = 0,
Handle<Value> data = Handle<Value>(), Handle<Value> data = Handle<Value>(),
skipping to change at line 3367 skipping to change at line 3340
friend class Context; friend class Context;
friend class ObjectTemplate; friend class ObjectTemplate;
}; };
/** /**
* An ObjectTemplate is used to create objects at runtime. * An ObjectTemplate is used to create objects at runtime.
* *
* Properties added to an ObjectTemplate are added to each object * Properties added to an ObjectTemplate are added to each object
* created from the ObjectTemplate. * created from the ObjectTemplate.
*/ */
class V8_EXPORT ObjectTemplate : public Template { class V8EXPORT ObjectTemplate : public Template {
public: public:
/** Creates an ObjectTemplate. */ /** Creates an ObjectTemplate. */
static Local<ObjectTemplate> New(); static Local<ObjectTemplate> New();
/** Creates a new instance of this template.*/ /** Creates a new instance of this template.*/
Local<Object> NewInstance(); Local<Object> NewInstance();
/** /**
* Sets an accessor on the object template. * Sets an accessor on the object template.
* *
skipping to change at line 3552 skipping to change at line 3525
private: private:
ObjectTemplate(); ObjectTemplate();
static Local<ObjectTemplate> New(Handle<FunctionTemplate> constructor); static Local<ObjectTemplate> New(Handle<FunctionTemplate> constructor);
friend class FunctionTemplate; friend class FunctionTemplate;
}; };
/** /**
* A Signature specifies which receivers and arguments are valid * A Signature specifies which receivers and arguments are valid
* parameters to a function. * parameters to a function.
*/ */
class V8_EXPORT Signature : public Data { class V8EXPORT Signature : public Data {
public: public:
static Local<Signature> New(Handle<FunctionTemplate> receiver = static Local<Signature> New(Handle<FunctionTemplate> receiver =
Handle<FunctionTemplate>(), Handle<FunctionTemplate>(),
int argc = 0, int argc = 0,
Handle<FunctionTemplate> argv[] = 0); Handle<FunctionTemplate> argv[] = 0);
private: private:
Signature(); Signature();
}; };
/** /**
* An AccessorSignature specifies which receivers are valid parameters * An AccessorSignature specifies which receivers are valid parameters
* to an accessor callback. * to an accessor callback.
*/ */
class V8_EXPORT AccessorSignature : public Data { class V8EXPORT AccessorSignature : public Data {
public: public:
static Local<AccessorSignature> New(Handle<FunctionTemplate> receiver = static Local<AccessorSignature> New(Handle<FunctionTemplate> receiver =
Handle<FunctionTemplate>()); Handle<FunctionTemplate>());
private: private:
AccessorSignature(); AccessorSignature();
}; };
class V8_EXPORT DeclaredAccessorDescriptor : public Data { class V8EXPORT DeclaredAccessorDescriptor : public Data {
private: private:
DeclaredAccessorDescriptor(); DeclaredAccessorDescriptor();
}; };
class V8_EXPORT ObjectOperationDescriptor : public Data { class V8EXPORT ObjectOperationDescriptor : public Data {
public: public:
// This function is not yet stable and should not be used at this time. // This function is not yet stable and should not be used at this time.
static Local<RawOperationDescriptor> NewInternalFieldDereference( static Local<RawOperationDescriptor> NewInternalFieldDereference(
Isolate* isolate, Isolate* isolate,
int internal_field); int internal_field);
private: private:
ObjectOperationDescriptor(); ObjectOperationDescriptor();
}; };
enum DeclaredAccessorDescriptorDataType { enum DeclaredAccessorDescriptorDataType {
kDescriptorBoolType, kDescriptorBoolType,
kDescriptorInt8Type, kDescriptorUint8Type, kDescriptorInt8Type, kDescriptorUint8Type,
kDescriptorInt16Type, kDescriptorUint16Type, kDescriptorInt16Type, kDescriptorUint16Type,
kDescriptorInt32Type, kDescriptorUint32Type, kDescriptorInt32Type, kDescriptorUint32Type,
kDescriptorFloatType, kDescriptorDoubleType kDescriptorFloatType, kDescriptorDoubleType
}; };
class V8_EXPORT RawOperationDescriptor : public Data { class V8EXPORT RawOperationDescriptor : public Data {
public: public:
Local<DeclaredAccessorDescriptor> NewHandleDereference(Isolate* isolate); Local<DeclaredAccessorDescriptor> NewHandleDereference(Isolate* isolate);
Local<RawOperationDescriptor> NewRawDereference(Isolate* isolate); Local<RawOperationDescriptor> NewRawDereference(Isolate* isolate);
Local<RawOperationDescriptor> NewRawShift(Isolate* isolate, Local<RawOperationDescriptor> NewRawShift(Isolate* isolate,
int16_t byte_offset); int16_t byte_offset);
Local<DeclaredAccessorDescriptor> NewPointerCompare(Isolate* isolate, Local<DeclaredAccessorDescriptor> NewPointerCompare(Isolate* isolate,
void* compare_value); void* compare_value);
Local<DeclaredAccessorDescriptor> NewPrimitiveValue( Local<DeclaredAccessorDescriptor> NewPrimitiveValue(
Isolate* isolate, Isolate* isolate,
DeclaredAccessorDescriptorDataType data_type, DeclaredAccessorDescriptorDataType data_type,
skipping to change at line 3629 skipping to change at line 3602
uint32_t compare_value); uint32_t compare_value);
private: private:
RawOperationDescriptor(); RawOperationDescriptor();
}; };
/** /**
* A utility for determining the type of objects based on the template * A utility for determining the type of objects based on the template
* they were constructed from. * they were constructed from.
*/ */
class V8_EXPORT TypeSwitch : public Data { class V8EXPORT TypeSwitch : public Data {
public: public:
static Local<TypeSwitch> New(Handle<FunctionTemplate> type); static Local<TypeSwitch> New(Handle<FunctionTemplate> type);
static Local<TypeSwitch> New(int argc, Handle<FunctionTemplate> types[]); static Local<TypeSwitch> New(int argc, Handle<FunctionTemplate> types[]);
int match(Handle<Value> value); int match(Handle<Value> value);
private: private:
TypeSwitch(); TypeSwitch();
}; };
// --- Extensions --- // --- Extensions ---
class V8_EXPORT ExternalAsciiStringResourceImpl class V8EXPORT ExternalAsciiStringResourceImpl
: public String::ExternalAsciiStringResource { : public String::ExternalAsciiStringResource {
public: public:
ExternalAsciiStringResourceImpl() : data_(0), length_(0) {} ExternalAsciiStringResourceImpl() : data_(0), length_(0) {}
ExternalAsciiStringResourceImpl(const char* data, size_t length) ExternalAsciiStringResourceImpl(const char* data, size_t length)
: data_(data), length_(length) {} : data_(data), length_(length) {}
const char* data() const { return data_; } const char* data() const { return data_; }
size_t length() const { return length_; } size_t length() const { return length_; }
private: private:
const char* data_; const char* data_;
size_t length_; size_t length_;
}; };
/** /**
* Ignore * Ignore
*/ */
class V8_EXPORT Extension { // NOLINT class V8EXPORT Extension { // NOLINT
public: public:
// Note that the strings passed into this constructor must live as long // Note that the strings passed into this constructor must live as long
// as the Extension itself. // as the Extension itself.
Extension(const char* name, Extension(const char* name,
const char* source = 0, const char* source = 0,
int dep_count = 0, int dep_count = 0,
const char** deps = 0, const char** deps = 0,
int source_length = -1); int source_length = -1);
virtual ~Extension() { } virtual ~Extension() { }
virtual v8::Handle<v8::FunctionTemplate> virtual v8::Handle<v8::FunctionTemplate>
skipping to change at line 3694 skipping to change at line 3667
ExternalAsciiStringResourceImpl source_; ExternalAsciiStringResourceImpl source_;
int dep_count_; int dep_count_;
const char** deps_; const char** deps_;
bool auto_enable_; bool auto_enable_;
// Disallow copying and assigning. // Disallow copying and assigning.
Extension(const Extension&); Extension(const Extension&);
void operator=(const Extension&); void operator=(const Extension&);
}; };
void V8_EXPORT RegisterExtension(Extension* extension); void V8EXPORT RegisterExtension(Extension* extension);
/** /**
* Ignore * Ignore
*/ */
class V8_EXPORT DeclareExtension { class V8EXPORT DeclareExtension {
public: public:
V8_INLINE(DeclareExtension(Extension* extension)) { V8_INLINE(DeclareExtension(Extension* extension)) {
RegisterExtension(extension); RegisterExtension(extension);
} }
}; };
// --- Statics --- // --- Statics ---
Handle<Primitive> V8_EXPORT Undefined(); Handle<Primitive> V8EXPORT Undefined();
Handle<Primitive> V8_EXPORT Null(); Handle<Primitive> V8EXPORT Null();
Handle<Boolean> V8_EXPORT True(); Handle<Boolean> V8EXPORT True();
Handle<Boolean> V8_EXPORT False(); Handle<Boolean> V8EXPORT False();
V8_INLINE(Handle<Primitive> Undefined(Isolate* isolate)); V8_INLINE(Handle<Primitive> Undefined(Isolate* isolate));
V8_INLINE(Handle<Primitive> Null(Isolate* isolate)); V8_INLINE(Handle<Primitive> Null(Isolate* isolate));
V8_INLINE(Handle<Boolean> True(Isolate* isolate)); V8_INLINE(Handle<Boolean> True(Isolate* isolate));
V8_INLINE(Handle<Boolean> False(Isolate* isolate)); V8_INLINE(Handle<Boolean> False(Isolate* isolate));
/** /**
* A set of constraints that specifies the limits of the runtime's memory u se. * A set of constraints that specifies the limits of the runtime's memory u se.
* You must set the heap size before initializing the VM - the size cannot be * You must set the heap size before initializing the VM - the size cannot be
* adjusted after the VM is initialized. * adjusted after the VM is initialized.
* *
* If you are using threads then you should hold the V8::Locker lock while * If you are using threads then you should hold the V8::Locker lock while
* setting the stack limit and you must set a non-default stack limit separ ately * setting the stack limit and you must set a non-default stack limit separ ately
* for each thread. * for each thread.
*/ */
class V8_EXPORT ResourceConstraints { class V8EXPORT ResourceConstraints {
public: public:
ResourceConstraints(); ResourceConstraints();
int max_young_space_size() const { return max_young_space_size_; } int max_young_space_size() const { return max_young_space_size_; }
void set_max_young_space_size(int value) { max_young_space_size_ = value; } void set_max_young_space_size(int value) { max_young_space_size_ = value; }
int max_old_space_size() const { return max_old_space_size_; } int max_old_space_size() const { return max_old_space_size_; }
void set_max_old_space_size(int value) { max_old_space_size_ = value; } void set_max_old_space_size(int value) { max_old_space_size_ = value; }
int max_executable_size() { return max_executable_size_; } int max_executable_size() { return max_executable_size_; }
void set_max_executable_size(int value) { max_executable_size_ = value; } void set_max_executable_size(int value) { max_executable_size_ = value; }
uint32_t* stack_limit() const { return stack_limit_; } uint32_t* stack_limit() const { return stack_limit_; }
// Sets an address beyond which the VM's stack may not grow. // Sets an address beyond which the VM's stack may not grow.
void set_stack_limit(uint32_t* value) { stack_limit_ = value; } void set_stack_limit(uint32_t* value) { stack_limit_ = value; }
private: private:
int max_young_space_size_; int max_young_space_size_;
int max_old_space_size_; int max_old_space_size_;
int max_executable_size_; int max_executable_size_;
uint32_t* stack_limit_; uint32_t* stack_limit_;
}; };
bool V8_EXPORT SetResourceConstraints(ResourceConstraints* constraints); bool V8EXPORT SetResourceConstraints(ResourceConstraints* constraints);
// --- Exceptions --- // --- Exceptions ---
typedef void (*FatalErrorCallback)(const char* location, const char* messag e); typedef void (*FatalErrorCallback)(const char* location, const char* messag e);
typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> erro r); typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> erro r);
/** /**
* Schedules an exception to be thrown when returning to JavaScript. When an * Schedules an exception to be thrown when returning to JavaScript. When an
* exception has been scheduled it is illegal to invoke any JavaScript * exception has been scheduled it is illegal to invoke any JavaScript
* operation; the caller must return immediately and only after the excepti on * operation; the caller must return immediately and only after the excepti on
* has been handled does it become legal to invoke JavaScript operations. * has been handled does it become legal to invoke JavaScript operations.
*/ */
Handle<Value> V8_EXPORT ThrowException(Handle<Value> exception); Handle<Value> V8EXPORT ThrowException(Handle<Value> exception);
/** /**
* Create new error objects by calling the corresponding error object * Create new error objects by calling the corresponding error object
* constructor with the message. * constructor with the message.
*/ */
class V8_EXPORT Exception { class V8EXPORT Exception {
public: public:
static Local<Value> RangeError(Handle<String> message); static Local<Value> RangeError(Handle<String> message);
static Local<Value> ReferenceError(Handle<String> message); static Local<Value> ReferenceError(Handle<String> message);
static Local<Value> SyntaxError(Handle<String> message); static Local<Value> SyntaxError(Handle<String> message);
static Local<Value> TypeError(Handle<String> message); static Local<Value> TypeError(Handle<String> message);
static Local<Value> Error(Handle<String> message); static Local<Value> Error(Handle<String> message);
}; };
// --- Counters Callbacks --- // --- Counters Callbacks ---
skipping to change at line 3858 skipping to change at line 3831
typedef void (*GCEpilogueCallback)(GCType type, GCCallbackFlags flags); typedef void (*GCEpilogueCallback)(GCType type, GCCallbackFlags flags);
typedef void (*GCCallback)(); typedef void (*GCCallback)();
/** /**
* Collection of V8 heap information. * Collection of V8 heap information.
* *
* Instances of this class can be passed to v8::V8::HeapStatistics to * Instances of this class can be passed to v8::V8::HeapStatistics to
* get heap statistics from V8. * get heap statistics from V8.
*/ */
class V8_EXPORT HeapStatistics { class V8EXPORT HeapStatistics {
public: public:
HeapStatistics(); HeapStatistics();
size_t total_heap_size() { return total_heap_size_; } size_t total_heap_size() { return total_heap_size_; }
size_t total_heap_size_executable() { return total_heap_size_executable_; } size_t total_heap_size_executable() { return total_heap_size_executable_; }
size_t total_physical_size() { return total_physical_size_; } size_t total_physical_size() { return total_physical_size_; }
size_t used_heap_size() { return used_heap_size_; } size_t used_heap_size() { return used_heap_size_; }
size_t heap_size_limit() { return heap_size_limit_; } size_t heap_size_limit() { return heap_size_limit_; }
private: private:
size_t total_heap_size_; size_t total_heap_size_;
skipping to change at line 3889 skipping to change at line 3862
/** /**
* Isolate represents an isolated instance of the V8 engine. V8 * Isolate represents an isolated instance of the V8 engine. V8
* isolates have completely separate states. Objects from one isolate * isolates have completely separate states. Objects from one isolate
* must not be used in other isolates. When V8 is initialized a * must not be used in other isolates. When V8 is initialized a
* default isolate is implicitly created and entered. The embedder * default isolate is implicitly created and entered. The embedder
* can create additional isolates and use them in parallel in multiple * can create additional isolates and use them in parallel in multiple
* threads. An isolate can be entered by at most one thread at any * threads. An isolate can be entered by at most one thread at any
* given time. The Locker/Unlocker API must be used to synchronize. * given time. The Locker/Unlocker API must be used to synchronize.
*/ */
class V8_EXPORT Isolate { class V8EXPORT Isolate {
public: public:
/** /**
* Stack-allocated class which sets the isolate for all operations * Stack-allocated class which sets the isolate for all operations
* executed within a local scope. * executed within a local scope.
*/ */
class V8_EXPORT Scope { class V8EXPORT Scope {
public: public:
explicit Scope(Isolate* isolate) : isolate_(isolate) { explicit Scope(Isolate* isolate) : isolate_(isolate) {
isolate->Enter(); isolate->Enter();
} }
~Scope() { isolate_->Exit(); } ~Scope() { isolate_->Exit(); }
private: private:
Isolate* const isolate_; Isolate* const isolate_;
skipping to change at line 4042 skipping to change at line 4015
private: private:
Isolate(); Isolate();
Isolate(const Isolate&); Isolate(const Isolate&);
~Isolate(); ~Isolate();
Isolate& operator=(const Isolate&); Isolate& operator=(const Isolate&);
void* operator new(size_t size); void* operator new(size_t size);
void operator delete(void*, size_t); void operator delete(void*, size_t);
}; };
class V8_EXPORT StartupData { class V8EXPORT StartupData {
public: public:
enum CompressionAlgorithm { enum CompressionAlgorithm {
kUncompressed, kUncompressed,
kBZip2 kBZip2
}; };
const char* data; const char* data;
int compressed_size; int compressed_size;
int raw_size; int raw_size;
}; };
/** /**
* A helper class for driving V8 startup data decompression. It is based o n * A helper class for driving V8 startup data decompression. It is based o n
* "CompressedStartupData" API functions from the V8 class. It isn't manda tory * "CompressedStartupData" API functions from the V8 class. It isn't manda tory
* for an embedder to use this class, instead, API functions can be used * for an embedder to use this class, instead, API functions can be used
* directly. * directly.
* *
* For an example of the class usage, see the "shell.cc" sample application . * For an example of the class usage, see the "shell.cc" sample application .
*/ */
class V8_EXPORT StartupDataDecompressor { // NOLINT class V8EXPORT StartupDataDecompressor { // NOLINT
public: public:
StartupDataDecompressor(); StartupDataDecompressor();
virtual ~StartupDataDecompressor(); virtual ~StartupDataDecompressor();
int Decompress(); int Decompress();
protected: protected:
virtual int DecompressData(char* raw_data, virtual int DecompressData(char* raw_data,
int* raw_data_size, int* raw_data_size,
const char* compressed_data, const char* compressed_data,
int compressed_data_size) = 0; int compressed_data_size) = 0;
skipping to change at line 4200 skipping to change at line 4173
/** /**
* Callback function passed to SetJitCodeEventHandler. * Callback function passed to SetJitCodeEventHandler.
* *
* \param event code add, move or removal event. * \param event code add, move or removal event.
*/ */
typedef void (*JitCodeEventHandler)(const JitCodeEvent* event); typedef void (*JitCodeEventHandler)(const JitCodeEvent* event);
/** /**
* Interface for iterating through all external resources in the heap. * Interface for iterating through all external resources in the heap.
*/ */
class V8_EXPORT ExternalResourceVisitor { // NOLINT class V8EXPORT ExternalResourceVisitor { // NOLINT
public: public:
virtual ~ExternalResourceVisitor() {} virtual ~ExternalResourceVisitor() {}
virtual void VisitExternalString(Handle<String> string) {} virtual void VisitExternalString(Handle<String> string) {}
}; };
/** /**
* Interface for iterating through all the persistent handles in the heap. * Interface for iterating through all the persistent handles in the heap.
*/ */
class V8_EXPORT PersistentHandleVisitor { // NOLINT class V8EXPORT PersistentHandleVisitor { // NOLINT
public: public:
virtual ~PersistentHandleVisitor() {} virtual ~PersistentHandleVisitor() {}
virtual void VisitPersistentHandle(Persistent<Value>* value, virtual void VisitPersistentHandle(Persistent<Value>* value,
uint16_t class_id) {} uint16_t class_id) {}
}; };
/** /**
* Asserts that no action is performed that could cause a handle's value * Asserts that no action is performed that could cause a handle's value
* to be modified. Useful when otherwise unsafe handle operations need to * to be modified. Useful when otherwise unsafe handle operations need to
* be performed. * be performed.
*/ */
class V8_EXPORT AssertNoGCScope { class V8EXPORT AssertNoGCScope {
#ifndef DEBUG #ifndef DEBUG
// TODO(yangguo): remove isolate argument. // TODO(yangguo): remove isolate argument.
V8_INLINE(AssertNoGCScope(Isolate* isolate)) { } V8_INLINE(AssertNoGCScope(Isolate* isolate)) { }
#else #else
AssertNoGCScope(Isolate* isolate); AssertNoGCScope(Isolate* isolate);
~AssertNoGCScope(); ~AssertNoGCScope();
private: private:
void* disallow_heap_allocation_; void* disallow_heap_allocation_;
#endif #endif
}; };
/** /**
* Container class for static utility functions. * Container class for static utility functions.
*/ */
class V8_EXPORT V8 { class V8EXPORT V8 {
public: public:
/** Set the callback to invoke in case of fatal errors. */ /** Set the callback to invoke in case of fatal errors. */
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);
skipping to change at line 4693 skipping to change at line 4666
V8(); V8();
static internal::Object** GlobalizeReference(internal::Isolate* isolate, static internal::Object** GlobalizeReference(internal::Isolate* isolate,
internal::Object** handle); internal::Object** handle);
static void DisposeGlobal(internal::Object** global_handle); static void DisposeGlobal(internal::Object** global_handle);
typedef WeakReferenceCallbacks<Value, void>::Revivable RevivableCallback; typedef WeakReferenceCallbacks<Value, void>::Revivable RevivableCallback;
static void MakeWeak(internal::Object** global_handle, static void MakeWeak(internal::Object** global_handle,
void* data, void* data,
RevivableCallback weak_reference_callback); RevivableCallback weak_reference_callback);
static void ClearWeak(internal::Object** global_handle); static void ClearWeak(internal::Object** global_handle);
static int Eternalize(internal::Isolate* isolate,
internal::Object** handle);
static internal::Object** GetEternal(internal::Isolate* isolate, int inde
x);
template <class T> friend class Handle; template <class T> friend class Handle;
template <class T> friend class Local; template <class T> friend class Local;
template <class T> friend class Persistent; template <class T> friend class Persistent;
friend class Context; friend class Context;
}; };
/** /**
* An external exception handler. * An external exception handler.
*/ */
class V8_EXPORT TryCatch { class V8EXPORT TryCatch {
public: public:
/** /**
* Creates a new try/catch block and registers it with v8. Note that * Creates a new try/catch block and registers it with v8. Note that
* all TryCatch blocks should be stack allocated because the memory * all TryCatch blocks should be stack allocated because the memory
* location itself is compared against JavaScript try/catch blocks. * location itself is compared against JavaScript try/catch blocks.
*/ */
TryCatch(); TryCatch();
/** /**
* Unregisters and deletes this try/catch block. * Unregisters and deletes this try/catch block.
skipping to change at line 4837 skipping to change at line 4807
bool has_terminated_ : 1; bool has_terminated_ : 1;
friend class v8::internal::Isolate; friend class v8::internal::Isolate;
}; };
// --- Context --- // --- Context ---
/** /**
* Ignore * Ignore
*/ */
class V8_EXPORT ExtensionConfiguration { class V8EXPORT ExtensionConfiguration {
public: public:
ExtensionConfiguration(int name_count, const char* names[]) ExtensionConfiguration(int name_count, const char* names[])
: name_count_(name_count), names_(names) { } : name_count_(name_count), names_(names) { }
private: private:
friend class ImplementationUtilities; friend class ImplementationUtilities;
int name_count_; int name_count_;
const char** names_; const char** names_;
}; };
/** /**
* A sandboxed execution context with its own set of built-in objects * A sandboxed execution context with its own set of built-in objects
* and functions. * and functions.
*/ */
class V8_EXPORT Context { class V8EXPORT Context {
public: public:
/** /**
* Returns the global proxy object or global object itself for * Returns the global proxy object or global object itself for
* detached contexts. * detached contexts.
* *
* Global proxy object is a thin wrapper whose prototype points to * Global proxy object is a thin wrapper whose prototype points to
* actual context's global object with the properties like Object, etc. * actual context's global object with the properties like Object, etc.
* This is done that way for security reasons (for more details see * This is done that way for security reasons (for more details see
* https://wiki.mozilla.org/Gecko:SplitWindow). * https://wiki.mozilla.org/Gecko:SplitWindow).
* *
skipping to change at line 5135 skipping to change at line 5105
* // V8 not locked. * // V8 not locked.
* } * }
* isolate->Enter(); * isolate->Enter();
* // V8 locked again (2 levels). * // V8 locked again (2 levels).
* } * }
* // V8 still locked (1 level). * // V8 still locked (1 level).
* } * }
* // V8 Now no longer locked. * // V8 Now no longer locked.
* \endcode * \endcode
*/ */
class V8_EXPORT Unlocker { class V8EXPORT Unlocker {
public: public:
/** /**
* Initialize Unlocker for a given Isolate. * Initialize Unlocker for a given Isolate.
*/ */
V8_INLINE(explicit Unlocker(Isolate* isolate)) { Initialize(isolate); } V8_INLINE(explicit Unlocker(Isolate* isolate)) { Initialize(isolate); }
/** Deprecated. Use Isolate version instead. */ /** Deprecated. Use Isolate version instead. */
V8_DEPRECATED(Unlocker()); V8_DEPRECATED(Unlocker());
~Unlocker(); ~Unlocker();
private: private:
void Initialize(Isolate* isolate); void Initialize(Isolate* isolate);
internal::Isolate* isolate_; internal::Isolate* isolate_;
}; };
class V8_EXPORT Locker { class V8EXPORT Locker {
public: public:
/** /**
* Initialize Locker for a given Isolate. * Initialize Locker for a given Isolate.
*/ */
V8_INLINE(explicit Locker(Isolate* isolate)) { Initialize(isolate); } V8_INLINE(explicit Locker(Isolate* isolate)) { Initialize(isolate); }
/** Deprecated. Use Isolate version instead. */ /** Deprecated. Use Isolate version instead. */
V8_DEPRECATED(Locker()); V8_DEPRECATED(Locker());
~Locker(); ~Locker();
skipping to change at line 5211 skipping to change at line 5181
}; };
/** /**
* A struct for exporting HeapStats data from V8, using "push" model. * A struct for exporting HeapStats data from V8, using "push" model.
*/ */
struct HeapStatsUpdate; struct HeapStatsUpdate;
/** /**
* An interface for exporting data from V8, using "push" model. * An interface for exporting data from V8, using "push" model.
*/ */
class V8_EXPORT OutputStream { // NOLINT class V8EXPORT OutputStream { // NOLINT
public: public:
enum OutputEncoding { enum OutputEncoding {
kAscii = 0 // 7-bit ASCII. kAscii = 0 // 7-bit ASCII.
}; };
enum WriteResult { enum WriteResult {
kContinue = 0, kContinue = 0,
kAbort = 1 kAbort = 1
}; };
virtual ~OutputStream() {} virtual ~OutputStream() {}
/** Notify about the end of stream. */ /** Notify about the end of stream. */
skipping to change at line 5247 skipping to change at line 5217
*/ */
virtual WriteResult WriteHeapStatsChunk(HeapStatsUpdate* data, int count) { virtual WriteResult WriteHeapStatsChunk(HeapStatsUpdate* data, int count) {
return kAbort; return kAbort;
}; };
}; };
/** /**
* An interface for reporting progress and controlling long-running * An interface for reporting progress and controlling long-running
* activities. * activities.
*/ */
class V8_EXPORT ActivityControl { // NOLINT class V8EXPORT ActivityControl { // NOLINT
public: public:
enum ControlOption { enum ControlOption {
kContinue = 0, kContinue = 0,
kAbort = 1 kAbort = 1
}; };
virtual ~ActivityControl() {} virtual ~ActivityControl() {}
/** /**
* Notify about current progress. The activity can be stopped by * Notify about current progress. The activity can be stopped by
* returning kAbort as the callback result. * returning kAbort as the callback result.
*/ */
skipping to change at line 5368 skipping to change at line 5338
static const int kStringEncodingMask = 0x4; static const int kStringEncodingMask = 0x4;
static const int kExternalTwoByteRepresentationTag = 0x02; static const int kExternalTwoByteRepresentationTag = 0x02;
static const int kExternalAsciiRepresentationTag = 0x06; static const int kExternalAsciiRepresentationTag = 0x06;
static const int kIsolateEmbedderDataOffset = 1 * kApiPointerSize; static const int kIsolateEmbedderDataOffset = 1 * kApiPointerSize;
static const int kIsolateRootsOffset = 3 * kApiPointerSize; static const int kIsolateRootsOffset = 3 * kApiPointerSize;
static const int kUndefinedValueRootIndex = 5; static const int kUndefinedValueRootIndex = 5;
static const int kNullValueRootIndex = 7; static const int kNullValueRootIndex = 7;
static const int kTrueValueRootIndex = 8; static const int kTrueValueRootIndex = 8;
static const int kFalseValueRootIndex = 9; static const int kFalseValueRootIndex = 9;
static const int kEmptyStringRootIndex = 133; static const int kEmptyStringRootIndex = 135;
static const int kNodeClassIdOffset = 1 * kApiPointerSize; static const int kNodeClassIdOffset = 1 * kApiPointerSize;
static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3;
static const int kNodeStateMask = 0xf; static const int kNodeStateMask = 0xf;
static const int kNodeStateIsWeakValue = 2; static const int kNodeStateIsWeakValue = 2;
static const int kNodeStateIsPendingValue = 3;
static const int kNodeStateIsNearDeathValue = 4; static const int kNodeStateIsNearDeathValue = 4;
static const int kNodeIsIndependentShift = 4; static const int kNodeIsIndependentShift = 4;
static const int kNodeIsPartiallyDependentShift = 5; static const int kNodeIsPartiallyDependentShift = 5;
static const int kJSObjectType = 0xb1; static const int kJSObjectType = 0xb1;
static const int kFirstNonstringType = 0x80; static const int kFirstNonstringType = 0x80;
static const int kOddballType = 0x83; static const int kOddballType = 0x83;
static const int kForeignType = 0x87; static const int kForeignType = 0x87;
static const int kUndefinedOddballKind = 5; static const int kUndefinedOddballKind = 5;
skipping to change at line 5429 skipping to change at line 5398
return SmiValue(ReadField<O*>(obj, kOddballKindOffset)); return SmiValue(ReadField<O*>(obj, kOddballKindOffset));
} }
V8_INLINE(static bool IsExternalTwoByteString(int instance_type)) { V8_INLINE(static bool IsExternalTwoByteString(int instance_type)) {
int representation = (instance_type & kFullStringRepresentationMask); int representation = (instance_type & kFullStringRepresentationMask);
return representation == kExternalTwoByteRepresentationTag; return representation == kExternalTwoByteRepresentationTag;
} }
V8_INLINE(static uint8_t GetNodeFlag(internal::Object** obj, int shift)) { V8_INLINE(static uint8_t GetNodeFlag(internal::Object** obj, int shift)) {
uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
return *addr & static_cast<uint8_t>(1U << shift); return *addr & (1 << shift);
} }
V8_INLINE(static void UpdateNodeFlag(internal::Object** obj, V8_INLINE(static void UpdateNodeFlag(internal::Object** obj,
bool value, int shift)) { bool value, int shift)) {
uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
uint8_t mask = static_cast<uint8_t>(1 << shift); uint8_t mask = 1 << shift;
*addr = static_cast<uint8_t>((*addr & ~mask) | (value << shift)); *addr = (*addr & ~mask) | (value << shift);
} }
V8_INLINE(static uint8_t GetNodeState(internal::Object** obj)) { V8_INLINE(static uint8_t GetNodeState(internal::Object** obj)) {
uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
return *addr & kNodeStateMask; return *addr & kNodeStateMask;
} }
V8_INLINE(static void UpdateNodeState(internal::Object** obj, V8_INLINE(static void UpdateNodeState(internal::Object** obj,
uint8_t value)) { uint8_t value)) {
uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
*addr = static_cast<uint8_t>((*addr & ~kNodeStateMask) | value); *addr = (*addr & ~kNodeStateMask) | value;
} }
V8_INLINE(static void SetEmbedderData(v8::Isolate* isolate, void* data)) { V8_INLINE(static void SetEmbedderData(v8::Isolate* isolate, void* data)) {
uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) +
kIsolateEmbedderDataOffset; kIsolateEmbedderDataOffset;
*reinterpret_cast<void**>(addr) = data; *reinterpret_cast<void**>(addr) = data;
} }
V8_INLINE(static void* GetEmbedderData(v8::Isolate* isolate)) { V8_INLINE(static void* GetEmbedderData(v8::Isolate* isolate)) {
uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) +
skipping to change at line 5543 skipping to change at line 5512
template <class T> template <class T>
Local<T> Local<T>::New(Isolate* isolate, T* that) { Local<T> Local<T>::New(Isolate* isolate, T* that) {
if (that == NULL) return Local<T>(); if (that == NULL) return Local<T>();
T* that_ptr = that; T* that_ptr = that;
internal::Object** p = reinterpret_cast<internal::Object**>(that_ptr); internal::Object** p = reinterpret_cast<internal::Object**>(that_ptr);
return Local<T>(reinterpret_cast<T*>(HandleScope::CreateHandle( return Local<T>(reinterpret_cast<T*>(HandleScope::CreateHandle(
reinterpret_cast<internal::Isolate*>(isolate), *p))); reinterpret_cast<internal::Isolate*>(isolate), *p)));
} }
template<class T>
int Local<T>::Eternalize(Isolate* isolate) {
return V8::Eternalize(reinterpret_cast<internal::Isolate*>(isolate),
reinterpret_cast<internal::Object**>(this->val_));
}
template<class T>
Local<T> Local<T>::GetEternal(Isolate* isolate, int index) {
internal::Object** handle =
V8::GetEternal(reinterpret_cast<internal::Isolate*>(isolate), index);
return Local<T>(T::Cast(reinterpret_cast<Value*>(handle)));
}
#ifdef V8_USE_UNSAFE_HANDLES #ifdef V8_USE_UNSAFE_HANDLES
template <class T> template <class T>
Persistent<T> Persistent<T>::New(Handle<T> that) { Persistent<T> Persistent<T>::New(Handle<T> that) {
return New(Isolate::GetCurrent(), that.val_); return New(Isolate::GetCurrent(), that.val_);
} }
template <class T> template <class T>
Persistent<T> Persistent<T>::New(Isolate* isolate, Handle<T> that) { Persistent<T> Persistent<T>::New(Isolate* isolate, Handle<T> that) {
return New(Isolate::GetCurrent(), that.val_); return New(Isolate::GetCurrent(), that.val_);
} }
skipping to change at line 5594 skipping to change at line 5550
typedef internal::Internals I; typedef internal::Internals I;
if (this->IsEmpty()) return false; if (this->IsEmpty()) return false;
return I::GetNodeFlag(reinterpret_cast<internal::Object**>(this->val_), return I::GetNodeFlag(reinterpret_cast<internal::Object**>(this->val_),
I::kNodeIsIndependentShift); I::kNodeIsIndependentShift);
} }
template <class T> template <class T>
bool Persistent<T>::IsNearDeath() const { bool Persistent<T>::IsNearDeath() const {
typedef internal::Internals I; typedef internal::Internals I;
if (this->IsEmpty()) return false; if (this->IsEmpty()) return false;
uint8_t node_state = return I::GetNodeState(reinterpret_cast<internal::Object**>(this->val_))
I::GetNodeState(reinterpret_cast<internal::Object**>(this->val_)); ==
return node_state == I::kNodeStateIsNearDeathValue || I::kNodeStateIsNearDeathValue;
node_state == I::kNodeStateIsPendingValue;
} }
template <class T> template <class T>
bool Persistent<T>::IsWeak() const { bool Persistent<T>::IsWeak() const {
typedef internal::Internals I; typedef internal::Internals I;
if (this->IsEmpty()) return false; if (this->IsEmpty()) return false;
return I::GetNodeState(reinterpret_cast<internal::Object**>(this->val_)) == return I::GetNodeState(reinterpret_cast<internal::Object**>(this->val_)) ==
I::kNodeStateIsWeakValue; I::kNodeStateIsWeakValue;
} }
skipping to change at line 5786 skipping to change at line 5740
return; return;
} }
Set(Integer::New(i, GetIsolate())); Set(Integer::New(i, GetIsolate()));
} }
template<typename T> template<typename T>
void ReturnValue<T>::Set(uint32_t i) { void ReturnValue<T>::Set(uint32_t i) {
TYPE_CHECK(T, Integer); TYPE_CHECK(T, Integer);
typedef internal::Internals I; typedef internal::Internals I;
// Can't simply use INT32_MAX here for whatever reason. // Can't simply use INT32_MAX here for whatever reason.
bool fits_into_int32_t = (i & (1U << 31)) == 0; bool fits_into_int32_t = (i & (1 << 31)) == 0;
if (V8_LIKELY(fits_into_int32_t)) { if (V8_LIKELY(fits_into_int32_t)) {
Set(static_cast<int32_t>(i)); Set(static_cast<int32_t>(i));
return; return;
} }
Set(Integer::NewFromUnsigned(i, GetIsolate())); Set(Integer::NewFromUnsigned(i, GetIsolate()));
} }
template<typename T> template<typename T>
void ReturnValue<T>::Set(bool value) { void ReturnValue<T>::Set(bool value) {
TYPE_CHECK(T, Boolean); TYPE_CHECK(T, Boolean);
skipping to change at line 6374 skipping to change at line 6328
* A simple shell that takes a list of expressions on the * A simple shell that takes a list of expressions on the
* command-line and executes them. * command-line and executes them.
*/ */
/** /**
* \example process.cc * \example process.cc
*/ */
} // namespace v8 } // namespace v8
#undef V8EXPORT
#undef TYPE_CHECK #undef TYPE_CHECK
#endif // V8_H_ #endif // V8_H_
 End of changes. 104 change blocks. 
148 lines changed or deleted 103 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/