Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 6effe1c3967686630218dbf00602bca2e010eb88..5bca14f32853cd8c33e286f05487ec53c4b0144c 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -1816,6 +1816,37 @@ HValue* HGraphBuilder::BuildUncheckedDictionaryElementLoad( |
} |
+HValue* HGraphBuilder::BuildCreateIterResultObject(HValue* value, |
+ HValue* done) { |
+ NoObservableSideEffectsScope scope(this); |
+ |
+ // Allocate the JSIteratorResult object. |
+ HValue* result = |
+ Add<HAllocate>(Add<HConstant>(JSIteratorResult::kSize), HType::JSObject(), |
+ NOT_TENURED, JS_ITERATOR_RESULT_TYPE); |
+ |
+ // Initialize the JSIteratorResult object. |
+ HValue* native_context = BuildGetNativeContext(); |
+ HValue* map = Add<HLoadNamedField>( |
+ native_context, nullptr, |
+ HObjectAccess::ForContextSlot(Context::ITERATOR_RESULT_MAP_INDEX)); |
+ Add<HStoreNamedField>(result, HObjectAccess::ForMap(), map); |
+ HValue* empty_fixed_array = Add<HLoadRoot>(Heap::kEmptyFixedArrayRootIndex); |
+ Add<HStoreNamedField>(result, HObjectAccess::ForPropertiesPointer(), |
+ empty_fixed_array); |
+ Add<HStoreNamedField>(result, HObjectAccess::ForElementsPointer(), |
+ empty_fixed_array); |
+ Add<HStoreNamedField>(result, HObjectAccess::ForObservableJSObjectOffset( |
+ JSIteratorResult::kValueOffset), |
+ value); |
+ Add<HStoreNamedField>(result, HObjectAccess::ForObservableJSObjectOffset( |
+ JSIteratorResult::kDoneOffset), |
+ done); |
+ STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize); |
+ return result; |
+} |
+ |
+ |
HValue* HGraphBuilder::BuildRegExpConstructResult(HValue* length, |
HValue* index, |
HValue* input) { |
@@ -12597,6 +12628,17 @@ void HOptimizedGraphBuilder::GenerateTheHole(CallRuntime* call) { |
} |
+void HOptimizedGraphBuilder::GenerateCreateIterResultObject(CallRuntime* call) { |
+ DCHECK_EQ(2, call->arguments()->length()); |
+ CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
+ CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); |
+ HValue* done = Pop(); |
+ HValue* value = Pop(); |
+ HValue* result = BuildCreateIterResultObject(value, done); |
+ return ast_context()->ReturnValue(result); |
+} |
+ |
+ |
void HOptimizedGraphBuilder::GenerateJSCollectionGetTable(CallRuntime* call) { |
DCHECK(call->arguments()->length() == 1); |
CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |