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

Side by Side Diff: src/ast.h

Issue 7830036: Optimize isFinite and isNaN. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Made the change general by moving putting it in the NUMBER_IS_FINITE macro. Created 9 years, 3 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 | « src/array.js ('k') | src/ast.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 313
314 unsigned id() const { return id_; } 314 unsigned id() const { return id_; }
315 unsigned test_id() const { return test_id_; } 315 unsigned test_id() const { return test_id_; }
316 316
317 private: 317 private:
318 unsigned id_; 318 unsigned id_;
319 unsigned test_id_; 319 unsigned test_id_;
320 }; 320 };
321 321
322 322
323 /**
324 * A sentinel used during pre parsing that represents some expression
325 * that is a valid left hand side without having to actually build
326 * the expression.
327 */
328 class ValidLeftHandSideSentinel: public Expression {
329 public:
330 explicit ValidLeftHandSideSentinel(Isolate* isolate) : Expression(isolate) {}
331 virtual bool IsValidLeftHandSide() { return true; }
332 virtual void Accept(AstVisitor* v) { UNREACHABLE(); }
333 virtual bool IsInlineable() const;
334 };
335
336
323 class BreakableStatement: public Statement { 337 class BreakableStatement: public Statement {
324 public: 338 public:
325 enum Type { 339 enum Type {
326 TARGET_FOR_ANONYMOUS, 340 TARGET_FOR_ANONYMOUS,
327 TARGET_FOR_NAMED_ONLY 341 TARGET_FOR_NAMED_ONLY
328 }; 342 };
329 343
330 // The labels associated with this statement. May be NULL; 344 // The labels associated with this statement. May be NULL;
331 // if it is != NULL, guaranteed to contain at least one entry. 345 // if it is != NULL, guaranteed to contain at least one entry.
332 ZoneStringList* labels() const { return labels_; } 346 ZoneStringList* labels() const { return labels_; }
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
1153 bool is_this_; 1167 bool is_this_;
1154 bool inside_with_; 1168 bool inside_with_;
1155 bool is_trivial_; 1169 bool is_trivial_;
1156 int position_; 1170 int position_;
1157 1171
1158 VariableProxy(Isolate* isolate, 1172 VariableProxy(Isolate* isolate,
1159 Handle<String> name, 1173 Handle<String> name,
1160 bool is_this, 1174 bool is_this,
1161 bool inside_with, 1175 bool inside_with,
1162 int position = RelocInfo::kNoPosition); 1176 int position = RelocInfo::kNoPosition);
1177 VariableProxy(Isolate* isolate, bool is_this);
1163 1178
1164 friend class Scope; 1179 friend class Scope;
1165 }; 1180 };
1166 1181
1167 1182
1183 class VariableProxySentinel: public VariableProxy {
1184 public:
1185 virtual bool IsValidLeftHandSide() { return !is_this(); }
1186
1187 private:
1188 VariableProxySentinel(Isolate* isolate, bool is_this)
1189 : VariableProxy(isolate, is_this) { }
1190
1191 friend class AstSentinels;
1192 };
1193
1194
1168 class Slot: public Expression { 1195 class Slot: public Expression {
1169 public: 1196 public:
1170 enum Type { 1197 enum Type {
1171 // A slot in the parameter section on the stack. index() is 1198 // A slot in the parameter section on the stack. index() is
1172 // the parameter index, counting left-to-right, starting at 0. 1199 // the parameter index, counting left-to-right, starting at 0.
1173 PARAMETER, 1200 PARAMETER,
1174 1201
1175 // A slot in the local section on the stack. index() is 1202 // A slot in the local section on the stack. index() is
1176 // the variable index in the stack frame, starting at 0. 1203 // the variable index in the stack frame, starting at 0.
1177 LOCAL, 1204 LOCAL,
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 CheckType check_type_; 1342 CheckType check_type_;
1316 SmallMapList receiver_types_; 1343 SmallMapList receiver_types_;
1317 Handle<JSFunction> target_; 1344 Handle<JSFunction> target_;
1318 Handle<JSObject> holder_; 1345 Handle<JSObject> holder_;
1319 Handle<JSGlobalPropertyCell> cell_; 1346 Handle<JSGlobalPropertyCell> cell_;
1320 1347
1321 int return_id_; 1348 int return_id_;
1322 }; 1349 };
1323 1350
1324 1351
1352 class AstSentinels {
1353 public:
1354 ~AstSentinels() { }
1355
1356 // Returns a property singleton property access on 'this'. Used
1357 // during preparsing.
1358 Property* this_property() { return &this_property_; }
1359 VariableProxySentinel* this_proxy() { return &this_proxy_; }
1360 VariableProxySentinel* identifier_proxy() { return &identifier_proxy_; }
1361 ValidLeftHandSideSentinel* valid_left_hand_side_sentinel() {
1362 return &valid_left_hand_side_sentinel_;
1363 }
1364 Call* call_sentinel() { return &call_sentinel_; }
1365 EmptyStatement* empty_statement() { return &empty_statement_; }
1366
1367 private:
1368 AstSentinels();
1369 VariableProxySentinel this_proxy_;
1370 VariableProxySentinel identifier_proxy_;
1371 ValidLeftHandSideSentinel valid_left_hand_side_sentinel_;
1372 Property this_property_;
1373 Call call_sentinel_;
1374 EmptyStatement empty_statement_;
1375
1376 friend class Isolate;
1377
1378 DISALLOW_COPY_AND_ASSIGN(AstSentinels);
1379 };
1380
1381
1325 class CallNew: public Expression { 1382 class CallNew: public Expression {
1326 public: 1383 public:
1327 CallNew(Isolate* isolate, 1384 CallNew(Isolate* isolate,
1328 Expression* expression, 1385 Expression* expression,
1329 ZoneList<Expression*>* arguments, 1386 ZoneList<Expression*>* arguments,
1330 int pos) 1387 int pos)
1331 : Expression(isolate), 1388 : Expression(isolate),
1332 expression_(expression), 1389 expression_(expression),
1333 arguments_(arguments), 1390 arguments_(arguments),
1334 pos_(pos) { } 1391 pos_(pos) { }
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after
2208 2265
2209 private: 2266 private:
2210 Isolate* isolate_; 2267 Isolate* isolate_;
2211 bool stack_overflow_; 2268 bool stack_overflow_;
2212 }; 2269 };
2213 2270
2214 2271
2215 } } // namespace v8::internal 2272 } } // namespace v8::internal
2216 2273
2217 #endif // V8_AST_H_ 2274 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « src/array.js ('k') | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698