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

Side by Side Diff: src/runtime.cc

Issue 136003003: Closed generator returns a completed object instead of throwing a error (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Rev 2 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 3098 matching lines...) Expand 10 before | Expand all | Expand 10 after
3109 ASSERT(args.length() == 3); 3109 ASSERT(args.length() == 3);
3110 CONVERT_ARG_CHECKED(JSGeneratorObject, generator_object, 0); 3110 CONVERT_ARG_CHECKED(JSGeneratorObject, generator_object, 0);
3111 CONVERT_ARG_CHECKED(Object, value, 1); 3111 CONVERT_ARG_CHECKED(Object, value, 1);
3112 CONVERT_SMI_ARG_CHECKED(resume_mode_int, 2); 3112 CONVERT_SMI_ARG_CHECKED(resume_mode_int, 2);
3113 JavaScriptFrameIterator stack_iterator(isolate); 3113 JavaScriptFrameIterator stack_iterator(isolate);
3114 JavaScriptFrame* frame = stack_iterator.frame(); 3114 JavaScriptFrame* frame = stack_iterator.frame();
3115 3115
3116 ASSERT_EQ(frame->function(), generator_object->function()); 3116 ASSERT_EQ(frame->function(), generator_object->function());
3117 ASSERT(frame->function()->is_compiled()); 3117 ASSERT(frame->function()->is_compiled());
3118 3118
3119 STATIC_ASSERT(JSGeneratorObject::kGeneratorExecuting <= 0); 3119 STATIC_ASSERT(JSGeneratorObject::kGeneratorExecuting < 0);
3120 STATIC_ASSERT(JSGeneratorObject::kGeneratorClosed <= 0); 3120 STATIC_ASSERT(JSGeneratorObject::kGeneratorClosed == 0);
3121 3121
3122 Address pc = generator_object->function()->code()->instruction_start(); 3122 Address pc = generator_object->function()->code()->instruction_start();
3123 int offset = generator_object->continuation(); 3123 int offset = generator_object->continuation();
3124 ASSERT(offset > 0); 3124 ASSERT(offset > 0);
3125 frame->set_pc(pc + offset); 3125 frame->set_pc(pc + offset);
3126 generator_object->set_continuation(JSGeneratorObject::kGeneratorExecuting); 3126 generator_object->set_continuation(JSGeneratorObject::kGeneratorExecuting);
3127 3127
3128 FixedArray* operand_stack = generator_object->operand_stack(); 3128 FixedArray* operand_stack = generator_object->operand_stack();
3129 int operands_count = operand_stack->length(); 3129 int operands_count = operand_stack->length();
3130 if (operands_count != 0) { 3130 if (operands_count != 0) {
(...skipping 11753 matching lines...) Expand 10 before | Expand all | Expand 10 after
14884 // Handle last resort GC and make sure to allow future allocations 14884 // Handle last resort GC and make sure to allow future allocations
14885 // to grow the heap without causing GCs (if possible). 14885 // to grow the heap without causing GCs (if possible).
14886 isolate->counters()->gc_last_resort_from_js()->Increment(); 14886 isolate->counters()->gc_last_resort_from_js()->Increment();
14887 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14887 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14888 "Runtime::PerformGC"); 14888 "Runtime::PerformGC");
14889 } 14889 }
14890 } 14890 }
14891 14891
14892 14892
14893 } } // namespace v8::internal 14893 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698