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

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

Issue 2622833002: WIP [esnext] implement async iteration proposal (Closed)
Patch Set: 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
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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 isolate, Object::OrdinaryHasInstance(isolate, callable, object)); 492 isolate, Object::OrdinaryHasInstance(isolate, callable, object));
486 } 493 }
487 494
488 RUNTIME_FUNCTION(Runtime_Typeof) { 495 RUNTIME_FUNCTION(Runtime_Typeof) {
489 HandleScope scope(isolate); 496 HandleScope scope(isolate);
490 DCHECK_EQ(1, args.length()); 497 DCHECK_EQ(1, args.length());
491 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); 498 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
492 return *Object::TypeOf(isolate, object); 499 return *Object::TypeOf(isolate, object);
493 } 500 }
494 501
502 RUNTIME_FUNCTION(Runtime_CreateAsyncFromSyncIterator) {
503 HandleScope scope(isolate);
504 DCHECK_EQ(1, args.length());
505
506 CONVERT_ARG_HANDLE_CHECKED(Object, sync_iterator, 0);
507
508 if (!sync_iterator->IsJSReceiver()) {
509 THROW_NEW_ERROR_RETURN_FAILURE(
510 isolate, NewTypeError(MessageTemplate::kSymbolIteratorInvalid));
511 }
512
513 return *isolate->factory()->NewJSAsyncFromSyncIterator(
514 Handle<HeapObject>::cast(sync_iterator));
515 }
516
495 } // namespace internal 517 } // namespace internal
496 } // namespace v8 518 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698