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 7295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7306 | 7306 |
7307 // [context]: The context of the suspended computation. | 7307 // [context]: The context of the suspended computation. |
7308 DECL_ACCESSORS(context, Context) | 7308 DECL_ACCESSORS(context, Context) |
7309 | 7309 |
7310 // [receiver]: The receiver of the suspended computation. | 7310 // [receiver]: The receiver of the suspended computation. |
7311 DECL_ACCESSORS(receiver, Object) | 7311 DECL_ACCESSORS(receiver, Object) |
7312 | 7312 |
7313 // [input]: The most recent input value. | 7313 // [input]: The most recent input value. |
7314 DECL_ACCESSORS(input, Object) | 7314 DECL_ACCESSORS(input, Object) |
7315 | 7315 |
| 7316 // [resume_mode]: The most recent resume mode. |
| 7317 enum ResumeMode { kNext, kReturn, kThrow }; |
| 7318 DECL_INT_ACCESSORS(resume_mode) |
| 7319 |
7316 // [continuation]: Offset into code of continuation. | 7320 // [continuation]: Offset into code of continuation. |
7317 // | 7321 // |
7318 // A positive offset indicates a suspended generator. The special | 7322 // A positive offset indicates a suspended generator. The special |
7319 // kGeneratorExecuting and kGeneratorClosed values indicate that a generator | 7323 // kGeneratorExecuting and kGeneratorClosed values indicate that a generator |
7320 // cannot be resumed. | 7324 // cannot be resumed. |
7321 inline int continuation() const; | 7325 inline int continuation() const; |
7322 inline void set_continuation(int continuation); | 7326 inline void set_continuation(int continuation); |
7323 inline bool is_closed(); | 7327 inline bool is_closed(); |
7324 inline bool is_executing(); | 7328 inline bool is_executing(); |
7325 inline bool is_suspended(); | 7329 inline bool is_suspended(); |
7326 | 7330 |
7327 // [operand_stack]: Saved operand stack. | 7331 // [operand_stack]: Saved operand stack. |
7328 DECL_ACCESSORS(operand_stack, FixedArray) | 7332 DECL_ACCESSORS(operand_stack, FixedArray) |
7329 | 7333 |
7330 DECLARE_CAST(JSGeneratorObject) | 7334 DECLARE_CAST(JSGeneratorObject) |
7331 | 7335 |
7332 // Dispatched behavior. | 7336 // Dispatched behavior. |
7333 DECLARE_PRINTER(JSGeneratorObject) | 7337 DECLARE_PRINTER(JSGeneratorObject) |
7334 DECLARE_VERIFIER(JSGeneratorObject) | 7338 DECLARE_VERIFIER(JSGeneratorObject) |
7335 | 7339 |
7336 // Magic sentinel values for the continuation. | 7340 // Magic sentinel values for the continuation. |
7337 static const int kGeneratorExecuting = -1; | 7341 static const int kGeneratorExecuting = -1; |
7338 static const int kGeneratorClosed = 0; | 7342 static const int kGeneratorClosed = 0; |
7339 | 7343 |
7340 // Layout description. | 7344 // Layout description. |
7341 static const int kFunctionOffset = JSObject::kHeaderSize; | 7345 static const int kFunctionOffset = JSObject::kHeaderSize; |
7342 static const int kContextOffset = kFunctionOffset + kPointerSize; | 7346 static const int kContextOffset = kFunctionOffset + kPointerSize; |
7343 static const int kReceiverOffset = kContextOffset + kPointerSize; | 7347 static const int kReceiverOffset = kContextOffset + kPointerSize; |
7344 static const int kInputOffset = kReceiverOffset + kPointerSize; | 7348 static const int kInputOffset = kReceiverOffset + kPointerSize; |
7345 static const int kContinuationOffset = kInputOffset + kPointerSize; | 7349 static const int kResumeModeOffset = kInputOffset + kPointerSize; |
| 7350 static const int kContinuationOffset = kResumeModeOffset + kPointerSize; |
7346 static const int kOperandStackOffset = kContinuationOffset + kPointerSize; | 7351 static const int kOperandStackOffset = kContinuationOffset + kPointerSize; |
7347 static const int kSize = kOperandStackOffset + kPointerSize; | 7352 static const int kSize = kOperandStackOffset + kPointerSize; |
7348 | 7353 |
7349 // Resume mode, for use by runtime functions. | |
7350 enum ResumeMode { kNext, kReturn, kThrow }; | |
7351 | |
7352 private: | 7354 private: |
7353 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGeneratorObject); | 7355 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGeneratorObject); |
7354 }; | 7356 }; |
7355 | 7357 |
7356 | 7358 |
7357 // Representation for module instance objects. | 7359 // Representation for module instance objects. |
7358 class JSModule: public JSObject { | 7360 class JSModule: public JSObject { |
7359 public: | 7361 public: |
7360 // [context]: the context holding the module's locals, or undefined if none. | 7362 // [context]: the context holding the module's locals, or undefined if none. |
7361 DECL_ACCESSORS(context, Object) | 7363 DECL_ACCESSORS(context, Object) |
(...skipping 3398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10760 } | 10762 } |
10761 return value; | 10763 return value; |
10762 } | 10764 } |
10763 }; | 10765 }; |
10764 | 10766 |
10765 | 10767 |
10766 } // NOLINT, false-positive due to second-order macros. | 10768 } // NOLINT, false-positive due to second-order macros. |
10767 } // NOLINT, false-positive due to second-order macros. | 10769 } // NOLINT, false-positive due to second-order macros. |
10768 | 10770 |
10769 #endif // V8_OBJECTS_H_ | 10771 #endif // V8_OBJECTS_H_ |
OLD | NEW |