OLD | NEW |
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-intrinsic-lowering.h" | 5 #include "src/compiler/js-intrinsic-lowering.h" |
6 | 6 |
7 #include <stack> | 7 #include <stack> |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/compiler/access-builder.h" | 10 #include "src/compiler/access-builder.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 case Runtime::kInlineIsRegExp: | 47 case Runtime::kInlineIsRegExp: |
48 return ReduceIsInstanceType(node, JS_REGEXP_TYPE); | 48 return ReduceIsInstanceType(node, JS_REGEXP_TYPE); |
49 case Runtime::kInlineIsJSReceiver: | 49 case Runtime::kInlineIsJSReceiver: |
50 return ReduceIsJSReceiver(node); | 50 return ReduceIsJSReceiver(node); |
51 case Runtime::kInlineIsSmi: | 51 case Runtime::kInlineIsSmi: |
52 return ReduceIsSmi(node); | 52 return ReduceIsSmi(node); |
53 case Runtime::kInlineFixedArrayGet: | 53 case Runtime::kInlineFixedArrayGet: |
54 return ReduceFixedArrayGet(node); | 54 return ReduceFixedArrayGet(node); |
55 case Runtime::kInlineFixedArraySet: | 55 case Runtime::kInlineFixedArraySet: |
56 return ReduceFixedArraySet(node); | 56 return ReduceFixedArraySet(node); |
57 case Runtime::kInlineRegExpConstructResult: | |
58 return ReduceRegExpConstructResult(node); | |
59 case Runtime::kInlineRegExpExec: | 57 case Runtime::kInlineRegExpExec: |
60 return ReduceRegExpExec(node); | 58 return ReduceRegExpExec(node); |
61 case Runtime::kInlineRegExpFlags: | |
62 return ReduceRegExpFlags(node); | |
63 case Runtime::kInlineRegExpSource: | |
64 return ReduceRegExpSource(node); | |
65 case Runtime::kInlineSubString: | 59 case Runtime::kInlineSubString: |
66 return ReduceSubString(node); | 60 return ReduceSubString(node); |
67 case Runtime::kInlineToInteger: | 61 case Runtime::kInlineToInteger: |
68 return ReduceToInteger(node); | 62 return ReduceToInteger(node); |
69 case Runtime::kInlineToLength: | 63 case Runtime::kInlineToLength: |
70 return ReduceToLength(node); | 64 return ReduceToLength(node); |
71 case Runtime::kInlineToNumber: | 65 case Runtime::kInlineToNumber: |
72 return ReduceToNumber(node); | 66 return ReduceToNumber(node); |
73 case Runtime::kInlineToObject: | 67 case Runtime::kInlineToObject: |
74 return ReduceToObject(node); | 68 return ReduceToObject(node); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 Node* effect = NodeProperties::GetEffectInput(node); | 221 Node* effect = NodeProperties::GetEffectInput(node); |
228 Node* control = NodeProperties::GetControlInput(node); | 222 Node* control = NodeProperties::GetControlInput(node); |
229 Node* store = (graph()->NewNode( | 223 Node* store = (graph()->NewNode( |
230 simplified()->StoreElement(AccessBuilder::ForFixedArrayElement()), base, | 224 simplified()->StoreElement(AccessBuilder::ForFixedArrayElement()), base, |
231 index, value, effect, control)); | 225 index, value, effect, control)); |
232 ReplaceWithValue(node, value, store); | 226 ReplaceWithValue(node, value, store); |
233 return Changed(store); | 227 return Changed(store); |
234 } | 228 } |
235 | 229 |
236 | 230 |
237 Reduction JSIntrinsicLowering::ReduceRegExpConstructResult(Node* node) { | |
238 // TODO(bmeurer): Introduce JSCreateRegExpResult? | |
239 return Change(node, CodeFactory::RegExpConstructResult(isolate()), 0); | |
240 } | |
241 | |
242 | |
243 Reduction JSIntrinsicLowering::ReduceRegExpExec(Node* node) { | 231 Reduction JSIntrinsicLowering::ReduceRegExpExec(Node* node) { |
244 return Change(node, CodeFactory::RegExpExec(isolate()), 4); | 232 return Change(node, CodeFactory::RegExpExec(isolate()), 4); |
245 } | 233 } |
246 | 234 |
247 | 235 |
248 Reduction JSIntrinsicLowering::ReduceRegExpFlags(Node* node) { | |
249 Node* const receiver = NodeProperties::GetValueInput(node, 0); | |
250 Node* const effect = NodeProperties::GetEffectInput(node); | |
251 Node* const control = NodeProperties::GetControlInput(node); | |
252 Operator const* const op = | |
253 simplified()->LoadField(AccessBuilder::ForJSRegExpFlags()); | |
254 return Change(node, op, receiver, effect, control); | |
255 } | |
256 | |
257 | |
258 Reduction JSIntrinsicLowering::ReduceRegExpSource(Node* node) { | |
259 Node* const receiver = NodeProperties::GetValueInput(node, 0); | |
260 Node* const effect = NodeProperties::GetEffectInput(node); | |
261 Node* const control = NodeProperties::GetControlInput(node); | |
262 Operator const* const op = | |
263 simplified()->LoadField(AccessBuilder::ForJSRegExpSource()); | |
264 return Change(node, op, receiver, effect, control); | |
265 } | |
266 | |
267 | |
268 Reduction JSIntrinsicLowering::ReduceSubString(Node* node) { | 236 Reduction JSIntrinsicLowering::ReduceSubString(Node* node) { |
269 return Change(node, CodeFactory::SubString(isolate()), 3); | 237 return Change(node, CodeFactory::SubString(isolate()), 3); |
270 } | 238 } |
271 | 239 |
272 | 240 |
273 Reduction JSIntrinsicLowering::ReduceToInteger(Node* node) { | 241 Reduction JSIntrinsicLowering::ReduceToInteger(Node* node) { |
274 NodeProperties::ChangeOp(node, javascript()->ToInteger()); | 242 NodeProperties::ChangeOp(node, javascript()->ToInteger()); |
275 return Changed(node); | 243 return Changed(node); |
276 } | 244 } |
277 | 245 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 return jsgraph_->javascript(); | 354 return jsgraph_->javascript(); |
387 } | 355 } |
388 | 356 |
389 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { | 357 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { |
390 return jsgraph()->simplified(); | 358 return jsgraph()->simplified(); |
391 } | 359 } |
392 | 360 |
393 } // namespace compiler | 361 } // namespace compiler |
394 } // namespace internal | 362 } // namespace internal |
395 } // namespace v8 | 363 } // namespace v8 |
OLD | NEW |