| 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
| 8 #include "src/frames-inl.h" | 8 #include "src/frames-inl.h" |
| 9 #include "src/runtime/runtime-utils.h" | 9 #include "src/runtime/runtime-utils.h" |
| 10 | 10 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 return value; | 128 return value; |
| 129 case JSGeneratorObject::THROW: | 129 case JSGeneratorObject::THROW: |
| 130 return isolate->Throw(value); | 130 return isolate->Throw(value); |
| 131 } | 131 } |
| 132 | 132 |
| 133 UNREACHABLE(); | 133 UNREACHABLE(); |
| 134 return isolate->ThrowIllegalOperation(); | 134 return isolate->ThrowIllegalOperation(); |
| 135 } | 135 } |
| 136 | 136 |
| 137 | 137 |
| 138 RUNTIME_FUNCTION(Runtime_GeneratorClose) { |
| 139 HandleScope scope(isolate); |
| 140 DCHECK(args.length() == 1); |
| 141 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0); |
| 142 |
| 143 generator->set_continuation(JSGeneratorObject::kGeneratorClosed); |
| 144 |
| 145 return isolate->heap()->undefined_value(); |
| 146 } |
| 147 |
| 148 |
| 138 RUNTIME_FUNCTION(Runtime_ThrowGeneratorStateError) { | 149 RUNTIME_FUNCTION(Runtime_ThrowGeneratorStateError) { |
| 139 HandleScope scope(isolate); | 150 HandleScope scope(isolate); |
| 140 DCHECK(args.length() == 1); | 151 DCHECK(args.length() == 1); |
| 141 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0); | 152 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0); |
| 142 int continuation = generator->continuation(); | 153 int continuation = generator->continuation(); |
| 143 const char* message = continuation == JSGeneratorObject::kGeneratorClosed | 154 const char* message = continuation == JSGeneratorObject::kGeneratorClosed |
| 144 ? "generator_finished" | 155 ? "generator_finished" |
| 145 : "generator_running"; | 156 : "generator_running"; |
| 146 Vector<Handle<Object> > argv = HandleVector<Object>(NULL, 0); | 157 Vector<Handle<Object> > argv = HandleVector<Object>(NULL, 0); |
| 147 THROW_NEW_ERROR_RETURN_FAILURE(isolate, NewError(message, argv)); | 158 THROW_NEW_ERROR_RETURN_FAILURE(isolate, NewError(message, argv)); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 return NULL; | 231 return NULL; |
| 221 } | 232 } |
| 222 | 233 |
| 223 | 234 |
| 224 RUNTIME_FUNCTION(RuntimeReference_GeneratorThrow) { | 235 RUNTIME_FUNCTION(RuntimeReference_GeneratorThrow) { |
| 225 UNREACHABLE(); // Optimization disabled in SetUpGenerators(). | 236 UNREACHABLE(); // Optimization disabled in SetUpGenerators(). |
| 226 return NULL; | 237 return NULL; |
| 227 } | 238 } |
| 228 } | 239 } |
| 229 } // namespace v8::internal | 240 } // namespace v8::internal |
| OLD | NEW |