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

Unified Diff: src/runtime/runtime-scopes.cc

Issue 2645743002: [builtins] Port parameter and argument-related code stubs to CSA (Closed)
Patch Set: Review feedback Created 3 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/mips64/interface-descriptors-mips64.cc ('k') | src/v8.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-scopes.cc
diff --git a/src/runtime/runtime-scopes.cc b/src/runtime/runtime-scopes.cc
index 50f5704f3275a5566eb9ef087fdbce8671716c97..f6fcf34224bb4d8ad0c706d1453c1506b924ac95 100644
--- a/src/runtime/runtime-scopes.cc
+++ b/src/runtime/runtime-scopes.cc
@@ -590,12 +590,29 @@ RUNTIME_FUNCTION(Runtime_NewRestParameter) {
RUNTIME_FUNCTION(Runtime_NewSloppyArguments) {
HandleScope scope(isolate);
- DCHECK_EQ(3, args.length());
+ DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSFunction, callee, 0);
- Object** parameters = reinterpret_cast<Object**>(args[1]);
- CONVERT_SMI_ARG_CHECKED(argument_count, 2);
+ StackFrameIterator iterator(isolate);
+
+ // Stub/interpreter handler frame
+ iterator.Advance();
+ DCHECK(iterator.frame()->type() == StackFrame::STUB);
+
+ // Function frame
+ iterator.Advance();
+ JavaScriptFrame* function_frame = JavaScriptFrame::cast(iterator.frame());
+ DCHECK(function_frame->is_java_script());
+ int argc = function_frame->GetArgumentsLength();
+ Address fp = function_frame->fp();
+ if (function_frame->has_adapted_arguments()) {
+ iterator.Advance();
+ fp = iterator.frame()->fp();
+ }
+
+ Object** parameters = reinterpret_cast<Object**>(
+ fp + argc * kPointerSize + StandardFrameConstants::kCallerSPOffset);
ParameterArguments argument_getter(parameters);
- return *NewSloppyArguments(isolate, callee, argument_getter, argument_count);
+ return *NewSloppyArguments(isolate, callee, argument_getter, argc);
}
RUNTIME_FUNCTION(Runtime_NewArgumentsElements) {
« no previous file with comments | « src/mips64/interface-descriptors-mips64.cc ('k') | src/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698