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

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: Created 6 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 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 3143 matching lines...) Expand 10 before | Expand all | Expand 10 after
3154 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0); 3154 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0);
3155 int continuation = generator->continuation(); 3155 int continuation = generator->continuation();
3156 const char* message = continuation == JSGeneratorObject::kGeneratorClosed ? 3156 const char* message = continuation == JSGeneratorObject::kGeneratorClosed ?
3157 "generator_finished" : "generator_running"; 3157 "generator_finished" : "generator_running";
3158 Vector< Handle<Object> > argv = HandleVector<Object>(NULL, 0); 3158 Vector< Handle<Object> > argv = HandleVector<Object>(NULL, 0);
3159 Handle<Object> error = isolate->factory()->NewError(message, argv); 3159 Handle<Object> error = isolate->factory()->NewError(message, argv);
3160 return isolate->Throw(*error); 3160 return isolate->Throw(*error);
3161 } 3161 }
3162 3162
3163 3163
3164 RUNTIME_FUNCTION(MaybeObject*, Runtime_ThrowGeneratorStartError) {
3165 HandleScope scope(isolate);
3166 ASSERT(args.length() == 0);
3167 Vector< Handle<Object> > argv = HandleVector<Object>(NULL, 0);
3168 Handle<Object> error =
3169 isolate->factory()->NewTypeError("generator_start", argv);
3170 return isolate->Throw(*error);
3171 }
3172
3173
3164 RUNTIME_FUNCTION(MaybeObject*, Runtime_ObjectFreeze) { 3174 RUNTIME_FUNCTION(MaybeObject*, Runtime_ObjectFreeze) {
3165 HandleScope scope(isolate); 3175 HandleScope scope(isolate);
3166 ASSERT(args.length() == 1); 3176 ASSERT(args.length() == 1);
3167 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); 3177 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
3168 Handle<Object> result = JSObject::Freeze(object); 3178 Handle<Object> result = JSObject::Freeze(object);
3169 RETURN_IF_EMPTY_HANDLE(isolate, result); 3179 RETURN_IF_EMPTY_HANDLE(isolate, result);
3170 return *result; 3180 return *result;
3171 } 3181 }
3172 3182
3173 3183
(...skipping 11714 matching lines...) Expand 10 before | Expand all | Expand 10 after
14888 // Handle last resort GC and make sure to allow future allocations 14898 // Handle last resort GC and make sure to allow future allocations
14889 // to grow the heap without causing GCs (if possible). 14899 // to grow the heap without causing GCs (if possible).
14890 isolate->counters()->gc_last_resort_from_js()->Increment(); 14900 isolate->counters()->gc_last_resort_from_js()->Increment();
14891 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14901 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14892 "Runtime::PerformGC"); 14902 "Runtime::PerformGC");
14893 } 14903 }
14894 } 14904 }
14895 14905
14896 14906
14897 } } // namespace v8::internal 14907 } } // namespace v8::internal
OLDNEW
« src/ia32/full-codegen-ia32.cc ('K') | « 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