Mark some of the places we leave V8 via callbacks as transitions to

state EXTERNAL rather than OTHER.
Review URL: http://codereview.chromium.org/55007

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1632 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 66d40652
...@@ -376,7 +376,7 @@ BUILTIN(HandleApiCall) { ...@@ -376,7 +376,7 @@ BUILTIN(HandleApiCall) {
v8::Handle<v8::Value> value; v8::Handle<v8::Value> value;
{ {
// Leaving JavaScript. // Leaving JavaScript.
VMState state(OTHER); VMState state(EXTERNAL);
value = callback(args); value = callback(args);
} }
if (value.IsEmpty()) { if (value.IsEmpty()) {
...@@ -437,7 +437,7 @@ BUILTIN(HandleApiCallAsFunction) { ...@@ -437,7 +437,7 @@ BUILTIN(HandleApiCallAsFunction) {
v8::Handle<v8::Value> value; v8::Handle<v8::Value> value;
{ {
// Leaving JavaScript. // Leaving JavaScript.
VMState state(OTHER); VMState state(EXTERNAL);
value = callback(args); value = callback(args);
} }
if (value.IsEmpty()) { if (value.IsEmpty()) {
......
...@@ -430,7 +430,7 @@ v8::Handle<v8::Array> GetKeysForNamedInterceptor(Handle<JSObject> receiver, ...@@ -430,7 +430,7 @@ v8::Handle<v8::Array> GetKeysForNamedInterceptor(Handle<JSObject> receiver,
LOG(ApiObjectAccess("interceptor-named-enum", *object)); LOG(ApiObjectAccess("interceptor-named-enum", *object));
{ {
// Leaving JavaScript. // Leaving JavaScript.
VMState state(OTHER); VMState state(EXTERNAL);
result = enum_fun(info); result = enum_fun(info);
} }
} }
...@@ -454,7 +454,7 @@ v8::Handle<v8::Array> GetKeysForIndexedInterceptor(Handle<JSObject> receiver, ...@@ -454,7 +454,7 @@ v8::Handle<v8::Array> GetKeysForIndexedInterceptor(Handle<JSObject> receiver,
LOG(ApiObjectAccess("interceptor-indexed-enum", *object)); LOG(ApiObjectAccess("interceptor-indexed-enum", *object));
{ {
// Leaving JavaScript. // Leaving JavaScript.
VMState state(OTHER); VMState state(EXTERNAL);
result = enum_fun(info); result = enum_fun(info);
} }
} }
......
...@@ -1125,11 +1125,11 @@ VMState::VMState(StateTag state) { ...@@ -1125,11 +1125,11 @@ VMState::VMState(StateTag state) {
if (FLAG_protect_heap && previous_ != NULL) { if (FLAG_protect_heap && previous_ != NULL) {
if (state_ == EXTERNAL) { if (state_ == EXTERNAL) {
// We are leaving V8. // We are leaving V8.
ASSERT(previous_ == NULL || previous_->state_ != EXTERNAL); ASSERT(previous_->state_ != EXTERNAL);
Heap::Protect(); Heap::Protect();
} else { } else if (previous_->state_ == EXTERNAL) {
// Are we entering V8? // We are entering V8.
if (previous_->state_ == EXTERNAL) Heap::Unprotect(); Heap::Unprotect();
} }
} }
#endif #endif
...@@ -1149,11 +1149,12 @@ VMState::~VMState() { ...@@ -1149,11 +1149,12 @@ VMState::~VMState() {
#ifdef ENABLE_HEAP_PROTECTION #ifdef ENABLE_HEAP_PROTECTION
if (FLAG_protect_heap && previous_ != NULL) { if (FLAG_protect_heap && previous_ != NULL) {
if (state_ == EXTERNAL) { if (state_ == EXTERNAL) {
// Are we (re)entering V8? // We are reentering V8.
if (previous_->state_ != EXTERNAL) Heap::Unprotect(); ASSERT(previous_->state_ != EXTERNAL);
} else { Heap::Unprotect();
// Are we leaving V8? } else if (previous_->state_ == EXTERNAL) {
if (previous_->state_ == EXTERNAL) Heap::Protect(); // We are leaving V8.
Heap::Protect();
} }
} }
#endif #endif
......
...@@ -201,7 +201,7 @@ Object* Object::GetPropertyWithCallback(Object* receiver, ...@@ -201,7 +201,7 @@ Object* Object::GetPropertyWithCallback(Object* receiver,
v8::Handle<v8::Value> result; v8::Handle<v8::Value> result;
{ {
// Leaving JavaScript. // Leaving JavaScript.
VMState state(OTHER); VMState state(EXTERNAL);
result = call_fun(v8::Utils::ToLocal(key), info); result = call_fun(v8::Utils::ToLocal(key), info);
} }
RETURN_IF_SCHEDULED_EXCEPTION(); RETURN_IF_SCHEDULED_EXCEPTION();
...@@ -1423,7 +1423,7 @@ Object* JSObject::SetPropertyWithInterceptor(String* name, ...@@ -1423,7 +1423,7 @@ Object* JSObject::SetPropertyWithInterceptor(String* name,
v8::Handle<v8::Value> result; v8::Handle<v8::Value> result;
{ {
// Leaving JavaScript. // Leaving JavaScript.
VMState state(OTHER); VMState state(EXTERNAL);
Handle<Object> value_unhole(value->IsTheHole() ? Handle<Object> value_unhole(value->IsTheHole() ?
Heap::undefined_value() : Heap::undefined_value() :
value); value);
...@@ -1490,7 +1490,7 @@ Object* JSObject::SetPropertyWithCallback(Object* structure, ...@@ -1490,7 +1490,7 @@ Object* JSObject::SetPropertyWithCallback(Object* structure,
v8::Utils::ToLocal(holder_handle)); v8::Utils::ToLocal(holder_handle));
{ {
// Leaving JavaScript. // Leaving JavaScript.
VMState state(OTHER); VMState state(EXTERNAL);
call_fun(v8::Utils::ToLocal(key), call_fun(v8::Utils::ToLocal(key),
v8::Utils::ToLocal(value_handle), v8::Utils::ToLocal(value_handle),
info); info);
...@@ -1892,7 +1892,7 @@ PropertyAttributes JSObject::GetPropertyAttributeWithInterceptor( ...@@ -1892,7 +1892,7 @@ PropertyAttributes JSObject::GetPropertyAttributeWithInterceptor(
v8::Handle<v8::Boolean> result; v8::Handle<v8::Boolean> result;
{ {
// Leaving JavaScript. // Leaving JavaScript.
VMState state(OTHER); VMState state(EXTERNAL);
result = query(v8::Utils::ToLocal(name_handle), info); result = query(v8::Utils::ToLocal(name_handle), info);
} }
if (!result.IsEmpty()) { if (!result.IsEmpty()) {
...@@ -1907,7 +1907,7 @@ PropertyAttributes JSObject::GetPropertyAttributeWithInterceptor( ...@@ -1907,7 +1907,7 @@ PropertyAttributes JSObject::GetPropertyAttributeWithInterceptor(
v8::Handle<v8::Value> result; v8::Handle<v8::Value> result;
{ {
// Leaving JavaScript. // Leaving JavaScript.
VMState state(OTHER); VMState state(EXTERNAL);
result = getter(v8::Utils::ToLocal(name_handle), info); result = getter(v8::Utils::ToLocal(name_handle), info);
} }
if (!result.IsEmpty()) return NONE; if (!result.IsEmpty()) return NONE;
...@@ -2156,7 +2156,7 @@ Object* JSObject::DeletePropertyWithInterceptor(String* name) { ...@@ -2156,7 +2156,7 @@ Object* JSObject::DeletePropertyWithInterceptor(String* name) {
v8::Handle<v8::Boolean> result; v8::Handle<v8::Boolean> result;
{ {
// Leaving JavaScript. // Leaving JavaScript.
VMState state(OTHER); VMState state(EXTERNAL);
result = deleter(v8::Utils::ToLocal(name_handle), info); result = deleter(v8::Utils::ToLocal(name_handle), info);
} }
RETURN_IF_SCHEDULED_EXCEPTION(); RETURN_IF_SCHEDULED_EXCEPTION();
...@@ -2207,7 +2207,7 @@ Object* JSObject::DeleteElementWithInterceptor(uint32_t index) { ...@@ -2207,7 +2207,7 @@ Object* JSObject::DeleteElementWithInterceptor(uint32_t index) {
v8::Handle<v8::Boolean> result; v8::Handle<v8::Boolean> result;
{ {
// Leaving JavaScript. // Leaving JavaScript.
VMState state(OTHER); VMState state(EXTERNAL);
result = deleter(index, info); result = deleter(index, info);
} }
RETURN_IF_SCHEDULED_EXCEPTION(); RETURN_IF_SCHEDULED_EXCEPTION();
...@@ -5086,7 +5086,7 @@ bool JSObject::HasElementWithInterceptor(JSObject* receiver, uint32_t index) { ...@@ -5086,7 +5086,7 @@ bool JSObject::HasElementWithInterceptor(JSObject* receiver, uint32_t index) {
v8::Handle<v8::Boolean> result; v8::Handle<v8::Boolean> result;
{ {
// Leaving JavaScript. // Leaving JavaScript.
VMState state(OTHER); VMState state(EXTERNAL);
result = query(index, info); result = query(index, info);
} }
if (!result.IsEmpty()) return result->IsTrue(); if (!result.IsEmpty()) return result->IsTrue();
...@@ -5097,7 +5097,7 @@ bool JSObject::HasElementWithInterceptor(JSObject* receiver, uint32_t index) { ...@@ -5097,7 +5097,7 @@ bool JSObject::HasElementWithInterceptor(JSObject* receiver, uint32_t index) {
v8::Handle<v8::Value> result; v8::Handle<v8::Value> result;
{ {
// Leaving JavaScript. // Leaving JavaScript.
VMState state(OTHER); VMState state(EXTERNAL);
result = getter(index, info); result = getter(index, info);
} }
if (!result.IsEmpty()) return !result->IsUndefined(); if (!result.IsEmpty()) return !result->IsUndefined();
...@@ -5247,7 +5247,7 @@ Object* JSObject::SetElementWithInterceptor(uint32_t index, Object* value) { ...@@ -5247,7 +5247,7 @@ Object* JSObject::SetElementWithInterceptor(uint32_t index, Object* value) {
v8::Handle<v8::Value> result; v8::Handle<v8::Value> result;
{ {
// Leaving JavaScript. // Leaving JavaScript.
VMState state(OTHER); VMState state(EXTERNAL);
result = setter(index, v8::Utils::ToLocal(value_handle), info); result = setter(index, v8::Utils::ToLocal(value_handle), info);
} }
RETURN_IF_SCHEDULED_EXCEPTION(); RETURN_IF_SCHEDULED_EXCEPTION();
...@@ -5474,7 +5474,7 @@ Object* JSObject::GetElementWithInterceptor(JSObject* receiver, ...@@ -5474,7 +5474,7 @@ Object* JSObject::GetElementWithInterceptor(JSObject* receiver,
v8::Handle<v8::Value> result; v8::Handle<v8::Value> result;
{ {
// Leaving JavaScript. // Leaving JavaScript.
VMState state(OTHER); VMState state(EXTERNAL);
result = getter(index, info); result = getter(index, info);
} }
RETURN_IF_SCHEDULED_EXCEPTION(); RETURN_IF_SCHEDULED_EXCEPTION();
...@@ -5713,7 +5713,7 @@ Object* JSObject::GetPropertyWithInterceptor(JSObject* receiver, ...@@ -5713,7 +5713,7 @@ Object* JSObject::GetPropertyWithInterceptor(JSObject* receiver,
v8::Handle<v8::Value> result; v8::Handle<v8::Value> result;
{ {
// Leaving JavaScript. // Leaving JavaScript.
VMState state(OTHER); VMState state(EXTERNAL);
result = getter(v8::Utils::ToLocal(name_handle), info); result = getter(v8::Utils::ToLocal(name_handle), info);
} }
RETURN_IF_SCHEDULED_EXCEPTION(); RETURN_IF_SCHEDULED_EXCEPTION();
......
...@@ -674,7 +674,7 @@ Object* LoadCallbackProperty(Arguments args) { ...@@ -674,7 +674,7 @@ Object* LoadCallbackProperty(Arguments args) {
v8::Handle<v8::Value> result; v8::Handle<v8::Value> result;
{ {
// Leaving JavaScript. // Leaving JavaScript.
VMState state(OTHER); VMState state(EXTERNAL);
result = fun(v8::Utils::ToLocal(name), info); result = fun(v8::Utils::ToLocal(name), info);
} }
RETURN_IF_SCHEDULED_EXCEPTION(); RETURN_IF_SCHEDULED_EXCEPTION();
...@@ -699,7 +699,7 @@ Object* StoreCallbackProperty(Arguments args) { ...@@ -699,7 +699,7 @@ Object* StoreCallbackProperty(Arguments args) {
v8::Utils::ToLocal(recv)); v8::Utils::ToLocal(recv));
{ {
// Leaving JavaScript. // Leaving JavaScript.
VMState state(OTHER); VMState state(EXTERNAL);
fun(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), info); fun(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), info);
} }
RETURN_IF_SCHEDULED_EXCEPTION(); RETURN_IF_SCHEDULED_EXCEPTION();
......
...@@ -516,7 +516,7 @@ bool Top::MayNamedAccess(JSObject* receiver, Object* key, v8::AccessType type) { ...@@ -516,7 +516,7 @@ bool Top::MayNamedAccess(JSObject* receiver, Object* key, v8::AccessType type) {
bool result = false; bool result = false;
{ {
// Leaving JavaScript. // Leaving JavaScript.
VMState state(OTHER); VMState state(EXTERNAL);
result = callback(v8::Utils::ToLocal(receiver_handle), result = callback(v8::Utils::ToLocal(receiver_handle),
v8::Utils::ToLocal(key_handle), v8::Utils::ToLocal(key_handle),
type, type,
...@@ -560,7 +560,7 @@ bool Top::MayIndexedAccess(JSObject* receiver, ...@@ -560,7 +560,7 @@ bool Top::MayIndexedAccess(JSObject* receiver,
bool result = false; bool result = false;
{ {
// Leaving JavaScript. // Leaving JavaScript.
VMState state(OTHER); VMState state(EXTERNAL);
result = callback(v8::Utils::ToLocal(receiver_handle), result = callback(v8::Utils::ToLocal(receiver_handle),
index, index,
type, type,
......
...@@ -48,7 +48,7 @@ class CcTestCase(test.TestCase): ...@@ -48,7 +48,7 @@ class CcTestCase(test.TestCase):
def GetName(self): def GetName(self):
return self.path[-1] return self.path[-1]
def BuildCommand(self, name): def BuildCommand(self, name):
serialization_file = join('obj', 'test', self.mode, 'serdes') serialization_file = join('obj', 'test', self.mode, 'serdes')
serialization_file += '_' + self.GetName() serialization_file += '_' + self.GetName()
...@@ -60,12 +60,12 @@ class CcTestCase(test.TestCase): ...@@ -60,12 +60,12 @@ class CcTestCase(test.TestCase):
def GetCommand(self): def GetCommand(self):
return self.BuildCommand(self.raw_name) return self.BuildCommand(self.raw_name)
def Run(self): def Run(self):
if self.dependency != '': if self.dependency != '':
dependent_command = self.BuildCommand(self.dependency) dependent_command = self.BuildCommand(self.dependency)
output = self.RunCommand(dependent_command) output = self.RunCommand(dependent_command)
if output.HasFailed(): if output.HasFailed():
return output return output
return test.TestCase.Run(self) return test.TestCase.Run(self)
...@@ -97,7 +97,7 @@ class CcTestConfiguration(test.TestConfiguration): ...@@ -97,7 +97,7 @@ class CcTestConfiguration(test.TestConfiguration):
if self.Contains(path, full_path): if self.Contains(path, full_path):
result.append(CcTestCase(full_path, executable, mode, raw_test, dependency, self.context)) result.append(CcTestCase(full_path, executable, mode, raw_test, dependency, self.context))
return result return result
def GetTestStatus(self, sections, defs): def GetTestStatus(self, sections, defs):
status_file = join(self.root, 'cctest.status') status_file = join(self.root, 'cctest.status')
if exists(status_file): if exists(status_file):
......
...@@ -147,7 +147,7 @@ class Assembler(object): ...@@ -147,7 +147,7 @@ class Assembler(object):
self.regions = [] self.regions = []
VMStates = { 'JS': 0, 'GC': 1, 'COMPILER': 2, 'OTHER': 3 } VMStates = { 'JS': 0, 'GC': 1, 'COMPILER': 2, 'OTHER': 3, 'EXTERNAL' : 4 }
class TickProcessor(object): class TickProcessor(object):
...@@ -416,7 +416,13 @@ class TickProcessor(object): ...@@ -416,7 +416,13 @@ class TickProcessor(object):
class CmdLineProcessor(object): class CmdLineProcessor(object):
def __init__(self): def __init__(self):
self.options = ["js", "gc", "compiler", "other", "ignore-unknown", "separate-ic"] self.options = ["js",
"gc",
"compiler",
"other",
"external",
"ignore-unknown",
"separate-ic"]
# default values # default values
self.state = None self.state = None
self.ignore_unknown = False self.ignore_unknown = False
...@@ -425,7 +431,7 @@ class CmdLineProcessor(object): ...@@ -425,7 +431,7 @@ class CmdLineProcessor(object):
def ProcessArguments(self): def ProcessArguments(self):
try: try:
opts, args = getopt.getopt(sys.argv[1:], "jgco", self.options) opts, args = getopt.getopt(sys.argv[1:], "jgcoe", self.options)
except getopt.GetoptError: except getopt.GetoptError:
self.PrintUsageAndExit() self.PrintUsageAndExit()
for key, value in opts: for key, value in opts:
...@@ -437,6 +443,8 @@ class CmdLineProcessor(object): ...@@ -437,6 +443,8 @@ class CmdLineProcessor(object):
self.state = VMStates['COMPILER'] self.state = VMStates['COMPILER']
if key in ("-o", "--other"): if key in ("-o", "--other"):
self.state = VMStates['OTHER'] self.state = VMStates['OTHER']
if key in ("-e", "--external"):
self.state = VMStates['EXTERNAL']
if key in ("--ignore-unknown"): if key in ("--ignore-unknown"):
self.ignore_unknown = True self.ignore_unknown = True
if key in ("--separate-ic"): if key in ("--separate-ic"):
......
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