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

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

Issue 1693513002: [runtime] Introduce FastNewStrictArgumentsStub to optimize strict arguments. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix mips and mips64. 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/runtime/runtime.h ('k') | src/x64/builtins-x64.cc » ('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 1ecbde058101da5ccd05eb9497d63bdf97fdefad..1cf04a8dba04d7b7df4a74c379fdd09a0c6516b4 100644
--- a/src/runtime/runtime-scopes.cc
+++ b/src/runtime/runtime-scopes.cc
@@ -568,26 +568,6 @@ Handle<JSObject> NewSloppyArguments(Isolate* isolate, Handle<JSFunction> callee,
}
-template <typename T>
-Handle<JSObject> NewStrictArguments(Isolate* isolate, Handle<JSFunction> callee,
- T parameters, int argument_count) {
- Handle<JSObject> result =
- isolate->factory()->NewArgumentsObject(callee, argument_count);
-
- if (argument_count > 0) {
- Handle<FixedArray> array =
- isolate->factory()->NewUninitializedFixedArray(argument_count);
- DisallowHeapAllocation no_gc;
- WriteBarrierMode mode = array->GetWriteBarrierMode(no_gc);
- for (int i = 0; i < argument_count; i++) {
- array->set(i, parameters[i], mode);
- }
- result->set_elements(*array);
- }
- return result;
-}
-
-
class HandleArguments BASE_EMBEDDED {
public:
explicit HandleArguments(Handle<Object>* array) : array_(array) {}
@@ -624,17 +604,28 @@ RUNTIME_FUNCTION(Runtime_NewSloppyArguments_Generic) {
}
-RUNTIME_FUNCTION(Runtime_NewStrictArguments_Generic) {
+RUNTIME_FUNCTION(Runtime_NewStrictArguments) {
HandleScope scope(isolate);
- DCHECK(args.length() == 1);
+ DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSFunction, callee, 0);
// This generic runtime function can also be used when the caller has been
// inlined, we use the slow but accurate {GetCallerArguments}.
int argument_count = 0;
base::SmartArrayPointer<Handle<Object>> arguments =
GetCallerArguments(isolate, &argument_count);
- HandleArguments argument_getter(arguments.get());
- return *NewStrictArguments(isolate, callee, argument_getter, argument_count);
+ Handle<JSObject> result =
+ isolate->factory()->NewArgumentsObject(callee, argument_count);
+ if (argument_count) {
+ Handle<FixedArray> array =
+ isolate->factory()->NewUninitializedFixedArray(argument_count);
+ DisallowHeapAllocation no_gc;
+ WriteBarrierMode mode = array->GetWriteBarrierMode(no_gc);
+ for (int i = 0; i < argument_count; i++) {
+ array->set(i, *arguments[i], mode);
+ }
+ result->set_elements(*array);
+ }
+ return *result;
}
@@ -681,23 +672,6 @@ RUNTIME_FUNCTION(Runtime_NewSloppyArguments) {
}
-RUNTIME_FUNCTION(Runtime_NewStrictArguments) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 3);
- CONVERT_ARG_HANDLE_CHECKED(JSFunction, callee, 0)
- Object** parameters = reinterpret_cast<Object**>(args[1]);
- CONVERT_SMI_ARG_CHECKED(argument_count, 2);
-#ifdef DEBUG
- // This runtime function does not materialize the correct arguments when the
- // caller has been inlined, better make sure we are not hitting that case.
- JavaScriptFrameIterator it(isolate);
- DCHECK(!it.frame()->HasInlinedFrames());
-#endif // DEBUG
- ParameterArguments argument_getter(parameters);
- return *NewStrictArguments(isolate, callee, argument_getter, argument_count);
-}
-
-
RUNTIME_FUNCTION(Runtime_NewClosure) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
« no previous file with comments | « src/runtime/runtime.h ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698