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

Unified Diff: src/interpreter/interpreter.cc

Issue 1909903003: [Interpreter] Use FastNewSloppyArguments when possible. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add ports Created 4 years, 8 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/ia32/code-stubs-ia32.cc ('k') | src/interpreter/interpreter-assembler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/interpreter.cc
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc
index a8d491f35d25ba9fe3f34acc977cb6ed2fc21c7c..aca784c5f857101581b0f54f6b9a35d2ee0f21a2 100644
--- a/src/interpreter/interpreter.cc
+++ b/src/interpreter/interpreter.cc
@@ -22,6 +22,8 @@ namespace internal {
namespace interpreter {
using compiler::Node;
+typedef CodeStubAssembler::Label Label;
+typedef CodeStubAssembler::Variable Variable;
#define __ assembler->
@@ -1471,9 +1473,40 @@ void Interpreter::DoCreateClosure(InterpreterAssembler* assembler) {
void Interpreter::DoCreateMappedArguments(InterpreterAssembler* assembler) {
Node* closure = __ LoadRegister(Register::function_closure());
Node* context = __ GetContext();
- Node* result =
- __ CallRuntime(Runtime::kNewSloppyArguments_Generic, context, closure);
- __ SetAccumulator(result);
+
+ Variable result(assembler, MachineRepresentation::kTagged);
+ Label end(assembler), if_duplicate_parameters(assembler),
+ if_not_duplicate_parameters(assembler);
+
+ // Check if function has duplicate parameters.
+ // TODO(rmcilroy): Remove this check when FastNewSloppyArgumentsStub supports
+ // duplicate parameters.
+ Node* shared_info =
+ __ LoadObjectField(closure, JSFunction::kSharedFunctionInfoOffset);
+ Node* compiler_hints = __ LoadObjectField(
+ shared_info, SharedFunctionInfo::kHasDuplicateParametersByteOffset,
+ MachineType::Uint8());
+ Node* duplicate_parameters_bit = __ Int32Constant(
+ 1 << SharedFunctionInfo::kHasDuplicateParametersBitWithinByte);
+ Node* compare = __ Word32And(compiler_hints, duplicate_parameters_bit);
+ __ BranchIf(compare, &if_duplicate_parameters, &if_not_duplicate_parameters);
+
+ __ Bind(&if_duplicate_parameters);
+ {
+ result.Bind(
+ __ CallRuntime(Runtime::kNewSloppyArguments_Generic, context, closure));
+ __ Goto(&end);
+ }
+
+ __ Bind(&if_not_duplicate_parameters);
+ {
+ Callable callable = CodeFactory::FastNewSloppyArguments(isolate_);
+ Node* target = __ HeapConstant(callable.code());
+ result.Bind(__ CallStub(callable.descriptor(), target, context, closure));
+ __ Goto(&end);
+ }
+ __ Bind(&end);
+ __ SetAccumulator(result.value());
__ Dispatch();
}
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/interpreter/interpreter-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698