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

Side by Side Diff: src/ast.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/arm/full-codegen-arm.cc ('k') | src/full-codegen.cc » ('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 1946 matching lines...) Expand 10 before | Expand all | Expand 10 after
1957 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed, 1957 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed,
1958 // must have extra bit. 1958 // must have extra bit.
1959 SmallMapList receiver_types_; 1959 SmallMapList receiver_types_;
1960 }; 1960 };
1961 1961
1962 1962
1963 class Yield: public Expression { 1963 class Yield: public Expression {
1964 public: 1964 public:
1965 DECLARE_NODE_TYPE(Yield) 1965 DECLARE_NODE_TYPE(Yield)
1966 1966
1967 enum Kind {
1968 INITIAL, // The initial yield that returns the unboxed generator object.
1969 SUSPEND, // A normal yield: { value: EXPRESSION, done: false }
1970 DELEGATING, // A yield*.
1971 FINAL // A return: { value: EXPRESSION, done: true }
1972 };
1973
1967 Expression* generator_object() const { return generator_object_; } 1974 Expression* generator_object() const { return generator_object_; }
1968 Expression* expression() const { return expression_; } 1975 Expression* expression() const { return expression_; }
1969 bool is_delegating_yield() const { return is_delegating_yield_; } 1976 Kind yield_kind() const { return yield_kind_; }
1970 virtual int position() const { return pos_; } 1977 virtual int position() const { return pos_; }
1971 1978
1972 protected: 1979 protected:
1973 Yield(Isolate* isolate, 1980 Yield(Isolate* isolate,
1974 Expression* generator_object, 1981 Expression* generator_object,
1975 Expression* expression, 1982 Expression* expression,
1976 bool is_delegating_yield, 1983 Kind yield_kind,
1977 int pos) 1984 int pos)
1978 : Expression(isolate), 1985 : Expression(isolate),
1979 generator_object_(generator_object), 1986 generator_object_(generator_object),
1980 expression_(expression), 1987 expression_(expression),
1981 is_delegating_yield_(is_delegating_yield), 1988 yield_kind_(yield_kind),
1982 pos_(pos) { } 1989 pos_(pos) { }
1983 1990
1984 private: 1991 private:
1985 Expression* generator_object_; 1992 Expression* generator_object_;
1986 Expression* expression_; 1993 Expression* expression_;
1987 bool is_delegating_yield_; 1994 Kind yield_kind_;
1988 int pos_; 1995 int pos_;
1989 }; 1996 };
1990 1997
1991 1998
1992 class Throw: public Expression { 1999 class Throw: public Expression {
1993 public: 2000 public:
1994 DECLARE_NODE_TYPE(Throw) 2001 DECLARE_NODE_TYPE(Throw)
1995 2002
1996 Expression* exception() const { return exception_; } 2003 Expression* exception() const { return exception_; }
1997 virtual int position() const { return pos_; } 2004 virtual int position() const { return pos_; }
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
2959 Expression* value, 2966 Expression* value,
2960 int pos) { 2967 int pos) {
2961 Assignment* assign = 2968 Assignment* assign =
2962 new(zone_) Assignment(isolate_, op, target, value, pos); 2969 new(zone_) Assignment(isolate_, op, target, value, pos);
2963 assign->Init(isolate_, this); 2970 assign->Init(isolate_, this);
2964 VISIT_AND_RETURN(Assignment, assign) 2971 VISIT_AND_RETURN(Assignment, assign)
2965 } 2972 }
2966 2973
2967 Yield* NewYield(Expression *generator_object, 2974 Yield* NewYield(Expression *generator_object,
2968 Expression* expression, 2975 Expression* expression,
2969 bool is_delegating_yield, 2976 Yield::Kind yield_kind,
2970 int pos) { 2977 int pos) {
2971 Yield* yield = new(zone_) Yield( 2978 Yield* yield = new(zone_) Yield(
2972 isolate_, generator_object, expression, is_delegating_yield, pos); 2979 isolate_, generator_object, expression, yield_kind, pos);
2973 VISIT_AND_RETURN(Yield, yield) 2980 VISIT_AND_RETURN(Yield, yield)
2974 } 2981 }
2975 2982
2976 Throw* NewThrow(Expression* exception, int pos) { 2983 Throw* NewThrow(Expression* exception, int pos) {
2977 Throw* t = new(zone_) Throw(isolate_, exception, pos); 2984 Throw* t = new(zone_) Throw(isolate_, exception, pos);
2978 VISIT_AND_RETURN(Throw, t) 2985 VISIT_AND_RETURN(Throw, t)
2979 } 2986 }
2980 2987
2981 FunctionLiteral* NewFunctionLiteral( 2988 FunctionLiteral* NewFunctionLiteral(
2982 Handle<String> name, 2989 Handle<String> name,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
3023 private: 3030 private:
3024 Isolate* isolate_; 3031 Isolate* isolate_;
3025 Zone* zone_; 3032 Zone* zone_;
3026 Visitor visitor_; 3033 Visitor visitor_;
3027 }; 3034 };
3028 3035
3029 3036
3030 } } // namespace v8::internal 3037 } } // namespace v8::internal
3031 3038
3032 #endif // V8_AST_H_ 3039 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/full-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698