Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Unified Diff: src/hydrogen.cc

Issue 1302173007: [es6] Introduce a dedicated JSIteratorResult type. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/hydrogen.h ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)));
« no previous file with comments | « src/hydrogen.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698