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

Side by Side Diff: src/runtime/runtime-generator.cc

Issue 2519853002: [debugger] step-next across yield should not leave the generator. (Closed)
Patch Set: Created 4 years, 1 month 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/runtime/runtime-debug.cc ('k') | test/debugger/debug/es6/debug-stepin-generators.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/factory.h" 9 #include "src/factory.h"
10 #include "src/frames-inl.h" 10 #include "src/frames-inl.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 DCHECK(args.length() == 1); 47 DCHECK(args.length() == 1);
48 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator_object, 0); 48 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator_object, 0);
49 49
50 JavaScriptFrameIterator stack_iterator(isolate); 50 JavaScriptFrameIterator stack_iterator(isolate);
51 JavaScriptFrame* frame = stack_iterator.frame(); 51 JavaScriptFrame* frame = stack_iterator.frame();
52 CHECK(IsResumableFunction(frame->function()->shared()->kind())); 52 CHECK(IsResumableFunction(frame->function()->shared()->kind()));
53 DCHECK_EQ(frame->function(), generator_object->function()); 53 DCHECK_EQ(frame->function(), generator_object->function());
54 DCHECK(frame->function()->shared()->is_compiled()); 54 DCHECK(frame->function()->shared()->is_compiled());
55 DCHECK(!frame->function()->IsOptimized()); 55 DCHECK(!frame->function()->IsOptimized());
56 56
57 isolate->debug()->RecordAsyncFunction(generator_object); 57 isolate->debug()->RecordGenerator(generator_object);
58 58
59 // The caller should have saved the context and continuation already. 59 // The caller should have saved the context and continuation already.
60 DCHECK_EQ(generator_object->context(), Context::cast(frame->context())); 60 DCHECK_EQ(generator_object->context(), Context::cast(frame->context()));
61 DCHECK_LT(0, generator_object->continuation()); 61 DCHECK_LT(0, generator_object->continuation());
62 62
63 // We expect there to be at least two values on the operand stack: the return 63 // We expect there to be at least two values on the operand stack: the return
64 // value of the yield expression, and the arguments to this runtime call. 64 // value of the yield expression, and the arguments to this runtime call.
65 // Neither of those should be saved. 65 // Neither of those should be saved.
66 int operands_count = frame->ComputeOperandsCount(); 66 int operands_count = frame->ComputeOperandsCount();
67 DCHECK_GE(operands_count, 1 + args.length()); 67 DCHECK_GE(operands_count, 1 + args.length());
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 HandleScope scope(isolate); 136 HandleScope scope(isolate);
137 DCHECK(args.length() == 1); 137 DCHECK(args.length() == 1);
138 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0); 138 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0);
139 139
140 if (!generator->is_suspended()) return isolate->heap()->undefined_value(); 140 if (!generator->is_suspended()) return isolate->heap()->undefined_value();
141 return Smi::FromInt(generator->source_position()); 141 return Smi::FromInt(generator->source_position());
142 } 142 }
143 143
144 } // namespace internal 144 } // namespace internal
145 } // namespace v8 145 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | test/debugger/debug/es6/debug-stepin-generators.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698