OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/hydrogen.h" | 5 #include "src/hydrogen.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/allocation-site-scopes.h" | 9 #include "src/allocation-site-scopes.h" |
10 #include "src/ast-numbering.h" | 10 #include "src/ast-numbering.h" |
(...skipping 1798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1809 Push(count); | 1809 Push(count); |
1810 | 1810 |
1811 probe_loop.EndBody(); | 1811 probe_loop.EndBody(); |
1812 | 1812 |
1813 return_or_loop.End(); | 1813 return_or_loop.End(); |
1814 | 1814 |
1815 return Pop(); | 1815 return Pop(); |
1816 } | 1816 } |
1817 | 1817 |
1818 | 1818 |
| 1819 HValue* HGraphBuilder::BuildCreateIterResultObject(HValue* value, |
| 1820 HValue* done) { |
| 1821 NoObservableSideEffectsScope scope(this); |
| 1822 |
| 1823 // Allocate the JSIteratorResult object. |
| 1824 HValue* result = |
| 1825 Add<HAllocate>(Add<HConstant>(JSIteratorResult::kSize), HType::JSObject(), |
| 1826 NOT_TENURED, JS_ITERATOR_RESULT_TYPE); |
| 1827 |
| 1828 // Initialize the JSIteratorResult object. |
| 1829 HValue* native_context = BuildGetNativeContext(); |
| 1830 HValue* map = Add<HLoadNamedField>( |
| 1831 native_context, nullptr, |
| 1832 HObjectAccess::ForContextSlot(Context::ITERATOR_RESULT_MAP_INDEX)); |
| 1833 Add<HStoreNamedField>(result, HObjectAccess::ForMap(), map); |
| 1834 HValue* empty_fixed_array = Add<HLoadRoot>(Heap::kEmptyFixedArrayRootIndex); |
| 1835 Add<HStoreNamedField>(result, HObjectAccess::ForPropertiesPointer(), |
| 1836 empty_fixed_array); |
| 1837 Add<HStoreNamedField>(result, HObjectAccess::ForElementsPointer(), |
| 1838 empty_fixed_array); |
| 1839 Add<HStoreNamedField>(result, HObjectAccess::ForObservableJSObjectOffset( |
| 1840 JSIteratorResult::kValueOffset), |
| 1841 value); |
| 1842 Add<HStoreNamedField>(result, HObjectAccess::ForObservableJSObjectOffset( |
| 1843 JSIteratorResult::kDoneOffset), |
| 1844 done); |
| 1845 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize); |
| 1846 return result; |
| 1847 } |
| 1848 |
| 1849 |
1819 HValue* HGraphBuilder::BuildRegExpConstructResult(HValue* length, | 1850 HValue* HGraphBuilder::BuildRegExpConstructResult(HValue* length, |
1820 HValue* index, | 1851 HValue* index, |
1821 HValue* input) { | 1852 HValue* input) { |
1822 NoObservableSideEffectsScope scope(this); | 1853 NoObservableSideEffectsScope scope(this); |
1823 HConstant* max_length = Add<HConstant>(JSObject::kInitialMaxFastElementArray); | 1854 HConstant* max_length = Add<HConstant>(JSObject::kInitialMaxFastElementArray); |
1824 Add<HBoundsCheck>(length, max_length); | 1855 Add<HBoundsCheck>(length, max_length); |
1825 | 1856 |
1826 // Generate size calculation code here in order to make it dominate | 1857 // Generate size calculation code here in order to make it dominate |
1827 // the JSRegExpResult allocation. | 1858 // the JSRegExpResult allocation. |
1828 ElementsKind elements_kind = FAST_ELEMENTS; | 1859 ElementsKind elements_kind = FAST_ELEMENTS; |
(...skipping 10761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12590 return ast_context()->ReturnValue(graph()->GetConstantUndefined()); | 12621 return ast_context()->ReturnValue(graph()->GetConstantUndefined()); |
12591 } | 12622 } |
12592 | 12623 |
12593 | 12624 |
12594 void HOptimizedGraphBuilder::GenerateTheHole(CallRuntime* call) { | 12625 void HOptimizedGraphBuilder::GenerateTheHole(CallRuntime* call) { |
12595 DCHECK(call->arguments()->length() == 0); | 12626 DCHECK(call->arguments()->length() == 0); |
12596 return ast_context()->ReturnValue(graph()->GetConstantHole()); | 12627 return ast_context()->ReturnValue(graph()->GetConstantHole()); |
12597 } | 12628 } |
12598 | 12629 |
12599 | 12630 |
| 12631 void HOptimizedGraphBuilder::GenerateCreateIterResultObject(CallRuntime* call) { |
| 12632 DCHECK_EQ(2, call->arguments()->length()); |
| 12633 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
| 12634 CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); |
| 12635 HValue* done = Pop(); |
| 12636 HValue* value = Pop(); |
| 12637 HValue* result = BuildCreateIterResultObject(value, done); |
| 12638 return ast_context()->ReturnValue(result); |
| 12639 } |
| 12640 |
| 12641 |
12600 void HOptimizedGraphBuilder::GenerateJSCollectionGetTable(CallRuntime* call) { | 12642 void HOptimizedGraphBuilder::GenerateJSCollectionGetTable(CallRuntime* call) { |
12601 DCHECK(call->arguments()->length() == 1); | 12643 DCHECK(call->arguments()->length() == 1); |
12602 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | 12644 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
12603 HValue* receiver = Pop(); | 12645 HValue* receiver = Pop(); |
12604 HInstruction* result = New<HLoadNamedField>( | 12646 HInstruction* result = New<HLoadNamedField>( |
12605 receiver, nullptr, HObjectAccess::ForJSCollectionTable()); | 12647 receiver, nullptr, HObjectAccess::ForJSCollectionTable()); |
12606 return ast_context()->ReturnInstruction(result, call->id()); | 12648 return ast_context()->ReturnInstruction(result, call->id()); |
12607 } | 12649 } |
12608 | 12650 |
12609 | 12651 |
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13451 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13493 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13452 } | 13494 } |
13453 | 13495 |
13454 #ifdef DEBUG | 13496 #ifdef DEBUG |
13455 graph_->Verify(false); // No full verify. | 13497 graph_->Verify(false); // No full verify. |
13456 #endif | 13498 #endif |
13457 } | 13499 } |
13458 | 13500 |
13459 } // namespace internal | 13501 } // namespace internal |
13460 } // namespace v8 | 13502 } // namespace v8 |
OLD | NEW |