Commit c7b3ef0e authored by yurys@chromium.org's avatar yurys@chromium.org

Make sure ExternalCallbackScope is always created when VM state changes to EXTERNAL

ExternalCallbackScope is used to let CPU profiler know which API callback is being executed. Whenever such callback is called we should create VMState<ETERNAL> and ExternalCallbackScope. This patch fixes several places where VMState<ETERNAL> went without ExternalCallbackScope.

BUG=244580
R=dcarney@chromium.org, svenpanne@chromium.org

Review URL: https://codereview.chromium.org/17059005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15249 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 6ae544ec
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include "v8.h" #include "v8.h"
#include "arguments.h" #include "arguments.h"
#include "vm-state-inl.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
...@@ -90,6 +92,8 @@ v8::Handle<v8::Value> FunctionCallbackArguments::Call(InvocationCallback f) { ...@@ -90,6 +92,8 @@ v8::Handle<v8::Value> FunctionCallbackArguments::Call(InvocationCallback f) {
Isolate* isolate = this->isolate(); Isolate* isolate = this->isolate();
void* f_as_void = CallbackTable::FunctionToVoidPtr(f); void* f_as_void = CallbackTable::FunctionToVoidPtr(f);
bool new_style = CallbackTable::ReturnsVoid(isolate, f_as_void); bool new_style = CallbackTable::ReturnsVoid(isolate, f_as_void);
VMState<EXTERNAL> state(isolate);
ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
if (new_style) { if (new_style) {
FunctionCallback c = reinterpret_cast<FunctionCallback>(f); FunctionCallback c = reinterpret_cast<FunctionCallback>(f);
FunctionCallbackInfo<v8::Value> info(end(), FunctionCallbackInfo<v8::Value> info(end(),
...@@ -114,6 +118,8 @@ v8::Handle<ReturnValue> PropertyCallbackArguments::Call(OldFunction f) { \ ...@@ -114,6 +118,8 @@ v8::Handle<ReturnValue> PropertyCallbackArguments::Call(OldFunction f) { \
Isolate* isolate = this->isolate(); \ Isolate* isolate = this->isolate(); \
void* f_as_void = CallbackTable::FunctionToVoidPtr(f); \ void* f_as_void = CallbackTable::FunctionToVoidPtr(f); \
bool new_style = CallbackTable::ReturnsVoid(isolate, f_as_void); \ bool new_style = CallbackTable::ReturnsVoid(isolate, f_as_void); \
VMState<EXTERNAL> state(isolate); \
ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \
if (new_style) { \ if (new_style) { \
NewFunction c = reinterpret_cast<NewFunction>(f); \ NewFunction c = reinterpret_cast<NewFunction>(f); \
PropertyCallbackInfo<ReturnValue> info(end()); \ PropertyCallbackInfo<ReturnValue> info(end()); \
...@@ -132,6 +138,8 @@ v8::Handle<ReturnValue> PropertyCallbackArguments::Call(OldFunction f, \ ...@@ -132,6 +138,8 @@ v8::Handle<ReturnValue> PropertyCallbackArguments::Call(OldFunction f, \
Isolate* isolate = this->isolate(); \ Isolate* isolate = this->isolate(); \
void* f_as_void = CallbackTable::FunctionToVoidPtr(f); \ void* f_as_void = CallbackTable::FunctionToVoidPtr(f); \
bool new_style = CallbackTable::ReturnsVoid(isolate, f_as_void); \ bool new_style = CallbackTable::ReturnsVoid(isolate, f_as_void); \
VMState<EXTERNAL> state(isolate); \
ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \
if (new_style) { \ if (new_style) { \
NewFunction c = reinterpret_cast<NewFunction>(f); \ NewFunction c = reinterpret_cast<NewFunction>(f); \
PropertyCallbackInfo<ReturnValue> info(end()); \ PropertyCallbackInfo<ReturnValue> info(end()); \
...@@ -151,6 +159,8 @@ v8::Handle<ReturnValue> PropertyCallbackArguments::Call(OldFunction f, \ ...@@ -151,6 +159,8 @@ v8::Handle<ReturnValue> PropertyCallbackArguments::Call(OldFunction f, \
Isolate* isolate = this->isolate(); \ Isolate* isolate = this->isolate(); \
void* f_as_void = CallbackTable::FunctionToVoidPtr(f); \ void* f_as_void = CallbackTable::FunctionToVoidPtr(f); \
bool new_style = CallbackTable::ReturnsVoid(isolate, f_as_void); \ bool new_style = CallbackTable::ReturnsVoid(isolate, f_as_void); \
VMState<EXTERNAL> state(isolate); \
ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \
if (new_style) { \ if (new_style) { \
NewFunction c = reinterpret_cast<NewFunction>(f); \ NewFunction c = reinterpret_cast<NewFunction>(f); \
PropertyCallbackInfo<ReturnValue> info(end()); \ PropertyCallbackInfo<ReturnValue> info(end()); \
...@@ -170,6 +180,8 @@ void PropertyCallbackArguments::Call(OldFunction f, \ ...@@ -170,6 +180,8 @@ void PropertyCallbackArguments::Call(OldFunction f, \
Isolate* isolate = this->isolate(); \ Isolate* isolate = this->isolate(); \
void* f_as_void = CallbackTable::FunctionToVoidPtr(f); \ void* f_as_void = CallbackTable::FunctionToVoidPtr(f); \
bool new_style = CallbackTable::ReturnsVoid(isolate, f_as_void); \ bool new_style = CallbackTable::ReturnsVoid(isolate, f_as_void); \
VMState<EXTERNAL> state(isolate); \
ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \
if (new_style) { \ if (new_style) { \
NewFunction c = reinterpret_cast<NewFunction>(f); \ NewFunction c = reinterpret_cast<NewFunction>(f); \
PropertyCallbackInfo<ReturnValue> info(end()); \ PropertyCallbackInfo<ReturnValue> info(end()); \
......
...@@ -1267,14 +1267,7 @@ MUST_USE_RESULT static MaybeObject* HandleApiCallHelper( ...@@ -1267,14 +1267,7 @@ MUST_USE_RESULT static MaybeObject* HandleApiCallHelper(
args.length() - 1, args.length() - 1,
is_construct); is_construct);
v8::Handle<v8::Value> value; v8::Handle<v8::Value> value = custom.Call(callback);
{
// Leaving JavaScript.
VMState<EXTERNAL> state(isolate);
ExternalCallbackScope call_scope(isolate,
v8::ToCData<Address>(callback_obj));
value = custom.Call(callback);
}
if (value.IsEmpty()) { if (value.IsEmpty()) {
result = heap->undefined_value(); result = heap->undefined_value();
} else { } else {
...@@ -1343,14 +1336,7 @@ MUST_USE_RESULT static MaybeObject* HandleApiCallAsFunctionOrConstructor( ...@@ -1343,14 +1336,7 @@ MUST_USE_RESULT static MaybeObject* HandleApiCallAsFunctionOrConstructor(
&args[0] - 1, &args[0] - 1,
args.length() - 1, args.length() - 1,
is_construct_call); is_construct_call);
v8::Handle<v8::Value> value; v8::Handle<v8::Value> value = custom.Call(callback);
{
// Leaving JavaScript.
VMState<EXTERNAL> state(isolate);
ExternalCallbackScope call_scope(isolate,
v8::ToCData<Address>(callback_obj));
value = custom.Call(callback);
}
if (value.IsEmpty()) { if (value.IsEmpty()) {
result = heap->undefined_value(); result = heap->undefined_value();
} else { } else {
......
...@@ -557,11 +557,7 @@ v8::Handle<v8::Array> GetKeysForNamedInterceptor(Handle<JSReceiver> receiver, ...@@ -557,11 +557,7 @@ v8::Handle<v8::Array> GetKeysForNamedInterceptor(Handle<JSReceiver> receiver,
v8::NamedPropertyEnumerator enum_fun = v8::NamedPropertyEnumerator enum_fun =
v8::ToCData<v8::NamedPropertyEnumerator>(interceptor->enumerator()); v8::ToCData<v8::NamedPropertyEnumerator>(interceptor->enumerator());
LOG(isolate, ApiObjectAccess("interceptor-named-enum", *object)); LOG(isolate, ApiObjectAccess("interceptor-named-enum", *object));
{ result = args.Call(enum_fun);
// Leaving JavaScript.
VMState<EXTERNAL> state(isolate);
result = args.Call(enum_fun);
}
} }
#if ENABLE_EXTRA_CHECKS #if ENABLE_EXTRA_CHECKS
CHECK(result.IsEmpty() || v8::Utils::OpenHandle(*result)->IsJSObject()); CHECK(result.IsEmpty() || v8::Utils::OpenHandle(*result)->IsJSObject());
...@@ -583,14 +579,10 @@ v8::Handle<v8::Array> GetKeysForIndexedInterceptor(Handle<JSReceiver> receiver, ...@@ -583,14 +579,10 @@ v8::Handle<v8::Array> GetKeysForIndexedInterceptor(Handle<JSReceiver> receiver,
v8::IndexedPropertyEnumerator enum_fun = v8::IndexedPropertyEnumerator enum_fun =
v8::ToCData<v8::IndexedPropertyEnumerator>(interceptor->enumerator()); v8::ToCData<v8::IndexedPropertyEnumerator>(interceptor->enumerator());
LOG(isolate, ApiObjectAccess("interceptor-indexed-enum", *object)); LOG(isolate, ApiObjectAccess("interceptor-indexed-enum", *object));
{ result = args.Call(enum_fun);
// Leaving JavaScript.
VMState<EXTERNAL> state(isolate);
result = args.Call(enum_fun);
#if ENABLE_EXTRA_CHECKS #if ENABLE_EXTRA_CHECKS
CHECK(result.IsEmpty() || v8::Utils::OpenHandle(*result)->IsJSObject()); CHECK(result.IsEmpty() || v8::Utils::OpenHandle(*result)->IsJSObject());
#endif #endif
}
} }
return v8::Local<v8::Array>::New(reinterpret_cast<v8::Isolate*>(isolate), return v8::Local<v8::Array>::New(reinterpret_cast<v8::Isolate*>(isolate),
result); result);
......
...@@ -47,7 +47,6 @@ ...@@ -47,7 +47,6 @@
#include "safepoint-table.h" #include "safepoint-table.h"
#include "string-stream.h" #include "string-stream.h"
#include "utils.h" #include "utils.h"
#include "vm-state-inl.h"
#ifdef ENABLE_DISASSEMBLER #ifdef ENABLE_DISASSEMBLER
#include "disasm.h" #include "disasm.h"
...@@ -375,14 +374,8 @@ MaybeObject* JSObject::GetPropertyWithCallback(Object* receiver, ...@@ -375,14 +374,8 @@ MaybeObject* JSObject::GetPropertyWithCallback(Object* receiver,
Handle<String> key(String::cast(name)); Handle<String> key(String::cast(name));
LOG(isolate, ApiNamedPropertyAccess("load", self, name)); LOG(isolate, ApiNamedPropertyAccess("load", self, name));
PropertyCallbackArguments args(isolate, data->data(), self, this); PropertyCallbackArguments args(isolate, data->data(), self, this);
v8::Handle<v8::Value> result; v8::Handle<v8::Value> result =
{ args.Call(call_fun, v8::Utils::ToLocal(key));
// Leaving JavaScript.
VMState<EXTERNAL> state(isolate);
ExternalCallbackScope call_scope(isolate,
v8::ToCData<Address>(fun_obj));
result = args.Call(call_fun, v8::Utils::ToLocal(key));
}
RETURN_IF_SCHEDULED_EXCEPTION(isolate); RETURN_IF_SCHEDULED_EXCEPTION(isolate);
if (result.IsEmpty()) { if (result.IsEmpty()) {
return isolate->heap()->undefined_value(); return isolate->heap()->undefined_value();
...@@ -2736,18 +2729,13 @@ MaybeObject* JSObject::SetPropertyWithInterceptor( ...@@ -2736,18 +2729,13 @@ MaybeObject* JSObject::SetPropertyWithInterceptor(
PropertyCallbackArguments args(isolate, interceptor->data(), this, this); PropertyCallbackArguments args(isolate, interceptor->data(), this, this);
v8::NamedPropertySetter setter = v8::NamedPropertySetter setter =
v8::ToCData<v8::NamedPropertySetter>(interceptor->setter()); v8::ToCData<v8::NamedPropertySetter>(interceptor->setter());
v8::Handle<v8::Value> result; Handle<Object> value_unhole(value->IsTheHole() ?
{ isolate->heap()->undefined_value() :
// Leaving JavaScript. value,
VMState<EXTERNAL> state(isolate); isolate);
Handle<Object> value_unhole(value->IsTheHole() ? v8::Handle<v8::Value> result = args.Call(setter,
isolate->heap()->undefined_value() : v8::Utils::ToLocal(name_handle),
value, v8::Utils::ToLocal(value_unhole));
isolate);
result = args.Call(setter,
v8::Utils::ToLocal(name_handle),
v8::Utils::ToLocal(value_unhole));
}
RETURN_IF_SCHEDULED_EXCEPTION(isolate); RETURN_IF_SCHEDULED_EXCEPTION(isolate);
if (!result.IsEmpty()) return *value_handle; if (!result.IsEmpty()) return *value_handle;
} }
...@@ -2846,17 +2834,11 @@ MaybeObject* JSObject::SetPropertyWithCallback(Object* structure, ...@@ -2846,17 +2834,11 @@ MaybeObject* JSObject::SetPropertyWithCallback(Object* structure,
if (call_fun == NULL) return value; if (call_fun == NULL) return value;
Handle<String> key(String::cast(name)); Handle<String> key(String::cast(name));
LOG(isolate, ApiNamedPropertyAccess("store", this, name)); LOG(isolate, ApiNamedPropertyAccess("store", this, name));
PropertyCallbackArguments PropertyCallbackArguments args(
args(isolate, data->data(), this, JSObject::cast(holder)); isolate, data->data(), this, JSObject::cast(holder));
{ args.Call(call_fun,
// Leaving JavaScript. v8::Utils::ToLocal(key),
VMState<EXTERNAL> state(isolate); v8::Utils::ToLocal(value_handle));
ExternalCallbackScope call_scope(isolate,
v8::ToCData<Address>(call_obj));
args.Call(call_fun,
v8::Utils::ToLocal(key),
v8::Utils::ToLocal(value_handle));
}
RETURN_IF_SCHEDULED_EXCEPTION(isolate); RETURN_IF_SCHEDULED_EXCEPTION(isolate);
return *value_handle; return *value_handle;
} }
...@@ -4187,12 +4169,8 @@ PropertyAttributes JSObject::GetPropertyAttributeWithInterceptor( ...@@ -4187,12 +4169,8 @@ PropertyAttributes JSObject::GetPropertyAttributeWithInterceptor(
v8::ToCData<v8::NamedPropertyQuery>(interceptor->query()); v8::ToCData<v8::NamedPropertyQuery>(interceptor->query());
LOG(isolate, LOG(isolate,
ApiNamedPropertyAccess("interceptor-named-has", *holder_handle, name)); ApiNamedPropertyAccess("interceptor-named-has", *holder_handle, name));
v8::Handle<v8::Integer> result; v8::Handle<v8::Integer> result =
{ args.Call(query, v8::Utils::ToLocal(name_handle));
// Leaving JavaScript.
VMState<EXTERNAL> state(isolate);
result = args.Call(query, v8::Utils::ToLocal(name_handle));
}
if (!result.IsEmpty()) { if (!result.IsEmpty()) {
ASSERT(result->IsInt32()); ASSERT(result->IsInt32());
return static_cast<PropertyAttributes>(result->Int32Value()); return static_cast<PropertyAttributes>(result->Int32Value());
...@@ -4202,12 +4180,8 @@ PropertyAttributes JSObject::GetPropertyAttributeWithInterceptor( ...@@ -4202,12 +4180,8 @@ PropertyAttributes JSObject::GetPropertyAttributeWithInterceptor(
v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter()); v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter());
LOG(isolate, LOG(isolate,
ApiNamedPropertyAccess("interceptor-named-get-has", this, name)); ApiNamedPropertyAccess("interceptor-named-get-has", this, name));
v8::Handle<v8::Value> result; v8::Handle<v8::Value> result =
{ args.Call(getter, v8::Utils::ToLocal(name_handle));
// Leaving JavaScript.
VMState<EXTERNAL> state(isolate);
result = args.Call(getter, v8::Utils::ToLocal(name_handle));
}
if (!result.IsEmpty()) return DONT_ENUM; if (!result.IsEmpty()) return DONT_ENUM;
} }
return holder_handle->GetPropertyAttributePostInterceptor(*receiver_handle, return holder_handle->GetPropertyAttributePostInterceptor(*receiver_handle,
...@@ -4327,12 +4301,7 @@ PropertyAttributes JSObject::GetElementAttributeWithInterceptor( ...@@ -4327,12 +4301,7 @@ PropertyAttributes JSObject::GetElementAttributeWithInterceptor(
v8::ToCData<v8::IndexedPropertyQuery>(interceptor->query()); v8::ToCData<v8::IndexedPropertyQuery>(interceptor->query());
LOG(isolate, LOG(isolate,
ApiIndexedPropertyAccess("interceptor-indexed-has", this, index)); ApiIndexedPropertyAccess("interceptor-indexed-has", this, index));
v8::Handle<v8::Integer> result; v8::Handle<v8::Integer> result = args.Call(query, index);
{
// Leaving JavaScript.
VMState<EXTERNAL> state(isolate);
result = args.Call(query, index);
}
if (!result.IsEmpty()) if (!result.IsEmpty())
return static_cast<PropertyAttributes>(result->Int32Value()); return static_cast<PropertyAttributes>(result->Int32Value());
} else if (!interceptor->getter()->IsUndefined()) { } else if (!interceptor->getter()->IsUndefined()) {
...@@ -4340,12 +4309,7 @@ PropertyAttributes JSObject::GetElementAttributeWithInterceptor( ...@@ -4340,12 +4309,7 @@ PropertyAttributes JSObject::GetElementAttributeWithInterceptor(
v8::ToCData<v8::IndexedPropertyGetter>(interceptor->getter()); v8::ToCData<v8::IndexedPropertyGetter>(interceptor->getter());
LOG(isolate, LOG(isolate,
ApiIndexedPropertyAccess("interceptor-indexed-get-has", this, index)); ApiIndexedPropertyAccess("interceptor-indexed-get-has", this, index));
v8::Handle<v8::Value> result; v8::Handle<v8::Value> result = args.Call(getter, index);
{
// Leaving JavaScript.
VMState<EXTERNAL> state(isolate);
result = args.Call(getter, index);
}
if (!result.IsEmpty()) return NONE; if (!result.IsEmpty()) return NONE;
} }
...@@ -5015,12 +4979,8 @@ MaybeObject* JSObject::DeletePropertyWithInterceptor(Name* name) { ...@@ -5015,12 +4979,8 @@ MaybeObject* JSObject::DeletePropertyWithInterceptor(Name* name) {
LOG(isolate, LOG(isolate,
ApiNamedPropertyAccess("interceptor-named-delete", *this_handle, name)); ApiNamedPropertyAccess("interceptor-named-delete", *this_handle, name));
PropertyCallbackArguments args(isolate, interceptor->data(), this, this); PropertyCallbackArguments args(isolate, interceptor->data(), this, this);
v8::Handle<v8::Boolean> result; v8::Handle<v8::Boolean> result =
{ args.Call(deleter, v8::Utils::ToLocal(name_handle));
// Leaving JavaScript.
VMState<EXTERNAL> state(isolate);
result = args.Call(deleter, v8::Utils::ToLocal(name_handle));
}
RETURN_IF_SCHEDULED_EXCEPTION(isolate); RETURN_IF_SCHEDULED_EXCEPTION(isolate);
if (!result.IsEmpty()) { if (!result.IsEmpty()) {
ASSERT(result->IsBoolean()); ASSERT(result->IsBoolean());
...@@ -5051,12 +5011,7 @@ MaybeObject* JSObject::DeleteElementWithInterceptor(uint32_t index) { ...@@ -5051,12 +5011,7 @@ MaybeObject* JSObject::DeleteElementWithInterceptor(uint32_t index) {
LOG(isolate, LOG(isolate,
ApiIndexedPropertyAccess("interceptor-indexed-delete", this, index)); ApiIndexedPropertyAccess("interceptor-indexed-delete", this, index));
PropertyCallbackArguments args(isolate, interceptor->data(), this, this); PropertyCallbackArguments args(isolate, interceptor->data(), this, this);
v8::Handle<v8::Boolean> result; v8::Handle<v8::Boolean> result = args.Call(deleter, index);
{
// Leaving JavaScript.
VMState<EXTERNAL> state(isolate);
result = args.Call(deleter, index);
}
RETURN_IF_SCHEDULED_EXCEPTION(isolate); RETURN_IF_SCHEDULED_EXCEPTION(isolate);
if (!result.IsEmpty()) { if (!result.IsEmpty()) {
ASSERT(result->IsBoolean()); ASSERT(result->IsBoolean());
...@@ -11464,12 +11419,8 @@ MaybeObject* JSObject::SetElementWithInterceptor(uint32_t index, ...@@ -11464,12 +11419,8 @@ MaybeObject* JSObject::SetElementWithInterceptor(uint32_t index,
LOG(isolate, LOG(isolate,
ApiIndexedPropertyAccess("interceptor-indexed-set", this, index)); ApiIndexedPropertyAccess("interceptor-indexed-set", this, index));
PropertyCallbackArguments args(isolate, interceptor->data(), this, this); PropertyCallbackArguments args(isolate, interceptor->data(), this, this);
v8::Handle<v8::Value> result; v8::Handle<v8::Value> result =
{ args.Call(setter, index, v8::Utils::ToLocal(value_handle));
// Leaving JavaScript.
VMState<EXTERNAL> state(isolate);
result = args.Call(setter, index, v8::Utils::ToLocal(value_handle));
}
RETURN_IF_SCHEDULED_EXCEPTION(isolate); RETURN_IF_SCHEDULED_EXCEPTION(isolate);
if (!result.IsEmpty()) return *value_handle; if (!result.IsEmpty()) return *value_handle;
} }
...@@ -11507,12 +11458,7 @@ MaybeObject* JSObject::GetElementWithCallback(Object* receiver, ...@@ -11507,12 +11458,7 @@ MaybeObject* JSObject::GetElementWithCallback(Object* receiver,
LOG(isolate, ApiNamedPropertyAccess("load", *self, *key)); LOG(isolate, ApiNamedPropertyAccess("load", *self, *key));
PropertyCallbackArguments PropertyCallbackArguments
args(isolate, data->data(), *self, *holder_handle); args(isolate, data->data(), *self, *holder_handle);
v8::Handle<v8::Value> result; v8::Handle<v8::Value> result = args.Call(call_fun, v8::Utils::ToLocal(key));
{
// Leaving JavaScript.
VMState<EXTERNAL> state(isolate);
result = args.Call(call_fun, v8::Utils::ToLocal(key));
}
RETURN_IF_SCHEDULED_EXCEPTION(isolate); RETURN_IF_SCHEDULED_EXCEPTION(isolate);
if (result.IsEmpty()) return isolate->heap()->undefined_value(); if (result.IsEmpty()) return isolate->heap()->undefined_value();
Handle<Object> result_internal = v8::Utils::OpenHandle(*result); Handle<Object> result_internal = v8::Utils::OpenHandle(*result);
...@@ -11574,13 +11520,9 @@ MaybeObject* JSObject::SetElementWithCallback(Object* structure, ...@@ -11574,13 +11520,9 @@ MaybeObject* JSObject::SetElementWithCallback(Object* structure,
LOG(isolate, ApiNamedPropertyAccess("store", *self, *key)); LOG(isolate, ApiNamedPropertyAccess("store", *self, *key));
PropertyCallbackArguments PropertyCallbackArguments
args(isolate, data->data(), *self, *holder_handle); args(isolate, data->data(), *self, *holder_handle);
{ args.Call(call_fun,
// Leaving JavaScript. v8::Utils::ToLocal(key),
VMState<EXTERNAL> state(isolate); v8::Utils::ToLocal(value_handle));
args.Call(call_fun,
v8::Utils::ToLocal(key),
v8::Utils::ToLocal(value_handle));
}
RETURN_IF_SCHEDULED_EXCEPTION(isolate); RETURN_IF_SCHEDULED_EXCEPTION(isolate);
return *value_handle; return *value_handle;
} }
...@@ -12480,12 +12422,7 @@ MaybeObject* JSObject::GetElementWithInterceptor(Object* receiver, ...@@ -12480,12 +12422,7 @@ MaybeObject* JSObject::GetElementWithInterceptor(Object* receiver,
ApiIndexedPropertyAccess("interceptor-indexed-get", this, index)); ApiIndexedPropertyAccess("interceptor-indexed-get", this, index));
PropertyCallbackArguments PropertyCallbackArguments
args(isolate, interceptor->data(), receiver, this); args(isolate, interceptor->data(), receiver, this);
v8::Handle<v8::Value> result; v8::Handle<v8::Value> result = args.Call(getter, index);
{
// Leaving JavaScript.
VMState<EXTERNAL> state(isolate);
result = args.Call(getter, index);
}
RETURN_IF_SCHEDULED_EXCEPTION(isolate); RETURN_IF_SCHEDULED_EXCEPTION(isolate);
if (!result.IsEmpty()) { if (!result.IsEmpty()) {
Handle<Object> result_internal = v8::Utils::OpenHandle(*result); Handle<Object> result_internal = v8::Utils::OpenHandle(*result);
...@@ -12790,12 +12727,8 @@ MaybeObject* JSObject::GetPropertyWithInterceptor( ...@@ -12790,12 +12727,8 @@ MaybeObject* JSObject::GetPropertyWithInterceptor(
ApiNamedPropertyAccess("interceptor-named-get", *holder_handle, name)); ApiNamedPropertyAccess("interceptor-named-get", *holder_handle, name));
PropertyCallbackArguments PropertyCallbackArguments
args(isolate, interceptor->data(), receiver, this); args(isolate, interceptor->data(), receiver, this);
v8::Handle<v8::Value> result; v8::Handle<v8::Value> result =
{ args.Call(getter, v8::Utils::ToLocal(name_handle));
// Leaving JavaScript.
VMState<EXTERNAL> state(isolate);
result = args.Call(getter, v8::Utils::ToLocal(name_handle));
}
RETURN_IF_SCHEDULED_EXCEPTION(isolate); RETURN_IF_SCHEDULED_EXCEPTION(isolate);
if (!result.IsEmpty()) { if (!result.IsEmpty()) {
*attributes = NONE; *attributes = NONE;
......
...@@ -1113,12 +1113,7 @@ RUNTIME_FUNCTION(MaybeObject*, StoreCallbackProperty) { ...@@ -1113,12 +1113,7 @@ RUNTIME_FUNCTION(MaybeObject*, StoreCallbackProperty) {
LOG(isolate, ApiNamedPropertyAccess("store", recv, *name)); LOG(isolate, ApiNamedPropertyAccess("store", recv, *name));
PropertyCallbackArguments PropertyCallbackArguments
custom_args(isolate, callback->data(), recv, recv); custom_args(isolate, callback->data(), recv, recv);
{ custom_args.Call(fun, v8::Utils::ToLocal(str), v8::Utils::ToLocal(value));
// Leaving JavaScript.
VMState<EXTERNAL> state(isolate);
ExternalCallbackScope call_scope(isolate, setter_address);
custom_args.Call(fun, v8::Utils::ToLocal(str), v8::Utils::ToLocal(value));
}
RETURN_IF_SCHEDULED_EXCEPTION(isolate); RETURN_IF_SCHEDULED_EXCEPTION(isolate);
return *value; return *value;
} }
...@@ -1164,12 +1159,8 @@ RUNTIME_FUNCTION(MaybeObject*, LoadPropertyWithInterceptorOnly) { ...@@ -1164,12 +1159,8 @@ RUNTIME_FUNCTION(MaybeObject*, LoadPropertyWithInterceptorOnly) {
{ {
// Use the interceptor getter. // Use the interceptor getter.
HandleScope scope(isolate); HandleScope scope(isolate);
v8::Handle<v8::Value> r; v8::Handle<v8::Value> r =
{ callback_args.Call(getter, v8::Utils::ToLocal(name));
// Leaving JavaScript.
VMState<EXTERNAL> state(isolate);
r = callback_args.Call(getter, v8::Utils::ToLocal(name));
}
RETURN_IF_SCHEDULED_EXCEPTION(isolate); RETURN_IF_SCHEDULED_EXCEPTION(isolate);
if (!r.IsEmpty()) { if (!r.IsEmpty()) {
Handle<Object> result = v8::Utils::OpenHandle(*r); Handle<Object> result = v8::Utils::OpenHandle(*r);
...@@ -1234,12 +1225,8 @@ static MaybeObject* LoadWithInterceptor(Arguments* args, ...@@ -1234,12 +1225,8 @@ static MaybeObject* LoadWithInterceptor(Arguments* args,
{ {
// Use the interceptor getter. // Use the interceptor getter.
HandleScope scope(isolate); HandleScope scope(isolate);
v8::Handle<v8::Value> r; v8::Handle<v8::Value> r =
{ callback_args.Call(getter, v8::Utils::ToLocal(name));
// Leaving JavaScript.
VMState<EXTERNAL> state(isolate);
r = callback_args.Call(getter, v8::Utils::ToLocal(name));
}
RETURN_IF_SCHEDULED_EXCEPTION(isolate); RETURN_IF_SCHEDULED_EXCEPTION(isolate);
if (!r.IsEmpty()) { if (!r.IsEmpty()) {
*attrs = NONE; *attrs = NONE;
......
...@@ -1074,7 +1074,7 @@ Handle<Value> TestFastReturnValues() { ...@@ -1074,7 +1074,7 @@ Handle<Value> TestFastReturnValues() {
return scope.Close(CompileRun("callback_object.callback()")); return scope.Close(CompileRun("callback_object.callback()"));
} }
THREADED_TEST(FastReturnValues) { THREADED_PROFILED_TEST(FastReturnValues) {
LocalContext env; LocalContext env;
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(v8::Isolate::GetCurrent());
v8::Handle<v8::Value> value; v8::Handle<v8::Value> value;
...@@ -2102,7 +2102,7 @@ void CheckThisNamedPropertyEnumerator( ...@@ -2102,7 +2102,7 @@ void CheckThisNamedPropertyEnumerator(
} }
THREADED_TEST(PropertyHandlerInPrototype) { THREADED_PROFILED_TEST(PropertyHandlerInPrototype) {
LocalContext env; LocalContext env;
v8::HandleScope scope(env->GetIsolate()); v8::HandleScope scope(env->GetIsolate());
...@@ -10757,7 +10757,7 @@ static void LoadICFastApi_DirectCall_GCMoveStub(Accessor accessor) { ...@@ -10757,7 +10757,7 @@ static void LoadICFastApi_DirectCall_GCMoveStub(Accessor accessor) {
CHECK_EQ(31, p_getter_count); CHECK_EQ(31, p_getter_count);
} }
THREADED_TEST(LoadICFastApi_DirectCall_GCMoveStub) { THREADED_PROFILED_TEST(LoadICFastApi_DirectCall_GCMoveStub) {
LoadICFastApi_DirectCall_GCMoveStub(DirectGetterCallback); LoadICFastApi_DirectCall_GCMoveStub(DirectGetterCallback);
} }
...@@ -10785,7 +10785,7 @@ THREADED_TEST(LoadICFastApi_DirectCall_Throw) { ...@@ -10785,7 +10785,7 @@ THREADED_TEST(LoadICFastApi_DirectCall_Throw) {
} }
THREADED_TEST(InterceptorCallICFastApi_TrivialSignature) { THREADED_PROFILED_TEST(InterceptorCallICFastApi_TrivialSignature) {
int interceptor_call_count = 0; int interceptor_call_count = 0;
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(v8::Isolate::GetCurrent());
v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(); v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
...@@ -10812,7 +10812,7 @@ THREADED_TEST(InterceptorCallICFastApi_TrivialSignature) { ...@@ -10812,7 +10812,7 @@ THREADED_TEST(InterceptorCallICFastApi_TrivialSignature) {
CHECK_EQ(100, interceptor_call_count); CHECK_EQ(100, interceptor_call_count);
} }
THREADED_TEST(InterceptorCallICFastApi_SimpleSignature) { THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature) {
int interceptor_call_count = 0; int interceptor_call_count = 0;
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(v8::Isolate::GetCurrent());
v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(); v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
...@@ -10843,7 +10843,7 @@ THREADED_TEST(InterceptorCallICFastApi_SimpleSignature) { ...@@ -10843,7 +10843,7 @@ THREADED_TEST(InterceptorCallICFastApi_SimpleSignature) {
CHECK_EQ(100, interceptor_call_count); CHECK_EQ(100, interceptor_call_count);
} }
THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss1) { THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss1) {
int interceptor_call_count = 0; int interceptor_call_count = 0;
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(v8::Isolate::GetCurrent());
v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(); v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
...@@ -10880,7 +10880,7 @@ THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss1) { ...@@ -10880,7 +10880,7 @@ THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss1) {
CHECK_GE(interceptor_call_count, 50); CHECK_GE(interceptor_call_count, 50);
} }
THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss2) { THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss2) {
int interceptor_call_count = 0; int interceptor_call_count = 0;
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(v8::Isolate::GetCurrent());
v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(); v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
...@@ -10917,7 +10917,7 @@ THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss2) { ...@@ -10917,7 +10917,7 @@ THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss2) {
CHECK_GE(interceptor_call_count, 50); CHECK_GE(interceptor_call_count, 50);
} }
THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss3) { THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss3) {
int interceptor_call_count = 0; int interceptor_call_count = 0;
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(v8::Isolate::GetCurrent());
v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(); v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
...@@ -10957,7 +10957,7 @@ THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss3) { ...@@ -10957,7 +10957,7 @@ THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss3) {
CHECK_GE(interceptor_call_count, 50); CHECK_GE(interceptor_call_count, 50);
} }
THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_TypeError) { THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature_TypeError) {
int interceptor_call_count = 0; int interceptor_call_count = 0;
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(v8::Isolate::GetCurrent());
v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(); v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
...@@ -10997,7 +10997,7 @@ THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_TypeError) { ...@@ -10997,7 +10997,7 @@ THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_TypeError) {
CHECK_GE(interceptor_call_count, 50); CHECK_GE(interceptor_call_count, 50);
} }
THREADED_TEST(CallICFastApi_TrivialSignature) { THREADED_PROFILED_TEST(CallICFastApi_TrivialSignature) {
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(v8::Isolate::GetCurrent());
v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(); v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
v8::Handle<v8::FunctionTemplate> method_templ = v8::Handle<v8::FunctionTemplate> method_templ =
...@@ -11021,7 +11021,7 @@ THREADED_TEST(CallICFastApi_TrivialSignature) { ...@@ -11021,7 +11021,7 @@ THREADED_TEST(CallICFastApi_TrivialSignature) {
CHECK_EQ(42, context->Global()->Get(v8_str("result"))->Int32Value()); CHECK_EQ(42, context->Global()->Get(v8_str("result"))->Int32Value());
} }
THREADED_TEST(CallICFastApi_SimpleSignature) { THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature) {
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(v8::Isolate::GetCurrent());
v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(); v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
v8::Handle<v8::FunctionTemplate> method_templ = v8::Handle<v8::FunctionTemplate> method_templ =
...@@ -11049,7 +11049,7 @@ THREADED_TEST(CallICFastApi_SimpleSignature) { ...@@ -11049,7 +11049,7 @@ THREADED_TEST(CallICFastApi_SimpleSignature) {
CHECK_EQ(42, context->Global()->Get(v8_str("result"))->Int32Value()); CHECK_EQ(42, context->Global()->Get(v8_str("result"))->Int32Value());
} }
THREADED_TEST(CallICFastApi_SimpleSignature_Miss1) { THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature_Miss1) {
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(v8::Isolate::GetCurrent());
v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(); v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
v8::Handle<v8::FunctionTemplate> method_templ = v8::Handle<v8::FunctionTemplate> method_templ =
...@@ -11082,7 +11082,7 @@ THREADED_TEST(CallICFastApi_SimpleSignature_Miss1) { ...@@ -11082,7 +11082,7 @@ THREADED_TEST(CallICFastApi_SimpleSignature_Miss1) {
CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value()); CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value());
} }
THREADED_TEST(CallICFastApi_SimpleSignature_Miss2) { THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature_Miss2) {
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(v8::Isolate::GetCurrent());
v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(); v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
v8::Handle<v8::FunctionTemplate> method_templ = v8::Handle<v8::FunctionTemplate> method_templ =
...@@ -11118,7 +11118,7 @@ THREADED_TEST(CallICFastApi_SimpleSignature_Miss2) { ...@@ -11118,7 +11118,7 @@ THREADED_TEST(CallICFastApi_SimpleSignature_Miss2) {
CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value()); CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value());
} }
THREADED_TEST(CallICFastApi_SimpleSignature_TypeError) { THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature_TypeError) {
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(v8::Isolate::GetCurrent());
v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(); v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
v8::Handle<v8::FunctionTemplate> method_templ = v8::Handle<v8::FunctionTemplate> method_templ =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment