OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 } | 282 } |
283 | 283 |
284 | 284 |
285 void FastCodeGenerator::VisitEmptyStatement(EmptyStatement* stmt) { | 285 void FastCodeGenerator::VisitEmptyStatement(EmptyStatement* stmt) { |
286 Comment cmnt(masm_, "[ EmptyStatement"); | 286 Comment cmnt(masm_, "[ EmptyStatement"); |
287 SetStatementPosition(stmt); | 287 SetStatementPosition(stmt); |
288 } | 288 } |
289 | 289 |
290 | 290 |
291 void FastCodeGenerator::VisitIfStatement(IfStatement* stmt) { | 291 void FastCodeGenerator::VisitIfStatement(IfStatement* stmt) { |
292 UNREACHABLE(); | 292 // Expressions cannot recursively enter statements, there are no labels in |
| 293 // the state. |
| 294 ASSERT_EQ(NULL, true_label_); |
| 295 ASSERT_EQ(NULL, false_label_); |
| 296 Label then_part, else_part, done; |
| 297 |
| 298 // Do not worry about optimizing for empty then or else bodies. |
| 299 true_label_ = &then_part; |
| 300 false_label_ = &else_part; |
| 301 Visit(stmt->condition()); |
| 302 true_label_ = NULL; |
| 303 false_label_ = NULL; |
| 304 |
| 305 __ bind(&then_part); |
| 306 Visit(stmt->then_statement()); |
| 307 __ jmp(&done); |
| 308 |
| 309 __ bind(&else_part); |
| 310 Visit(stmt->else_statement()); |
| 311 |
| 312 __ bind(&done); |
293 } | 313 } |
294 | 314 |
295 | 315 |
296 void FastCodeGenerator::VisitContinueStatement(ContinueStatement* stmt) { | 316 void FastCodeGenerator::VisitContinueStatement(ContinueStatement* stmt) { |
297 UNREACHABLE(); | 317 UNREACHABLE(); |
298 } | 318 } |
299 | 319 |
300 | 320 |
301 void FastCodeGenerator::VisitBreakStatement(BreakStatement* stmt) { | 321 void FastCodeGenerator::VisitBreakStatement(BreakStatement* stmt) { |
302 UNREACHABLE(); | 322 UNREACHABLE(); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 | 417 |
398 void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) { | 418 void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) { |
399 UNREACHABLE(); | 419 UNREACHABLE(); |
400 } | 420 } |
401 | 421 |
402 | 422 |
403 #undef __ | 423 #undef __ |
404 | 424 |
405 | 425 |
406 } } // namespace v8::internal | 426 } } // namespace v8::internal |
OLD | NEW |