OLD | NEW |
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 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1374 Handle<String> s1 = static_cast<Literal*>(literal1)->ToString(); | 1374 Handle<String> s1 = static_cast<Literal*>(literal1)->ToString(); |
1375 Handle<String> s2 = static_cast<Literal*>(literal2)->ToString(); | 1375 Handle<String> s2 = static_cast<Literal*>(literal2)->ToString(); |
1376 return s1->Equals(*s2); | 1376 return s1->Equals(*s2); |
1377 } | 1377 } |
1378 | 1378 |
1379 TypeFeedbackId LiteralFeedbackId() const { return reuse(id()); } | 1379 TypeFeedbackId LiteralFeedbackId() const { return reuse(id()); } |
1380 | 1380 |
1381 protected: | 1381 protected: |
1382 Literal(Isolate* isolate, Handle<Object> value) | 1382 Literal(Isolate* isolate, Handle<Object> value) |
1383 : Expression(isolate), | 1383 : Expression(isolate), |
1384 value_(value) { } | 1384 value_(value), |
| 1385 isolate_(isolate) { } |
1385 | 1386 |
1386 private: | 1387 private: |
1387 Handle<String> ToString(); | 1388 Handle<String> ToString(); |
1388 | 1389 |
1389 Handle<Object> value_; | 1390 Handle<Object> value_; |
| 1391 // TODO(dcarney): remove. this is only needed for Match and Hash. |
| 1392 Isolate* isolate_; |
1390 }; | 1393 }; |
1391 | 1394 |
1392 | 1395 |
1393 // Base class for literals that needs space in the corresponding JSFunction. | 1396 // Base class for literals that needs space in the corresponding JSFunction. |
1394 class MaterializedLiteral : public Expression { | 1397 class MaterializedLiteral : public Expression { |
1395 public: | 1398 public: |
1396 virtual MaterializedLiteral* AsMaterializedLiteral() { return this; } | 1399 virtual MaterializedLiteral* AsMaterializedLiteral() { return this; } |
1397 | 1400 |
1398 int literal_index() { return literal_index_; } | 1401 int literal_index() { return literal_index_; } |
1399 | 1402 |
(...skipping 1404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2804 bool HasStackOverflow() const { return stack_overflow_; } \ | 2807 bool HasStackOverflow() const { return stack_overflow_; } \ |
2805 \ | 2808 \ |
2806 bool CheckStackOverflow() { \ | 2809 bool CheckStackOverflow() { \ |
2807 if (stack_overflow_) return true; \ | 2810 if (stack_overflow_) return true; \ |
2808 StackLimitCheck check(isolate_); \ | 2811 StackLimitCheck check(isolate_); \ |
2809 if (!check.HasOverflowed()) return false; \ | 2812 if (!check.HasOverflowed()) return false; \ |
2810 return (stack_overflow_ = true); \ | 2813 return (stack_overflow_ = true); \ |
2811 } \ | 2814 } \ |
2812 \ | 2815 \ |
2813 private: \ | 2816 private: \ |
2814 void InitializeAstVisitor() { \ | 2817 void InitializeAstVisitor(Isolate* isolate) { \ |
2815 isolate_ = Isolate::Current(); \ | 2818 isolate_ = isolate; \ |
2816 stack_overflow_ = false; \ | 2819 stack_overflow_ = false; \ |
2817 } \ | 2820 } \ |
2818 Isolate* isolate() { return isolate_; } \ | 2821 Isolate* isolate() { return isolate_; } \ |
2819 \ | 2822 \ |
2820 Isolate* isolate_; \ | 2823 Isolate* isolate_; \ |
2821 bool stack_overflow_ | 2824 bool stack_overflow_ |
2822 | 2825 |
2823 | 2826 |
2824 // ---------------------------------------------------------------------------- | 2827 // ---------------------------------------------------------------------------- |
2825 // Construction time visitor. | 2828 // Construction time visitor. |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3239 private: | 3242 private: |
3240 Isolate* isolate_; | 3243 Isolate* isolate_; |
3241 Zone* zone_; | 3244 Zone* zone_; |
3242 Visitor visitor_; | 3245 Visitor visitor_; |
3243 }; | 3246 }; |
3244 | 3247 |
3245 | 3248 |
3246 } } // namespace v8::internal | 3249 } } // namespace v8::internal |
3247 | 3250 |
3248 #endif // V8_AST_H_ | 3251 #endif // V8_AST_H_ |
OLD | NEW |