v8.h | v8.h | |||
---|---|---|---|---|
skipping to change at line 1311 | skipping to change at line 1311 | |||
V8_INLINE(ExternalStringResource* GetExternalStringResource() const); | V8_INLINE(ExternalStringResource* GetExternalStringResource() const); | |||
/** | /** | |||
* Get the ExternalAsciiStringResource for an external ASCII string. | * Get the ExternalAsciiStringResource for an external ASCII string. | |||
* Returns NULL if IsExternalAscii() doesn't return true. | * Returns NULL if IsExternalAscii() doesn't return true. | |||
*/ | */ | |||
const ExternalAsciiStringResource* GetExternalAsciiStringResource() const ; | const ExternalAsciiStringResource* GetExternalAsciiStringResource() const ; | |||
V8_INLINE(static String* Cast(v8::Value* obj)); | V8_INLINE(static String* Cast(v8::Value* obj)); | |||
// TODO(dcarney): deprecate | ||||
/** | /** | |||
* Allocates a new string from either UTF-8 encoded or ASCII data. | * Allocates a new string from either UTF-8 encoded or ASCII data. | |||
* The second parameter 'length' gives the buffer length. If omitted, | * The second parameter 'length' gives the buffer length. If omitted, | |||
* the function calls 'strlen' to determine the buffer length. | * the function calls 'strlen' to determine the buffer length. | |||
*/ | */ | |||
static Local<String> New(const char* data, int length = -1); | V8_INLINE(static Local<String> New(const char* data, int length = -1)); | |||
// TODO(dcarney): deprecate | ||||
/** Allocates a new string from 16-bit character codes.*/ | /** Allocates a new string from 16-bit character codes.*/ | |||
static Local<String> New(const uint16_t* data, int length = -1); | V8_INLINE(static Local<String> New(const uint16_t* data, int length = -1) ); | |||
// TODO(dcarney): deprecate | ||||
/** | /** | |||
* Creates an internalized string (historically called a "symbol", | * Creates an internalized string (historically called a "symbol", | |||
* not to be confused with ES6 symbols). Returns one if it exists already . | * not to be confused with ES6 symbols). Returns one if it exists already . | |||
* TODO(rossberg): Deprecate me when the new string API is here. | ||||
*/ | */ | |||
static Local<String> NewSymbol(const char* data, int length = -1); | V8_INLINE(static Local<String> NewSymbol(const char* data, int length = - | |||
1)); | ||||
enum NewStringType { | ||||
kNormalString, kInternalizedString, kUndetectableString | ||||
}; | ||||
/** Allocates a new string from UTF-8 data.*/ | ||||
static Local<String> NewFromUtf8(Isolate* isolate, | ||||
const char* data, | ||||
NewStringType type = kNormalString, | ||||
int length = -1); | ||||
/** Allocates a new string from Latin-1 data.*/ | ||||
static Local<String> NewFromOneByte( | ||||
Isolate* isolate, | ||||
const uint8_t* data, | ||||
NewStringType type = kNormalString, | ||||
int length = -1); | ||||
/** Allocates a new string from UTF-16 data.*/ | ||||
static Local<String> NewFromTwoByte( | ||||
Isolate* isolate, | ||||
const uint16_t* data, | ||||
NewStringType type = kNormalString, | ||||
int length = -1); | ||||
/** | /** | |||
* Creates a new string by concatenating the left and the right strings | * Creates a new string by concatenating the left and the right strings | |||
* passed in as parameters. | * passed in as parameters. | |||
*/ | */ | |||
static Local<String> Concat(Handle<String> left, Handle<String> right); | static Local<String> Concat(Handle<String> left, Handle<String> right); | |||
/** | /** | |||
* Creates a new external string using the data defined in the given | * Creates a new external string using the data defined in the given | |||
* 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 | |||
skipping to change at line 1381 | skipping to change at line 1407 | |||
* 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. | |||
*/ | */ | |||
bool MakeExternal(ExternalAsciiStringResource* resource); | bool MakeExternal(ExternalAsciiStringResource* resource); | |||
/** | /** | |||
* Returns true if this string can be made external. | * Returns true if this string can be made external. | |||
*/ | */ | |||
bool CanMakeExternal(); | bool CanMakeExternal(); | |||
// TODO(dcarney): deprecate | ||||
/** Creates an undetectable string from the supplied ASCII or UTF-8 data. */ | /** Creates an undetectable string from the supplied ASCII or UTF-8 data. */ | |||
static Local<String> NewUndetectable(const char* data, int length = -1); | V8_INLINE( | |||
static Local<String> NewUndetectable(const char* data, int length = - | ||||
1)); | ||||
// TODO(dcarney): deprecate | ||||
/** Creates an undetectable string from the supplied 16-bit character cod es.*/ | /** Creates an undetectable string from the supplied 16-bit character cod es.*/ | |||
static Local<String> NewUndetectable(const uint16_t* data, int length = - | V8_INLINE(static Local<String> NewUndetectable( | |||
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 V8EXPORT Utf8Value { | class V8EXPORT Utf8Value { | |||
public: | public: | |||
skipping to change at line 3597 | skipping to change at line 3627 | |||
* Returns true if JavaScript execution is currently terminating | * Returns true if JavaScript execution is currently terminating | |||
* because of a call to TerminateExecution. In that case there are | * because of a call to TerminateExecution. In that case there are | |||
* still JavaScript frames on the stack and the termination | * still JavaScript frames on the stack and the termination | |||
* exception is still active. | * exception is still active. | |||
* | * | |||
* \param isolate The isolate in which to check. | * \param isolate The isolate in which to check. | |||
*/ | */ | |||
static bool IsExecutionTerminating(Isolate* isolate = NULL); | static bool IsExecutionTerminating(Isolate* isolate = NULL); | |||
/** | /** | |||
* Resume execution capability in the given isolate, whose execution | ||||
* was previously forcefully terminated using TerminateExecution(). | ||||
* | ||||
* When execution is forcefully terminated using TerminateExecution(), | ||||
* the isolate can not resume execution until all JavaScript frames | ||||
* have propagated the uncatchable exception which is generated. This | ||||
* method allows the program embedding the engine to handle the | ||||
* termination event and resume execution capability, even if | ||||
* JavaScript frames remain on the stack. | ||||
* | ||||
* This method can be used by any thread even if that thread has not | ||||
* acquired the V8 lock with a Locker object. | ||||
* | ||||
* \param isolate The isolate in which to resume execution capability. | ||||
*/ | ||||
static void CancelTerminateExecution(Isolate* isolate); | ||||
/** | ||||
* Releases any resources used by v8 and stops any utility threads | * Releases any resources used by v8 and stops any utility threads | |||
* that may be running. Note that disposing v8 is permanent, it | * that may be running. Note that disposing v8 is permanent, it | |||
* cannot be reinitialized. | * cannot be reinitialized. | |||
* | * | |||
* It should generally not be necessary to dispose v8 before exiting | * It should generally not be necessary to dispose v8 before exiting | |||
* a process, this should happen automatically. It is only necessary | * a process, this should happen automatically. It is only necessary | |||
* to use if the process needs the resources taken up by v8. | * to use if the process needs the resources taken up by v8. | |||
*/ | */ | |||
static bool Dispose(); | static bool Dispose(); | |||
skipping to change at line 3705 | skipping to change at line 3753 | |||
* Unregisters and deletes this try/catch block. | * Unregisters and deletes this try/catch block. | |||
*/ | */ | |||
~TryCatch(); | ~TryCatch(); | |||
/** | /** | |||
* Returns true if an exception has been caught by this try/catch block. | * Returns true if an exception has been caught by this try/catch block. | |||
*/ | */ | |||
bool HasCaught() const; | bool HasCaught() const; | |||
/** | /** | |||
* For certain types of exceptions, it makes no sense to continue | * For certain types of exceptions, it makes no sense to continue executi | |||
* execution. | on. | |||
* | * | |||
* Currently, the only type of exception that can be caught by a | * If CanContinue returns false, the correct action is to perform any C++ | |||
* TryCatch handler and for which it does not make sense to continue | * cleanup needed and then return. If CanContinue returns false and | |||
* is termination exception. Such exceptions are thrown when the | * HasTerminated returns true, it is possible to call | |||
* TerminateExecution methods are called to terminate a long-running | * CancelTerminateExecution in order to continue calling into the engine. | |||
* script. | ||||
* | ||||
* If CanContinue returns false, the correct action is to perform | ||||
* any C++ cleanup needed and then return. | ||||
*/ | */ | |||
bool CanContinue() const; | bool CanContinue() const; | |||
/** | /** | |||
* Returns true if an exception has been caught due to script execution | ||||
* being terminated. | ||||
* | ||||
* There is no JavaScript representation of an execution termination | ||||
* exception. Such exceptions are thrown when the TerminateExecution | ||||
* methods are called to terminate a long-running script. | ||||
* | ||||
* If such an exception has been thrown, HasTerminated will return true, | ||||
* indicating that it is possible to call CancelTerminateExecution in ord | ||||
er | ||||
* to continue calling into the engine. | ||||
*/ | ||||
bool HasTerminated() const; | ||||
/** | ||||
* Throws the exception caught by this TryCatch in a way that avoids | * Throws the exception caught by this TryCatch in a way that avoids | |||
* it being caught again by this same TryCatch. As with ThrowException | * it being caught again by this same TryCatch. As with ThrowException | |||
* it is illegal to execute any JavaScript operations after calling | * it is illegal to execute any JavaScript operations after calling | |||
* ReThrow; the caller must return immediately to where the exception | * ReThrow; the caller must return immediately to where the exception | |||
* is caught. | * is caught. | |||
*/ | */ | |||
Handle<Value> ReThrow(); | Handle<Value> ReThrow(); | |||
/** | /** | |||
* Returns the exception caught by this try/catch block. If no exception has | * Returns the exception caught by this try/catch block. If no exception has | |||
skipping to change at line 3794 | skipping to change at line 3851 | |||
void operator delete(void*, size_t); | void operator delete(void*, size_t); | |||
v8::internal::Isolate* isolate_; | v8::internal::Isolate* isolate_; | |||
void* next_; | void* next_; | |||
void* exception_; | void* exception_; | |||
void* message_; | void* message_; | |||
bool is_verbose_ : 1; | bool is_verbose_ : 1; | |||
bool can_continue_ : 1; | bool can_continue_ : 1; | |||
bool capture_message_ : 1; | bool capture_message_ : 1; | |||
bool rethrow_ : 1; | bool rethrow_ : 1; | |||
bool has_terminated_ : 1; | ||||
friend class v8::internal::Isolate; | friend class v8::internal::Isolate; | |||
}; | }; | |||
// --- Context --- | // --- Context --- | |||
/** | /** | |||
* Ignore | * Ignore | |||
*/ | */ | |||
class V8EXPORT ExtensionConfiguration { | class V8EXPORT ExtensionConfiguration { | |||
skipping to change at line 4717 | skipping to change at line 4775 | |||
} | } | |||
Local<String> String::Empty(Isolate* isolate) { | Local<String> String::Empty(Isolate* isolate) { | |||
typedef internal::Object* S; | typedef internal::Object* S; | |||
typedef internal::Internals I; | typedef internal::Internals I; | |||
if (!I::IsInitialized(isolate)) return Empty(); | if (!I::IsInitialized(isolate)) return Empty(); | |||
S* slot = I::GetRoot(isolate, I::kEmptyStringRootIndex); | S* slot = I::GetRoot(isolate, I::kEmptyStringRootIndex); | |||
return Local<String>(reinterpret_cast<String*>(slot)); | return Local<String>(reinterpret_cast<String*>(slot)); | |||
} | } | |||
Local<String> String::New(const char* data, int length) { | ||||
return NewFromUtf8(Isolate::GetCurrent(), data, kNormalString, length); | ||||
} | ||||
Local<String> String::New(const uint16_t* data, int length) { | ||||
return NewFromTwoByte(Isolate::GetCurrent(), data, kNormalString, length) | ||||
; | ||||
} | ||||
Local<String> String::NewSymbol(const char* data, int length) { | ||||
return NewFromUtf8(Isolate::GetCurrent(), data, kInternalizedString, leng | ||||
th); | ||||
} | ||||
Local<String> String::NewUndetectable(const char* data, int length) { | ||||
return NewFromUtf8(Isolate::GetCurrent(), data, kUndetectableString, leng | ||||
th); | ||||
} | ||||
Local<String> String::NewUndetectable(const uint16_t* data, int length) { | ||||
return NewFromTwoByte( | ||||
Isolate::GetCurrent(), data, kUndetectableString, length); | ||||
} | ||||
String::ExternalStringResource* String::GetExternalStringResource() const { | String::ExternalStringResource* String::GetExternalStringResource() const { | |||
typedef internal::Object O; | typedef internal::Object O; | |||
typedef internal::Internals I; | typedef internal::Internals I; | |||
O* obj = *reinterpret_cast<O**>(const_cast<String*>(this)); | O* obj = *reinterpret_cast<O**>(const_cast<String*>(this)); | |||
String::ExternalStringResource* result; | String::ExternalStringResource* result; | |||
if (I::IsExternalTwoByteString(I::GetInstanceType(obj))) { | if (I::IsExternalTwoByteString(I::GetInstanceType(obj))) { | |||
void* value = I::ReadField<void*>(obj, I::kStringResourceOffset); | void* value = I::ReadField<void*>(obj, I::kStringResourceOffset); | |||
result = reinterpret_cast<String::ExternalStringResource*>(value); | result = reinterpret_cast<String::ExternalStringResource*>(value); | |||
} else { | } else { | |||
result = NULL; | result = NULL; | |||
End of changes. 17 change blocks. | ||||
17 lines changed or deleted | 102 lines changed or added | |||