| 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/ast-graph-builder.h" | 5 #include "src/compiler/ast-graph-builder.h" | 
| 6 | 6 | 
| 7 #include "src/compiler.h" | 7 #include "src/compiler.h" | 
| 8 #include "src/compiler/ast-loop-assignment-analyzer.h" | 8 #include "src/compiler/ast-loop-assignment-analyzer.h" | 
| 9 #include "src/compiler/control-builders.h" | 9 #include "src/compiler/control-builders.h" | 
| 10 #include "src/compiler/js-type-feedback.h" | 10 #include "src/compiler/js-type-feedback.h" | 
| (...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1321     //                a few simplified instructions. | 1321     //                a few simplified instructions. | 
| 1322     Node* cache_pair = NewNode( | 1322     Node* cache_pair = NewNode( | 
| 1323         javascript()->CallRuntime(Runtime::kForInInit, 2), obj, cache_type); | 1323         javascript()->CallRuntime(Runtime::kForInInit, 2), obj, cache_type); | 
| 1324     // cache_type may have been replaced. | 1324     // cache_type may have been replaced. | 
| 1325     Node* cache_array = NewNode(common()->Projection(0), cache_pair); | 1325     Node* cache_array = NewNode(common()->Projection(0), cache_pair); | 
| 1326     cache_type = NewNode(common()->Projection(1), cache_pair); | 1326     cache_type = NewNode(common()->Projection(1), cache_pair); | 
| 1327     Node* cache_length = | 1327     Node* cache_length = | 
| 1328         NewNode(javascript()->CallRuntime(Runtime::kForInCacheArrayLength, 2), | 1328         NewNode(javascript()->CallRuntime(Runtime::kForInCacheArrayLength, 2), | 
| 1329                 cache_type, cache_array); | 1329                 cache_type, cache_array); | 
| 1330     { | 1330     { | 
| 1331       // TODO(dcarney): this check is actually supposed to be for the | 1331       // Construct the rest of the environment. | 
| 1332       //                empty enum case only. | 1332       environment()->Push(cache_type); | 
| 1333       IfBuilder have_no_properties(this); | 1333       environment()->Push(cache_array); | 
| 1334       Node* empty_array_cond = NewNode(javascript()->StrictEqual(), | 1334       environment()->Push(cache_length); | 
| 1335                                        cache_length, jsgraph()->ZeroConstant()); | 1335       environment()->Push(jsgraph()->ZeroConstant()); | 
| 1336       have_no_properties.If(empty_array_cond); |  | 
| 1337       have_no_properties.Then(); |  | 
| 1338       // Pop obj and skip loop. |  | 
| 1339       environment()->Pop(); |  | 
| 1340       have_no_properties.Else(); |  | 
| 1341       { |  | 
| 1342         // Construct the rest of the environment. |  | 
| 1343         environment()->Push(cache_type); |  | 
| 1344         environment()->Push(cache_array); |  | 
| 1345         environment()->Push(cache_length); |  | 
| 1346         environment()->Push(jsgraph()->ZeroConstant()); |  | 
| 1347 | 1336 | 
| 1348         // Build the actual loop body. | 1337       // Build the actual loop body. | 
| 1349         VisitForInBody(stmt); | 1338       VisitForInBody(stmt); | 
| 1350       } |  | 
| 1351       have_no_properties.End(); |  | 
| 1352     } | 1339     } | 
| 1353     is_null.End(); | 1340     is_null.End(); | 
| 1354   } | 1341   } | 
| 1355   is_undefined.End(); | 1342   is_undefined.End(); | 
| 1356 } | 1343 } | 
| 1357 | 1344 | 
| 1358 | 1345 | 
| 1359 // TODO(dcarney): this is a big function.  Try to clean up some. | 1346 // TODO(dcarney): this is a big function.  Try to clean up some. | 
| 1360 void AstGraphBuilder::VisitForInBody(ForInStatement* stmt) { | 1347 void AstGraphBuilder::VisitForInBody(ForInStatement* stmt) { | 
| 1361   LoopBuilder for_loop(this); | 1348   LoopBuilder for_loop(this); | 
| (...skipping 2434 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3796     // Phi does not exist yet, introduce one. | 3783     // Phi does not exist yet, introduce one. | 
| 3797     value = NewPhi(inputs, value, control); | 3784     value = NewPhi(inputs, value, control); | 
| 3798     value->ReplaceInput(inputs - 1, other); | 3785     value->ReplaceInput(inputs - 1, other); | 
| 3799   } | 3786   } | 
| 3800   return value; | 3787   return value; | 
| 3801 } | 3788 } | 
| 3802 | 3789 | 
| 3803 }  // namespace compiler | 3790 }  // namespace compiler | 
| 3804 }  // namespace internal | 3791 }  // namespace internal | 
| 3805 }  // namespace v8 | 3792 }  // namespace v8 | 
| OLD | NEW | 
|---|