#ifdef ENABLE_HEAP_PROTECTION
#define ENTER_V8 i::VMState __state__(i::OTHER)
+#define LEAVE_V8 i::VMState __state__(i::EXTERNAL)
#else
#define ENTER_V8 ((void) 0)
+#define LEAVE_V8 ((void) 0)
#endif
-
namespace v8 {
static void DefaultFatalErrorHandler(const char* location,
const char* message) {
+ ENTER_V8;
API_Fatal(location, message);
}
void i::V8::FatalProcessOutOfMemory(const char* location) {
has_shut_down = true;
FatalErrorCallback callback = GetFatalErrorHandler();
- callback(location, "Allocation failed - process out of memory");
+ {
+ LEAVE_V8;
+ callback(location, "Allocation failed - process out of memory");
+ }
// If the callback returns, we stop execution.
UNREACHABLE();
}
bool Utils::ReportApiFailure(const char* location, const char* message) {
FatalErrorCallback callback = GetFatalErrorHandler();
- callback(location, message);
+ {
+ LEAVE_V8;
+ callback(location, message);
+ }
has_shut_down = true;
return false;
}
static bool ReportV8Dead(const char* location) {
FatalErrorCallback callback = GetFatalErrorHandler();
- callback(location, "V8 is no longer usable");
+ {
+ LEAVE_V8;
+ callback(location, "V8 is no longer usable");
+ }
return true;
}
static bool ReportEmptyHandle(const char* location) {
FatalErrorCallback callback = GetFatalErrorHandler();
- callback(location, "Reading from empty handle");
+ {
+ LEAVE_V8;
+ callback(location, "Reading from empty handle");
+ }
return true;
}
static void EnsureInitialized(const char* location) {
+ ENTER_V8;
if (IsDeadCheck(location)) return;
ApiCheck(v8::V8::Initialize(), location, "Error initializing V8");
}
v8::Handle<v8::Primitive> ImplementationUtilities::Undefined() {
+ ENTER_V8;
if (IsDeadCheck("v8::Undefined()")) return v8::Handle<v8::Primitive>();
EnsureInitialized("v8::Undefined()");
return v8::Handle<Primitive>(ToApi<Primitive>(i::Factory::undefined_value()));
v8::Handle<v8::Primitive> ImplementationUtilities::Null() {
+ ENTER_V8;
if (IsDeadCheck("v8::Null()")) return v8::Handle<v8::Primitive>();
EnsureInitialized("v8::Null()");
return v8::Handle<Primitive>(ToApi<Primitive>(i::Factory::null_value()));
v8::Handle<v8::Boolean> ImplementationUtilities::True() {
+ ENTER_V8;
if (IsDeadCheck("v8::True()")) return v8::Handle<v8::Boolean>();
EnsureInitialized("v8::True()");
return v8::Handle<v8::Boolean>(ToApi<Boolean>(i::Factory::true_value()));
v8::Handle<v8::Boolean> ImplementationUtilities::False() {
+ ENTER_V8;
if (IsDeadCheck("v8::False()")) return v8::Handle<v8::Boolean>();
EnsureInitialized("v8::False()");
return v8::Handle<v8::Boolean>(ToApi<Boolean>(i::Factory::false_value()));
v8::Handle<Value> ThrowException(v8::Handle<v8::Value> value) {
+ ENTER_V8;
if (IsDeadCheck("v8::ThrowException()")) return v8::Handle<Value>();
// If we're passed an empty handle, we throw an undefined exception
// to deal more gracefully with out of memory situations.
void** V8::GlobalizeReference(void** obj) {
+ ENTER_V8;
LOG_API("Persistent::New");
if (IsDeadCheck("V8::Persistent::New")) return NULL;
i::Handle<i::Object> result =
void Context::Enter() {
+ ENTER_V8;
if (IsDeadCheck("v8::Context::Enter()")) return;
i::Handle<i::Context> env = Utils::OpenHandle(this);
thread_local.EnterContext(env);
Local<ObjectTemplate> FunctionTemplate::PrototypeTemplate() {
+ ENTER_V8;
if (IsDeadCheck("v8::FunctionTemplate::PrototypeTemplate()")) {
return Local<ObjectTemplate>();
}
void FunctionTemplate::Inherit(v8::Handle<FunctionTemplate> value) {
+ ENTER_V8;
if (IsDeadCheck("v8::FunctionTemplate::Inherit()")) return;
Utils::OpenHandle(this)->set_parent_template(*Utils::OpenHandle(*value));
}
Local<Signature> Signature::New(Handle<FunctionTemplate> receiver,
int argc, Handle<FunctionTemplate> argv[]) {
+ ENTER_V8;
EnsureInitialized("v8::Signature::New()");
LOG_API("Signature::New");
i::Handle<i::Struct> struct_obj =
Local<TypeSwitch> TypeSwitch::New(int argc, Handle<FunctionTemplate> types[]) {
+ ENTER_V8;
EnsureInitialized("v8::TypeSwitch::New()");
LOG_API("TypeSwitch::New");
i::Handle<i::FixedArray> vector = i::Factory::NewFixedArray(argc);
void FunctionTemplate::SetCallHandler(InvocationCallback callback,
v8::Handle<Value> data) {
+ ENTER_V8;
if (IsDeadCheck("v8::FunctionTemplate::SetCallHandler()")) return;
HandleScope scope;
i::Handle<i::Struct> struct_obj =
v8::Handle<Value> data,
v8::AccessControl settings,
v8::PropertyAttribute attributes) {
+ ENTER_V8;
if (IsDeadCheck("v8::FunctionTemplate::AddInstancePropertyAccessor()")) {
return;
}
Local<ObjectTemplate> FunctionTemplate::InstanceTemplate() {
+ ENTER_V8;
if (IsDeadCheck("v8::FunctionTemplate::InstanceTemplate()")
|| EmptyCheck("v8::FunctionTemplate::InstanceTemplate()", this))
return Local<ObjectTemplate>();
void FunctionTemplate::SetClassName(Handle<String> name) {
+ ENTER_V8;
if (IsDeadCheck("v8::FunctionTemplate::SetClassName()")) return;
Utils::OpenHandle(this)->set_class_name(*Utils::OpenHandle(*name));
}
void FunctionTemplate::SetHiddenPrototype(bool value) {
+ ENTER_V8;
if (IsDeadCheck("v8::FunctionTemplate::SetHiddenPrototype()")) return;
Utils::OpenHandle(this)->set_hidden_prototype(value);
}
NamedPropertyDeleter remover,
NamedPropertyEnumerator enumerator,
Handle<Value> data) {
+ ENTER_V8;
if (IsDeadCheck("v8::FunctionTemplate::SetNamedInstancePropertyHandler()")) {
return;
}
IndexedPropertyDeleter remover,
IndexedPropertyEnumerator enumerator,
Handle<Value> data) {
+ ENTER_V8;
if (IsDeadCheck(
"v8::FunctionTemplate::SetIndexedInstancePropertyHandler()")) {
return;
void FunctionTemplate::SetInstanceCallAsFunctionHandler(
InvocationCallback callback,
Handle<Value> data) {
+ ENTER_V8;
if (IsDeadCheck("v8::FunctionTemplate::SetInstanceCallAsFunctionHandler()")) {
return;
}
v8::Handle<Value> data,
AccessControl settings,
PropertyAttribute attribute) {
+ ENTER_V8;
if (IsDeadCheck("v8::ObjectTemplate::SetAccessor()")) return;
HandleScope scope;
EnsureConstructor(this);
NamedPropertyDeleter remover,
NamedPropertyEnumerator enumerator,
Handle<Value> data) {
+ ENTER_V8;
if (IsDeadCheck("v8::ObjectTemplate::SetNamedPropertyHandler()")) return;
HandleScope scope;
EnsureConstructor(this);
void ObjectTemplate::MarkAsUndetectable() {
+ ENTER_V8;
if (IsDeadCheck("v8::ObjectTemplate::MarkAsUndetectable()")) return;
HandleScope scope;
EnsureConstructor(this);
IndexedSecurityCallback indexed_callback,
Handle<Value> data,
bool turned_on_by_default) {
+ ENTER_V8;
if (IsDeadCheck("v8::ObjectTemplate::SetAccessCheckCallbacks()")) return;
HandleScope scope;
EnsureConstructor(this);
IndexedPropertyDeleter remover,
IndexedPropertyEnumerator enumerator,
Handle<Value> data) {
+ ENTER_V8;
if (IsDeadCheck("v8::ObjectTemplate::SetIndexedPropertyHandler()")) return;
HandleScope scope;
EnsureConstructor(this);
void ObjectTemplate::SetCallAsFunctionHandler(InvocationCallback callback,
Handle<Value> data) {
+ ENTER_V8;
if (IsDeadCheck("v8::ObjectTemplate::SetCallAsFunctionHandler()")) return;
HandleScope scope;
EnsureConstructor(this);
int ObjectTemplate::InternalFieldCount() {
+ ENTER_V8;
if (IsDeadCheck("v8::ObjectTemplate::InternalFieldCount()")) {
return 0;
}
void ObjectTemplate::SetInternalFieldCount(int value) {
+ ENTER_V8;
if (IsDeadCheck("v8::ObjectTemplate::SetInternalFieldCount()")) return;
if (!ApiCheck(i::Smi::IsValid(value),
"v8::ObjectTemplate::SetInternalFieldCount()",
Local<Value> Script::Run() {
+ ENTER_V8;
ON_BAILOUT("v8::Script::Run()", return Local<Value>());
LOG_API("Script::Run");
i::Object* raw_result = NULL;
Local<Value> Script::Id() {
+ ENTER_V8;
ON_BAILOUT("v8::Script::Id()", return Local<Value>());
LOG_API("Script::Id");
i::Object* raw_id = NULL;
Local<String> Message::Get() const {
+ ENTER_V8;
ON_BAILOUT("v8::Message::Get()", return Local<String>());
HandleScope scope;
i::Handle<i::Object> obj = Utils::OpenHandle(this);
v8::Handle<Value> Message::GetScriptResourceName() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Message::GetScriptResourceName()")) {
return Local<String>();
}
int Message::GetLineNumber() const {
+ ENTER_V8;
ON_BAILOUT("v8::Message::GetLineNumber()", return -1);
HandleScope scope;
EXCEPTION_PREAMBLE();
int Message::GetStartPosition() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Message::GetStartPosition()")) return 0;
HandleScope scope;
int Message::GetEndPosition() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Message::GetEndPosition()")) return 0;
HandleScope scope;
i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this);
int Message::GetStartColumn() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Message::GetStartColumn()")) return 0;
HandleScope scope;
i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this);
int Message::GetEndColumn() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Message::GetEndColumn()")) return 0;
HandleScope scope;
i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this);
Local<String> Message::GetSourceLine() const {
+ ENTER_V8;
ON_BAILOUT("v8::Message::GetSourceLine()", return Local<String>());
HandleScope scope;
EXCEPTION_PREAMBLE();
void Message::PrintCurrentStackTrace(FILE* out) {
+ ENTER_V8;
if (IsDeadCheck("v8::Message::PrintCurrentStackTrace()")) return;
i::Top::PrintCurrentStackTrace(out);
}
// --- D a t a ---
bool Value::IsUndefined() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Value::IsUndefined()")) return false;
return Utils::OpenHandle(this)->IsUndefined();
}
bool Value::IsNull() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Value::IsNull()")) return false;
return Utils::OpenHandle(this)->IsNull();
}
bool Value::IsTrue() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Value::IsTrue()")) return false;
return Utils::OpenHandle(this)->IsTrue();
}
bool Value::IsFalse() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Value::IsFalse()")) return false;
return Utils::OpenHandle(this)->IsFalse();
}
bool Value::IsFunction() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Value::IsFunction()")) return false;
return Utils::OpenHandle(this)->IsJSFunction();
}
bool Value::IsString() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Value::IsString()")) return false;
return Utils::OpenHandle(this)->IsString();
}
bool Value::IsArray() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Value::IsArray()")) return false;
return Utils::OpenHandle(this)->IsJSArray();
}
bool Value::IsObject() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Value::IsObject()")) return false;
return Utils::OpenHandle(this)->IsJSObject();
}
bool Value::IsNumber() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Value::IsNumber()")) return false;
return Utils::OpenHandle(this)->IsNumber();
}
bool Value::IsBoolean() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Value::IsBoolean()")) return false;
return Utils::OpenHandle(this)->IsBoolean();
}
bool Value::IsExternal() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Value::IsExternal()")) return false;
return Utils::OpenHandle(this)->IsProxy();
}
bool Value::IsInt32() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Value::IsInt32()")) return false;
i::Handle<i::Object> obj = Utils::OpenHandle(this);
if (obj->IsSmi()) return true;
bool Value::IsDate() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Value::IsDate()")) return false;
i::Handle<i::Object> obj = Utils::OpenHandle(this);
return obj->HasSpecificClassOf(i::Heap::Date_symbol());
Local<String> Value::ToString() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Value::ToString()")) return Local<String>();
LOG_API("ToString");
i::Handle<i::Object> obj = Utils::OpenHandle(this);
Local<String> Value::ToDetailString() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Value::ToDetailString()")) return Local<String>();
LOG_API("ToDetailString");
i::Handle<i::Object> obj = Utils::OpenHandle(this);
Local<v8::Object> Value::ToObject() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Value::ToObject()")) return Local<v8::Object>();
LOG_API("ToObject");
i::Handle<i::Object> obj = Utils::OpenHandle(this);
Local<Boolean> Value::ToBoolean() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Value::ToBoolean()")) return Local<Boolean>();
LOG_API("ToBoolean");
i::Handle<i::Object> obj = Utils::OpenHandle(this);
Local<Number> Value::ToNumber() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Value::ToNumber()")) return Local<Number>();
LOG_API("ToNumber");
i::Handle<i::Object> obj = Utils::OpenHandle(this);
Local<Integer> Value::ToInteger() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Value::ToInteger()")) return Local<Integer>();
LOG_API("ToInteger");
i::Handle<i::Object> obj = Utils::OpenHandle(this);
External* External::Cast(v8::Value* that) {
+ ENTER_V8;
if (IsDeadCheck("v8::External::Cast()")) return 0;
i::Handle<i::Object> obj = Utils::OpenHandle(that);
ApiCheck(obj->IsProxy(),
v8::Object* v8::Object::Cast(Value* that) {
+ ENTER_V8;
if (IsDeadCheck("v8::Object::Cast()")) return 0;
i::Handle<i::Object> obj = Utils::OpenHandle(that);
ApiCheck(obj->IsJSObject(),
v8::Function* v8::Function::Cast(Value* that) {
+ ENTER_V8;
if (IsDeadCheck("v8::Function::Cast()")) return 0;
i::Handle<i::Object> obj = Utils::OpenHandle(that);
ApiCheck(obj->IsJSFunction(),
v8::String* v8::String::Cast(v8::Value* that) {
+ ENTER_V8;
if (IsDeadCheck("v8::String::Cast()")) return 0;
i::Handle<i::Object> obj = Utils::OpenHandle(that);
ApiCheck(obj->IsString(),
v8::Number* v8::Number::Cast(v8::Value* that) {
+ ENTER_V8;
if (IsDeadCheck("v8::Number::Cast()")) return 0;
i::Handle<i::Object> obj = Utils::OpenHandle(that);
ApiCheck(obj->IsNumber(),
v8::Integer* v8::Integer::Cast(v8::Value* that) {
+ ENTER_V8;
if (IsDeadCheck("v8::Integer::Cast()")) return 0;
i::Handle<i::Object> obj = Utils::OpenHandle(that);
ApiCheck(obj->IsNumber(),
v8::Array* v8::Array::Cast(Value* that) {
+ ENTER_V8;
if (IsDeadCheck("v8::Array::Cast()")) return 0;
i::Handle<i::Object> obj = Utils::OpenHandle(that);
ApiCheck(obj->IsJSArray(),
v8::Date* v8::Date::Cast(v8::Value* that) {
+ ENTER_V8;
if (IsDeadCheck("v8::Date::Cast()")) return 0;
i::Handle<i::Object> obj = Utils::OpenHandle(that);
ApiCheck(obj->HasSpecificClassOf(i::Heap::Date_symbol()),
bool Value::BooleanValue() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Value::BooleanValue()")) return false;
LOG_API("BooleanValue");
i::Handle<i::Object> obj = Utils::OpenHandle(this);
double Value::NumberValue() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Value::NumberValue()")) return i::OS::nan_value();
LOG_API("NumberValue");
i::Handle<i::Object> obj = Utils::OpenHandle(this);
int64_t Value::IntegerValue() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Value::IntegerValue()")) return 0;
LOG_API("IntegerValue");
i::Handle<i::Object> obj = Utils::OpenHandle(this);
Local<Int32> Value::ToInt32() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Value::ToInt32()")) return Local<Int32>();
LOG_API("ToInt32");
i::Handle<i::Object> obj = Utils::OpenHandle(this);
Local<Uint32> Value::ToUint32() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Value::ToUint32()")) return Local<Uint32>();
LOG_API("ToUInt32");
i::Handle<i::Object> obj = Utils::OpenHandle(this);
Local<Uint32> Value::ToArrayIndex() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Value::ToArrayIndex()")) return Local<Uint32>();
LOG_API("ToArrayIndex");
i::Handle<i::Object> obj = Utils::OpenHandle(this);
int32_t Value::Int32Value() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Value::Int32Value()")) return 0;
LOG_API("Int32Value");
i::Handle<i::Object> obj = Utils::OpenHandle(this);
bool Value::Equals(Handle<Value> that) const {
+ ENTER_V8;
if (IsDeadCheck("v8::Value::Equals()")
|| EmptyCheck("v8::Value::Equals()", this)
|| EmptyCheck("v8::Value::Equals()", that))
bool Value::StrictEquals(Handle<Value> that) const {
+ ENTER_V8;
if (IsDeadCheck("v8::Value::StrictEquals()")
|| EmptyCheck("v8::Value::StrictEquals()", this)
|| EmptyCheck("v8::Value::StrictEquals()", that))
uint32_t Value::Uint32Value() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Value::Uint32Value()")) return 0;
LOG_API("Uint32Value");
i::Handle<i::Object> obj = Utils::OpenHandle(this);
bool v8::Object::Set(v8::Handle<Value> key, v8::Handle<Value> value,
v8::PropertyAttribute attribs) {
+ ENTER_V8;
ON_BAILOUT("v8::Object::Set()", return false);
i::Handle<i::Object> self = Utils::OpenHandle(this);
i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
Local<Value> v8::Object::Get(v8::Handle<Value> key) {
+ ENTER_V8;
ON_BAILOUT("v8::Object::Get()", return Local<v8::Value>());
i::Handle<i::Object> self = Utils::OpenHandle(this);
i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
Local<Value> v8::Object::GetPrototype() {
+ ENTER_V8;
ON_BAILOUT("v8::Object::GetPrototype()", return Local<v8::Value>());
i::Handle<i::Object> self = Utils::OpenHandle(this);
i::Handle<i::Object> result = i::GetPrototype(self);
Local<Array> v8::Object::GetPropertyNames() {
+ ENTER_V8;
ON_BAILOUT("v8::Object::GetPropertyNames()", return Local<v8::Array>());
v8::HandleScope scope;
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
Local<String> v8::Object::ObjectProtoToString() {
+ ENTER_V8;
ON_BAILOUT("v8::Object::ObjectProtoToString()", return Local<v8::String>());
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
bool v8::Object::Delete(v8::Handle<String> key) {
+ ENTER_V8;
ON_BAILOUT("v8::Object::Delete()", return false);
HandleScope scope;
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
bool v8::Object::Has(v8::Handle<String> key) {
+ ENTER_V8;
ON_BAILOUT("v8::Object::Has()", return false);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
bool v8::Object::Delete(uint32_t index) {
+ ENTER_V8;
ON_BAILOUT("v8::Object::DeleteProperty()", return false);
HandleScope scope;
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
bool v8::Object::Has(uint32_t index) {
+ ENTER_V8;
ON_BAILOUT("v8::Object::HasProperty()", return false);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
return self->HasElement(index);
bool v8::Object::HasRealNamedProperty(Handle<String> key) {
+ ENTER_V8;
ON_BAILOUT("v8::Object::HasRealNamedProperty()", return false);
return Utils::OpenHandle(this)->HasRealNamedProperty(
*Utils::OpenHandle(*key));
bool v8::Object::HasRealIndexedProperty(uint32_t index) {
+ ENTER_V8;
ON_BAILOUT("v8::Object::HasRealIndexedProperty()", return false);
return Utils::OpenHandle(this)->HasRealElementProperty(index);
}
bool v8::Object::HasRealNamedCallbackProperty(Handle<String> key) {
+ ENTER_V8;
ON_BAILOUT("v8::Object::HasRealNamedCallbackProperty()", return false);
return Utils::OpenHandle(this)->HasRealNamedCallbackProperty(
*Utils::OpenHandle(*key));
bool v8::Object::HasNamedLookupInterceptor() {
+ ENTER_V8;
ON_BAILOUT("v8::Object::HasNamedLookupInterceptor()", return false);
return Utils::OpenHandle(this)->HasNamedInterceptor();
}
bool v8::Object::HasIndexedLookupInterceptor() {
+ ENTER_V8;
ON_BAILOUT("v8::Object::HasIndexedLookupInterceptor()", return false);
return Utils::OpenHandle(this)->HasIndexedInterceptor();
}
Handle<Value> v8::Object::GetRealNamedPropertyInPrototypeChain(
Handle<String> key) {
+ ENTER_V8;
ON_BAILOUT("v8::Object::GetRealNamedPropertyInPrototypeChain()",
return Local<Value>());
i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this);
// Because the object gets a new map, existing inline cache caching
// the old map of this object will fail.
void v8::Object::TurnOnAccessCheck() {
+ ENTER_V8;
ON_BAILOUT("v8::Object::TurnOnAccessCheck()", return);
i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
Local<v8::Object> v8::Object::Clone() {
+ ENTER_V8;
ON_BAILOUT("v8::Object::Clone()", return Local<Object>());
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
EXCEPTION_PREAMBLE();
int v8::Object::GetIdentityHash() {
+ ENTER_V8;
ON_BAILOUT("v8::Object::GetIdentityHash()", return 0);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::Object> hidden_props(i::GetHiddenProperties(self, true));
bool v8::Object::SetHiddenValue(v8::Handle<v8::String> key,
v8::Handle<v8::Value> value) {
+ ENTER_V8;
ON_BAILOUT("v8::Object::SetHiddenValue()", return false);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::Object> hidden_props(i::GetHiddenProperties(self, true));
v8::Local<v8::Value> v8::Object::GetHiddenValue(v8::Handle<v8::String> key) {
+ ENTER_V8;
ON_BAILOUT("v8::Object::GetHiddenValue()", return Local<v8::Value>());
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::Object> hidden_props(i::GetHiddenProperties(self, false));
bool v8::Object::DeleteHiddenValue(v8::Handle<v8::String> key) {
+ ENTER_V8;
ON_BAILOUT("v8::DeleteHiddenValue()", return false);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::JSObject> hidden_props(
Local<v8::Object> Function::NewInstance(int argc,
v8::Handle<v8::Value> argv[]) const {
+ ENTER_V8;
ON_BAILOUT("v8::Function::NewInstance()", return Local<v8::Object>());
LOG_API("Function::NewInstance");
HandleScope scope;
Local<v8::Value> Function::Call(v8::Handle<v8::Object> recv, int argc,
v8::Handle<v8::Value> argv[]) {
+ ENTER_V8;
ON_BAILOUT("v8::Function::Call()", return Local<v8::Value>());
LOG_API("Function::Call");
i::Object* raw_result = NULL;
void Function::SetName(v8::Handle<v8::String> name) {
+ ENTER_V8;
i::Handle<i::JSFunction> func = Utils::OpenHandle(this);
func->shared()->set_name(*Utils::OpenHandle(*name));
}
int String::Length() const {
+ ENTER_V8;
if (IsDeadCheck("v8::String::Length()")) return 0;
return Utils::OpenHandle(this)->length();
}
int String::Utf8Length() const {
+ ENTER_V8;
if (IsDeadCheck("v8::String::Utf8Length()")) return 0;
return Utils::OpenHandle(this)->Utf8Length();
}
int String::WriteUtf8(char* buffer, int capacity) const {
+ ENTER_V8;
if (IsDeadCheck("v8::String::WriteUtf8()")) return 0;
LOG_API("String::WriteUtf8");
i::Handle<i::String> str = Utils::OpenHandle(this);
int String::WriteAscii(char* buffer, int start, int length) const {
+ ENTER_V8;
if (IsDeadCheck("v8::String::WriteAscii()")) return 0;
LOG_API("String::WriteAscii");
ASSERT(start >= 0 && length >= -1);
int String::Write(uint16_t* buffer, int start, int length) const {
+ ENTER_V8;
if (IsDeadCheck("v8::String::Write()")) return 0;
LOG_API("String::Write");
ASSERT(start >= 0 && length >= -1);
bool v8::String::IsExternal() const {
+ ENTER_V8;
EnsureInitialized("v8::String::IsExternal()");
i::Handle<i::String> str = Utils::OpenHandle(this);
return i::StringShape(*str).IsExternalTwoByte();
bool v8::String::IsExternalAscii() const {
+ ENTER_V8;
EnsureInitialized("v8::String::IsExternalAscii()");
i::Handle<i::String> str = Utils::OpenHandle(this);
return i::StringShape(*str).IsExternalAscii();
v8::String::ExternalStringResource*
v8::String::GetExternalStringResource() const {
+ ENTER_V8;
EnsureInitialized("v8::String::GetExternalStringResource()");
i::Handle<i::String> str = Utils::OpenHandle(this);
ASSERT(str->IsExternalTwoByteString());
v8::String::ExternalAsciiStringResource*
v8::String::GetExternalAsciiStringResource() const {
+ ENTER_V8;
EnsureInitialized("v8::String::GetExternalAsciiStringResource()");
i::Handle<i::String> str = Utils::OpenHandle(this);
ASSERT(str->IsExternalAsciiString());
double Number::Value() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Number::Value()")) return 0;
i::Handle<i::Object> obj = Utils::OpenHandle(this);
return obj->Number();
bool Boolean::Value() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Boolean::Value()")) return false;
i::Handle<i::Object> obj = Utils::OpenHandle(this);
return obj->IsTrue();
int64_t Integer::Value() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Integer::Value()")) return 0;
i::Handle<i::Object> obj = Utils::OpenHandle(this);
if (obj->IsSmi()) {
int32_t Int32::Value() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Int32::Value()")) return 0;
i::Handle<i::Object> obj = Utils::OpenHandle(this);
if (obj->IsSmi()) {
int v8::Object::InternalFieldCount() {
+ ENTER_V8;
if (IsDeadCheck("v8::Object::InternalFieldCount()")) return 0;
i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
return obj->GetInternalFieldCount();
Local<Value> v8::Object::GetInternalField(int index) {
+ ENTER_V8;
if (IsDeadCheck("v8::Object::GetInternalField()")) return Local<Value>();
i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
if (!ApiCheck(index < obj->GetInternalFieldCount(),
void v8::Object::SetInternalField(int index, v8::Handle<Value> value) {
+ ENTER_V8;
if (IsDeadCheck("v8::Object::SetInternalField()")) return;
i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
if (!ApiCheck(index < obj->GetInternalFieldCount(),
void v8::Context::SetSecurityToken(Handle<Value> token) {
+ ENTER_V8;
if (IsDeadCheck("v8::Context::SetSecurityToken()")) return;
i::Handle<i::Context> env = Utils::OpenHandle(this);
i::Handle<i::Object> token_handle = Utils::OpenHandle(*token);
void v8::Context::UseDefaultSecurityToken() {
+ ENTER_V8;
if (IsDeadCheck("v8::Context::UseDefaultSecurityToken()")) return;
i::Handle<i::Context> env = Utils::OpenHandle(this);
env->set_security_token(env->global());
Handle<Value> v8::Context::GetSecurityToken() {
+ ENTER_V8;
if (IsDeadCheck("v8::Context::GetSecurityToken()")) return Handle<Value>();
i::Handle<i::Context> env = Utils::OpenHandle(this);
i::Object* security_token = env->security_token();
v8::Local<v8::Context> Context::GetEntered() {
+ ENTER_V8;
if (IsDeadCheck("v8::Context::GetEntered()")) return Local<Context>();
i::Handle<i::Object> last = thread_local.LastEnteredContext();
if (last.is_null()) return Local<Context>();
v8::Local<v8::Context> Context::GetCurrent() {
+ ENTER_V8;
if (IsDeadCheck("v8::Context::GetCurrent()")) return Local<Context>();
i::Handle<i::Context> context(i::Top::global_context());
return Utils::ToLocal(context);
v8::Local<v8::Object> Context::Global() {
+ ENTER_V8;
if (IsDeadCheck("v8::Context::Global()")) return Local<v8::Object>();
i::Object** ctx = reinterpret_cast<i::Object**>(this);
i::Handle<i::Context> context =
void Context::DetachGlobal() {
+ ENTER_V8;
if (IsDeadCheck("v8::Context::DetachGlobal()")) return;
i::Object** ctx = reinterpret_cast<i::Object**>(this);
i::Handle<i::Context> context =
Local<v8::Object> ObjectTemplate::NewInstance() {
+ ENTER_V8;
ON_BAILOUT("v8::ObjectTemplate::NewInstance()", return Local<v8::Object>());
LOG_API("ObjectTemplate::NewInstance");
EXCEPTION_PREAMBLE();
Local<v8::Function> FunctionTemplate::GetFunction() {
+ ENTER_V8;
ON_BAILOUT("v8::FunctionTemplate::GetFunction()",
return Local<v8::Function>());
LOG_API("FunctionTemplate::GetFunction");
bool FunctionTemplate::HasInstance(v8::Handle<v8::Value> value) {
+ ENTER_V8;
ON_BAILOUT("v8::FunctionTemplate::HasInstanceOf()", return false);
i::Object* obj = *Utils::OpenHandle(*value);
return obj->IsInstanceOf(*Utils::OpenHandle(this));
Local<Value> v8::External::Wrap(void* data) {
+ ENTER_V8;
STATIC_ASSERT(sizeof(data) == sizeof(i::Address));
LOG_API("External::Wrap");
EnsureInitialized("v8::External::Wrap()");
void* v8::External::Unwrap(v8::Handle<v8::Value> value) {
+ ENTER_V8;
if (IsDeadCheck("v8::External::Unwrap()")) return 0;
i::Handle<i::Object> obj = Utils::OpenHandle(*value);
if (obj->IsSmi()) {
Local<External> v8::External::New(void* data) {
+ ENTER_V8;
STATIC_ASSERT(sizeof(data) == sizeof(i::Address));
LOG_API("External::New");
EnsureInitialized("v8::External::New()");
void* External::Value() const {
+ ENTER_V8;
if (IsDeadCheck("v8::External::Value()")) return 0;
i::Handle<i::Object> obj = Utils::OpenHandle(this);
return ExternalValueImpl(obj);
Local<String> v8::String::Empty() {
+ ENTER_V8;
EnsureInitialized("v8::String::Empty()");
LOG_API("String::Empty()");
return Utils::ToLocal(i::Factory::empty_symbol());
Local<String> v8::String::NewUndetectable(const char* data, int length) {
+ ENTER_V8;
EnsureInitialized("v8::String::NewUndetectable()");
LOG_API("String::NewUndetectable(char)");
if (length == -1) length = strlen(data);
Local<String> v8::String::New(const uint16_t* data, int length) {
+ ENTER_V8;
EnsureInitialized("v8::String::New()");
LOG_API("String::New(uint16_)");
if (length == 0) return Empty();
Local<String> v8::String::NewUndetectable(const uint16_t* data, int length) {
+ ENTER_V8;
EnsureInitialized("v8::String::NewUndetectable()");
LOG_API("String::NewUndetectable(uint16_)");
if (length == -1) length = TwoByteStringLength(data);
static void DisposeExternalString(v8::Persistent<v8::Value> obj,
void* parameter) {
+ ENTER_V8;
i::ExternalTwoByteString* str =
i::ExternalTwoByteString::cast(*Utils::OpenHandle(*obj));
static void DisposeExternalAsciiString(v8::Persistent<v8::Value> obj,
void* parameter) {
+ ENTER_V8;
i::ExternalAsciiString* str =
i::ExternalAsciiString::cast(*Utils::OpenHandle(*obj));
Local<String> v8::String::NewExternal(
v8::String::ExternalStringResource* resource) {
+ ENTER_V8;
EnsureInitialized("v8::String::NewExternal()");
LOG_API("String::NewExternal");
const size_t total_size = resource->length() * sizeof(*resource->data());
bool v8::String::MakeExternal(v8::String::ExternalStringResource* resource) {
+ ENTER_V8;
if (IsDeadCheck("v8::String::MakeExternal()")) return false;
if (this->IsExternal()) return false; // Already an external string.
i::Handle <i::String> obj = Utils::OpenHandle(this);
Local<String> v8::String::NewExternal(
v8::String::ExternalAsciiStringResource* resource) {
+ ENTER_V8;
EnsureInitialized("v8::String::NewExternal()");
LOG_API("String::NewExternal");
const size_t total_size = resource->length() * sizeof(*resource->data());
bool v8::String::MakeExternal(
v8::String::ExternalAsciiStringResource* resource) {
+ ENTER_V8;
if (IsDeadCheck("v8::String::MakeExternal()")) return false;
if (this->IsExternal()) return false; // Already an external string.
i::Handle <i::String> obj = Utils::OpenHandle(this);
Local<v8::Object> v8::Object::New() {
+ ENTER_V8;
EnsureInitialized("v8::Object::New()");
LOG_API("Object::New");
i::Handle<i::JSObject> obj =
Local<v8::Value> v8::Date::New(double time) {
+ ENTER_V8;
EnsureInitialized("v8::Date::New()");
LOG_API("Date::New");
EXCEPTION_PREAMBLE();
double v8::Date::NumberValue() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Date::NumberValue()")) return 0;
LOG_API("Date::NumberValue");
i::Handle<i::Object> obj = Utils::OpenHandle(this);
Local<v8::Array> v8::Array::New(int length) {
+ ENTER_V8;
EnsureInitialized("v8::Array::New()");
LOG_API("Array::New");
i::Handle<i::JSArray> obj = i::Factory::NewJSArray(length);
uint32_t v8::Array::Length() const {
+ ENTER_V8;
if (IsDeadCheck("v8::Array::Length()")) return 0;
i::Handle<i::JSArray> obj = Utils::OpenHandle(this);
i::Object* length = obj->length();
Local<String> v8::String::NewSymbol(const char* data, int length) {
+ ENTER_V8;
EnsureInitialized("v8::String::NewSymbol()");
LOG_API("String::NewSymbol(char)");
if (length == -1) length = strlen(data);
Local<Number> v8::Number::New(double value) {
+ ENTER_V8;
EnsureInitialized("v8::Number::New()");
i::Handle<i::Object> result = i::Factory::NewNumber(value);
return Utils::NumberToLocal(result);
Local<Integer> v8::Integer::New(int32_t value) {
+ ENTER_V8;
EnsureInitialized("v8::Integer::New()");
if (i::Smi::IsValid(value)) {
return Utils::IntegerToLocal(i::Handle<i::Object>(i::Smi::FromInt(value)));
bool V8::AddMessageListener(MessageCallback that, Handle<Value> data) {
+ ENTER_V8;
EnsureInitialized("v8::V8::AddMessageListener()");
ON_BAILOUT("v8::V8::AddMessageListener()", return false);
HandleScope scope;
void V8::RemoveMessageListeners(MessageCallback that) {
+ ENTER_V8;
EnsureInitialized("v8::V8::RemoveMessageListener()");
ON_BAILOUT("v8::V8::RemoveMessageListeners()", return);
HandleScope scope;
void V8::SetCounterFunction(CounterLookupCallback callback) {
+ ENTER_V8;
if (IsDeadCheck("v8::V8::SetCounterFunction()")) return;
i::StatsTable::SetCounterFunction(callback);
}
void V8::SetCreateHistogramFunction(CreateHistogramCallback callback) {
+ ENTER_V8;
if (IsDeadCheck("v8::V8::SetCreateHistogramFunction()")) return;
i::StatsTable::SetCreateHistogramFunction(callback);
}
void V8::SetAddHistogramSampleFunction(AddHistogramSampleCallback callback) {
+ ENTER_V8;
if (IsDeadCheck("v8::V8::SetAddHistogramSampleFunction()")) return;
i::StatsTable::SetAddHistogramSampleFunction(callback);
}
void V8::EnableSlidingStateWindow() {
+ ENTER_V8;
if (IsDeadCheck("v8::V8::EnableSlidingStateWindow()")) return;
i::Logger::EnableSlidingStateWindow();
}
void V8::SetFailedAccessCheckCallbackFunction(
FailedAccessCheckCallback callback) {
+ ENTER_V8;
if (IsDeadCheck("v8::V8::SetFailedAccessCheckCallbackFunction()")) return;
i::Top::SetFailedAccessCheckCallback(callback);
}
void V8::AddObjectGroup(Persistent<Value>* objects, size_t length) {
+ ENTER_V8;
if (IsDeadCheck("v8::V8::AddObjectGroup()")) return;
STATIC_ASSERT(sizeof(Persistent<Value>) == sizeof(i::Object**));
i::GlobalHandles::AddGroup(reinterpret_cast<i::Object***>(objects), length);
int V8::AdjustAmountOfExternalAllocatedMemory(int change_in_bytes) {
+ ENTER_V8;
if (IsDeadCheck("v8::V8::AdjustAmountOfExternalAllocatedMemory()")) return 0;
return i::Heap::AdjustAmountOfExternalAllocatedMemory(change_in_bytes);
}
void V8::SetGlobalGCPrologueCallback(GCCallback callback) {
+ ENTER_V8;
if (IsDeadCheck("v8::V8::SetGlobalGCPrologueCallback()")) return;
i::Heap::SetGlobalGCPrologueCallback(callback);
}
void V8::SetGlobalGCEpilogueCallback(GCCallback callback) {
+ ENTER_V8;
if (IsDeadCheck("v8::V8::SetGlobalGCEpilogueCallback()")) return;
i::Heap::SetGlobalGCEpilogueCallback(callback);
}
String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj) {
+ ENTER_V8;
EnsureInitialized("v8::String::Utf8Value::Utf8Value()");
if (obj.IsEmpty()) {
str_ = NULL;
String::AsciiValue::AsciiValue(v8::Handle<v8::Value> obj) {
+ ENTER_V8;
EnsureInitialized("v8::String::AsciiValue::AsciiValue()");
if (obj.IsEmpty()) {
str_ = NULL;
String::Value::Value(v8::Handle<v8::Value> obj) {
+ ENTER_V8;
EnsureInitialized("v8::String::Value::Value()");
if (obj.IsEmpty()) {
str_ = NULL;
}
Local<Value> Exception::RangeError(v8::Handle<v8::String> raw_message) {
+ ENTER_V8;
LOG_API("RangeError");
ON_BAILOUT("v8::Exception::RangeError()", return Local<Value>());
i::Object* error;
}
Local<Value> Exception::ReferenceError(v8::Handle<v8::String> raw_message) {
+ ENTER_V8;
LOG_API("ReferenceError");
ON_BAILOUT("v8::Exception::ReferenceError()", return Local<Value>());
i::Object* error;
}
Local<Value> Exception::SyntaxError(v8::Handle<v8::String> raw_message) {
+ ENTER_V8;
LOG_API("SyntaxError");
ON_BAILOUT("v8::Exception::SyntaxError()", return Local<Value>());
i::Object* error;
}
Local<Value> Exception::TypeError(v8::Handle<v8::String> raw_message) {
+ ENTER_V8;
LOG_API("TypeError");
ON_BAILOUT("v8::Exception::TypeError()", return Local<Value>());
i::Object* error;
}
Local<Value> Exception::Error(v8::Handle<v8::String> raw_message) {
+ ENTER_V8;
LOG_API("Error");
ON_BAILOUT("v8::Exception::Error()", return Local<Value>());
i::Object* error;
bool Debug::SetDebugEventListener(DebugEventCallback that, Handle<Value> data) {
+ ENTER_V8;
EnsureInitialized("v8::Debug::SetDebugEventListener()");
ON_BAILOUT("v8::Debug::SetDebugEventListener()", return false);
HandleScope scope;
bool Debug::SetDebugEventListener(v8::Handle<v8::Object> that,
Handle<Value> data) {
+ ENTER_V8;
ON_BAILOUT("v8::Debug::SetDebugEventListener()", return false);
i::Debugger::SetEventListener(Utils::OpenHandle(*that),
Utils::OpenHandle(*data));
void Debug::SetMessageHandler(v8::DebugMessageHandler handler, void* data,
bool message_handler_thread) {
+ ENTER_V8;
EnsureInitialized("v8::Debug::SetMessageHandler");
i::Debugger::SetMessageHandler(handler, data, message_handler_thread);
}
void Debug::SetHostDispatchHandler(v8::DebugHostDispatchHandler handler,
void* data) {
+ ENTER_V8;
EnsureInitialized("v8::Debug::SetHostDispatchHandler");
i::Debugger::SetHostDispatchHandler(handler, data);
}
Handle<Value> Debug::Call(v8::Handle<v8::Function> fun,
v8::Handle<v8::Value> data) {
+ ENTER_V8;
if (!i::V8::HasBeenSetup()) return Handle<Value>();
ON_BAILOUT("v8::Debug::Call()", return Handle<Value>());
i::Handle<i::Object> result;