From 2165d4008dda901ef80b6ba5d93d9cdab161110b Mon Sep 17 00:00:00 2001 From: "mstarzinger@chromium.org" Date: Thu, 18 Jul 2013 14:00:53 +0000 Subject: [PATCH] Handlify Accessors::FunctionGetArguments method. R=yangguo@chromium.org Review URL: https://codereview.chromium.org/19638003 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15751 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/accessors.cc | 7 +++++++ src/accessors.h | 5 +++-- src/deoptimizer.cc | 8 +++----- src/runtime.cc | 13 +++++-------- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/accessors.cc b/src/accessors.cc index 648f113..51db361 100644 --- a/src/accessors.cc +++ b/src/accessors.cc @@ -576,6 +576,13 @@ const AccessorDescriptor Accessors::FunctionName = { // +Handle Accessors::FunctionGetArguments(Handle object) { + Isolate* isolate = Isolate::Current(); + CALL_HEAP_FUNCTION( + isolate, Accessors::FunctionGetArguments(*object, 0), Object); +} + + static MaybeObject* ConstructArgumentsObjectForInlinedFunction( JavaScriptFrame* frame, Handle inlined_function, diff --git a/src/accessors.h b/src/accessors.h index a7e67b5..ae56a3d 100644 --- a/src/accessors.h +++ b/src/accessors.h @@ -78,11 +78,11 @@ class Accessors : public AllStatic { // Accessor functions called directly from the runtime system. static Handle FunctionGetPrototype(Handle object); + static Handle FunctionGetArguments(Handle object); MUST_USE_RESULT static MaybeObject* FunctionSetPrototype(JSObject* object, Object* value, void*); - static MaybeObject* FunctionGetArguments(Object* object, void*); // Accessor infos. static Handle MakeModuleExport( @@ -90,10 +90,11 @@ class Accessors : public AllStatic { private: // Accessor functions only used through the descriptor. + static MaybeObject* FunctionGetPrototype(Object* object, void*); static MaybeObject* FunctionGetLength(Object* object, void*); static MaybeObject* FunctionGetName(Object* object, void*); + static MaybeObject* FunctionGetArguments(Object* object, void*); static MaybeObject* FunctionGetCaller(Object* object, void*); - static MaybeObject* FunctionGetPrototype(Object* object, void*); MUST_USE_RESULT static MaybeObject* ArraySetLength(JSObject* object, Object* value, void*); static MaybeObject* ArrayGetLength(Object* object, void*); diff --git a/src/deoptimizer.cc b/src/deoptimizer.cc index 4284950..674b9ae 100644 --- a/src/deoptimizer.cc +++ b/src/deoptimizer.cc @@ -1624,11 +1624,9 @@ void Deoptimizer::MaterializeHeapObjects(JavaScriptFrameIterator* it) { if (arguments.is_null()) { if (frame->has_adapted_arguments()) { // Use the arguments adapter frame we just built to materialize the - // arguments object. FunctionGetArguments can't throw an exception, - // so cast away the doubt with an assert. - arguments = Handle(JSObject::cast( - Accessors::FunctionGetArguments(*function, - NULL)->ToObjectUnchecked())); + // arguments object. FunctionGetArguments can't throw an exception. + arguments = Handle::cast( + Accessors::FunctionGetArguments(function)); values.RewindBy(length); } else { // Construct an arguments object and copy the parameters to a newly diff --git a/src/runtime.cc b/src/runtime.cc index 9c5cdf9..8391bef 100644 --- a/src/runtime.cc +++ b/src/runtime.cc @@ -12484,8 +12484,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_ClearStepping) { static Handle MaterializeArgumentsObject( Isolate* isolate, Handle target, - Handle function, - FrameInspector* frame_inspector) { + Handle function) { // Do not materialize the arguments object for eval or top-level code. // Skip if "arguments" is already taken. if (!function->shared()->is_function() || @@ -12493,10 +12492,9 @@ static Handle MaterializeArgumentsObject( return target; } - // FunctionGetArguments can't return a non-Object. - Handle arguments(JSObject::cast( - Accessors::FunctionGetArguments(frame_inspector->GetFunction(), - NULL)->ToObjectUnchecked()), isolate); + // FunctionGetArguments can't throw an exception. + Handle arguments = Handle::cast( + Accessors::FunctionGetArguments(function)); SetProperty(isolate, target, isolate->factory()->arguments_string(), @@ -12600,8 +12598,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) { isolate, materialized, function, &frame_inspector); RETURN_IF_EMPTY_HANDLE(isolate, materialized); - materialized = MaterializeArgumentsObject( - isolate, materialized, function, &frame_inspector); + materialized = MaterializeArgumentsObject(isolate, materialized, function); RETURN_IF_EMPTY_HANDLE(isolate, materialized); // Add the materialized object in a with-scope to shadow the stack locals. -- 2.7.4