OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 6246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6257 private: | 6257 private: |
6258 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo); | 6258 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo); |
6259 }; | 6259 }; |
6260 | 6260 |
6261 | 6261 |
6262 class JSGeneratorObject: public JSObject { | 6262 class JSGeneratorObject: public JSObject { |
6263 public: | 6263 public: |
6264 // [function]: The function corresponding to this generator object. | 6264 // [function]: The function corresponding to this generator object. |
6265 DECL_ACCESSORS(function, JSFunction) | 6265 DECL_ACCESSORS(function, JSFunction) |
6266 | 6266 |
6267 // [context]: The context of the suspended computation, or undefined. | 6267 // [context]: The context of the suspended computation. |
6268 DECL_ACCESSORS(context, Object) | 6268 DECL_ACCESSORS(context, Context) |
6269 | 6269 |
6270 // [continuation]: Offset into code of continuation. | 6270 // [continuation]: Offset into code of continuation. |
| 6271 // |
| 6272 // A positive offset indicates a suspended generator. The special |
| 6273 // kGeneratorExecuting and kGeneratorClosed values indicate that a generator |
| 6274 // cannot be resumed. |
6271 inline int continuation(); | 6275 inline int continuation(); |
6272 inline void set_continuation(int continuation); | 6276 inline void set_continuation(int continuation); |
6273 | 6277 |
6274 // [operands]: Saved operand stack. | 6278 // [operands]: Saved operand stack. |
6275 DECL_ACCESSORS(operand_stack, FixedArray) | 6279 DECL_ACCESSORS(operand_stack, FixedArray) |
6276 | 6280 |
6277 // Casting. | 6281 // Casting. |
6278 static inline JSGeneratorObject* cast(Object* obj); | 6282 static inline JSGeneratorObject* cast(Object* obj); |
6279 | 6283 |
6280 // Dispatched behavior. | 6284 // Dispatched behavior. |
6281 DECLARE_PRINTER(JSGeneratorObject) | 6285 DECLARE_PRINTER(JSGeneratorObject) |
6282 DECLARE_VERIFIER(JSGeneratorObject) | 6286 DECLARE_VERIFIER(JSGeneratorObject) |
6283 | 6287 |
| 6288 // Magic sentinel values for the continuation. |
| 6289 static const int kGeneratorExecuting = -1; |
| 6290 static const int kGeneratorClosed = 0; |
| 6291 |
6284 // Layout description. | 6292 // Layout description. |
6285 static const int kFunctionOffset = JSObject::kHeaderSize; | 6293 static const int kFunctionOffset = JSObject::kHeaderSize; |
6286 static const int kContextOffset = kFunctionOffset + kPointerSize; | 6294 static const int kContextOffset = kFunctionOffset + kPointerSize; |
6287 static const int kContinuationOffset = kContextOffset + kPointerSize; | 6295 static const int kContinuationOffset = kContextOffset + kPointerSize; |
6288 static const int kOperandStackOffset = kContinuationOffset + kPointerSize; | 6296 static const int kOperandStackOffset = kContinuationOffset + kPointerSize; |
6289 static const int kSize = kOperandStackOffset + kPointerSize; | 6297 static const int kSize = kOperandStackOffset + kPointerSize; |
6290 | 6298 |
6291 private: | 6299 private: |
6292 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGeneratorObject); | 6300 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGeneratorObject); |
6293 }; | 6301 }; |
(...skipping 3062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9356 } else { | 9364 } else { |
9357 value &= ~(1 << bit_position); | 9365 value &= ~(1 << bit_position); |
9358 } | 9366 } |
9359 return value; | 9367 return value; |
9360 } | 9368 } |
9361 }; | 9369 }; |
9362 | 9370 |
9363 } } // namespace v8::internal | 9371 } } // namespace v8::internal |
9364 | 9372 |
9365 #endif // V8_OBJECTS_H_ | 9373 #endif // V8_OBJECTS_H_ |
OLD | NEW |