From b9bf2051cd9c62de75fdd0300d2801c6328a80cc Mon Sep 17 00:00:00 2001 From: dcarney Date: Fri, 6 Mar 2015 02:28:02 -0800 Subject: [PATCH] convert more things to maybe BUG=v8:3929 LOG=y Review URL: https://codereview.chromium.org/982123003 Cr-Commit-Position: refs/heads/master@{#27038} --- include/v8.h | 17 +++ src/api.cc | 344 +++++++++++++++++++++++++++-------------------------------- 2 files changed, 175 insertions(+), 186 deletions(-) diff --git a/include/v8.h b/include/v8.h index 752204e..d9ba12b 100644 --- a/include/v8.h +++ b/include/v8.h @@ -1085,7 +1085,9 @@ class V8_EXPORT Script { * context in which it was created (ScriptCompiler::CompileBound or * UnboundScript::BindToCurrentContext()). */ + // TODO(dcarney): deprecate Local Run(); + MaybeLocal Run(Local context); /** * Returns the corresponding context-unbound script. @@ -1398,7 +1400,10 @@ class V8_EXPORT ScriptCompiler { class V8_EXPORT Message { public: Local Get() const; + + // TODO(dcarney): deprecate Local GetSourceLine() const; + MaybeLocal GetSourceLine(Local context) const; /** * Returns the origin for the script from where the function causing the @@ -1422,7 +1427,9 @@ class V8_EXPORT Message { /** * Returns the number, 1-based, of the line where the error occurred. */ + // TODO(dcarney): deprecate int GetLineNumber() const; + Maybe GetLineNumber(Local context) const; /** * Returns the index within the script of the first character where @@ -1440,13 +1447,17 @@ class V8_EXPORT Message { * Returns the index within the line of the first character where * the error occurred. */ + // TODO(dcarney): deprecate int GetStartColumn() const; + Maybe GetStartColumn(Local context) const; /** * Returns the index within the line of the last character where * the error occurred. */ + // TODO(dcarney): deprecate int GetEndColumn() const; + Maybe GetEndColumn(Local context) const; /** * Passes on the value set by the embedder when it fed the script from which @@ -1613,7 +1624,9 @@ class V8_EXPORT JSON { * \param json_string The string to parse. * \return The corresponding value if successfully parsed. */ + // TODO(dcarney): deprecate static Local Parse(Local json_string); + static MaybeLocal Parse(Isolate* isolate, Local json_string); }; @@ -1926,7 +1939,9 @@ class V8_EXPORT Value : public Data { * Attempts to convert a string to an array index. * Returns an empty handle if the conversion fails. */ + // TODO(dcarney): deprecate. Local ToArrayIndex() const; + MaybeLocal ToArrayIndex(Local context) const; Maybe BooleanValue(Local context) const; Maybe NumberValue(Local context) const; @@ -1942,7 +1957,9 @@ class V8_EXPORT Value : public Data { int32_t Int32Value() const; /** JS == */ + // TODO(dcarney): deprecate. bool Equals(Handle that) const; + Maybe Equals(Local context, Handle that) const; bool StrictEquals(Handle that) const; bool SameValue(Handle that) const; diff --git a/src/api.cc b/src/api.cc index 7de0d12..5d44fe3 100644 --- a/src/api.cc +++ b/src/api.cc @@ -1508,15 +1508,12 @@ int UnboundScript::GetId() { i::Handle obj = i::Handle::cast(Utils::OpenHandle(this)); i::Isolate* isolate = obj->GetIsolate(); - ON_BAILOUT(isolate, "v8::UnboundScript::GetId()", return -1); LOG_API(isolate, "v8::UnboundScript::GetId"); - { - i::HandleScope scope(isolate); - i::Handle function_info( - i::SharedFunctionInfo::cast(*obj)); - i::Handle script(i::Script::cast(function_info->script())); - return script->id()->value(); - } + i::HandleScope scope(isolate); + i::Handle function_info( + i::SharedFunctionInfo::cast(*obj)); + i::Handle script(i::Script::cast(function_info->script())); + return script->id()->value(); } @@ -1524,7 +1521,6 @@ int UnboundScript::GetLineNumber(int code_pos) { i::Handle obj = i::Handle::cast(Utils::OpenHandle(this)); i::Isolate* isolate = obj->GetIsolate(); - ON_BAILOUT(isolate, "v8::UnboundScript::GetLineNumber()", return -1); LOG_API(isolate, "UnboundScript::GetLineNumber"); if (obj->script()->IsScript()) { i::Handle script(i::Script::cast(obj->script())); @@ -1539,8 +1535,6 @@ Handle UnboundScript::GetScriptName() { i::Handle obj = i::Handle::cast(Utils::OpenHandle(this)); i::Isolate* isolate = obj->GetIsolate(); - ON_BAILOUT(isolate, "v8::UnboundScript::GetName()", - return Handle()); LOG_API(isolate, "UnboundScript::GetName"); if (obj->script()->IsScript()) { i::Object* name = i::Script::cast(obj->script())->name(); @@ -1555,8 +1549,6 @@ Handle UnboundScript::GetSourceURL() { i::Handle obj = i::Handle::cast(Utils::OpenHandle(this)); i::Isolate* isolate = obj->GetIsolate(); - ON_BAILOUT(isolate, "v8::UnboundScript::GetSourceURL()", - return Handle()); LOG_API(isolate, "UnboundScript::GetSourceURL"); if (obj->script()->IsScript()) { i::Object* url = i::Script::cast(obj->script())->source_url(); @@ -1571,8 +1563,6 @@ Handle UnboundScript::GetSourceMappingURL() { i::Handle obj = i::Handle::cast(Utils::OpenHandle(this)); i::Isolate* isolate = obj->GetIsolate(); - ON_BAILOUT(isolate, "v8::UnboundScript::GetSourceMappingURL()", - return Handle()); LOG_API(isolate, "UnboundScript::GetSourceMappingURL"); if (obj->script()->IsScript()) { i::Object* url = i::Script::cast(obj->script())->source_mapping_url(); @@ -1583,26 +1573,28 @@ Handle UnboundScript::GetSourceMappingURL() { } -Local Script::Run() { - i::Handle obj = Utils::OpenHandle(this, true); - // If execution is terminating, Compile(..)->Run() requires this - // check. - if (obj.is_null()) return Local(); - i::Isolate* isolate = i::Handle::cast(obj)->GetIsolate(); - ON_BAILOUT(isolate, "v8::Script::Run()", return Local()); - LOG_API(isolate, "Script::Run"); - ENTER_V8(isolate); +MaybeLocal Script::Run(Local context) { + PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, "v8::Script::Run()", Value) i::AggregatingHistogramTimerScope timer(isolate->counters()->compile_lazy()); i::TimerEventScope timer_scope(isolate); - i::HandleScope scope(isolate); - i::Handle fun = i::Handle::cast(obj); - EXCEPTION_PREAMBLE(isolate); + auto fun = i::Handle::cast(Utils::OpenHandle(this)); i::Handle receiver(isolate->global_proxy(), isolate); - i::Handle result; - has_pending_exception = !i::Execution::Call( - isolate, fun, receiver, 0, NULL).ToHandle(&result); - EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local()); - return Utils::ToLocal(scope.CloseAndEscape(result)); + Local result; + has_pending_exception = + !ToLocal(i::Execution::Call(isolate, fun, receiver, 0, NULL), + &result); + RETURN_ON_FAILED_EXECUTION(Value); + RETURN_ESCAPED(result); +} + + +Local Script::Run() { + auto self = Utils::OpenHandle(this, true); + // If execution is terminating, Compile(..)->Run() requires this + // check. + if (self.is_null()) return Local(); + auto context = ContextFromHeapObject(self); + RETURN_TO_LOCAL_UNCHECKED(Run(context), Value); } @@ -2176,7 +2168,6 @@ void v8::TryCatch::SetCaptureMessage(bool value) { Local Message::Get() const { i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); - ON_BAILOUT(isolate, "v8::Message::Get()", return Local()); ENTER_V8(isolate); EscapableHandleScope scope(reinterpret_cast(isolate)); i::Handle obj = Utils::OpenHandle(this); @@ -2188,12 +2179,9 @@ Local Message::Get() const { ScriptOrigin Message::GetScriptOrigin() const { i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); - i::Handle message = - i::Handle::cast(Utils::OpenHandle(this)); - i::Handle script_wraper = - i::Handle(message->script(), isolate); - i::Handle script_value = - i::Handle::cast(script_wraper); + auto message = i::Handle::cast(Utils::OpenHandle(this)); + auto script_wraper = i::Handle(message->script(), isolate); + auto script_value = i::Handle::cast(script_wraper); i::Handle script(i::Script::cast(script_value->value())); return GetScriptOriginForScript(isolate, script); } @@ -2208,12 +2196,10 @@ v8::Handle Message::GetStackTrace() const { i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); ENTER_V8(isolate); EscapableHandleScope scope(reinterpret_cast(isolate)); - i::Handle message = - i::Handle::cast(Utils::OpenHandle(this)); + auto message = i::Handle::cast(Utils::OpenHandle(this)); i::Handle stackFramesObj(message->stack_frames(), isolate); if (!stackFramesObj->IsJSArray()) return v8::Handle(); - i::Handle stackTrace = - i::Handle::cast(stackFramesObj); + auto stackTrace = i::Handle::cast(stackFramesObj); return scope.Escape(Utils::StackTraceToLocal(stackTrace)); } @@ -2237,107 +2223,102 @@ MUST_USE_RESULT static i::MaybeHandle CallV8HeapFunction( } -int Message::GetLineNumber() const { - i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); - ON_BAILOUT(isolate, "v8::Message::GetLineNumber()", return kNoLineNumberInfo); - ENTER_V8(isolate); - i::HandleScope scope(isolate); - - EXCEPTION_PREAMBLE(isolate); +Maybe Message::GetLineNumber(Local context) const { + PREPARE_FOR_EXECUTION_PRIMITIVE(context, "v8::Message::GetLineNumber()", int); i::Handle result; has_pending_exception = !CallV8HeapFunction(isolate, "GetLineNumber", Utils::OpenHandle(this)) .ToHandle(&result); - EXCEPTION_BAILOUT_CHECK(isolate, 0); - return static_cast(result->Number()); + RETURN_ON_FAILED_EXECUTION_PRIMITIVE(int); + return Just(static_cast(result->Number())); +} + + +int Message::GetLineNumber() const { + auto context = ContextFromHeapObject(Utils::OpenHandle(this)); + return GetLineNumber(context).FromMaybe(0); } int Message::GetStartPosition() const { - i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); - ENTER_V8(isolate); - i::HandleScope scope(isolate); - i::Handle message = - i::Handle::cast(Utils::OpenHandle(this)); - return message->start_position(); + auto self = Utils::OpenHandle(this); + return self->start_position(); } int Message::GetEndPosition() const { - i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); - ENTER_V8(isolate); - i::HandleScope scope(isolate); - i::Handle message = - i::Handle::cast(Utils::OpenHandle(this)); - return message->end_position(); + auto self = Utils::OpenHandle(this); + return self->end_position(); +} + + +Maybe Message::GetStartColumn(Local context) const { + PREPARE_FOR_EXECUTION_PRIMITIVE(context, "v8::Message::GetStartColumn()", + int); + auto self = Utils::OpenHandle(this); + i::Handle start_col_obj; + has_pending_exception = !CallV8HeapFunction(isolate, "GetPositionInLine", + self).ToHandle(&start_col_obj); + RETURN_ON_FAILED_EXECUTION_PRIMITIVE(int); + return Just(static_cast(start_col_obj->Number())); } int Message::GetStartColumn() const { - i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); - ON_BAILOUT(isolate, "v8::Message::GetStartColumn()", return kNoColumnInfo); - ENTER_V8(isolate); - i::HandleScope scope(isolate); - i::Handle data_obj = Utils::OpenHandle(this); - EXCEPTION_PREAMBLE(isolate); + auto context = ContextFromHeapObject(Utils::OpenHandle(this)); + const int default_value = kNoColumnInfo; + return GetStartColumn(context).FromMaybe(default_value); +} + + +Maybe Message::GetEndColumn(Local context) const { + PREPARE_FOR_EXECUTION_PRIMITIVE(context, "v8::Message::GetEndColumn()", int); + auto self = Utils::OpenHandle(this); i::Handle start_col_obj; - has_pending_exception = - !CallV8HeapFunction(isolate, "GetPositionInLine", data_obj) - .ToHandle(&start_col_obj); - EXCEPTION_BAILOUT_CHECK(isolate, 0); - return static_cast(start_col_obj->Number()); + has_pending_exception = !CallV8HeapFunction(isolate, "GetPositionInLine", + self).ToHandle(&start_col_obj); + RETURN_ON_FAILED_EXECUTION_PRIMITIVE(int); + int start = self->start_position(); + int end = self->end_position(); + return Just(static_cast(start_col_obj->Number()) + (end - start)); } int Message::GetEndColumn() const { - i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); - ON_BAILOUT(isolate, "v8::Message::GetEndColumn()", return kNoColumnInfo); - ENTER_V8(isolate); - i::HandleScope scope(isolate); - i::Handle data_obj = Utils::OpenHandle(this); - EXCEPTION_PREAMBLE(isolate); - i::Handle start_col_obj; - has_pending_exception = - !CallV8HeapFunction(isolate, "GetPositionInLine", data_obj) - .ToHandle(&start_col_obj); - EXCEPTION_BAILOUT_CHECK(isolate, 0); - i::Handle message = - i::Handle::cast(data_obj); - int start = message->start_position(); - int end = message->end_position(); - return static_cast(start_col_obj->Number()) + (end - start); + auto context = ContextFromHeapObject(Utils::OpenHandle(this)); + const int default_value = kNoColumnInfo; + return GetEndColumn(context).FromMaybe(default_value); } bool Message::IsSharedCrossOrigin() const { i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); ENTER_V8(isolate); - i::HandleScope scope(isolate); - i::Handle message = - i::Handle::cast(Utils::OpenHandle(this)); - i::Handle script = - i::Handle::cast(i::Handle(message->script(), - isolate)); + auto self = Utils::OpenHandle(this); + auto script = i::Handle::cast( + i::Handle(self->script(), isolate)); return i::Script::cast(script->value())->is_shared_cross_origin(); } -Local Message::GetSourceLine() const { - i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); - ON_BAILOUT(isolate, "v8::Message::GetSourceLine()", return Local()); - ENTER_V8(isolate); - EscapableHandleScope scope(reinterpret_cast(isolate)); - EXCEPTION_PREAMBLE(isolate); +MaybeLocal Message::GetSourceLine(Local context) const { + PREPARE_FOR_EXECUTION(context, "v8::Message::GetSourceLine()", String); i::Handle result; has_pending_exception = !CallV8HeapFunction(isolate, "GetSourceLine", Utils::OpenHandle(this)) .ToHandle(&result); - EXCEPTION_BAILOUT_CHECK(isolate, Local()); + RETURN_ON_FAILED_EXECUTION(String); + Local str; if (result->IsString()) { - return scope.Escape(Utils::ToLocal(i::Handle::cast(result))); - } else { - return Local(); + str = Utils::ToLocal(i::Handle::cast(result)); } + RETURN_ESCAPED(str); +} + + +Local Message::GetSourceLine() const { + auto context = ContextFromHeapObject(Utils::OpenHandle(this)); + RETURN_TO_LOCAL_UNCHECKED(GetSourceLine(context), String) } @@ -2354,24 +2335,19 @@ Local StackTrace::GetFrame(uint32_t index) const { i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); ENTER_V8(isolate); EscapableHandleScope scope(reinterpret_cast(isolate)); - i::Handle self = Utils::OpenHandle(this); - i::Handle obj = - i::Object::GetElement(isolate, self, index).ToHandleChecked(); - i::Handle jsobj = i::Handle::cast(obj); + auto self = Utils::OpenHandle(this); + auto obj = i::Object::GetElement(isolate, self, index).ToHandleChecked(); + auto jsobj = i::Handle::cast(obj); return scope.Escape(Utils::StackFrameToLocal(jsobj)); } int StackTrace::GetFrameCount() const { - i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); - ENTER_V8(isolate); return i::Smi::cast(Utils::OpenHandle(this)->length())->value(); } Local StackTrace::AsArray() { - i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); - ENTER_V8(isolate); return Utils::ToLocal(Utils::OpenHandle(this)); } @@ -2564,21 +2540,25 @@ bool NativeWeakMap::Delete(Handle v8_key) { // --- J S O N --- -Local JSON::Parse(Local json_string) { +MaybeLocal JSON::Parse(Isolate* v8_isolate, Local json_string) { + auto isolate = reinterpret_cast(v8_isolate); + PREPARE_FOR_EXECUTION_WITH_ISOLATE(isolate, "JSON::Parse", Value); i::Handle string = Utils::OpenHandle(*json_string); - i::Isolate* isolate = string->GetIsolate(); - ENTER_V8(isolate); - i::HandleScope scope(isolate); i::Handle source = i::String::Flatten(string); - EXCEPTION_PREAMBLE(isolate); - i::MaybeHandle maybe_result = - source->IsSeqOneByteString() ? i::JsonParser::Parse(source) - : i::JsonParser::Parse(source); - i::Handle result; - has_pending_exception = !maybe_result.ToHandle(&result); - EXCEPTION_BAILOUT_CHECK(isolate, Local()); - return Utils::ToLocal( - i::Handle::cast(scope.CloseAndEscape(result))); + auto maybe = source->IsSeqOneByteString() + ? i::JsonParser::Parse(source) + : i::JsonParser::Parse(source); + Local result; + has_pending_exception = !ToLocal(maybe, &result); + RETURN_ON_FAILED_EXECUTION(Value); + RETURN_ESCAPED(result); +} + + +Local JSON::Parse(Local json_string) { + auto isolate = reinterpret_cast( + Utils::OpenHandle(*json_string)->GetIsolate()); + RETURN_TO_LOCAL_UNCHECKED(Parse(isolate, json_string), Value); } @@ -3228,20 +3208,17 @@ uint32_t Value::Uint32Value() const { } -Local Value::ToArrayIndex() const { - i::Handle obj = Utils::OpenHandle(this); - if (obj->IsSmi()) { - if (i::Smi::cast(*obj)->value() >= 0) return Utils::Uint32ToLocal(obj); +MaybeLocal Value::ToArrayIndex(Local context) const { + auto self = Utils::OpenHandle(this); + if (self->IsSmi()) { + if (i::Smi::cast(*self)->value() >= 0) return Utils::Uint32ToLocal(self); return Local(); } - i::Isolate* isolate = i::HeapObject::cast(*obj)->GetIsolate(); - LOG_API(isolate, "ToArrayIndex"); - ENTER_V8(isolate); - EXCEPTION_PREAMBLE(isolate); + PREPARE_FOR_EXECUTION(context, "ToArrayIndex", Uint32); i::Handle string_obj; - has_pending_exception = !i::Execution::ToString( - isolate, obj).ToHandle(&string_obj); - EXCEPTION_BAILOUT_CHECK(isolate, Local()); + has_pending_exception = + !i::Execution::ToString(isolate, self).ToHandle(&string_obj); + RETURN_ON_FAILED_EXECUTION(Uint32); i::Handle str = i::Handle::cast(string_obj); uint32_t index; if (str->AsArrayIndex(&index)) { @@ -3251,56 +3228,65 @@ Local Value::ToArrayIndex() const { } else { value = isolate->factory()->NewNumber(index); } - return Utils::Uint32ToLocal(value); + RETURN_ESCAPED(Utils::Uint32ToLocal(value)); } return Local(); } -bool Value::Equals(Handle that) const { - i::Handle obj = Utils::OpenHandle(this, true); - i::Handle other = Utils::OpenHandle(*that); - if (obj->IsSmi() && other->IsSmi()) { - return obj->Number() == other->Number(); +Local Value::ToArrayIndex() const { + auto self = Utils::OpenHandle(this); + if (self->IsSmi()) { + if (i::Smi::cast(*self)->value() >= 0) return Utils::Uint32ToLocal(self); + return Local(); } - i::Object* ho = obj->IsSmi() ? *other : *obj; - i::Isolate* isolate = i::HeapObject::cast(ho)->GetIsolate(); - if (!Utils::ApiCheck(!obj.is_null() && !that.IsEmpty(), - "v8::Value::Equals()", - "Reading from empty handle")) { - return false; + auto context = ContextFromHeapObject(self); + RETURN_TO_LOCAL_UNCHECKED(ToArrayIndex(context), Uint32); +} + + +Maybe Value::Equals(Local context, Handle that) const { + auto self = Utils::OpenHandle(this); + auto other = Utils::OpenHandle(*that); + if (self->IsSmi() && other->IsSmi()) { + return Just(self->Number() == other->Number()); } - LOG_API(isolate, "Equals"); - ENTER_V8(isolate); - // If both obj and other are JSObjects, we'd better compare by identity - // immediately when going into JS builtin. The reason is Invoke - // would overwrite global object receiver with global proxy. - if (obj->IsJSObject() && other->IsJSObject()) { - return *obj == *other; + if (self->IsJSObject() && other->IsJSObject()) { + return Just(*self == *other); } + PREPARE_FOR_EXECUTION_PRIMITIVE(context, "v8::Value::Equals()", bool); i::Handle args[] = { other }; - EXCEPTION_PREAMBLE(isolate); i::Handle result; has_pending_exception = - !CallV8HeapFunction(isolate, "EQUALS", obj, arraysize(args), args) + !CallV8HeapFunction(isolate, "EQUALS", self, arraysize(args), args) .ToHandle(&result); - EXCEPTION_BAILOUT_CHECK(isolate, false); - return *result == i::Smi::FromInt(i::EQUAL); + RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); + return Just(*result == i::Smi::FromInt(i::EQUAL)); +} + + +bool Value::Equals(Handle that) const { + auto self = Utils::OpenHandle(this); + auto other = Utils::OpenHandle(*that); + if (self->IsSmi() && other->IsSmi()) { + return self->Number() == other->Number(); + } + if (self->IsJSObject() && other->IsJSObject()) { + return *self == *other; + } + auto heap_object = self->IsSmi() ? other : self; + auto context = ContextFromHeapObject(heap_object); + return Equals(context, that).FromMaybe(false); } bool Value::StrictEquals(Handle that) const { - i::Handle obj = Utils::OpenHandle(this, true); + i::Handle obj = Utils::OpenHandle(this); i::Handle other = Utils::OpenHandle(*that); if (obj->IsSmi()) { return other->IsNumber() && obj->Number() == other->Number(); } i::Isolate* isolate = i::HeapObject::cast(*obj)->GetIsolate(); - if (!Utils::ApiCheck(!obj.is_null() && !that.IsEmpty(), - "v8::Value::StrictEquals()", - "Reading from empty handle")) { - return false; - } LOG_API(isolate, "StrictEquals"); // Must check HeapNumber first, since NaN !== NaN. if (obj->IsHeapNumber()) { @@ -3326,14 +3312,9 @@ bool Value::StrictEquals(Handle that) const { bool Value::SameValue(Handle that) const { - i::Handle obj = Utils::OpenHandle(this, true); - if (!Utils::ApiCheck(!obj.is_null() && !that.IsEmpty(), - "v8::Value::SameValue()", - "Reading from empty handle")) { - return false; - } - i::Handle other = Utils::OpenHandle(*that); - return obj->SameValue(*other); + auto self = Utils::OpenHandle(this); + auto other = Utils::OpenHandle(*that); + return self->SameValue(*other); } @@ -3859,7 +3840,6 @@ void Object::SetAccessorProperty(Local name, // TODO(verwaest): Remove |settings|. DCHECK_EQ(v8::DEFAULT, settings); i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); - ON_BAILOUT(isolate, "v8::Object::SetAccessorProperty()", return); ENTER_V8(isolate); i::HandleScope scope(isolate); i::Handle getter_i = v8::Utils::OpenHandle(*getter); @@ -4553,11 +4533,7 @@ Local Function::GetBoundFunction() const { int Name::GetIdentityHash() { - i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); - ON_BAILOUT(isolate, "v8::Name::GetIdentityHash()", return 0); - ENTER_V8(isolate); - i::HandleScope scope(isolate); - i::Handle self = Utils::OpenHandle(this); + auto self = Utils::OpenHandle(this); return static_cast(self->Hash()); } @@ -5522,8 +5498,6 @@ Local v8::Context::New( void v8::Context::SetSecurityToken(Handle token) { i::Handle env = Utils::OpenHandle(this); - i::Isolate* isolate = env->GetIsolate(); - ENTER_V8(isolate); i::Handle token_handle = Utils::OpenHandle(*token); env->set_security_token(*token_handle); } @@ -5531,8 +5505,6 @@ void v8::Context::SetSecurityToken(Handle token) { void v8::Context::UseDefaultSecurityToken() { i::Handle env = Utils::OpenHandle(this); - i::Isolate* isolate = env->GetIsolate(); - ENTER_V8(isolate); env->set_security_token(env->global_object()); } -- 2.7.4