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

Side by Side Diff: src/runtime/runtime-internal.cc

Issue 2622833002: WIP [esnext] implement async iteration proposal (Closed)
Patch Set: simplify AsyncIteratorValueUnwrap Created 3 years, 11 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
« no previous file with comments | « src/runtime/runtime-generator.cc ('k') | src/v8.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "src/arguments.h" 9 #include "src/arguments.h"
10 #include "src/ast/prettyprinter.h" 10 #include "src/ast/prettyprinter.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 NewTypeError(MessageTemplate::kIteratorResultNotAnObject, value)); 217 NewTypeError(MessageTemplate::kIteratorResultNotAnObject, value));
218 } 218 }
219 219
220 RUNTIME_FUNCTION(Runtime_ThrowSymbolIteratorInvalid) { 220 RUNTIME_FUNCTION(Runtime_ThrowSymbolIteratorInvalid) {
221 HandleScope scope(isolate); 221 HandleScope scope(isolate);
222 DCHECK_EQ(0, args.length()); 222 DCHECK_EQ(0, args.length());
223 THROW_NEW_ERROR_RETURN_FAILURE( 223 THROW_NEW_ERROR_RETURN_FAILURE(
224 isolate, NewTypeError(MessageTemplate::kSymbolIteratorInvalid)); 224 isolate, NewTypeError(MessageTemplate::kSymbolIteratorInvalid));
225 } 225 }
226 226
227 RUNTIME_FUNCTION(Runtime_ThrowSymbolAsyncIteratorInvalid) {
228 HandleScope scope(isolate);
229 DCHECK(args.length() == 0);
230 THROW_NEW_ERROR_RETURN_FAILURE(
231 isolate, NewTypeError(MessageTemplate::kSymbolAsyncIteratorInvalid));
232 }
233
227 RUNTIME_FUNCTION(Runtime_ThrowNotGeneric) { 234 RUNTIME_FUNCTION(Runtime_ThrowNotGeneric) {
228 HandleScope scope(isolate); 235 HandleScope scope(isolate);
229 DCHECK_EQ(1, args.length()); 236 DCHECK_EQ(1, args.length());
230 CONVERT_ARG_HANDLE_CHECKED(Object, arg0, 0); 237 CONVERT_ARG_HANDLE_CHECKED(Object, arg0, 0);
231 THROW_NEW_ERROR_RETURN_FAILURE( 238 THROW_NEW_ERROR_RETURN_FAILURE(
232 isolate, NewTypeError(MessageTemplate::kNotGeneric, arg0)); 239 isolate, NewTypeError(MessageTemplate::kNotGeneric, arg0));
233 } 240 }
234 241
235 RUNTIME_FUNCTION(Runtime_ThrowGeneratorRunning) { 242 RUNTIME_FUNCTION(Runtime_ThrowGeneratorRunning) {
236 HandleScope scope(isolate); 243 HandleScope scope(isolate);
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 isolate, Object::OrdinaryHasInstance(isolate, callable, object)); 494 isolate, Object::OrdinaryHasInstance(isolate, callable, object));
488 } 495 }
489 496
490 RUNTIME_FUNCTION(Runtime_Typeof) { 497 RUNTIME_FUNCTION(Runtime_Typeof) {
491 HandleScope scope(isolate); 498 HandleScope scope(isolate);
492 DCHECK_EQ(1, args.length()); 499 DCHECK_EQ(1, args.length());
493 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); 500 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
494 return *Object::TypeOf(isolate, object); 501 return *Object::TypeOf(isolate, object);
495 } 502 }
496 503
504 RUNTIME_FUNCTION(Runtime_CreateAsyncFromSyncIterator) {
505 HandleScope scope(isolate);
506 DCHECK_EQ(1, args.length());
507
508 CONVERT_ARG_HANDLE_CHECKED(Object, sync_iterator, 0);
509
510 if (!sync_iterator->IsJSReceiver()) {
511 THROW_NEW_ERROR_RETURN_FAILURE(
512 isolate, NewTypeError(MessageTemplate::kSymbolIteratorInvalid));
513 }
514
515 return *isolate->factory()->NewJSAsyncFromSyncIterator(
516 Handle<HeapObject>::cast(sync_iterator));
517 }
518
497 } // namespace internal 519 } // namespace internal
498 } // namespace v8 520 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime-generator.cc ('k') | src/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698