Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: src/accessors.cc

Issue 1678953004: [builtins] Remove bunch of uses of %_Arguments and %_ArgumentsLength. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Fix deoptimizer adapted arguments materialization for builtins. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/accessors.h ('k') | src/debug/debug-evaluate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/accessors.cc
diff --git a/src/accessors.cc b/src/accessors.cc
index f4eff3b732e98a90ddc3f5155f774b1918d4e556..1ab7fdd2522c73a1c5e7788b418ee9a4adecf264 100644
--- a/src/accessors.cc
+++ b/src/accessors.cc
@@ -944,10 +944,10 @@ static int FindFunctionInFrame(JavaScriptFrame* frame,
}
+namespace {
+
Handle<Object> GetFunctionArguments(Isolate* isolate,
Handle<JSFunction> function) {
- if (function->shared()->native()) return isolate->factory()->null_value();
-
// Find the top invocation of the function by traversing frames.
for (JavaScriptFrameIterator it(isolate); !it.done(); it.Advance()) {
JavaScriptFrame* frame = it.frame();
@@ -986,9 +986,14 @@ Handle<Object> GetFunctionArguments(Isolate* isolate,
return isolate->factory()->null_value();
}
+} // namespace
+
-Handle<Object> Accessors::FunctionGetArguments(Handle<JSFunction> function) {
- return GetFunctionArguments(function->GetIsolate(), function);
+Handle<JSObject> Accessors::FunctionGetArguments(Handle<JSFunction> function) {
+ Handle<Object> arguments =
+ GetFunctionArguments(function->GetIsolate(), function);
+ CHECK(arguments->IsJSObject());
+ return Handle<JSObject>::cast(arguments);
}
@@ -999,7 +1004,10 @@ void Accessors::FunctionArgumentsGetter(
HandleScope scope(isolate);
Handle<JSFunction> function =
Handle<JSFunction>::cast(Utils::OpenHandle(*info.Holder()));
- Handle<Object> result = GetFunctionArguments(isolate, function);
+ Handle<Object> result =
+ function->shared()->native()
+ ? Handle<Object>::cast(isolate->factory()->null_value())
+ : GetFunctionArguments(isolate, function);
info.GetReturnValue().Set(Utils::ToLocal(result));
}
« no previous file with comments | « src/accessors.h ('k') | src/debug/debug-evaluate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698