| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |