OLD | NEW |
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 // To avoid storing to .result all the time, we eliminate some of | 60 // To avoid storing to .result all the time, we eliminate some of |
61 // the stores by keeping track of whether or not we're sure .result | 61 // the stores by keeping track of whether or not we're sure .result |
62 // will be overwritten anyway. This is a bit more tricky than what I | 62 // will be overwritten anyway. This is a bit more tricky than what I |
63 // was hoping for | 63 // was hoping for |
64 bool is_set_; | 64 bool is_set_; |
65 bool in_try_; | 65 bool in_try_; |
66 | 66 |
67 Expression* SetResult(Expression* value) { | 67 Expression* SetResult(Expression* value) { |
68 result_assigned_ = true; | 68 result_assigned_ = true; |
69 VariableProxy* result_proxy = new VariableProxy(result_); | 69 Zone* zone = isolate()->zone(); |
70 return new Assignment(Token::ASSIGN, result_proxy, value, | 70 VariableProxy* result_proxy = new(zone) VariableProxy(result_); |
71 RelocInfo::kNoPosition); | 71 return new(zone) Assignment(Token::ASSIGN, result_proxy, value, |
| 72 RelocInfo::kNoPosition); |
72 } | 73 } |
73 | 74 |
74 // Node visitors. | 75 // Node visitors. |
75 #define DEF_VISIT(type) \ | 76 #define DEF_VISIT(type) \ |
76 virtual void Visit##type(type* node); | 77 virtual void Visit##type(type* node); |
77 AST_NODE_LIST(DEF_VISIT) | 78 AST_NODE_LIST(DEF_VISIT) |
78 #undef DEF_VISIT | 79 #undef DEF_VISIT |
79 | 80 |
80 void VisitIterationStatement(IterationStatement* stmt); | 81 void VisitIterationStatement(IterationStatement* stmt); |
81 }; | 82 }; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 223 |
223 ZoneList<Statement*>* body = function->body(); | 224 ZoneList<Statement*>* body = function->body(); |
224 if (!body->is_empty()) { | 225 if (!body->is_empty()) { |
225 Variable* result = scope->NewTemporary( | 226 Variable* result = scope->NewTemporary( |
226 info->isolate()->factory()->result_symbol()); | 227 info->isolate()->factory()->result_symbol()); |
227 Processor processor(result); | 228 Processor processor(result); |
228 processor.Process(body); | 229 processor.Process(body); |
229 if (processor.HasStackOverflow()) return false; | 230 if (processor.HasStackOverflow()) return false; |
230 | 231 |
231 if (processor.result_assigned()) { | 232 if (processor.result_assigned()) { |
232 VariableProxy* result_proxy = new VariableProxy(result); | 233 Zone* zone = info->isolate()->zone(); |
233 body->Add(new ReturnStatement(result_proxy)); | 234 VariableProxy* result_proxy = new(zone) VariableProxy(result); |
| 235 body->Add(new(zone) ReturnStatement(result_proxy)); |
234 } | 236 } |
235 } | 237 } |
236 | 238 |
237 return true; | 239 return true; |
238 } | 240 } |
239 | 241 |
240 | 242 |
241 } } // namespace v8::internal | 243 } } // namespace v8::internal |
OLD | NEW |