 Chromium Code Reviews
 Chromium Code Reviews Issue 2697513010:
  [turbofan] Avoid introducing useless JSConvertReceiver during inlining.  (Closed)
    
  
    Issue 2697513010:
  [turbofan] Avoid introducing useless JSConvertReceiver during inlining.  (Closed) 
  | 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 } | |
| 313 if (receiver->opcode() == IrOpcode::kJSCreate) return false; | |
| 
Jarin
2017/02/17 10:07:46
This line is not necessary anymore, no?
 
Benedikt Meurer
2017/02/17 10:09:40
Done.
 | |
| 293 for (Node* dominator = effect;;) { | 314 for (Node* dominator = effect;;) { | 
| 294 if (dominator->opcode() == IrOpcode::kCheckMaps && | 315 if (dominator->opcode() == IrOpcode::kCheckMaps && | 
| 295 NodeProperties::IsSame(dominator->InputAt(0), receiver)) { | 316 NodeProperties::IsSame(dominator->InputAt(0), receiver)) { | 
| 296 // Check if all maps have the given {instance_type}. | 317 // Check if all maps have the given {instance_type}. | 
| 297 ZoneHandleSet<Map> const& maps = | 318 ZoneHandleSet<Map> const& maps = | 
| 298 CheckMapsParametersOf(dominator->op()).maps(); | 319 CheckMapsParametersOf(dominator->op()).maps(); | 
| 299 for (size_t i = 0; i < maps.size(); ++i) { | 320 for (size_t i = 0; i < maps.size(); ++i) { | 
| 300 if (!maps[i]->IsJSReceiverMap()) return true; | 321 if (!maps[i]->IsJSReceiverMap()) return true; | 
| 301 } | 322 } | 
| 302 return false; | 323 return false; | 
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 735 | 756 | 
| 736 CommonOperatorBuilder* JSInliner::common() const { return jsgraph()->common(); } | 757 CommonOperatorBuilder* JSInliner::common() const { return jsgraph()->common(); } | 
| 737 | 758 | 
| 738 SimplifiedOperatorBuilder* JSInliner::simplified() const { | 759 SimplifiedOperatorBuilder* JSInliner::simplified() const { | 
| 739 return jsgraph()->simplified(); | 760 return jsgraph()->simplified(); | 
| 740 } | 761 } | 
| 741 | 762 | 
| 742 } // namespace compiler | 763 } // namespace compiler | 
| 743 } // namespace internal | 764 } // namespace internal | 
| 744 } // namespace v8 | 765 } // namespace v8 | 
| OLD | NEW |