Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(324)

Side by Side Diff: src/objects.h

Issue 13704010: Generator objects can suspend (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Use sentinel values for continuations Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698