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