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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 DCHECK(args.length() == 1); | 46 DCHECK(args.length() == 1); |
47 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator_object, 0); | 47 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator_object, 0); |
48 | 48 |
49 JavaScriptFrameIterator stack_iterator(isolate); | 49 JavaScriptFrameIterator stack_iterator(isolate); |
50 JavaScriptFrame* frame = stack_iterator.frame(); | 50 JavaScriptFrame* frame = stack_iterator.frame(); |
51 CHECK(frame->function()->shared()->is_resumable()); | 51 CHECK(frame->function()->shared()->is_resumable()); |
52 DCHECK_EQ(frame->function(), generator_object->function()); | 52 DCHECK_EQ(frame->function(), generator_object->function()); |
53 DCHECK(frame->function()->shared()->is_compiled()); | 53 DCHECK(frame->function()->shared()->is_compiled()); |
54 DCHECK(!frame->function()->IsOptimized()); | 54 DCHECK(!frame->function()->IsOptimized()); |
55 | 55 |
56 if (generator_object->function()->shared()->is_async()) { | 56 isolate->debug()->RecordAsyncFunction(generator_object); |
57 isolate->debug()->RecordAsyncFunction(generator_object); | |
58 } | |
59 | 57 |
60 // The caller should have saved the context and continuation already. | 58 // The caller should have saved the context and continuation already. |
61 DCHECK_EQ(generator_object->context(), Context::cast(frame->context())); | 59 DCHECK_EQ(generator_object->context(), Context::cast(frame->context())); |
62 DCHECK_LT(0, generator_object->continuation()); | 60 DCHECK_LT(0, generator_object->continuation()); |
63 | 61 |
64 // We expect there to be at least two values on the operand stack: the return | 62 // We expect there to be at least two values on the operand stack: the return |
65 // value of the yield expression, and the arguments to this runtime call. | 63 // value of the yield expression, and the arguments to this runtime call. |
66 // Neither of those should be saved. | 64 // Neither of those should be saved. |
67 int operands_count = frame->ComputeOperandsCount(); | 65 int operands_count = frame->ComputeOperandsCount(); |
68 DCHECK_GE(operands_count, 1 + args.length()); | 66 DCHECK_GE(operands_count, 1 + args.length()); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 if (generator->function()->shared()->HasBytecodeArray()) UNIMPLEMENTED(); | 150 if (generator->function()->shared()->HasBytecodeArray()) UNIMPLEMENTED(); |
153 | 151 |
154 Handle<Code> code(generator->function()->code(), isolate); | 152 Handle<Code> code(generator->function()->code(), isolate); |
155 int offset = generator->continuation(); | 153 int offset = generator->continuation(); |
156 CHECK(0 <= offset && offset < code->instruction_size()); | 154 CHECK(0 <= offset && offset < code->instruction_size()); |
157 return Smi::FromInt(code->SourcePosition(offset)); | 155 return Smi::FromInt(code->SourcePosition(offset)); |
158 } | 156 } |
159 | 157 |
160 } // namespace internal | 158 } // namespace internal |
161 } // namespace v8 | 159 } // namespace v8 |
OLD | NEW |