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

Side by Side Diff: src/factory.cc

Issue 2645313003: [async-iteration] implement Async-from-Sync Iterator (Closed)
Patch Set: rebase Created 3 years, 10 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 unified diff | Download patch
OLDNEW
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/factory.h" 5 #include "src/factory.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/allocation-site-scopes.h" 8 #include "src/allocation-site-scopes.h"
9 #include "src/ast/ast.h" 9 #include "src/ast/ast.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 1963 matching lines...) Expand 10 before | Expand all | Expand 10 after
1974 Handle<JSIteratorResult> Factory::NewJSIteratorResult(Handle<Object> value, 1974 Handle<JSIteratorResult> Factory::NewJSIteratorResult(Handle<Object> value,
1975 bool done) { 1975 bool done) {
1976 Handle<Map> map(isolate()->native_context()->iterator_result_map()); 1976 Handle<Map> map(isolate()->native_context()->iterator_result_map());
1977 Handle<JSIteratorResult> js_iter_result = 1977 Handle<JSIteratorResult> js_iter_result =
1978 Handle<JSIteratorResult>::cast(NewJSObjectFromMap(map)); 1978 Handle<JSIteratorResult>::cast(NewJSObjectFromMap(map));
1979 js_iter_result->set_value(*value); 1979 js_iter_result->set_value(*value);
1980 js_iter_result->set_done(*ToBoolean(done)); 1980 js_iter_result->set_done(*ToBoolean(done));
1981 return js_iter_result; 1981 return js_iter_result;
1982 } 1982 }
1983 1983
1984 Handle<JSAsyncFromSyncIterator> Factory::NewJSAsyncFromSyncIterator(
1985 Handle<HeapObject> sync_iterator) {
1986 Handle<Map> map(isolate()->native_context()->async_from_sync_iterator_map());
1987 Handle<JSAsyncFromSyncIterator> iterator =
1988 Handle<JSAsyncFromSyncIterator>::cast(NewJSObjectFromMap(map));
1989
1990 iterator->set_sync_iterator(*sync_iterator);
1991 return iterator;
1992 }
1993
1984 Handle<JSMap> Factory::NewJSMap() { 1994 Handle<JSMap> Factory::NewJSMap() {
1985 Handle<Map> map(isolate()->native_context()->js_map_map()); 1995 Handle<Map> map(isolate()->native_context()->js_map_map());
1986 Handle<JSMap> js_map = Handle<JSMap>::cast(NewJSObjectFromMap(map)); 1996 Handle<JSMap> js_map = Handle<JSMap>::cast(NewJSObjectFromMap(map));
1987 JSMap::Initialize(js_map, isolate()); 1997 JSMap::Initialize(js_map, isolate());
1988 return js_map; 1998 return js_map;
1989 } 1999 }
1990 2000
1991 2001
1992 Handle<JSSet> Factory::NewJSSet() { 2002 Handle<JSSet> Factory::NewJSSet() {
1993 Handle<Map> map(isolate()->native_context()->js_set_map()); 2003 Handle<Map> map(isolate()->native_context()->js_set_map());
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
2862 Handle<AccessorInfo> prototype = 2872 Handle<AccessorInfo> prototype =
2863 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs); 2873 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs);
2864 Descriptor d = Descriptor::AccessorConstant( 2874 Descriptor d = Descriptor::AccessorConstant(
2865 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs); 2875 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs);
2866 map->AppendDescriptor(&d); 2876 map->AppendDescriptor(&d);
2867 } 2877 }
2868 } 2878 }
2869 2879
2870 } // namespace internal 2880 } // namespace internal
2871 } // namespace v8 2881 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698