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

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: Rebased to apply to bleeding_edge 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 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 2274 matching lines...) Expand 10 before | Expand all | Expand 10 after
2285 HandleScope scope(isolate); 2285 HandleScope scope(isolate);
2286 ASSERT(args.length() == 2); 2286 ASSERT(args.length() == 2);
2287 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); 2287 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
2288 CONVERT_SMI_ARG_CHECKED(num, 1); 2288 CONVERT_SMI_ARG_CHECKED(num, 1);
2289 RUNTIME_ASSERT(num >= 0); 2289 RUNTIME_ASSERT(num >= 0);
2290 SetExpectedNofProperties(function, num); 2290 SetExpectedNofProperties(function, num);
2291 return isolate->heap()->undefined_value(); 2291 return isolate->heap()->undefined_value();
2292 } 2292 }
2293 2293
2294 2294
2295 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateJSGeneratorObject) {
2296 NoHandleAllocation ha(isolate);
2297 ASSERT(args.length() == 1);
2298 CONVERT_ARG_CHECKED(JSFunction, function, 0);
2299 ASSERT(function->shared()->is_generator());
2300 return isolate->heap()->AllocateJSGeneratorObject(function);
2301 }
2302
2303
2295 MUST_USE_RESULT static MaybeObject* CharFromCode(Isolate* isolate, 2304 MUST_USE_RESULT static MaybeObject* CharFromCode(Isolate* isolate,
2296 Object* char_code) { 2305 Object* char_code) {
2297 uint32_t code; 2306 uint32_t code;
2298 if (char_code->ToArrayIndex(&code)) { 2307 if (char_code->ToArrayIndex(&code)) {
2299 if (code <= 0xffff) { 2308 if (code <= 0xffff) {
2300 return isolate->heap()->LookupSingleCharacterStringFromCode(code); 2309 return isolate->heap()->LookupSingleCharacterStringFromCode(code);
2301 } 2310 }
2302 } 2311 }
2303 return isolate->heap()->empty_string(); 2312 return isolate->heap()->empty_string();
2304 } 2313 }
(...skipping 10779 matching lines...) Expand 10 before | Expand all | Expand 10 after
13084 // Handle last resort GC and make sure to allow future allocations 13093 // Handle last resort GC and make sure to allow future allocations
13085 // to grow the heap without causing GCs (if possible). 13094 // to grow the heap without causing GCs (if possible).
13086 isolate->counters()->gc_last_resort_from_js()->Increment(); 13095 isolate->counters()->gc_last_resort_from_js()->Increment();
13087 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13096 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13088 "Runtime::PerformGC"); 13097 "Runtime::PerformGC");
13089 } 13098 }
13090 } 13099 }
13091 13100
13092 13101
13093 } } // namespace v8::internal 13102 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698