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/machine-operator.h" | 10 #include "src/compiler/machine-operator.h" |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 NewNode(javascript()->StrictEqual(), obj, jsgraph()->NullConstant()); | 660 NewNode(javascript()->StrictEqual(), obj, jsgraph()->NullConstant()); |
661 is_null.If(is_null_cond); | 661 is_null.If(is_null_cond); |
662 is_null.Then(); | 662 is_null.Then(); |
663 is_null.Else(); | 663 is_null.Else(); |
664 // Convert object to jsobject. | 664 // Convert object to jsobject. |
665 // PrepareForBailoutForId(stmt->PrepareId(), TOS_REG); | 665 // PrepareForBailoutForId(stmt->PrepareId(), TOS_REG); |
666 obj = NewNode(javascript()->ToObject(), obj); | 666 obj = NewNode(javascript()->ToObject(), obj); |
667 PrepareFrameState(obj, stmt->ToObjectId(), OutputFrameStateCombine::Push()); | 667 PrepareFrameState(obj, stmt->ToObjectId(), OutputFrameStateCombine::Push()); |
668 environment()->Push(obj); | 668 environment()->Push(obj); |
669 // TODO(dcarney): should do a fast enum cache check here to skip runtime. | 669 // TODO(dcarney): should do a fast enum cache check here to skip runtime. |
670 environment()->Push(obj); | 670 Node* cache_type = NewNode( |
671 Node* cache_type = ProcessArguments( | 671 javascript()->CallRuntime(Runtime::kGetPropertyNamesFast, 1), obj); |
672 javascript()->CallRuntime(Runtime::kGetPropertyNamesFast, 1), 1); | |
673 PrepareFrameState(cache_type, stmt->EnumId(), | 672 PrepareFrameState(cache_type, stmt->EnumId(), |
674 OutputFrameStateCombine::Push()); | 673 OutputFrameStateCombine::Push()); |
675 // TODO(dcarney): these next runtime calls should be removed in favour of | 674 // TODO(dcarney): these next runtime calls should be removed in favour of |
676 // a few simplified instructions. | 675 // a few simplified instructions. |
677 environment()->Push(obj); | 676 Node* cache_pair = NewNode( |
678 environment()->Push(cache_type); | 677 javascript()->CallRuntime(Runtime::kForInInit, 2), obj, cache_type); |
679 Node* cache_pair = | |
680 ProcessArguments(javascript()->CallRuntime(Runtime::kForInInit, 2), 2); | |
681 // cache_type may have been replaced. | 678 // cache_type may have been replaced. |
682 Node* cache_array = NewNode(common()->Projection(0), cache_pair); | 679 Node* cache_array = NewNode(common()->Projection(0), cache_pair); |
683 cache_type = NewNode(common()->Projection(1), cache_pair); | 680 cache_type = NewNode(common()->Projection(1), cache_pair); |
684 environment()->Push(cache_type); | 681 Node* cache_length = |
685 environment()->Push(cache_array); | 682 NewNode(javascript()->CallRuntime(Runtime::kForInCacheArrayLength, 2), |
686 Node* cache_length = ProcessArguments( | 683 cache_type, cache_array); |
687 javascript()->CallRuntime(Runtime::kForInCacheArrayLength, 2), 2); | |
688 { | 684 { |
689 // TODO(dcarney): this check is actually supposed to be for the | 685 // TODO(dcarney): this check is actually supposed to be for the |
690 // empty enum case only. | 686 // empty enum case only. |
691 IfBuilder have_no_properties(this); | 687 IfBuilder have_no_properties(this); |
692 Node* empty_array_cond = NewNode(javascript()->StrictEqual(), | 688 Node* empty_array_cond = NewNode(javascript()->StrictEqual(), |
693 cache_length, jsgraph()->ZeroConstant()); | 689 cache_length, jsgraph()->ZeroConstant()); |
694 have_no_properties.If(empty_array_cond); | 690 have_no_properties.If(empty_array_cond); |
695 have_no_properties.Then(); | 691 have_no_properties.Then(); |
696 // Pop obj and skip loop. | 692 // Pop obj and skip loop. |
697 environment()->Pop(); | 693 environment()->Pop(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 IfBuilder test_should_filter(this); | 738 IfBuilder test_should_filter(this); |
743 Node* should_filter_cond = NewNode( | 739 Node* should_filter_cond = NewNode( |
744 javascript()->StrictEqual(), should_filter, jsgraph()->TrueConstant()); | 740 javascript()->StrictEqual(), should_filter, jsgraph()->TrueConstant()); |
745 test_should_filter.If(should_filter_cond); | 741 test_should_filter.If(should_filter_cond); |
746 test_should_filter.Then(); | 742 test_should_filter.Then(); |
747 value = environment()->Pop(); | 743 value = environment()->Pop(); |
748 Node* builtins = BuildLoadBuiltinsObject(); | 744 Node* builtins = BuildLoadBuiltinsObject(); |
749 Node* function = BuildLoadObjectField( | 745 Node* function = BuildLoadObjectField( |
750 builtins, | 746 builtins, |
751 JSBuiltinsObject::OffsetOfFunctionWithId(Builtins::FILTER_KEY)); | 747 JSBuiltinsObject::OffsetOfFunctionWithId(Builtins::FILTER_KEY)); |
752 // Callee. | |
753 environment()->Push(function); | |
754 // Receiver. | |
755 environment()->Push(obj); | |
756 // Args. | |
757 environment()->Push(value); | |
758 // result is either the string key or Smi(0) indicating the property | 748 // result is either the string key or Smi(0) indicating the property |
759 // is gone. | 749 // is gone. |
760 Node* res = ProcessArguments( | 750 Node* res = NewNode(javascript()->CallFunction(3, NO_CALL_FUNCTION_FLAGS), |
761 javascript()->CallFunction(3, NO_CALL_FUNCTION_FLAGS), 3); | 751 function, obj, value); |
762 // TODO(jarin): provide real bailout id. | 752 // TODO(jarin): provide real bailout id. |
763 PrepareFrameState(res, BailoutId::None()); | 753 PrepareFrameState(res, BailoutId::None()); |
764 Node* property_missing = | 754 Node* property_missing = |
765 NewNode(javascript()->StrictEqual(), res, jsgraph()->ZeroConstant()); | 755 NewNode(javascript()->StrictEqual(), res, jsgraph()->ZeroConstant()); |
766 { | 756 { |
767 IfBuilder is_property_missing(this); | 757 IfBuilder is_property_missing(this); |
768 is_property_missing.If(property_missing); | 758 is_property_missing.If(property_missing); |
769 is_property_missing.Then(); | 759 is_property_missing.Then(); |
770 // Inc counter and continue. | 760 // Inc counter and continue. |
771 Node* index_inc = | 761 Node* index_inc = |
(...skipping 1667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2439 | 2429 |
2440 BitVector* AstGraphBuilder::GetVariablesAssignedInLoop( | 2430 BitVector* AstGraphBuilder::GetVariablesAssignedInLoop( |
2441 IterationStatement* stmt) { | 2431 IterationStatement* stmt) { |
2442 if (loop_assignment_analysis_ == NULL) return NULL; | 2432 if (loop_assignment_analysis_ == NULL) return NULL; |
2443 return loop_assignment_analysis_->GetVariablesAssignedInLoop(stmt); | 2433 return loop_assignment_analysis_->GetVariablesAssignedInLoop(stmt); |
2444 } | 2434 } |
2445 | 2435 |
2446 } // namespace compiler | 2436 } // namespace compiler |
2447 } // namespace internal | 2437 } // namespace internal |
2448 } // namespace v8 | 2438 } // namespace v8 |
OLD | NEW |