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

Side by Side Diff: src/runtime.cc

Issue 32323013: Introduce JSFunction::EnsureHasInitialMap method. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | no next file » | 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 2982 matching lines...) Expand 10 before | Expand all | Expand 10 after
2993 Handle<Map>(func->initial_map())); 2993 Handle<Map>(func->initial_map()));
2994 new_initial_map->set_unused_property_fields(num); 2994 new_initial_map->set_unused_property_fields(num);
2995 func->set_initial_map(*new_initial_map); 2995 func->set_initial_map(*new_initial_map);
2996 } 2996 }
2997 } 2997 }
2998 return isolate->heap()->undefined_value(); 2998 return isolate->heap()->undefined_value();
2999 } 2999 }
3000 3000
3001 3001
3002 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateJSGeneratorObject) { 3002 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateJSGeneratorObject) {
3003 SealHandleScope shs(isolate); 3003 HandleScope scope(isolate);
3004 ASSERT(args.length() == 0); 3004 ASSERT(args.length() == 0);
3005 3005
3006 JavaScriptFrameIterator it(isolate); 3006 JavaScriptFrameIterator it(isolate);
3007 JavaScriptFrame* frame = it.frame(); 3007 JavaScriptFrame* frame = it.frame();
3008 JSFunction* function = frame->function(); 3008 Handle<JSFunction> function(frame->function());
3009 RUNTIME_ASSERT(function->shared()->is_generator()); 3009 RUNTIME_ASSERT(function->shared()->is_generator());
3010 3010
3011 JSGeneratorObject* generator; 3011 Handle<JSGeneratorObject> generator;
3012 if (frame->IsConstructor()) { 3012 if (frame->IsConstructor()) {
3013 generator = JSGeneratorObject::cast(frame->receiver()); 3013 generator = handle(JSGeneratorObject::cast(frame->receiver()));
3014 } else { 3014 } else {
3015 MaybeObject* maybe_generator = 3015 generator = isolate->factory()->NewJSGeneratorObject(function);
3016 isolate->heap()->AllocateJSGeneratorObject(function);
3017 if (!maybe_generator->To(&generator)) return maybe_generator;
3018 } 3016 }
3019 generator->set_function(function); 3017 generator->set_function(*function);
3020 generator->set_context(Context::cast(frame->context())); 3018 generator->set_context(Context::cast(frame->context()));
3021 generator->set_receiver(frame->receiver()); 3019 generator->set_receiver(frame->receiver());
3022 generator->set_continuation(0); 3020 generator->set_continuation(0);
3023 generator->set_operand_stack(isolate->heap()->empty_fixed_array()); 3021 generator->set_operand_stack(isolate->heap()->empty_fixed_array());
3024 generator->set_stack_handler_index(-1); 3022 generator->set_stack_handler_index(-1);
3025 3023
3026 return generator; 3024 return *generator;
3027 } 3025 }
3028 3026
3029 3027
3030 RUNTIME_FUNCTION(MaybeObject*, Runtime_SuspendJSGeneratorObject) { 3028 RUNTIME_FUNCTION(MaybeObject*, Runtime_SuspendJSGeneratorObject) {
3031 SealHandleScope shs(isolate); 3029 SealHandleScope shs(isolate);
3032 ASSERT(args.length() == 1); 3030 ASSERT(args.length() == 1);
3033 CONVERT_ARG_CHECKED(JSGeneratorObject, generator_object, 0); 3031 CONVERT_ARG_CHECKED(JSGeneratorObject, generator_object, 0);
3034 3032
3035 JavaScriptFrameIterator stack_iterator(isolate); 3033 JavaScriptFrameIterator stack_iterator(isolate);
3036 JavaScriptFrame* frame = stack_iterator.frame(); 3034 JavaScriptFrame* frame = stack_iterator.frame();
(...skipping 11829 matching lines...) Expand 10 before | Expand all | Expand 10 after
14866 // Handle last resort GC and make sure to allow future allocations 14864 // Handle last resort GC and make sure to allow future allocations
14867 // to grow the heap without causing GCs (if possible). 14865 // to grow the heap without causing GCs (if possible).
14868 isolate->counters()->gc_last_resort_from_js()->Increment(); 14866 isolate->counters()->gc_last_resort_from_js()->Increment();
14869 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14867 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14870 "Runtime::PerformGC"); 14868 "Runtime::PerformGC");
14871 } 14869 }
14872 } 14870 }
14873 14871
14874 14872
14875 } } // namespace v8::internal 14873 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698