| v8.h | | v8.h | |
|
| // Copyright 2011 the V8 project authors. All rights reserved. | | // Copyright 2012 the V8 project authors. All rights reserved. | |
| // Redistribution and use in source and binary forms, with or without | | // Redistribution and use in source and binary forms, with or without | |
| // modification, are permitted provided that the following conditions are | | // modification, are permitted provided that the following conditions are | |
| // met: | | // met: | |
| // | | // | |
| // * Redistributions of source code must retain the above copyright | | // * Redistributions of source code must retain the above copyright | |
| // notice, this list of conditions and the following disclaimer. | | // notice, this list of conditions and the following disclaimer. | |
| // * Redistributions in binary form must reproduce the above | | // * Redistributions in binary form must reproduce the above | |
| // copyright notice, this list of conditions and the following | | // copyright notice, this list of conditions and the following | |
| // disclaimer in the documentation and/or other materials provided | | // disclaimer in the documentation and/or other materials provided | |
| // with the distribution. | | // with the distribution. | |
| | | | |
| skipping to change at line 110 | | skipping to change at line 110 | |
| class Signature; | | class Signature; | |
| template <class T> class Handle; | | template <class T> class Handle; | |
| template <class T> class Local; | | template <class T> class Local; | |
| template <class T> class Persistent; | | template <class T> class Persistent; | |
| class FunctionTemplate; | | class FunctionTemplate; | |
| class ObjectTemplate; | | class ObjectTemplate; | |
| class Data; | | class Data; | |
| class AccessorInfo; | | class AccessorInfo; | |
| class StackTrace; | | class StackTrace; | |
| class StackFrame; | | class StackFrame; | |
|
| | | class Isolate; | |
| | | | |
| namespace internal { | | namespace internal { | |
| | | | |
| class Arguments; | | class Arguments; | |
| class Object; | | class Object; | |
| class Heap; | | class Heap; | |
| class HeapObject; | | class HeapObject; | |
| class Isolate; | | class Isolate; | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 1220 | | skipping to change at line 1221 | |
| */ | | */ | |
| V8EXPORT bool MakeExternal(ExternalStringResource* resource); | | V8EXPORT bool MakeExternal(ExternalStringResource* resource); | |
| | | | |
| /** | | /** | |
| * Creates a new external string using the ASCII data defined in the give
n | | * Creates a new external string using the ASCII data defined in the give
n | |
| * resource. When the external string is no longer live on V8's heap the | | * resource. When the external string is no longer live on V8's heap the | |
| * resource will be disposed by calling its Dispose method. The caller of | | * resource will be disposed by calling its Dispose method. The caller of | |
| * this function should not otherwise delete or modify the resource. Neit
her | | * this function should not otherwise delete or modify the resource. Neit
her | |
| * should the underlying buffer be deallocated or modified except through
the | | * should the underlying buffer be deallocated or modified except through
the | |
| * destructor of the external string resource. | | * destructor of the external string resource. | |
|
| */ | | */ V8EXPORT static Local<String> NewExternal( | |
| V8EXPORT static Local<String> NewExternal( | | | |
| ExternalAsciiStringResource* resource); | | ExternalAsciiStringResource* resource); | |
| | | | |
| /** | | /** | |
| * Associate an external string resource with this string by transforming
it | | * Associate an external string resource with this string by transforming
it | |
| * in place so that existing references to this string in the JavaScript
heap | | * in place so that existing references to this string in the JavaScript
heap | |
| * will use the external string resource. The external string resource's | | * will use the external string resource. The external string resource's | |
| * character contents need to be equivalent to this string. | | * character contents need to be equivalent to this string. | |
| * Returns true if the string has been changed to be an external string. | | * Returns true if the string has been changed to be an external string. | |
| * The string is not modified if the operation fails. See NewExternal for | | * The string is not modified if the operation fails. See NewExternal for | |
| * information on the lifetime of the resource. | | * information on the lifetime of the resource. | |
| | | | |
| skipping to change at line 1933 | | skipping to change at line 1933 | |
| */ | | */ | |
| class Arguments { | | class Arguments { | |
| public: | | public: | |
| inline int Length() const; | | inline int Length() const; | |
| inline Local<Value> operator[](int i) const; | | inline Local<Value> operator[](int i) const; | |
| inline Local<Function> Callee() const; | | inline Local<Function> Callee() const; | |
| inline Local<Object> This() const; | | inline Local<Object> This() const; | |
| inline Local<Object> Holder() const; | | inline Local<Object> Holder() const; | |
| inline bool IsConstructCall() const; | | inline bool IsConstructCall() const; | |
| inline Local<Value> Data() const; | | inline Local<Value> Data() const; | |
|
| | | inline Isolate* GetIsolate() const; | |
| private: | | private: | |
|
| static const int kDataIndex = 0; | | static const int kIsolateIndex = 0; | |
| static const int kCalleeIndex = -1; | | static const int kDataIndex = -1; | |
| static const int kHolderIndex = -2; | | static const int kCalleeIndex = -2; | |
| | | static const int kHolderIndex = -3; | |
| | | | |
| friend class ImplementationUtilities; | | friend class ImplementationUtilities; | |
| inline Arguments(internal::Object** implicit_args, | | inline Arguments(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_; | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * The information passed to an accessor callback about the context | | * The information passed to an accessor callback about the context | |
| * of the property access. | | * of the property access. | |
| */ | | */ | |
| class V8EXPORT AccessorInfo { | | class V8EXPORT AccessorInfo { | |
| public: | | public: | |
| inline AccessorInfo(internal::Object** args) | | inline AccessorInfo(internal::Object** args) | |
| : args_(args) { } | | : args_(args) { } | |
|
| | | inline Isolate* GetIsolate() const; | |
| inline Local<Value> Data() const; | | inline Local<Value> Data() const; | |
| inline Local<Object> This() const; | | inline Local<Object> This() const; | |
| inline Local<Object> Holder() const; | | inline Local<Object> Holder() const; | |
| private: | | private: | |
| internal::Object** args_; | | internal::Object** args_; | |
| }; | | }; | |
| | | | |
| typedef Handle<Value> (*InvocationCallback)(const Arguments& args); | | typedef Handle<Value> (*InvocationCallback)(const Arguments& args); | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 3083 | | skipping to change at line 3086 | |
| * when to perform global garbage collections. Registering | | * when to perform global garbage collections. Registering | |
| * externally allocated memory will trigger global garbage | | * externally allocated memory will trigger global garbage | |
| * collections more often than otherwise in an attempt to garbage | | * collections more often than otherwise in an attempt to garbage | |
| * collect the JavaScript objects keeping the externally allocated | | * collect the JavaScript objects keeping the externally allocated | |
| * memory alive. | | * memory alive. | |
| * | | * | |
| * \param change_in_bytes the change in externally allocated memory | | * \param change_in_bytes the change in externally allocated memory | |
| * that is kept alive by JavaScript objects. | | * that is kept alive by JavaScript objects. | |
| * \returns the adjusted value. | | * \returns the adjusted value. | |
| */ | | */ | |
|
| static int AdjustAmountOfExternalAllocatedMemory(int change_in_bytes); | | static intptr_t AdjustAmountOfExternalAllocatedMemory( | |
| | | intptr_t change_in_bytes); | |
| | | | |
| /** | | /** | |
| * Suspends recording of tick samples in the profiler. | | * Suspends recording of tick samples in the profiler. | |
| * When the V8 profiling mode is enabled (usually via command line | | * When the V8 profiling mode is enabled (usually via command line | |
| * switches) this function suspends recording of tick samples. | | * switches) this function suspends recording of tick samples. | |
| * Profiling ticks are discarded until ResumeProfiler() is called. | | * Profiling ticks are discarded until ResumeProfiler() is called. | |
| * | | * | |
| * See also the --prof and --prof_auto command line switches to | | * See also the --prof and --prof_auto command line switches to | |
| * enable V8 profiling. | | * enable V8 profiling. | |
| */ | | */ | |
| | | | |
| skipping to change at line 3664 | | skipping to change at line 3668 | |
| Locker(const Locker&); | | Locker(const Locker&); | |
| void operator=(const Locker&); | | void operator=(const Locker&); | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * An interface for exporting data from V8, using "push" model. | | * An interface for exporting data from V8, using "push" model. | |
| */ | | */ | |
| class V8EXPORT OutputStream { // NOLINT | | class V8EXPORT OutputStream { // NOLINT | |
| public: | | public: | |
| enum OutputEncoding { | | enum OutputEncoding { | |
|
| kAscii = 0 // 7-bit ASCII. | | kAscii = 0, // 7-bit ASCII. | |
| | | kUint32 = 1 | |
| }; | | }; | |
| 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. */ | |
| virtual void EndOfStream() = 0; | | virtual void EndOfStream() = 0; | |
| /** Get preferred output chunk size. Called only once. */ | | /** Get preferred output chunk size. Called only once. */ | |
| virtual int GetChunkSize() { return 1024; } | | virtual int GetChunkSize() { return 1024; } | |
| /** Get preferred output encoding. Called only once. */ | | /** Get preferred output encoding. Called only once. */ | |
| virtual OutputEncoding GetOutputEncoding() { return kAscii; } | | virtual OutputEncoding GetOutputEncoding() { return kAscii; } | |
| /** | | /** | |
| * Writes the next chunk of snapshot data into the stream. Writing | | * Writes the next chunk of snapshot data into the stream. Writing | |
| * can be stopped by returning kAbort as function result. EndOfStream | | * can be stopped by returning kAbort as function result. EndOfStream | |
| * will not be called in case writing was aborted. | | * will not be called in case writing was aborted. | |
| */ | | */ | |
| virtual WriteResult WriteAsciiChunk(char* data, int size) = 0; | | virtual WriteResult WriteAsciiChunk(char* data, int size) = 0; | |
|
| | | /** | |
| | | * Writes the next chunk of heap stats data into the stream. Writing | |
| | | * can be stopped by returning kAbort as function result. EndOfStream | |
| | | * will not be called in case writing was aborted. | |
| | | */ | |
| | | virtual WriteResult WriteUint32Chunk(uint32_t* data, int count) = 0; | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * An interface for reporting progress and controlling long-running | | * An interface for reporting progress and controlling long-running | |
| * activities. | | * activities. | |
| */ | | */ | |
| class V8EXPORT ActivityControl { // NOLINT | | class V8EXPORT ActivityControl { // NOLINT | |
| public: | | public: | |
| enum ControlOption { | | enum ControlOption { | |
| kContinue = 0, | | kContinue = 0, | |
| | | | |
| skipping to change at line 3955 | | skipping to change at line 3966 | |
| | | | |
| Local<Object> Arguments::Holder() const { | | Local<Object> Arguments::Holder() const { | |
| return Local<Object>(reinterpret_cast<Object*>( | | return Local<Object>(reinterpret_cast<Object*>( | |
| &implicit_args_[kHolderIndex])); | | &implicit_args_[kHolderIndex])); | |
| } | | } | |
| | | | |
| Local<Value> Arguments::Data() const { | | Local<Value> Arguments::Data() const { | |
| return Local<Value>(reinterpret_cast<Value*>(&implicit_args_[kDataIndex])
); | | return Local<Value>(reinterpret_cast<Value*>(&implicit_args_[kDataIndex])
); | |
| } | | } | |
| | | | |
|
| | | Isolate* Arguments::GetIsolate() const { | |
| | | return *reinterpret_cast<Isolate**>(&implicit_args_[kIsolateIndex]); | |
| | | } | |
| | | | |
| bool Arguments::IsConstructCall() const { | | bool Arguments::IsConstructCall() const { | |
| return is_construct_call_; | | return is_construct_call_; | |
| } | | } | |
| | | | |
| int Arguments::Length() const { | | int Arguments::Length() const { | |
| return length_; | | return length_; | |
| } | | } | |
| | | | |
| template <class T> | | template <class T> | |
| Local<T> HandleScope::Close(Handle<T> value) { | | Local<T> HandleScope::Close(Handle<T> value) { | |
| | | | |
| skipping to change at line 4164 | | skipping to change at line 4179 | |
| return static_cast<Function*>(value); | | return static_cast<Function*>(value); | |
| } | | } | |
| | | | |
| External* External::Cast(v8::Value* value) { | | External* External::Cast(v8::Value* value) { | |
| #ifdef V8_ENABLE_CHECKS | | #ifdef V8_ENABLE_CHECKS | |
| CheckCast(value); | | CheckCast(value); | |
| #endif | | #endif | |
| return static_cast<External*>(value); | | return static_cast<External*>(value); | |
| } | | } | |
| | | | |
|
| | | Isolate* AccessorInfo::GetIsolate() const { | |
| | | return *reinterpret_cast<Isolate**>(&args_[-3]); | |
| | | } | |
| | | | |
| Local<Value> AccessorInfo::Data() const { | | Local<Value> AccessorInfo::Data() const { | |
| return Local<Value>(reinterpret_cast<Value*>(&args_[-2])); | | return Local<Value>(reinterpret_cast<Value*>(&args_[-2])); | |
| } | | } | |
| | | | |
| Local<Object> AccessorInfo::This() const { | | Local<Object> AccessorInfo::This() const { | |
| return Local<Object>(reinterpret_cast<Object*>(&args_[0])); | | return Local<Object>(reinterpret_cast<Object*>(&args_[0])); | |
| } | | } | |
| | | | |
| Local<Object> AccessorInfo::Holder() const { | | Local<Object> AccessorInfo::Holder() const { | |
| return Local<Object>(reinterpret_cast<Object*>(&args_[-1])); | | return Local<Object>(reinterpret_cast<Object*>(&args_[-1])); | |
| | | | |
End of changes. 11 change blocks. |
| 8 lines changed or deleted | | 27 lines changed or added | |
|