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

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: Tighten typing on generator object contexts 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
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 // The initial yield that returns the unboxed generator object.
1969 INITIAL,
Michael Starzinger 2013/04/17 13:43:48 nit: Can we compact this enum a bit (e.g. by movin
1970
1971 // A normal yield: { value: VALUE, done: false }
1972 SUSPEND,
1973
1974 // A yield*.
1975 DELEGATING,
1976
1977 // A return: { value: VALUE, done: true }
1978 FINAL
1979 };
1980
1967 Expression* generator_object() const { return generator_object_; } 1981 Expression* generator_object() const { return generator_object_; }
1968 Expression* expression() const { return expression_; } 1982 Expression* expression() const { return expression_; }
1969 bool is_delegating_yield() const { return is_delegating_yield_; } 1983 Kind kind() const { return kind_; }
Michael Starzinger 2013/04/17 13:43:48 nit: There are so many "kinds" in V8 already, can
1970 virtual int position() const { return pos_; } 1984 virtual int position() const { return pos_; }
1971 1985
1972 protected: 1986 protected:
1973 Yield(Isolate* isolate, 1987 Yield(Isolate* isolate,
1974 Expression* generator_object, 1988 Expression* generator_object,
1975 Expression* expression, 1989 Expression* expression,
1976 bool is_delegating_yield, 1990 Kind kind,
1977 int pos) 1991 int pos)
1978 : Expression(isolate), 1992 : Expression(isolate),
1979 generator_object_(generator_object), 1993 generator_object_(generator_object),
1980 expression_(expression), 1994 expression_(expression),
1981 is_delegating_yield_(is_delegating_yield), 1995 kind_(kind),
1982 pos_(pos) { } 1996 pos_(pos) { }
1983 1997
1984 private: 1998 private:
1985 Expression* generator_object_; 1999 Expression* generator_object_;
1986 Expression* expression_; 2000 Expression* expression_;
1987 bool is_delegating_yield_; 2001 Kind kind_;
1988 int pos_; 2002 int pos_;
1989 }; 2003 };
1990 2004
1991 2005
1992 class Throw: public Expression { 2006 class Throw: public Expression {
1993 public: 2007 public:
1994 DECLARE_NODE_TYPE(Throw) 2008 DECLARE_NODE_TYPE(Throw)
1995 2009
1996 Expression* exception() const { return exception_; } 2010 Expression* exception() const { return exception_; }
1997 virtual int position() const { return pos_; } 2011 virtual int position() const { return pos_; }
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
2959 Expression* value, 2973 Expression* value,
2960 int pos) { 2974 int pos) {
2961 Assignment* assign = 2975 Assignment* assign =
2962 new(zone_) Assignment(isolate_, op, target, value, pos); 2976 new(zone_) Assignment(isolate_, op, target, value, pos);
2963 assign->Init(isolate_, this); 2977 assign->Init(isolate_, this);
2964 VISIT_AND_RETURN(Assignment, assign) 2978 VISIT_AND_RETURN(Assignment, assign)
2965 } 2979 }
2966 2980
2967 Yield* NewYield(Expression *generator_object, 2981 Yield* NewYield(Expression *generator_object,
2968 Expression* expression, 2982 Expression* expression,
2969 bool is_delegating_yield, 2983 Yield::Kind kind,
2970 int pos) { 2984 int pos) {
2971 Yield* yield = new(zone_) Yield( 2985 Yield* yield = new(zone_) Yield(
2972 isolate_, generator_object, expression, is_delegating_yield, pos); 2986 isolate_, generator_object, expression, kind, pos);
2973 VISIT_AND_RETURN(Yield, yield) 2987 VISIT_AND_RETURN(Yield, yield)
2974 } 2988 }
2975 2989
2976 Throw* NewThrow(Expression* exception, int pos) { 2990 Throw* NewThrow(Expression* exception, int pos) {
2977 Throw* t = new(zone_) Throw(isolate_, exception, pos); 2991 Throw* t = new(zone_) Throw(isolate_, exception, pos);
2978 VISIT_AND_RETURN(Throw, t) 2992 VISIT_AND_RETURN(Throw, t)
2979 } 2993 }
2980 2994
2981 FunctionLiteral* NewFunctionLiteral( 2995 FunctionLiteral* NewFunctionLiteral(
2982 Handle<String> name, 2996 Handle<String> name,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
3023 private: 3037 private:
3024 Isolate* isolate_; 3038 Isolate* isolate_;
3025 Zone* zone_; 3039 Zone* zone_;
3026 Visitor visitor_; 3040 Visitor visitor_;
3027 }; 3041 };
3028 3042
3029 3043
3030 } } // namespace v8::internal 3044 } } // namespace v8::internal
3031 3045
3032 #endif // V8_AST_H_ 3046 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/full-codegen.cc » ('j') | src/ia32/full-codegen-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698