From: yangguo@chromium.org Date: Fri, 11 Apr 2014 11:26:22 +0000 (+0000) Subject: Handlify GetProperty. X-Git-Tag: upstream/4.7.83~9679 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a3d68ca64d43eb64a3cf1cc8814561181f6b598e;p=platform%2Fupstream%2Fv8.git Handlify GetProperty. R=ishell@chromium.org Review URL: https://codereview.chromium.org/233233004 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20682 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/api.cc b/src/api.cc index aebb8d7..fde6bb6 100644 --- a/src/api.cc +++ b/src/api.cc @@ -1948,8 +1948,10 @@ v8::Local v8::TryCatch::StackTrace() const { i::Handle obj(i::JSObject::cast(raw_obj), isolate_); i::Handle name = isolate_->factory()->stack_string(); if (!i::JSReceiver::HasProperty(obj, name)) return v8::Local(); - i::Handle value = i::Object::GetProperty(obj, name); - if (value.is_null()) return v8::Local(); + i::Handle value; + if (!i::Object::GetProperty(obj, name).ToHandle(&value)) { + return v8::Local(); + } return v8::Utils::ToLocal(scope.CloseAndEscape(value)); } else { return v8::Local(); @@ -2044,8 +2046,8 @@ MUST_USE_RESULT static i::MaybeHandle CallV8HeapFunction( i::Handle fmt_str = isolate->factory()->InternalizeUtf8String(name); i::Handle object_fun = - i::GlobalObject::GetPropertyNoExceptionThrown( - isolate->js_builtins_object(), fmt_str); + i::Object::GetProperty( + isolate->js_builtins_object(), fmt_str).ToHandleChecked(); i::Handle fun = i::Handle::cast(object_fun); return i::Execution::Call(isolate, fun, recv, argc, argv); } @@ -2175,7 +2177,7 @@ Local StackTrace::GetFrame(uint32_t index) const { EscapableHandleScope scope(reinterpret_cast(isolate)); i::Handle self = Utils::OpenHandle(this); i::Handle obj = - i::Object::GetElementNoExceptionThrown(isolate, self, index); + i::Object::GetElement(isolate, self, index).ToHandleChecked(); i::Handle jsobj = i::Handle::cast(obj); return scope.Escape(Utils::StackFrameToLocal(jsobj)); } @@ -2490,8 +2492,8 @@ static i::Object* LookupBuiltin(i::Isolate* isolate, const char* builtin_name) { i::Handle string = isolate->factory()->InternalizeUtf8String(builtin_name); - return *i::GlobalObject::GetPropertyNoExceptionThrown( - isolate->js_builtins_object(), string); + return *i::Object::GetProperty( + isolate->js_builtins_object(), string).ToHandleChecked(); } @@ -7004,8 +7006,8 @@ Local Debug::GetMirror(v8::Handle obj) { isolate_debug->debug_context()->global_object()); i::Handle name = isolate->factory()->InternalizeOneByteString( STATIC_ASCII_VECTOR("MakeMirror")); - i::Handle fun_obj = i::Object::GetProperty(debug, name); - ASSERT(!fun_obj.is_null()); + i::Handle fun_obj = + i::Object::GetProperty(debug, name).ToHandleChecked(); i::Handle fun = i::Handle::cast(fun_obj); v8::Handle v8_fun = Utils::ToLocal(fun); const int kArgc = 1; diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc index 4e5a2a2..b59bf58 100644 --- a/src/bootstrapper.cc +++ b/src/bootstrapper.cc @@ -1515,9 +1515,9 @@ bool Genesis::CompileScriptCached(Isolate* isolate, #define INSTALL_NATIVE(Type, name, var) \ Handle var##_name = \ - factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR(name)); \ - Handle var##_native = GlobalObject::GetPropertyNoExceptionThrown( \ - handle(native_context()->builtins()), var##_name); \ + factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR(name)); \ + Handle var##_native = Object::GetProperty( \ + handle(native_context()->builtins()), var##_name).ToHandleChecked(); \ native_context()->set_##var(Type::cast(*var##_native)); @@ -1893,7 +1893,7 @@ bool Genesis::InstallNatives() { { Handle key = factory()->function_class_string(); Handle function = Handle::cast(Object::GetProperty( - isolate()->global_object(), key)); + isolate()->global_object(), key).ToHandleChecked()); Handle proto = Handle(JSObject::cast(function->instance_prototype())); @@ -2042,7 +2042,7 @@ static Handle ResolveBuiltinIdHolder( Handle property_string = factory->InternalizeUtf8String(property); ASSERT(!property_string.is_null()); Handle function = Handle::cast( - Object::GetProperty(global, property_string)); + Object::GetProperty(global, property_string).ToHandleChecked()); return Handle(JSObject::cast(function->prototype())); } @@ -2052,8 +2052,8 @@ static void InstallBuiltinFunctionId(Handle holder, BuiltinFunctionId id) { Factory* factory = holder->GetIsolate()->factory(); Handle name = factory->InternalizeUtf8String(function_name); - Handle function_object = Object::GetProperty(holder, name); - ASSERT(!function_object.is_null()); + Handle function_object = + Object::GetProperty(holder, name).ToHandleChecked(); Handle function = Handle::cast(function_object); function->shared()->set_function_data(Smi::FromInt(id)); } @@ -2349,7 +2349,7 @@ bool Genesis::InstallJSBuiltins(Handle builtins) { Handle name = factory()->InternalizeUtf8String(Builtins::GetName(id)); Handle function_object = - GlobalObject::GetPropertyNoExceptionThrown(builtins, name); + Object::GetProperty(builtins, name).ToHandleChecked(); Handle function = Handle::cast(function_object); builtins->set_javascript_builtin(id, *function); if (!Compiler::EnsureCompiled(function, CLEAR_EXCEPTION)) { diff --git a/src/debug.cc b/src/debug.cc index a1a648b..41c608a 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -1118,8 +1118,8 @@ bool Debug::CheckBreakPoint(Handle break_point_object) { STATIC_ASCII_VECTOR("IsBreakPointTriggered")); Handle debug_global(debug_context()->global_object()); Handle check_break_point = - Handle::cast(GlobalObject::GetPropertyNoExceptionThrown( - debug_global, is_break_point_triggered_string)); + Handle::cast(Object::GetProperty( + debug_global, is_break_point_triggered_string).ToHandleChecked()); // Get the break id as an object. Handle break_id = factory->NewNumberFromInt(Debug::break_id()); @@ -2459,8 +2459,8 @@ void Debug::ClearMirrorCache() { // Clear the mirror cache. Handle function_name = isolate_->factory()->InternalizeOneByteString( STATIC_ASCII_VECTOR("ClearMirrorCache")); - Handle fun = GlobalObject::GetPropertyNoExceptionThrown( - isolate_->global_object(), function_name); + Handle fun = Object::GetProperty( + isolate_->global_object(), function_name).ToHandleChecked(); ASSERT(fun->IsJSFunction()); Execution::TryCall( Handle::cast(fun), @@ -2597,8 +2597,8 @@ MaybeHandle Debugger::MakeJSObject( Handle constructor_str = isolate_->factory()->InternalizeUtf8String(constructor_name); ASSERT(!constructor_str.is_null()); - Handle constructor = GlobalObject::GetPropertyNoExceptionThrown( - isolate_->global_object(), constructor_str); + Handle constructor = Object::GetProperty( + isolate_->global_object(), constructor_str).ToHandleChecked(); ASSERT(constructor->IsJSFunction()); if (!constructor->IsJSFunction()) return MaybeHandle(); return Execution::TryCall( @@ -2788,8 +2788,8 @@ void Debugger::OnAfterCompile(Handle