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

Side by Side Diff: src/ast.h

Issue 965001: Add static analysis to AST expressions that records whether a negative zero w... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/ia32/codegen-ia32.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 // AST analysis results 244 // AST analysis results
245 245
246 // True if the expression rooted at this node can be compiled by the 246 // True if the expression rooted at this node can be compiled by the
247 // side-effect free compiler. 247 // side-effect free compiler.
248 bool side_effect_free() { return SideEffectFreeField::decode(bitfields_); } 248 bool side_effect_free() { return SideEffectFreeField::decode(bitfields_); }
249 void set_side_effect_free(bool is_side_effect_free) { 249 void set_side_effect_free(bool is_side_effect_free) {
250 bitfields_ &= ~SideEffectFreeField::mask(); 250 bitfields_ &= ~SideEffectFreeField::mask();
251 bitfields_ |= SideEffectFreeField::encode(is_side_effect_free); 251 bitfields_ |= SideEffectFreeField::encode(is_side_effect_free);
252 } 252 }
253 253
254 // Will the use of this expression treat -0 the same as 0 in all cases?
255 // If so, we can return 0 instead of -0 if we want to, to optimize code.
256 bool no_negative_zero() { return NoNegativeZeroField::decode(bitfields_); }
257 void set_no_negative_zero(bool no_negative_zero) {
258 bitfields_ &= ~NoNegativeZeroField::mask();
259 bitfields_ |= NoNegativeZeroField::encode(no_negative_zero);
260 }
261
254 // Will ToInt32 (ECMA 262-3 9.5) or ToUint32 (ECMA 262-3 9.6) 262 // Will ToInt32 (ECMA 262-3 9.5) or ToUint32 (ECMA 262-3 9.6)
255 // be applied to the value of this expression? 263 // be applied to the value of this expression?
256 // If so, we may be able to optimize the calculation of the value. 264 // If so, we may be able to optimize the calculation of the value.
257 bool to_int32() { return ToInt32Field::decode(bitfields_); } 265 bool to_int32() { return ToInt32Field::decode(bitfields_); }
258 void set_to_int32(bool to_int32) { 266 void set_to_int32(bool to_int32) {
259 bitfields_ &= ~ToInt32Field::mask(); 267 bitfields_ &= ~ToInt32Field::mask();
260 bitfields_ |= ToInt32Field::encode(to_int32); 268 bitfields_ |= ToInt32Field::encode(to_int32);
261 } 269 }
262 270
263 271
264 private: 272 private:
265 uint32_t bitfields_; 273 uint32_t bitfields_;
266 StaticType type_; 274 StaticType type_;
267 275
268 DefinitionInfo* def_; 276 DefinitionInfo* def_;
269 ZoneList<DefinitionInfo*>* defined_vars_; 277 ZoneList<DefinitionInfo*>* defined_vars_;
270 278
271 // Using template BitField<type, start, size>. 279 // Using template BitField<type, start, size>.
272 class SideEffectFreeField : public BitField<bool, 0, 1> {}; 280 class SideEffectFreeField : public BitField<bool, 0, 1> {};
273 class ToInt32Field : public BitField<bool, 1, 1> {}; 281 class NoNegativeZeroField : public BitField<bool, 1, 1> {};
282 class ToInt32Field : public BitField<bool, 2, 1> {};
274 }; 283 };
275 284
276 285
277 /** 286 /**
278 * A sentinel used during pre parsing that represents some expression 287 * A sentinel used during pre parsing that represents some expression
279 * that is a valid left hand side without having to actually build 288 * that is a valid left hand side without having to actually build
280 * the expression. 289 * the expression.
281 */ 290 */
282 class ValidLeftHandSideSentinel: public Expression { 291 class ValidLeftHandSideSentinel: public Expression {
283 public: 292 public:
(...skipping 1695 matching lines...) Expand 10 before | Expand all | Expand 10 after
1979 #undef DEF_VISIT 1988 #undef DEF_VISIT
1980 1989
1981 private: 1990 private:
1982 bool stack_overflow_; 1991 bool stack_overflow_;
1983 }; 1992 };
1984 1993
1985 1994
1986 } } // namespace v8::internal 1995 } } // namespace v8::internal
1987 1996
1988 #endif // V8_AST_H_ 1997 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « no previous file | src/ia32/codegen-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698