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/factory.h" | 9 #include "src/factory.h" |
9 #include "src/frames-inl.h" | 10 #include "src/frames-inl.h" |
10 #include "src/objects-inl.h" | 11 #include "src/objects-inl.h" |
11 | 12 |
12 namespace v8 { | 13 namespace v8 { |
13 namespace internal { | 14 namespace internal { |
14 | 15 |
15 RUNTIME_FUNCTION(Runtime_CreateJSGeneratorObject) { | 16 RUNTIME_FUNCTION(Runtime_CreateJSGeneratorObject) { |
16 HandleScope scope(isolate); | 17 HandleScope scope(isolate); |
17 DCHECK(args.length() == 2); | 18 DCHECK(args.length() == 2); |
(...skipping 26 matching lines...) Expand all Loading... |
44 DCHECK(args.length() == 1); | 45 DCHECK(args.length() == 1); |
45 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator_object, 0); | 46 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator_object, 0); |
46 | 47 |
47 JavaScriptFrameIterator stack_iterator(isolate); | 48 JavaScriptFrameIterator stack_iterator(isolate); |
48 JavaScriptFrame* frame = stack_iterator.frame(); | 49 JavaScriptFrame* frame = stack_iterator.frame(); |
49 RUNTIME_ASSERT(frame->function()->shared()->is_resumable()); | 50 RUNTIME_ASSERT(frame->function()->shared()->is_resumable()); |
50 DCHECK_EQ(frame->function(), generator_object->function()); | 51 DCHECK_EQ(frame->function(), generator_object->function()); |
51 DCHECK(frame->function()->shared()->is_compiled()); | 52 DCHECK(frame->function()->shared()->is_compiled()); |
52 DCHECK(!frame->function()->IsOptimized()); | 53 DCHECK(!frame->function()->IsOptimized()); |
53 | 54 |
| 55 if (generator_object->function()->shared()->is_async()) { |
| 56 isolate->debug()->RecordAsyncFunction(generator_object); |
| 57 } |
| 58 |
54 // The caller should have saved the context and continuation already. | 59 // The caller should have saved the context and continuation already. |
55 DCHECK_EQ(generator_object->context(), Context::cast(frame->context())); | 60 DCHECK_EQ(generator_object->context(), Context::cast(frame->context())); |
56 DCHECK_LT(0, generator_object->continuation()); | 61 DCHECK_LT(0, generator_object->continuation()); |
57 | 62 |
58 // 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 |
59 // 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. |
60 // Neither of those should be saved. | 65 // Neither of those should be saved. |
61 int operands_count = frame->ComputeOperandsCount(); | 66 int operands_count = frame->ComputeOperandsCount(); |
62 DCHECK_GE(operands_count, 1 + args.length()); | 67 DCHECK_GE(operands_count, 1 + args.length()); |
63 operands_count -= 1 + args.length(); | 68 operands_count -= 1 + args.length(); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 int offset = generator->continuation(); | 151 int offset = generator->continuation(); |
147 RUNTIME_ASSERT(0 <= offset && offset < code->instruction_size()); | 152 RUNTIME_ASSERT(0 <= offset && offset < code->instruction_size()); |
148 return Smi::FromInt(code->SourcePosition(offset)); | 153 return Smi::FromInt(code->SourcePosition(offset)); |
149 } | 154 } |
150 | 155 |
151 return isolate->heap()->undefined_value(); | 156 return isolate->heap()->undefined_value(); |
152 } | 157 } |
153 | 158 |
154 } // namespace internal | 159 } // namespace internal |
155 } // namespace v8 | 160 } // namespace v8 |
OLD | NEW |