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

Side by Side Diff: src/compiler/js-frame-specialization.cc

Issue 1429233004: [turbofan] Fix wrong parameter indices in JSFrameSpecialization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-552304.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/js-frame-specialization.h" 5 #include "src/compiler/js-frame-specialization.h"
6 6
7 #include "src/compiler/js-graph.h" 7 #include "src/compiler/js-graph.h"
8 #include "src/compiler/linkage.h" 8 #include "src/compiler/linkage.h"
9 #include "src/frames-inl.h" 9 #include "src/frames-inl.h"
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 Reduction JSFrameSpecialization::ReduceParameter(Node* node) { 46 Reduction JSFrameSpecialization::ReduceParameter(Node* node) {
47 DCHECK_EQ(IrOpcode::kParameter, node->opcode()); 47 DCHECK_EQ(IrOpcode::kParameter, node->opcode());
48 DisallowHeapAllocation no_gc; 48 DisallowHeapAllocation no_gc;
49 Object* object; 49 Object* object;
50 int const index = ParameterIndexOf(node->op()); 50 int const index = ParameterIndexOf(node->op());
51 int const parameters_count = frame()->ComputeParametersCount() + 1; 51 int const parameters_count = frame()->ComputeParametersCount() + 1;
52 if (index == Linkage::kJSFunctionCallClosureParamIndex) { 52 if (index == Linkage::kJSFunctionCallClosureParamIndex) {
53 object = frame()->function(); 53 object = frame()->function();
54 } else if (index == parameters_count) { 54 } else if (index == parameters_count) {
55 // The Parameter index (arity + 1) is the context. 55 // The Parameter index (arity + 1) is the parameter count.
56 object = Smi::FromInt(parameters_count - 1);
57 } else if (index == parameters_count + 1) {
58 // The Parameter index (arity + 2) is the context.
56 object = frame()->context(); 59 object = frame()->context();
57 } else { 60 } else {
58 // The Parameter index 0 is the receiver. 61 // The Parameter index 0 is the receiver.
59 object = index ? frame()->GetParameter(index - 1) : frame()->receiver(); 62 object = index ? frame()->GetParameter(index - 1) : frame()->receiver();
60 } 63 }
61 return Replace(jsgraph()->Constant(handle(object, isolate()))); 64 return Replace(jsgraph()->Constant(handle(object, isolate())));
62 } 65 }
63 66
64 67
65 Isolate* JSFrameSpecialization::isolate() const { return jsgraph()->isolate(); } 68 Isolate* JSFrameSpecialization::isolate() const { return jsgraph()->isolate(); }
66 69
67 } // namespace compiler 70 } // namespace compiler
68 } // namespace internal 71 } // namespace internal
69 } // namespace v8 72 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-552304.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698