| 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_ThrowGeneratorStateError) { | 138 RUNTIME_FUNCTION(Runtime_GeneratorClose) { |
| 139 HandleScope scope(isolate); | 139 HandleScope scope(isolate); |
| 140 DCHECK(args.length() == 1); | 140 DCHECK(args.length() == 1); |
| 141 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0); | 141 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0); |
| 142 int continuation = generator->continuation(); | 142 |
| 143 const char* message = continuation == JSGeneratorObject::kGeneratorClosed | 143 generator->set_continuation(JSGeneratorObject::kGeneratorClosed); |
| 144 ? "generator_finished" | 144 |
| 145 : "generator_running"; | 145 return isolate->heap()->undefined_value(); |
| 146 Vector<Handle<Object> > argv = HandleVector<Object>(NULL, 0); | |
| 147 THROW_NEW_ERROR_RETURN_FAILURE(isolate, NewError(message, argv)); | |
| 148 } | 146 } |
| 149 | 147 |
| 150 | 148 |
| 151 // Returns function of generator activation. | 149 // Returns function of generator activation. |
| 152 RUNTIME_FUNCTION(Runtime_GeneratorGetFunction) { | 150 RUNTIME_FUNCTION(Runtime_GeneratorGetFunction) { |
| 153 HandleScope scope(isolate); | 151 HandleScope scope(isolate); |
| 154 DCHECK(args.length() == 1); | 152 DCHECK(args.length() == 1); |
| 155 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0); | 153 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0); |
| 156 | 154 |
| 157 return generator->function(); | 155 return generator->function(); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 return NULL; | 218 return NULL; |
| 221 } | 219 } |
| 222 | 220 |
| 223 | 221 |
| 224 RUNTIME_FUNCTION(RuntimeReference_GeneratorThrow) { | 222 RUNTIME_FUNCTION(RuntimeReference_GeneratorThrow) { |
| 225 UNREACHABLE(); // Optimization disabled in SetUpGenerators(). | 223 UNREACHABLE(); // Optimization disabled in SetUpGenerators(). |
| 226 return NULL; | 224 return NULL; |
| 227 } | 225 } |
| 228 } | 226 } |
| 229 } // namespace v8::internal | 227 } // namespace v8::internal |
| OLD | NEW |