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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 } | 291 } |
292 | 292 |
293 | 293 |
294 Reduction JSIntrinsicLowering::ReduceToObject(Node* node) { | 294 Reduction JSIntrinsicLowering::ReduceToObject(Node* node) { |
295 NodeProperties::ChangeOp(node, javascript()->ToObject()); | 295 NodeProperties::ChangeOp(node, javascript()->ToObject()); |
296 return Changed(node); | 296 return Changed(node); |
297 } | 297 } |
298 | 298 |
299 | 299 |
300 Reduction JSIntrinsicLowering::ReduceToString(Node* node) { | 300 Reduction JSIntrinsicLowering::ReduceToString(Node* node) { |
| 301 // ToString is unnecessary if the input is a string. |
| 302 HeapObjectMatcher m(NodeProperties::GetValueInput(node, 0)); |
| 303 if (m.HasValue() && m.Value()->IsString()) { |
| 304 ReplaceWithValue(node, m.node()); |
| 305 return Replace(m.node()); |
| 306 } |
301 NodeProperties::ChangeOp(node, javascript()->ToString()); | 307 NodeProperties::ChangeOp(node, javascript()->ToString()); |
302 return Changed(node); | 308 return Changed(node); |
303 } | 309 } |
304 | 310 |
305 | 311 |
306 Reduction JSIntrinsicLowering::ReduceCall(Node* node) { | 312 Reduction JSIntrinsicLowering::ReduceCall(Node* node) { |
307 size_t const arity = CallRuntimeParametersOf(node->op()).arity(); | 313 size_t const arity = CallRuntimeParametersOf(node->op()).arity(); |
308 NodeProperties::ChangeOp( | 314 NodeProperties::ChangeOp( |
309 node, | 315 node, |
310 javascript()->Call(arity, 0.0f, VectorSlotPair(), | 316 javascript()->Call(arity, 0.0f, VectorSlotPair(), |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 return jsgraph_->javascript(); | 454 return jsgraph_->javascript(); |
449 } | 455 } |
450 | 456 |
451 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { | 457 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { |
452 return jsgraph()->simplified(); | 458 return jsgraph()->simplified(); |
453 } | 459 } |
454 | 460 |
455 } // namespace compiler | 461 } // namespace compiler |
456 } // namespace internal | 462 } // namespace internal |
457 } // namespace v8 | 463 } // namespace v8 |
OLD | NEW |