Skip to content

Commit

Permalink
Upgrade V8 to 2.2.18
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Jun 16, 2010
1 parent 187f191 commit 1c6671a
Show file tree
Hide file tree
Showing 48 changed files with 2,475 additions and 729 deletions.
14 changes: 14 additions & 0 deletions deps/v8/ChangeLog
@@ -1,3 +1,17 @@
2010-06-16: Version 2.2.18

Added API functions to retrieve information on indexed properties
managed by the embedding layer. Fixes bug 737.

Make ES5 Object.defineProperty support array elements. Fixes bug 619.

Add heap profiling to the API.

Remove old named property query from the API.

Incremental performance improvements.


2010-06-14: Version 2.2.17

Improved debugger support for stepping out of functions.
Expand Down
139 changes: 139 additions & 0 deletions deps/v8/include/v8-profiler.h
Expand Up @@ -184,6 +184,145 @@ class V8EXPORT CpuProfiler {
};


class HeapGraphNode;


/**
* HeapSnapshotEdge represents a directed connection between heap
* graph nodes: from retaners to retained nodes.
*/
class V8EXPORT HeapGraphEdge {
public:
enum Type {
CONTEXT_VARIABLE = 0, // A variable from a function context.
ELEMENT = 1, // An element of an array.
PROPERTY = 2 // A named object property.
};

/** Returns edge type (see HeapGraphEdge::Type). */
Type GetType() const;

/**
* Returns edge name. This can be a variable name, an element index, or
* a property name.
*/
Handle<Value> GetName() const;

/** Returns origin node. */
const HeapGraphNode* GetFromNode() const;

/** Returns destination node. */
const HeapGraphNode* GetToNode() const;
};


class V8EXPORT HeapGraphPath {
public:
/** Returns the number of edges in the path. */
int GetEdgesCount() const;

/** Returns an edge from the path. */
const HeapGraphEdge* GetEdge(int index) const;

/** Returns origin node. */
const HeapGraphNode* GetFromNode() const;

/** Returns destination node. */
const HeapGraphNode* GetToNode() const;
};


/**
* HeapGraphNode represents a node in a heap graph.
*/
class V8EXPORT HeapGraphNode {
public:
enum Type {
INTERNAL = 0, // Internal node, a virtual one, for housekeeping.
ARRAY = 1, // An array of elements.
STRING = 2, // A string.
OBJECT = 3, // A JS object (except for arrays and strings).
CODE = 4, // Compiled code.
CLOSURE = 5 // Function closure.
};

/** Returns node type (see HeapGraphNode::Type). */
Type GetType() const;

/**
* Returns node name. Depending on node's type this can be the name
* of the constructor (for objects), the name of the function (for
* closures), string value, or an empty string (for compiled code).
*/
Handle<String> GetName() const;

/** Returns node's own size, in bytes. */
int GetSelfSize() const;

/** Returns node's network (self + reachable nodes) size, in bytes. */
int GetTotalSize() const;

/**
* Returns node's private size, in bytes. That is, the size of memory
* that will be reclaimed having this node collected.
*/
int GetPrivateSize() const;

/** Returns child nodes count of the node. */
int GetChildrenCount() const;

/** Retrieves a child by index. */
const HeapGraphEdge* GetChild(int index) const;

/** Returns retainer nodes count of the node. */
int GetRetainersCount() const;

/** Returns a retainer by index. */
const HeapGraphEdge* GetRetainer(int index) const;

/** Returns the number of simple retaining paths from the root to the node. */
int GetRetainingPathsCount() const;

/** Returns a retaining path by index. */
const HeapGraphPath* GetRetainingPath(int index) const;
};


/**
* HeapSnapshots record the state of the JS heap at some moment.
*/
class V8EXPORT HeapSnapshot {
public:
/** Returns heap snapshot UID (assigned by the profiler.) */
unsigned GetUid() const;

/** Returns heap snapshot title. */
Handle<String> GetTitle() const;

/** Returns the root node of the heap graph. */
const HeapGraphNode* GetHead() const;
};


/**
* Interface for controlling heap profiling.
*/
class V8EXPORT HeapProfiler {
public:
/** Returns the number of snapshots taken. */
static int GetSnapshotsCount();

/** Returns a snapshot by index. */
static const HeapSnapshot* GetSnapshot(int index);

/** Returns a profile by uid. */
static const HeapSnapshot* FindSnapshot(unsigned uid);

/** Takes a heap snapshot and returns it. Title may be an empty string. */
static const HeapSnapshot* TakeSnapshot(Handle<String> title);
};


} // namespace v8


Expand Down
62 changes: 13 additions & 49 deletions deps/v8/include/v8.h
Expand Up @@ -1570,6 +1570,9 @@ class V8EXPORT Object : public Value {
* the backing store is preserved while V8 has a reference.
*/
void SetIndexedPropertiesToPixelData(uint8_t* data, int length);
bool HasIndexedPropertiesInPixelData();
uint8_t* GetIndexedPropertiesPixelData();
int GetIndexedPropertiesPixelDataLength();

/**
* Set the backing store of the indexed properties to be managed by the
Expand All @@ -1581,6 +1584,10 @@ class V8EXPORT Object : public Value {
void SetIndexedPropertiesToExternalArrayData(void* data,
ExternalArrayType array_type,
int number_of_elements);
bool HasIndexedPropertiesInExternalArrayData();
void* GetIndexedPropertiesExternalArrayData();
ExternalArrayType GetIndexedPropertiesExternalArrayDataType();
int GetIndexedPropertiesExternalArrayDataLength();

static Local<Object> New();
static inline Object* Cast(Value* obj);
Expand Down Expand Up @@ -1761,20 +1768,11 @@ typedef Handle<Value> (*NamedPropertySetter)(Local<String> property,

/**
* Returns a non-empty handle if the interceptor intercepts the request.
* The result is either boolean (true if property exists and false
* otherwise) or an integer encoding property attributes.
* The result is an integer encoding property attributes (like v8::None,
* v8::DontEnum, etc.)
*/
#ifdef USE_NEW_QUERY_CALLBACKS
typedef Handle<Integer> (*NamedPropertyQuery)(Local<String> property,
const AccessorInfo& info);
#else
typedef Handle<Boolean> (*NamedPropertyQuery)(Local<String> property,
const AccessorInfo& info);
#endif

typedef Handle<Value> (*NamedPropertyQueryImpl)(Local<String> property,
const AccessorInfo& info);



/**
Expand Down Expand Up @@ -2026,16 +2024,7 @@ class V8EXPORT FunctionTemplate : public Template {
NamedPropertyQuery query,
NamedPropertyDeleter remover,
NamedPropertyEnumerator enumerator,
Handle<Value> data) {
NamedPropertyQueryImpl casted =
reinterpret_cast<NamedPropertyQueryImpl>(query);
SetNamedInstancePropertyHandlerImpl(getter,
setter,
casted,
remover,
enumerator,
data);
}
Handle<Value> data);
void SetIndexedInstancePropertyHandler(IndexedPropertyGetter getter,
IndexedPropertySetter setter,
IndexedPropertyQuery query,
Expand All @@ -2047,13 +2036,6 @@ class V8EXPORT FunctionTemplate : public Template {

friend class Context;
friend class ObjectTemplate;
private:
void SetNamedInstancePropertyHandlerImpl(NamedPropertyGetter getter,
NamedPropertySetter setter,
NamedPropertyQueryImpl query,
NamedPropertyDeleter remover,
NamedPropertyEnumerator enumerator,
Handle<Value> data);
};


Expand Down Expand Up @@ -2111,7 +2093,8 @@ class V8EXPORT ObjectTemplate : public Template {
*
* \param getter The callback to invoke when getting a property.
* \param setter The callback to invoke when setting a property.
* \param query The callback to invoke to check if an object has a property.
* \param query The callback to invoke to check if a property is present,
* and if present, get its attributes.
* \param deleter The callback to invoke when deleting a property.
* \param enumerator The callback to invoke to enumerate all the named
* properties of an object.
Expand All @@ -2123,26 +2106,7 @@ class V8EXPORT ObjectTemplate : public Template {
NamedPropertyQuery query = 0,
NamedPropertyDeleter deleter = 0,
NamedPropertyEnumerator enumerator = 0,
Handle<Value> data = Handle<Value>()) {
NamedPropertyQueryImpl casted =
reinterpret_cast<NamedPropertyQueryImpl>(query);
SetNamedPropertyHandlerImpl(getter,
setter,
casted,
deleter,
enumerator,
data);
}

private:
void SetNamedPropertyHandlerImpl(NamedPropertyGetter getter,
NamedPropertySetter setter,
NamedPropertyQueryImpl query,
NamedPropertyDeleter deleter,
NamedPropertyEnumerator enumerator,
Handle<Value> data);

public:
Handle<Value> data = Handle<Value>());

/**
* Sets an indexed property handler on the object template.
Expand Down

0 comments on commit 1c6671a

Please sign in to comment.