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

Side by Side Diff: src/runtime.cc

Issue 139653003: Throw a TypeError when calling "next" method of a newly created generator with a value (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Revised Created 6 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
« no previous file with comments | « src/runtime.h ('k') | src/x64/full-codegen-x64.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 3120 matching lines...) Expand 10 before | Expand all | Expand 10 after
3131 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0); 3131 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0);
3132 int continuation = generator->continuation(); 3132 int continuation = generator->continuation();
3133 const char* message = continuation == JSGeneratorObject::kGeneratorClosed ? 3133 const char* message = continuation == JSGeneratorObject::kGeneratorClosed ?
3134 "generator_finished" : "generator_running"; 3134 "generator_finished" : "generator_running";
3135 Vector< Handle<Object> > argv = HandleVector<Object>(NULL, 0); 3135 Vector< Handle<Object> > argv = HandleVector<Object>(NULL, 0);
3136 Handle<Object> error = isolate->factory()->NewError(message, argv); 3136 Handle<Object> error = isolate->factory()->NewError(message, argv);
3137 return isolate->Throw(*error); 3137 return isolate->Throw(*error);
3138 } 3138 }
3139 3139
3140 3140
3141 RUNTIME_FUNCTION(MaybeObject*, Runtime_ThrowGeneratorStartError) {
3142 HandleScope scope(isolate);
3143 ASSERT(args.length() == 0);
3144 Vector< Handle<Object> > argv = HandleVector<Object>(NULL, 0);
3145 Handle<Object> error =
3146 isolate->factory()->NewTypeError("generator_start", argv);
3147 return isolate->Throw(*error);
3148 }
3149
3150
3141 RUNTIME_FUNCTION(MaybeObject*, Runtime_ObjectFreeze) { 3151 RUNTIME_FUNCTION(MaybeObject*, Runtime_ObjectFreeze) {
3142 HandleScope scope(isolate); 3152 HandleScope scope(isolate);
3143 ASSERT(args.length() == 1); 3153 ASSERT(args.length() == 1);
3144 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); 3154 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
3145 Handle<Object> result = JSObject::Freeze(object); 3155 Handle<Object> result = JSObject::Freeze(object);
3146 RETURN_IF_EMPTY_HANDLE(isolate, result); 3156 RETURN_IF_EMPTY_HANDLE(isolate, result);
3147 return *result; 3157 return *result;
3148 } 3158 }
3149 3159
3150 3160
(...skipping 11713 matching lines...) Expand 10 before | Expand all | Expand 10 after
14864 // Handle last resort GC and make sure to allow future allocations 14874 // Handle last resort GC and make sure to allow future allocations
14865 // to grow the heap without causing GCs (if possible). 14875 // to grow the heap without causing GCs (if possible).
14866 isolate->counters()->gc_last_resort_from_js()->Increment(); 14876 isolate->counters()->gc_last_resort_from_js()->Increment();
14867 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14877 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14868 "Runtime::PerformGC"); 14878 "Runtime::PerformGC");
14869 } 14879 }
14870 } 14880 }
14871 14881
14872 14882
14873 } } // namespace v8::internal 14883 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698