OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef V8_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 #include "src/assert-scope.h" | 10 #include "src/assert-scope.h" |
(...skipping 7345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7356 public: | 7356 public: |
7357 // [function]: The function corresponding to this generator object. | 7357 // [function]: The function corresponding to this generator object. |
7358 DECL_ACCESSORS(function, JSFunction) | 7358 DECL_ACCESSORS(function, JSFunction) |
7359 | 7359 |
7360 // [context]: The context of the suspended computation. | 7360 // [context]: The context of the suspended computation. |
7361 DECL_ACCESSORS(context, Context) | 7361 DECL_ACCESSORS(context, Context) |
7362 | 7362 |
7363 // [receiver]: The receiver of the suspended computation. | 7363 // [receiver]: The receiver of the suspended computation. |
7364 DECL_ACCESSORS(receiver, Object) | 7364 DECL_ACCESSORS(receiver, Object) |
7365 | 7365 |
7366 // [input]: The most recent input value. | 7366 // [input_or_debug_pos] |
7367 DECL_ACCESSORS(input, Object) | 7367 // For executing generators: the most recent input value. |
| 7368 // For suspended new-style generators: debug information (bytecode offset). |
| 7369 // For suspended old-style generators: unused. |
| 7370 // There is currently no need to remember the most recent input value for a |
| 7371 // suspended generator. |
| 7372 DECL_ACCESSORS(input_or_debug_pos, Object) |
7368 | 7373 |
7369 // [resume_mode]: The most recent resume mode. | 7374 // [resume_mode]: The most recent resume mode. |
7370 enum ResumeMode { kNext, kReturn, kThrow }; | 7375 enum ResumeMode { kNext, kReturn, kThrow }; |
7371 DECL_INT_ACCESSORS(resume_mode) | 7376 DECL_INT_ACCESSORS(resume_mode) |
7372 | 7377 |
7373 // [continuation]: Offset into code of continuation. | 7378 // [continuation] |
7374 // | 7379 // |
7375 // A positive offset indicates a suspended generator. The special | 7380 // A positive value indicates a suspended generator. The special |
7376 // kGeneratorExecuting and kGeneratorClosed values indicate that a generator | 7381 // kGeneratorExecuting and kGeneratorClosed values indicate that a generator |
7377 // cannot be resumed. | 7382 // cannot be resumed. |
7378 inline int continuation() const; | 7383 inline int continuation() const; |
7379 inline void set_continuation(int continuation); | 7384 inline void set_continuation(int continuation); |
7380 inline bool is_closed(); | 7385 inline bool is_closed() const; |
7381 inline bool is_executing(); | 7386 inline bool is_executing() const; |
7382 inline bool is_suspended(); | 7387 inline bool is_suspended() const; |
| 7388 |
| 7389 // For suspended generators: the source position at which the generator |
| 7390 // is suspended. |
| 7391 int source_position() const; |
7383 | 7392 |
7384 // [operand_stack]: Saved operand stack. | 7393 // [operand_stack]: Saved operand stack. |
7385 DECL_ACCESSORS(operand_stack, FixedArray) | 7394 DECL_ACCESSORS(operand_stack, FixedArray) |
7386 | 7395 |
7387 DECLARE_CAST(JSGeneratorObject) | 7396 DECLARE_CAST(JSGeneratorObject) |
7388 | 7397 |
7389 // Dispatched behavior. | 7398 // Dispatched behavior. |
7390 DECLARE_VERIFIER(JSGeneratorObject) | 7399 DECLARE_VERIFIER(JSGeneratorObject) |
7391 | 7400 |
7392 // Magic sentinel values for the continuation. | 7401 // Magic sentinel values for the continuation. |
7393 static const int kGeneratorExecuting = -2; | 7402 static const int kGeneratorExecuting = -2; |
7394 static const int kGeneratorClosed = -1; | 7403 static const int kGeneratorClosed = -1; |
7395 | 7404 |
7396 // Layout description. | 7405 // Layout description. |
7397 static const int kFunctionOffset = JSObject::kHeaderSize; | 7406 static const int kFunctionOffset = JSObject::kHeaderSize; |
7398 static const int kContextOffset = kFunctionOffset + kPointerSize; | 7407 static const int kContextOffset = kFunctionOffset + kPointerSize; |
7399 static const int kReceiverOffset = kContextOffset + kPointerSize; | 7408 static const int kReceiverOffset = kContextOffset + kPointerSize; |
7400 static const int kInputOffset = kReceiverOffset + kPointerSize; | 7409 static const int kInputOrDebugPosOffset = kReceiverOffset + kPointerSize; |
7401 static const int kResumeModeOffset = kInputOffset + kPointerSize; | 7410 static const int kResumeModeOffset = kInputOrDebugPosOffset + kPointerSize; |
7402 static const int kContinuationOffset = kResumeModeOffset + kPointerSize; | 7411 static const int kContinuationOffset = kResumeModeOffset + kPointerSize; |
7403 static const int kOperandStackOffset = kContinuationOffset + kPointerSize; | 7412 static const int kOperandStackOffset = kContinuationOffset + kPointerSize; |
7404 static const int kSize = kOperandStackOffset + kPointerSize; | 7413 static const int kSize = kOperandStackOffset + kPointerSize; |
7405 | 7414 |
7406 private: | 7415 private: |
7407 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGeneratorObject); | 7416 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGeneratorObject); |
7408 }; | 7417 }; |
7409 | 7418 |
7410 | 7419 |
7411 // Representation for module instance objects. | 7420 // Representation for module instance objects. |
(...skipping 3394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10806 } | 10815 } |
10807 return value; | 10816 return value; |
10808 } | 10817 } |
10809 }; | 10818 }; |
10810 | 10819 |
10811 | 10820 |
10812 } // NOLINT, false-positive due to second-order macros. | 10821 } // NOLINT, false-positive due to second-order macros. |
10813 } // NOLINT, false-positive due to second-order macros. | 10822 } // NOLINT, false-positive due to second-order macros. |
10814 | 10823 |
10815 #endif // V8_OBJECTS_H_ | 10824 #endif // V8_OBJECTS_H_ |
OLD | NEW |