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