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

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

Issue 2645743002: [builtins] Port parameter and argument-related code stubs to CSA (Closed)
Patch Set: Remove stray change Created 3 years, 11 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
Index: src/runtime/runtime-scopes.cc
diff --git a/src/runtime/runtime-scopes.cc b/src/runtime/runtime-scopes.cc
index 2e349f00d3b64dbc4fd6d3e91943b49f253d2b73..edca4a14b653a757536810f969b1df7cbf41614e 100644
--- a/src/runtime/runtime-scopes.cc
+++ b/src/runtime/runtime-scopes.cc
@@ -585,12 +585,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) {

Powered by Google App Engine
This is Rietveld 408576698