| OLD | NEW |
| 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-inlining.h" | 5 #include "src/compiler/js-inlining.h" |
| 6 | 6 |
| 7 #include "src/ast/ast.h" | 7 #include "src/ast/ast.h" |
| 8 #include "src/compilation-info.h" | 8 #include "src/compilation-info.h" |
| 9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
| 10 #include "src/compiler/all-nodes.h" | 10 #include "src/compiler/all-nodes.h" |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 // map tracking we want to do, and eventually changed the CheckMaps | 283 // map tracking we want to do, and eventually changed the CheckMaps |
| 284 // operator to carry map constants on the operator instead of inputs. | 284 // operator to carry map constants on the operator instead of inputs. |
| 285 // I.e. if the CheckMaps has some kind of SmallMapSet as operator | 285 // I.e. if the CheckMaps has some kind of SmallMapSet as operator |
| 286 // parameter, then this could be changed to call a generic | 286 // parameter, then this could be changed to call a generic |
| 287 // | 287 // |
| 288 // SmallMapSet NodeProperties::CollectMapWitness(receiver, effect) | 288 // SmallMapSet NodeProperties::CollectMapWitness(receiver, effect) |
| 289 // | 289 // |
| 290 // function, which either returns the map set from the CheckMaps or | 290 // function, which either returns the map set from the CheckMaps or |
| 291 // a singleton set from a StoreField. | 291 // a singleton set from a StoreField. |
| 292 bool NeedsConvertReceiver(Node* receiver, Node* effect) { | 292 bool NeedsConvertReceiver(Node* receiver, Node* effect) { |
| 293 // Check if the {receiver} is already a JSReceiver. |
| 294 switch (receiver->opcode()) { |
| 295 case IrOpcode::kJSConstruct: |
| 296 case IrOpcode::kJSConstructWithSpread: |
| 297 case IrOpcode::kJSCreate: |
| 298 case IrOpcode::kJSCreateArguments: |
| 299 case IrOpcode::kJSCreateArray: |
| 300 case IrOpcode::kJSCreateClosure: |
| 301 case IrOpcode::kJSCreateIterResultObject: |
| 302 case IrOpcode::kJSCreateKeyValueArray: |
| 303 case IrOpcode::kJSCreateLiteralArray: |
| 304 case IrOpcode::kJSCreateLiteralObject: |
| 305 case IrOpcode::kJSCreateLiteralRegExp: |
| 306 case IrOpcode::kJSConvertReceiver: |
| 307 case IrOpcode::kJSGetSuperConstructor: |
| 308 case IrOpcode::kJSToObject: |
| 309 return false; |
| 310 default: |
| 311 break; |
| 312 } |
| 293 for (Node* dominator = effect;;) { | 313 for (Node* dominator = effect;;) { |
| 294 if (dominator->opcode() == IrOpcode::kCheckMaps && | 314 if (dominator->opcode() == IrOpcode::kCheckMaps && |
| 295 NodeProperties::IsSame(dominator->InputAt(0), receiver)) { | 315 NodeProperties::IsSame(dominator->InputAt(0), receiver)) { |
| 296 // Check if all maps have the given {instance_type}. | 316 // Check if all maps have the given {instance_type}. |
| 297 ZoneHandleSet<Map> const& maps = | 317 ZoneHandleSet<Map> const& maps = |
| 298 CheckMapsParametersOf(dominator->op()).maps(); | 318 CheckMapsParametersOf(dominator->op()).maps(); |
| 299 for (size_t i = 0; i < maps.size(); ++i) { | 319 for (size_t i = 0; i < maps.size(); ++i) { |
| 300 if (!maps[i]->IsJSReceiverMap()) return true; | 320 if (!maps[i]->IsJSReceiverMap()) return true; |
| 301 } | 321 } |
| 302 return false; | 322 return false; |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 | 755 |
| 736 CommonOperatorBuilder* JSInliner::common() const { return jsgraph()->common(); } | 756 CommonOperatorBuilder* JSInliner::common() const { return jsgraph()->common(); } |
| 737 | 757 |
| 738 SimplifiedOperatorBuilder* JSInliner::simplified() const { | 758 SimplifiedOperatorBuilder* JSInliner::simplified() const { |
| 739 return jsgraph()->simplified(); | 759 return jsgraph()->simplified(); |
| 740 } | 760 } |
| 741 | 761 |
| 742 } // namespace compiler | 762 } // namespace compiler |
| 743 } // namespace internal | 763 } // namespace internal |
| 744 } // namespace v8 | 764 } // namespace v8 |
| OLD | NEW |