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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 return Smi::FromInt(generator->continuation()); | 140 return Smi::FromInt(generator->continuation()); |
141 } | 141 } |
142 | 142 |
143 | 143 |
144 RUNTIME_FUNCTION(Runtime_GeneratorGetSourcePosition) { | 144 RUNTIME_FUNCTION(Runtime_GeneratorGetSourcePosition) { |
145 HandleScope scope(isolate); | 145 HandleScope scope(isolate); |
146 DCHECK(args.length() == 1); | 146 DCHECK(args.length() == 1); |
147 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0); | 147 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0); |
148 | 148 |
149 if (generator->is_suspended()) { | 149 if (!generator->is_suspended()) return isolate->heap()->undefined_value(); |
150 Handle<Code> code(generator->function()->code(), isolate); | |
151 int offset = generator->continuation(); | |
152 RUNTIME_ASSERT(0 <= offset && offset < code->instruction_size()); | |
153 return Smi::FromInt(code->SourcePosition(offset)); | |
154 } | |
155 | 150 |
156 return isolate->heap()->undefined_value(); | 151 if (FLAG_ignition && FLAG_ignition_generators) UNIMPLEMENTED(); |
| 152 |
| 153 DCHECK(!generator->function()->shared()->HasBytecodeArray()); |
| 154 Handle<Code> code(generator->function()->code(), isolate); |
| 155 int offset = generator->continuation(); |
| 156 RUNTIME_ASSERT(0 <= offset && offset < code->instruction_size()); |
| 157 return Smi::FromInt(code->SourcePosition(offset)); |
157 } | 158 } |
158 | 159 |
159 } // namespace internal | 160 } // namespace internal |
160 } // namespace v8 | 161 } // namespace v8 |
OLD | NEW |