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

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

Issue 2792553002: [turbofan] Specialize to closure with function context specialization. (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « src/compiler/js-context-specialization.h ('k') | src/compiler/pipeline.cc » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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-context-specialization.h" 5 #include "src/compiler/js-context-specialization.h"
6 6
7 #include "src/compiler/common-operator.h" 7 #include "src/compiler/common-operator.h"
8 #include "src/compiler/js-graph.h" 8 #include "src/compiler/js-graph.h"
9 #include "src/compiler/js-operator.h" 9 #include "src/compiler/js-operator.h"
10 #include "src/compiler/linkage.h"
10 #include "src/compiler/node-matchers.h" 11 #include "src/compiler/node-matchers.h"
11 #include "src/compiler/node-properties.h" 12 #include "src/compiler/node-properties.h"
12 #include "src/contexts.h" 13 #include "src/contexts.h"
13 #include "src/objects-inl.h" 14 #include "src/objects-inl.h"
14 15
15 namespace v8 { 16 namespace v8 {
16 namespace internal { 17 namespace internal {
17 namespace compiler { 18 namespace compiler {
18 19
19 Reduction JSContextSpecialization::Reduce(Node* node) { 20 Reduction JSContextSpecialization::Reduce(Node* node) {
20 switch (node->opcode()) { 21 switch (node->opcode()) {
22 case IrOpcode::kParameter:
23 return ReduceParameter(node);
21 case IrOpcode::kJSLoadContext: 24 case IrOpcode::kJSLoadContext:
22 return ReduceJSLoadContext(node); 25 return ReduceJSLoadContext(node);
23 case IrOpcode::kJSStoreContext: 26 case IrOpcode::kJSStoreContext:
24 return ReduceJSStoreContext(node); 27 return ReduceJSStoreContext(node);
25 default: 28 default:
26 break; 29 break;
27 } 30 }
28 return NoChange(); 31 return NoChange();
29 } 32 }
30 33
34 Reduction JSContextSpecialization::ReduceParameter(Node* node) {
35 DCHECK_EQ(IrOpcode::kParameter, node->opcode());
36 int const index = ParameterIndexOf(node->op());
37 if (index == Linkage::kJSCallClosureParamIndex) {
38 // Constant-fold the function parameter {node}.
39 Handle<JSFunction> function;
40 if (closure().ToHandle(&function)) {
41 Node* value = jsgraph()->HeapConstant(function);
42 return Replace(value);
43 }
44 }
45 return NoChange();
46 }
47
31 Reduction JSContextSpecialization::SimplifyJSLoadContext(Node* node, 48 Reduction JSContextSpecialization::SimplifyJSLoadContext(Node* node,
32 Node* new_context, 49 Node* new_context,
33 size_t new_depth) { 50 size_t new_depth) {
34 DCHECK_EQ(IrOpcode::kJSLoadContext, node->opcode()); 51 DCHECK_EQ(IrOpcode::kJSLoadContext, node->opcode());
35 const ContextAccess& access = ContextAccessOf(node->op()); 52 const ContextAccess& access = ContextAccessOf(node->op());
36 DCHECK_LE(new_depth, access.depth()); 53 DCHECK_LE(new_depth, access.depth());
37 54
38 if (new_depth == access.depth() && 55 if (new_depth == access.depth() &&
39 new_context == NodeProperties::GetContextInput(node)) { 56 new_context == NodeProperties::GetContextInput(node)) {
40 return NoChange(); 57 return NoChange();
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 163 }
147 164
148 165
149 JSOperatorBuilder* JSContextSpecialization::javascript() const { 166 JSOperatorBuilder* JSContextSpecialization::javascript() const {
150 return jsgraph()->javascript(); 167 return jsgraph()->javascript();
151 } 168 }
152 169
153 } // namespace compiler 170 } // namespace compiler
154 } // namespace internal 171 } // namespace internal
155 } // namespace v8 172 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-context-specialization.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698