From 2c5ce418765eeac1e9f0cb1edd7c0664f00832a1 Mon Sep 17 00:00:00 2001 From: "kmillikin@chromium.org" Date: Fri, 3 Apr 2009 08:18:24 +0000 Subject: [PATCH] Move some more ENTER_V8 invocations. The biggest one is to move the one in v8::V8::Initialize to after the early bailout. Review URL: http://codereview.chromium.org/60083 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1673 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/api.cc | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/api.cc b/src/api.cc index 034bf57e5c..bf156183e1 100644 --- a/src/api.cc +++ b/src/api.cc @@ -1455,11 +1455,14 @@ Local Value::ToObject() const { Local Value::ToBoolean() const { if (IsDeadCheck("v8::Value::ToBoolean()")) return Local(); LOG_API("ToBoolean"); - ENTER_V8; i::Handle obj = Utils::OpenHandle(this); - i::Handle val = - obj->IsBoolean() ? obj : i::Execution::ToBoolean(obj); - return Local(ToApi(val)); + if (obj->IsBoolean()) { + return Local(ToApi(obj)); + } else { + ENTER_V8; + i::Handle val = i::Execution::ToBoolean(obj); + return Local(ToApi(val)); + } } @@ -1580,11 +1583,14 @@ v8::Date* v8::Date::Cast(v8::Value* that) { bool Value::BooleanValue() const { if (IsDeadCheck("v8::Value::BooleanValue()")) return false; LOG_API("BooleanValue"); - ENTER_V8; i::Handle obj = Utils::OpenHandle(this); - i::Handle value = - obj->IsBoolean() ? obj : i::Execution::ToBoolean(obj); - return value->IsTrue(); + if (obj->IsBoolean()) { + return obj->IsTrue(); + } else { + ENTER_V8; + i::Handle value = i::Execution::ToBoolean(obj); + return value->IsTrue(); + } } @@ -2347,8 +2353,8 @@ void v8::Object::SetInternalField(int index, v8::Handle value) { // --- E n v i r o n m e n t --- bool v8::V8::Initialize() { - ENTER_V8; if (i::V8::HasBeenSetup()) return true; + ENTER_V8; HandleScope scope; if (i::Snapshot::Initialize()) { return true;