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

Side by Side Diff: src/compiler/js-builtin-reducer.cc

Issue 797903003: [turbofan] Various cleanups. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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-builtin-reducer.h ('k') | src/compiler/js-graph.h » ('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/diamond.h" 5 #include "src/compiler/diamond.h"
6 #include "src/compiler/graph-inl.h" 6 #include "src/compiler/graph-inl.h"
7 #include "src/compiler/js-builtin-reducer.h" 7 #include "src/compiler/js-builtin-reducer.h"
8 #include "src/compiler/js-graph.h"
8 #include "src/compiler/node-matchers.h" 9 #include "src/compiler/node-matchers.h"
9 #include "src/compiler/node-properties-inl.h" 10 #include "src/compiler/node-properties-inl.h"
10 #include "src/types.h" 11 #include "src/types.h"
11 12
12 namespace v8 { 13 namespace v8 {
13 namespace internal { 14 namespace internal {
14 namespace compiler { 15 namespace compiler {
15 16
16 17
17 // Helper method that assumes replacement nodes are pure values that don't 18 // Helper method that assumes replacement nodes are pure values that don't
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 DCHECK_LT(index, GetJSCallArity()); 90 DCHECK_LT(index, GetJSCallArity());
90 // Skip first (i.e. callee) and second (i.e. receiver) operand. 91 // Skip first (i.e. callee) and second (i.e. receiver) operand.
91 return NodeProperties::GetValueInput(node_, index + 2); 92 return NodeProperties::GetValueInput(node_, index + 2);
92 } 93 }
93 94
94 private: 95 private:
95 Node* node_; 96 Node* node_;
96 }; 97 };
97 98
98 99
100 JSBuiltinReducer::JSBuiltinReducer(JSGraph* jsgraph)
101 : jsgraph_(jsgraph), simplified_(jsgraph->zone()) {}
102
103
99 // ECMA-262, section 15.8.2.1. 104 // ECMA-262, section 15.8.2.1.
100 Reduction JSBuiltinReducer::ReduceMathAbs(Node* node) { 105 Reduction JSBuiltinReducer::ReduceMathAbs(Node* node) {
101 JSCallReduction r(node); 106 JSCallReduction r(node);
102 if (r.InputsMatchOne(Type::Unsigned32())) { 107 if (r.InputsMatchOne(Type::Unsigned32())) {
103 // Math.abs(a:uint32) -> a 108 // Math.abs(a:uint32) -> a
104 return Replace(r.left()); 109 return Replace(r.left());
105 } 110 }
106 if (r.InputsMatchOne(Type::Number())) { 111 if (r.InputsMatchOne(Type::Number())) {
107 // Math.abs(a:number) -> (a > 0 ? a : 0 - a) 112 // Math.abs(a:number) -> (a > 0 ? a : 0 - a)
108 Node* const value = r.left(); 113 Node* const value = r.left();
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 case kMathFloor: 230 case kMathFloor:
226 return ReplaceWithPureReduction(node, ReduceMathFloor(node)); 231 return ReplaceWithPureReduction(node, ReduceMathFloor(node));
227 case kMathCeil: 232 case kMathCeil:
228 return ReplaceWithPureReduction(node, ReduceMathCeil(node)); 233 return ReplaceWithPureReduction(node, ReduceMathCeil(node));
229 default: 234 default:
230 break; 235 break;
231 } 236 }
232 return NoChange(); 237 return NoChange();
233 } 238 }
234 239
240
241 Graph* JSBuiltinReducer::graph() const { return jsgraph()->graph(); }
242
243
244 CommonOperatorBuilder* JSBuiltinReducer::common() const {
245 return jsgraph()->common();
246 }
247
248
249 MachineOperatorBuilder* JSBuiltinReducer::machine() const {
250 return jsgraph()->machine();
251 }
252
235 } // namespace compiler 253 } // namespace compiler
236 } // namespace internal 254 } // namespace internal
237 } // namespace v8 255 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-builtin-reducer.h ('k') | src/compiler/js-graph.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698