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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Zone* zone = isolate()->zone(); | 69 Zone* zone = isolate()->zone(); |
70 VariableProxy* result_proxy = new(zone) VariableProxy(result_); | 70 VariableProxy* result_proxy = new(zone) VariableProxy(isolate(), result_); |
71 return new(zone) Assignment(Token::ASSIGN, result_proxy, value, | 71 return new(zone) Assignment(isolate(), |
| 72 Token::ASSIGN, |
| 73 result_proxy, |
| 74 value, |
72 RelocInfo::kNoPosition); | 75 RelocInfo::kNoPosition); |
73 } | 76 } |
74 | 77 |
75 // Node visitors. | 78 // Node visitors. |
76 #define DEF_VISIT(type) \ | 79 #define DEF_VISIT(type) \ |
77 virtual void Visit##type(type* node); | 80 virtual void Visit##type(type* node); |
78 AST_NODE_LIST(DEF_VISIT) | 81 AST_NODE_LIST(DEF_VISIT) |
79 #undef DEF_VISIT | 82 #undef DEF_VISIT |
80 | 83 |
81 void VisitIterationStatement(IterationStatement* stmt); | 84 void VisitIterationStatement(IterationStatement* stmt); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 226 |
224 ZoneList<Statement*>* body = function->body(); | 227 ZoneList<Statement*>* body = function->body(); |
225 if (!body->is_empty()) { | 228 if (!body->is_empty()) { |
226 Variable* result = scope->NewTemporary( | 229 Variable* result = scope->NewTemporary( |
227 info->isolate()->factory()->result_symbol()); | 230 info->isolate()->factory()->result_symbol()); |
228 Processor processor(result); | 231 Processor processor(result); |
229 processor.Process(body); | 232 processor.Process(body); |
230 if (processor.HasStackOverflow()) return false; | 233 if (processor.HasStackOverflow()) return false; |
231 | 234 |
232 if (processor.result_assigned()) { | 235 if (processor.result_assigned()) { |
233 Zone* zone = info->isolate()->zone(); | 236 Isolate* isolate = info->isolate(); |
234 VariableProxy* result_proxy = new(zone) VariableProxy(result); | 237 Zone* zone = isolate->zone(); |
| 238 VariableProxy* result_proxy = new(zone) VariableProxy(isolate, result); |
235 body->Add(new(zone) ReturnStatement(result_proxy)); | 239 body->Add(new(zone) ReturnStatement(result_proxy)); |
236 } | 240 } |
237 } | 241 } |
238 | 242 |
239 return true; | 243 return true; |
240 } | 244 } |
241 | 245 |
242 | 246 |
243 } } // namespace v8::internal | 247 } } // namespace v8::internal |
OLD | NEW |