v8.h   v8.h 
skipping to change at line 1002 skipping to change at line 1002
public: public:
V8EXPORT bool Value() const; V8EXPORT bool Value() const;
static inline Handle<Boolean> New(bool value); static inline Handle<Boolean> New(bool value);
}; };
/** /**
* A JavaScript string value (ECMA-262, 4.3.17). * A JavaScript string value (ECMA-262, 4.3.17).
*/ */
class String : public Primitive { class String : public Primitive {
public: public:
enum Encoding {
UNKNOWN_ENCODING = 0x1,
TWO_BYTE_ENCODING = 0x0,
ASCII_ENCODING = 0x4
};
/** /**
* Returns the number of characters in this string. * Returns the number of characters in this string.
*/ */
V8EXPORT int Length() const; V8EXPORT int Length() const;
/** /**
* Returns the number of bytes in the UTF-8 encoded * Returns the number of bytes in the UTF-8 encoded
* representation of this string. * representation of this string.
*/ */
V8EXPORT int Utf8Length() const; V8EXPORT int Utf8Length() const;
skipping to change at line 1165 skipping to change at line 1170
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.*/
virtual size_t length() const = 0; virtual size_t length() const = 0;
protected: protected:
ExternalAsciiStringResource() {} ExternalAsciiStringResource() {}
}; };
/** /**
* If the string is an external string, return the ExternalStringResource
Base
* regardless of the encoding, otherwise return NULL. The encoding of th
e
* string is returned in encoding_out.
*/
inline ExternalStringResourceBase* GetExternalStringResourceBase(
Encoding* encoding_out) const;
/**
* Get the ExternalStringResource for an external string. Returns * Get the ExternalStringResource for an external string. Returns
* NULL if IsExternal() doesn't return true. * NULL if IsExternal() doesn't return true.
*/ */
inline ExternalStringResource* GetExternalStringResource() const; 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.
*/ */
V8EXPORT const ExternalAsciiStringResource* GetExternalAsciiStringResourc e() V8EXPORT const ExternalAsciiStringResource* GetExternalAsciiStringResourc e()
skipping to change at line 1327 skipping to change at line 1340
private: private:
uint16_t* str_; uint16_t* str_;
int length_; int length_;
// Disallow copying and assigning. // Disallow copying and assigning.
Value(const Value&); Value(const Value&);
void operator=(const Value&); void operator=(const Value&);
}; };
private: private:
V8EXPORT void VerifyExternalStringResourceBase(ExternalStringResourceBase
* v,
Encoding encoding) const;
V8EXPORT void VerifyExternalStringResource(ExternalStringResource* val) c onst; V8EXPORT void VerifyExternalStringResource(ExternalStringResource* val) c onst;
V8EXPORT static void CheckCast(v8::Value* obj); V8EXPORT 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 Number : public Primitive { class Number : public Primitive {
public: public:
V8EXPORT double Value() const; V8EXPORT double Value() const;
skipping to change at line 3625 skipping to change at line 3640
bool HasOutOfMemoryException(); bool HasOutOfMemoryException();
/** Returns true if V8 has a current context. */ /** Returns true if V8 has a current context. */
static bool InContext(); static bool InContext();
/** /**
* Associate an additional data object with the context. This is mainly u sed * Associate an additional data object with the context. This is mainly u sed
* with the debugger to provide additional information on the context thr ough * with the debugger to provide additional information on the context thr ough
* the debugger API. * the debugger API.
*/ */
void SetData(Handle<String> data); void SetData(Handle<Value> data);
Local<Value> GetData(); Local<Value> GetData();
/** /**
* Control whether code generation from strings is allowed. Calling * Control whether code generation from strings is allowed. Calling
* this method with false will disable 'eval' and the 'Function' * this method with false will disable 'eval' and the 'Function'
* constructor for code running in this context. If 'eval' or the * constructor for code running in this context. If 'eval' or the
* 'Function' constructor are used an exception will be thrown. * 'Function' constructor are used an exception will be thrown.
* *
* If code generation from strings is not allowed the * If code generation from strings is not allowed the
* V8::AllowCodeGenerationFromStrings callback will be invoked if * V8::AllowCodeGenerationFromStrings callback will be invoked if
skipping to change at line 3650 skipping to change at line 3665
*/ */
void AllowCodeGenerationFromStrings(bool allow); void AllowCodeGenerationFromStrings(bool allow);
/** /**
* Returns true if code generation from strings is allowed for the contex t. * Returns true if code generation from strings is allowed for the contex t.
* For more details see AllowCodeGenerationFromStrings(bool) documentatio n. * For more details see AllowCodeGenerationFromStrings(bool) documentatio n.
*/ */
bool IsCodeGenerationFromStringsAllowed(); bool IsCodeGenerationFromStringsAllowed();
/** /**
* Sets the error description for the exception that is thrown when
* code generation from strings is not allowed and 'eval' or the 'Functio
n'
* constructor are called.
*/
void SetErrorMessageForCodeGenerationFromStrings(Handle<String> message);
/**
* Stack-allocated class which sets the execution context for all * Stack-allocated class which sets the execution context for all
* operations executed within a local scope. * operations executed within a local scope.
*/ */
class Scope { class Scope {
public: public:
explicit inline Scope(Handle<Context> context) : context_(context) { explicit inline Scope(Handle<Context> context) : context_(context) {
context_->Enter(); context_->Enter();
} }
inline ~Scope() { context_->Exit(); } inline ~Scope() { context_->Exit(); }
private: private:
skipping to change at line 3948 skipping to change at line 3970
// These values match non-compiler-dependent values defined within // These values match non-compiler-dependent values defined within
// the implementation of v8. // the implementation of v8.
static const int kHeapObjectMapOffset = 0; static const int kHeapObjectMapOffset = 0;
static const int kMapInstanceTypeOffset = 1 * kApiPointerSize + kApiIntSi ze; static const int kMapInstanceTypeOffset = 1 * kApiPointerSize + kApiIntSi ze;
static const int kStringResourceOffset = 3 * kApiPointerSize; static const int kStringResourceOffset = 3 * kApiPointerSize;
static const int kOddballKindOffset = 3 * kApiPointerSize; static const int kOddballKindOffset = 3 * kApiPointerSize;
static const int kForeignAddressOffset = kApiPointerSize; static const int kForeignAddressOffset = kApiPointerSize;
static const int kJSObjectHeaderSize = 3 * kApiPointerSize; static const int kJSObjectHeaderSize = 3 * kApiPointerSize;
static const int kFullStringRepresentationMask = 0x07; static const int kFullStringRepresentationMask = 0x07;
static const int kStringEncodingMask = 0x4;
static const int kExternalTwoByteRepresentationTag = 0x02; static const int kExternalTwoByteRepresentationTag = 0x02;
static const int kExternalAsciiRepresentationTag = 0x06;
static const int kIsolateStateOffset = 0; static const int kIsolateStateOffset = 0;
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 kEmptySymbolRootIndex = 116; static const int kEmptySymbolRootIndex = 116;
skipping to change at line 4274 skipping to change at line 4298
result = reinterpret_cast<String::ExternalStringResource*>(value); result = reinterpret_cast<String::ExternalStringResource*>(value);
} else { } else {
result = NULL; result = NULL;
} }
#ifdef V8_ENABLE_CHECKS #ifdef V8_ENABLE_CHECKS
VerifyExternalStringResource(result); VerifyExternalStringResource(result);
#endif #endif
return result; return result;
} }
String::ExternalStringResourceBase* String::GetExternalStringResourceBase(
String::Encoding* encoding_out) const {
typedef internal::Object O;
typedef internal::Internals I;
O* obj = *reinterpret_cast<O**>(const_cast<String*>(this));
int type = I::GetInstanceType(obj) & I::kFullStringRepresentationMask;
*encoding_out = static_cast<Encoding>(type & I::kStringEncodingMask);
ExternalStringResourceBase* resource = NULL;
if (type == I::kExternalAsciiRepresentationTag ||
type == I::kExternalTwoByteRepresentationTag) {
void* value = I::ReadField<void*>(obj, I::kStringResourceOffset);
resource = static_cast<ExternalStringResourceBase*>(value);
}
#ifdef V8_ENABLE_CHECKS
VerifyExternalStringResourceBase(resource, *encoding_out);
#endif
return resource;
}
bool Value::IsUndefined() const { bool Value::IsUndefined() const {
#ifdef V8_ENABLE_CHECKS #ifdef V8_ENABLE_CHECKS
return FullIsUndefined(); return FullIsUndefined();
#else #else
return QuickIsUndefined(); return QuickIsUndefined();
#endif #endif
} }
bool Value::QuickIsUndefined() const { bool Value::QuickIsUndefined() const {
typedef internal::Object O; typedef internal::Object O;
 End of changes. 8 change blocks. 
1 lines changed or deleted 48 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/