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

Side by Side Diff: src/runtime.cc

Issue 13542002: Calling a generator function returns a generator object (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Link generator iterator definitions and uses through local variable Created 7 years, 8 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, 2013 the V8 project authors. All rights reserved.
Michael Starzinger 2013/04/08 13:14:05 No need to update the copyright header of existing
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
11 // with the distribution. 11 // with the distribution.
(...skipping 2366 matching lines...) Expand 10 before | Expand all | Expand 10 after
2378 HandleScope scope(isolate); 2378 HandleScope scope(isolate);
2379 ASSERT(args.length() == 2); 2379 ASSERT(args.length() == 2);
2380 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); 2380 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
2381 CONVERT_SMI_ARG_CHECKED(num, 1); 2381 CONVERT_SMI_ARG_CHECKED(num, 1);
2382 RUNTIME_ASSERT(num >= 0); 2382 RUNTIME_ASSERT(num >= 0);
2383 SetExpectedNofProperties(function, num); 2383 SetExpectedNofProperties(function, num);
2384 return isolate->heap()->undefined_value(); 2384 return isolate->heap()->undefined_value();
2385 } 2385 }
2386 2386
2387 2387
2388 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateJSGeneratorIterator) {
2389 HandleScope scope(isolate);
2390 ASSERT(args.length() == 1);
2391 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
2392 ASSERT(function->shared()->is_generator());
2393 Handle<JSGeneratorIterator> generator =
2394 isolate->factory()->NewJSGeneratorIterator(function);
Michael Starzinger 2013/04/08 13:14:05 If we call the Heap::AllocateJSGeneratorIterator d
2395 return *generator;
2396 }
2397
2398
2388 MUST_USE_RESULT static MaybeObject* CharFromCode(Isolate* isolate, 2399 MUST_USE_RESULT static MaybeObject* CharFromCode(Isolate* isolate,
2389 Object* char_code) { 2400 Object* char_code) {
2390 uint32_t code; 2401 uint32_t code;
2391 if (char_code->ToArrayIndex(&code)) { 2402 if (char_code->ToArrayIndex(&code)) {
2392 if (code <= 0xffff) { 2403 if (code <= 0xffff) {
2393 return isolate->heap()->LookupSingleCharacterStringFromCode(code); 2404 return isolate->heap()->LookupSingleCharacterStringFromCode(code);
2394 } 2405 }
2395 } 2406 }
2396 return isolate->heap()->empty_string(); 2407 return isolate->heap()->empty_string();
2397 } 2408 }
(...skipping 10753 matching lines...) Expand 10 before | Expand all | Expand 10 after
13151 // Handle last resort GC and make sure to allow future allocations 13162 // Handle last resort GC and make sure to allow future allocations
13152 // to grow the heap without causing GCs (if possible). 13163 // to grow the heap without causing GCs (if possible).
13153 isolate->counters()->gc_last_resort_from_js()->Increment(); 13164 isolate->counters()->gc_last_resort_from_js()->Increment();
13154 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13165 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13155 "Runtime::PerformGC"); 13166 "Runtime::PerformGC");
13156 } 13167 }
13157 } 13168 }
13158 13169
13159 13170
13160 } } // namespace v8::internal 13171 } } // namespace v8::internal
OLDNEW
« src/parser.cc ('K') | « src/runtime.h ('k') | test/mjsunit/harmony/generators-iteration.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698