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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 case Runtime::kInlineRegExpFlags: | 61 case Runtime::kInlineRegExpFlags: |
62 return ReduceRegExpFlags(node); | 62 return ReduceRegExpFlags(node); |
63 case Runtime::kInlineRegExpSource: | 63 case Runtime::kInlineRegExpSource: |
64 return ReduceRegExpSource(node); | 64 return ReduceRegExpSource(node); |
65 case Runtime::kInlineSubString: | 65 case Runtime::kInlineSubString: |
66 return ReduceSubString(node); | 66 return ReduceSubString(node); |
67 case Runtime::kInlineToInteger: | 67 case Runtime::kInlineToInteger: |
68 return ReduceToInteger(node); | 68 return ReduceToInteger(node); |
69 case Runtime::kInlineToLength: | 69 case Runtime::kInlineToLength: |
70 return ReduceToLength(node); | 70 return ReduceToLength(node); |
71 case Runtime::kInlineToName: | |
72 return ReduceToName(node); | |
73 case Runtime::kInlineToNumber: | 71 case Runtime::kInlineToNumber: |
74 return ReduceToNumber(node); | 72 return ReduceToNumber(node); |
75 case Runtime::kInlineToObject: | 73 case Runtime::kInlineToObject: |
76 return ReduceToObject(node); | 74 return ReduceToObject(node); |
77 case Runtime::kInlineToPrimitive: | |
78 return ReduceToPrimitive(node); | |
79 case Runtime::kInlineToString: | 75 case Runtime::kInlineToString: |
80 return ReduceToString(node); | 76 return ReduceToString(node); |
81 case Runtime::kInlineCall: | 77 case Runtime::kInlineCall: |
82 return ReduceCall(node); | 78 return ReduceCall(node); |
83 case Runtime::kInlineNewObject: | 79 case Runtime::kInlineNewObject: |
84 return ReduceNewObject(node); | 80 return ReduceNewObject(node); |
85 case Runtime::kInlineGetSuperConstructor: | 81 case Runtime::kInlineGetSuperConstructor: |
86 return ReduceGetSuperConstructor(node); | 82 return ReduceGetSuperConstructor(node); |
87 default: | 83 default: |
88 break; | 84 break; |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 return Change(node, CodeFactory::SubString(isolate()), 3); | 269 return Change(node, CodeFactory::SubString(isolate()), 3); |
274 } | 270 } |
275 | 271 |
276 | 272 |
277 Reduction JSIntrinsicLowering::ReduceToInteger(Node* node) { | 273 Reduction JSIntrinsicLowering::ReduceToInteger(Node* node) { |
278 NodeProperties::ChangeOp(node, javascript()->ToInteger()); | 274 NodeProperties::ChangeOp(node, javascript()->ToInteger()); |
279 return Changed(node); | 275 return Changed(node); |
280 } | 276 } |
281 | 277 |
282 | 278 |
283 Reduction JSIntrinsicLowering::ReduceToName(Node* node) { | |
284 NodeProperties::ChangeOp(node, javascript()->ToName()); | |
285 return Changed(node); | |
286 } | |
287 | |
288 | |
289 Reduction JSIntrinsicLowering::ReduceToNumber(Node* node) { | 279 Reduction JSIntrinsicLowering::ReduceToNumber(Node* node) { |
290 NodeProperties::ChangeOp(node, javascript()->ToNumber()); | 280 NodeProperties::ChangeOp(node, javascript()->ToNumber()); |
291 return Changed(node); | 281 return Changed(node); |
292 } | 282 } |
293 | 283 |
294 | 284 |
295 Reduction JSIntrinsicLowering::ReduceToLength(Node* node) { | 285 Reduction JSIntrinsicLowering::ReduceToLength(Node* node) { |
296 NodeProperties::ChangeOp(node, javascript()->ToLength()); | 286 NodeProperties::ChangeOp(node, javascript()->ToLength()); |
297 return Changed(node); | 287 return Changed(node); |
298 } | 288 } |
299 | 289 |
300 | 290 |
301 Reduction JSIntrinsicLowering::ReduceToObject(Node* node) { | 291 Reduction JSIntrinsicLowering::ReduceToObject(Node* node) { |
302 NodeProperties::ChangeOp(node, javascript()->ToObject()); | 292 NodeProperties::ChangeOp(node, javascript()->ToObject()); |
303 return Changed(node); | 293 return Changed(node); |
304 } | 294 } |
305 | 295 |
306 | 296 |
307 Reduction JSIntrinsicLowering::ReduceToPrimitive(Node* node) { | |
308 Node* value = NodeProperties::GetValueInput(node, 0); | |
309 Type* value_type = NodeProperties::GetType(value); | |
310 if (value_type->Is(Type::Primitive())) { | |
311 ReplaceWithValue(node, value); | |
312 return Replace(value); | |
313 } | |
314 return NoChange(); | |
315 } | |
316 | |
317 | |
318 Reduction JSIntrinsicLowering::ReduceToString(Node* node) { | 297 Reduction JSIntrinsicLowering::ReduceToString(Node* node) { |
319 NodeProperties::ChangeOp(node, javascript()->ToString()); | 298 NodeProperties::ChangeOp(node, javascript()->ToString()); |
320 return Changed(node); | 299 return Changed(node); |
321 } | 300 } |
322 | 301 |
323 | 302 |
324 Reduction JSIntrinsicLowering::ReduceCall(Node* node) { | 303 Reduction JSIntrinsicLowering::ReduceCall(Node* node) { |
325 size_t const arity = CallRuntimeParametersOf(node->op()).arity(); | 304 size_t const arity = CallRuntimeParametersOf(node->op()).arity(); |
326 NodeProperties::ChangeOp(node, | 305 NodeProperties::ChangeOp(node, |
327 javascript()->CallFunction(arity, VectorSlotPair(), | 306 javascript()->CallFunction(arity, VectorSlotPair(), |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 } | 392 } |
414 | 393 |
415 | 394 |
416 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { | 395 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { |
417 return jsgraph()->simplified(); | 396 return jsgraph()->simplified(); |
418 } | 397 } |
419 | 398 |
420 } // namespace compiler | 399 } // namespace compiler |
421 } // namespace internal | 400 } // namespace internal |
422 } // namespace v8 | 401 } // namespace v8 |
OLD | NEW |