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/factory.h" | 8 #include "src/factory.h" |
9 #include "src/frames-inl.h" | 9 #include "src/frames-inl.h" |
10 #include "src/objects-inl.h" | 10 #include "src/objects-inl.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 188 |
189 | 189 |
190 RUNTIME_FUNCTION(Runtime_GeneratorGetSourcePosition) { | 190 RUNTIME_FUNCTION(Runtime_GeneratorGetSourcePosition) { |
191 HandleScope scope(isolate); | 191 HandleScope scope(isolate); |
192 DCHECK(args.length() == 1); | 192 DCHECK(args.length() == 1); |
193 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0); | 193 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0); |
194 | 194 |
195 if (generator->is_suspended()) { | 195 if (generator->is_suspended()) { |
196 Handle<Code> code(generator->function()->code(), isolate); | 196 Handle<Code> code(generator->function()->code(), isolate); |
197 int offset = generator->continuation(); | 197 int offset = generator->continuation(); |
198 | 198 RUNTIME_ASSERT(0 <= offset && offset < code->instruction_size()); |
199 RUNTIME_ASSERT(0 <= offset && offset < code->Size()); | 199 return Smi::FromInt(code->SourcePosition(offset)); |
200 Address pc = code->address() + offset; | |
201 | |
202 return Smi::FromInt(code->SourcePosition(pc)); | |
203 } | 200 } |
204 | 201 |
205 return isolate->heap()->undefined_value(); | 202 return isolate->heap()->undefined_value(); |
206 } | 203 } |
207 | 204 |
208 | 205 |
209 RUNTIME_FUNCTION(Runtime_GeneratorNext) { | 206 RUNTIME_FUNCTION(Runtime_GeneratorNext) { |
210 UNREACHABLE(); // Optimization disabled in SetUpGenerators(). | 207 UNREACHABLE(); // Optimization disabled in SetUpGenerators(). |
211 return NULL; | 208 return NULL; |
212 } | 209 } |
213 | 210 |
214 | 211 |
215 RUNTIME_FUNCTION(Runtime_GeneratorThrow) { | 212 RUNTIME_FUNCTION(Runtime_GeneratorThrow) { |
216 UNREACHABLE(); // Optimization disabled in SetUpGenerators(). | 213 UNREACHABLE(); // Optimization disabled in SetUpGenerators(). |
217 return NULL; | 214 return NULL; |
218 } | 215 } |
219 } // namespace internal | 216 } // namespace internal |
220 } // namespace v8 | 217 } // namespace v8 |
OLD | NEW |