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

Unified Diff: src/builtins/builtins-array-gen.cc

Issue 2873653002: [array] Don't adapt arguments for ArrayIndexOf and ArrayIncludes (Closed)
Patch Set: Created 3 years, 7 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 | « no previous file | src/builtins/builtins-definitions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/builtins-array-gen.cc
diff --git a/src/builtins/builtins-array-gen.cc b/src/builtins/builtins-array-gen.cc
index f5963e7ae0da3c99ed98c07b52ae8f2b5d4726ed..abe31e6ce8f7c097f3c9919419791a288ae85912 100644
--- a/src/builtins/builtins-array-gen.cc
+++ b/src/builtins/builtins-array-gen.cc
@@ -1355,10 +1355,19 @@ TF_BUILTIN(ArrayIsArray, CodeStubAssembler) {
}
TF_BUILTIN(ArrayIncludes, CodeStubAssembler) {
- Node* const array = Parameter(Descriptor::kReceiver);
- Node* const search_element = Parameter(Descriptor::kSearchElement);
- Node* const start_from = Parameter(Descriptor::kFromIndex);
- Node* const context = Parameter(Descriptor::kContext);
+ const int kSearchElementArg = 0;
+ const int kFromIndexArg = 1;
+
+ Node* argc =
+ ChangeInt32ToIntPtr(Parameter(BuiltinDescriptor::kArgumentsCount));
+ CodeStubArguments args(this, argc);
+
+ Node* array = args.GetReceiver();
+ Node* search_element =
+ args.GetOptionalArgumentValue(kSearchElementArg, UndefinedConstant());
+ Node* start_from =
+ args.GetOptionalArgumentValue(kFromIndexArg, UndefinedConstant());
+ Node* const context = Parameter(BuiltinDescriptor::kContext);
VARIABLE(index_var, MachineType::PointerRepresentation());
@@ -1633,21 +1642,30 @@ TF_BUILTIN(ArrayIncludes, CodeStubAssembler) {
}
BIND(&return_true);
- Return(TrueConstant());
+ args.PopAndReturn(TrueConstant());
BIND(&return_false);
- Return(FalseConstant());
+ args.PopAndReturn(FalseConstant());
BIND(&call_runtime);
- Return(CallRuntime(Runtime::kArrayIncludes_Slow, context, array,
- search_element, start_from));
+ args.PopAndReturn(CallRuntime(Runtime::kArrayIncludes_Slow, context, array,
+ search_element, start_from));
}
TF_BUILTIN(ArrayIndexOf, CodeStubAssembler) {
- Node* array = Parameter(Descriptor::kReceiver);
- Node* search_element = Parameter(Descriptor::kSearchElement);
- Node* start_from = Parameter(Descriptor::kFromIndex);
- Node* context = Parameter(Descriptor::kContext);
+ const int kSearchElementArg = 0;
+ const int kFromIndexArg = 1;
+
+ Node* argc =
+ ChangeInt32ToIntPtr(Parameter(BuiltinDescriptor::kArgumentsCount));
+ CodeStubArguments args(this, argc);
+
+ Node* array = args.GetReceiver();
+ Node* search_element =
+ args.GetOptionalArgumentValue(kSearchElementArg, UndefinedConstant());
+ Node* start_from =
+ args.GetOptionalArgumentValue(kFromIndexArg, UndefinedConstant());
+ Node* context = Parameter(BuiltinDescriptor::kContext);
Node* intptr_zero = IntPtrConstant(0);
Node* intptr_one = IntPtrConstant(1);
@@ -1898,14 +1916,14 @@ TF_BUILTIN(ArrayIndexOf, CodeStubAssembler) {
}
BIND(&return_found);
- Return(SmiTag(index_var.value()));
+ args.PopAndReturn(SmiTag(index_var.value()));
BIND(&return_not_found);
- Return(NumberConstant(-1));
+ args.PopAndReturn(NumberConstant(-1));
BIND(&call_runtime);
- Return(CallRuntime(Runtime::kArrayIndexOf, context, array, search_element,
- start_from));
+ args.PopAndReturn(CallRuntime(Runtime::kArrayIndexOf, context, array,
+ search_element, start_from));
}
class ArrayPrototypeIterationAssembler : public CodeStubAssembler {
« no previous file with comments | « no previous file | src/builtins/builtins-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698