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

Unified Diff: src/compiler/js-call-reducer.cc

Issue 2664423003: [turbofan] fix wrong materialization of arguments object (Closed)
Patch Set: merged test files 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 | « no previous file | test/mjsunit/arguments-deopt.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-call-reducer.cc
diff --git a/src/compiler/js-call-reducer.cc b/src/compiler/js-call-reducer.cc
index 2e79ad8db32d9499b44f2b47353a10684fe46e9b..78dc26a31b14ea6eda4c1b4eb612f043a2f78807 100644
--- a/src/compiler/js-call-reducer.cc
+++ b/src/compiler/js-call-reducer.cc
@@ -117,16 +117,18 @@ Reduction JSCallReducer::ReduceFunctionPrototypeApply(Node* node) {
CreateArgumentsType const type = CreateArgumentsTypeOf(arg_array->op());
Node* frame_state = NodeProperties::GetFrameStateInput(arg_array);
FrameStateInfo state_info = OpParameter<FrameStateInfo>(frame_state);
+ int formal_parameter_count;
int start_index = 0;
- if (type == CreateArgumentsType::kMappedArguments) {
- // Mapped arguments (sloppy mode) cannot be handled if they are aliased.
+ {
Handle<SharedFunctionInfo> shared;
if (!state_info.shared_info().ToHandle(&shared)) return NoChange();
- if (shared->internal_formal_parameter_count() != 0) return NoChange();
+ formal_parameter_count = shared->internal_formal_parameter_count();
+ }
+ if (type == CreateArgumentsType::kMappedArguments) {
+ // Mapped arguments (sloppy mode) cannot be handled if they are aliased.
+ if (formal_parameter_count != 0) return NoChange();
} else if (type == CreateArgumentsType::kRestParameter) {
- Handle<SharedFunctionInfo> shared;
- if (!state_info.shared_info().ToHandle(&shared)) return NoChange();
- start_index = shared->internal_formal_parameter_count();
+ start_index = formal_parameter_count;
}
// Check if are applying to inlined arguments or to the arguments of
// the outermost function.
@@ -135,7 +137,10 @@ Reduction JSCallReducer::ReduceFunctionPrototypeApply(Node* node) {
// TODO(jarin,bmeurer): Support the NewUnmappedArgumentsElement and
// NewRestParameterElements in the EscapeAnalysis and Deoptimizer
// instead, then we don't need this hack.
- if (type != CreateArgumentsType::kRestParameter) {
+ // Only works with zero formal parameters because of lacking deoptimizer
+ // support.
+ if (type != CreateArgumentsType::kRestParameter &&
+ formal_parameter_count == 0) {
// There are no other uses of the {arg_array} except in StateValues,
// so we just replace {arg_array} with a marker for the Deoptimizer
// that this refers to the arguments object.
« no previous file with comments | « no previous file | test/mjsunit/arguments-deopt.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698