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

Side by Side Diff: src/heap.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
« no previous file with comments | « src/heap.h ('k') | src/objects.h » ('j') | src/objects.h » ('J')
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 4315 matching lines...) Expand 10 before | Expand all | Expand 10 after
4326 } 4326 }
4327 #ifdef DEBUG 4327 #ifdef DEBUG
4328 // Make sure result is NOT a global object if valid. 4328 // Make sure result is NOT a global object if valid.
4329 Object* non_failure; 4329 Object* non_failure;
4330 ASSERT(!result->ToObject(&non_failure) || !non_failure->IsGlobalObject()); 4330 ASSERT(!result->ToObject(&non_failure) || !non_failure->IsGlobalObject());
4331 #endif 4331 #endif
4332 return result; 4332 return result;
4333 } 4333 }
4334 4334
4335 4335
4336 MaybeObject* Heap::AllocateJSGeneratorIterator(JSFunction *function) {
4337 ASSERT(function->shared()->is_generator());
4338 Map *map = function->initial_map();
4339 ASSERT(map->IsMap());
4340 ASSERT(map->instance_type() == JS_GENERATOR_ITERATOR_TYPE);
4341 JSGeneratorIterator *generator;
4342 MaybeObject* maybe_generator = AllocateJSObjectFromMap(map, NOT_TENURED);
4343 if (!maybe_generator->To(&generator)) return maybe_generator;
4344 generator->set_function(function);
4345 generator->set_context(Smi::FromInt(0));
4346 generator->set_continuation(0);
4347 generator->set_operand_stack(Smi::FromInt(0));
4348 return generator;
4349 }
4350
4351
4336 MaybeObject* Heap::AllocateJSModule(Context* context, ScopeInfo* scope_info) { 4352 MaybeObject* Heap::AllocateJSModule(Context* context, ScopeInfo* scope_info) {
4337 // Allocate a fresh map. Modules do not have a prototype. 4353 // Allocate a fresh map. Modules do not have a prototype.
4338 Map* map; 4354 Map* map;
4339 MaybeObject* maybe_map = AllocateMap(JS_MODULE_TYPE, JSModule::kSize); 4355 MaybeObject* maybe_map = AllocateMap(JS_MODULE_TYPE, JSModule::kSize);
4340 if (!maybe_map->To(&map)) return maybe_map; 4356 if (!maybe_map->To(&map)) return maybe_map;
4341 // Allocate the object based on the map. 4357 // Allocate the object based on the map.
4342 JSModule* module; 4358 JSModule* module;
4343 MaybeObject* maybe_module = AllocateJSObjectFromMap(map, TENURED); 4359 MaybeObject* maybe_module = AllocateJSObjectFromMap(map, TENURED);
4344 if (!maybe_module->To(&module)) return maybe_module; 4360 if (!maybe_module->To(&module)) return maybe_module;
4345 module->set_context(context); 4361 module->set_context(context);
(...skipping 3480 matching lines...) Expand 10 before | Expand all | Expand 10 after
7826 static_cast<int>(object_sizes_last_time_[index])); 7842 static_cast<int>(object_sizes_last_time_[index]));
7827 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) 7843 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT)
7828 #undef ADJUST_LAST_TIME_OBJECT_COUNT 7844 #undef ADJUST_LAST_TIME_OBJECT_COUNT
7829 7845
7830 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 7846 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
7831 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 7847 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
7832 ClearObjectStats(); 7848 ClearObjectStats();
7833 } 7849 }
7834 7850
7835 } } // namespace v8::internal 7851 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/objects.h » ('j') | src/objects.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698