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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 StackCheckStub stack_stub; | 413 StackCheckStub stack_stub; |
414 __ CallStub(&stack_stub); | 414 __ CallStub(&stack_stub); |
415 __ jmp(&stack_check_success); | 415 __ jmp(&stack_check_success); |
416 | 416 |
417 __ bind(loop_statement.break_target()); | 417 __ bind(loop_statement.break_target()); |
418 decrement_loop_depth(); | 418 decrement_loop_depth(); |
419 } | 419 } |
420 | 420 |
421 | 421 |
422 void FastCodeGenerator::VisitForStatement(ForStatement* stmt) { | 422 void FastCodeGenerator::VisitForStatement(ForStatement* stmt) { |
423 UNREACHABLE(); | 423 Comment cmnt(masm_, "[ ForStatement"); |
| 424 SetStatementPosition(stmt); |
| 425 Label test, body, stack_limit_hit, stack_check_success; |
| 426 |
| 427 Iteration loop_statement(this, stmt); |
| 428 if (stmt->init() != NULL) { |
| 429 Visit(stmt->init()); |
| 430 } |
| 431 |
| 432 increment_loop_depth(); |
| 433 // Emit the test at the bottom of the loop (even if empty). |
| 434 __ jmp(&test); |
| 435 |
| 436 __ bind(&body); |
| 437 Visit(stmt->body()); |
| 438 |
| 439 __ bind(loop_statement.continue_target()); |
| 440 |
| 441 SetStatementPosition(stmt); |
| 442 if (stmt->next() != NULL) { |
| 443 Visit(stmt->next()); |
| 444 } |
| 445 |
| 446 __ bind(&test); |
| 447 |
| 448 // Check stack before looping. |
| 449 __ StackLimitCheck(&stack_limit_hit); |
| 450 __ bind(&stack_check_success); |
| 451 |
| 452 if (stmt->cond() != NULL) { |
| 453 VisitForControl(stmt->cond(), &body, loop_statement.break_target()); |
| 454 } else { |
| 455 __ jmp(&body); |
| 456 } |
| 457 |
| 458 __ bind(&stack_limit_hit); |
| 459 StackCheckStub stack_stub; |
| 460 __ CallStub(&stack_stub); |
| 461 __ jmp(&stack_check_success); |
| 462 |
| 463 __ bind(loop_statement.break_target()); |
| 464 decrement_loop_depth(); |
424 } | 465 } |
425 | 466 |
426 | 467 |
427 void FastCodeGenerator::VisitForInStatement(ForInStatement* stmt) { | 468 void FastCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
428 UNREACHABLE(); | 469 UNREACHABLE(); |
429 } | 470 } |
430 | 471 |
431 | 472 |
432 void FastCodeGenerator::VisitTryCatchStatement(TryCatchStatement* stmt) { | 473 void FastCodeGenerator::VisitTryCatchStatement(TryCatchStatement* stmt) { |
433 Comment cmnt(masm_, "[ TryCatchStatement"); | 474 Comment cmnt(masm_, "[ TryCatchStatement"); |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 __ Drop(stack_depth); | 739 __ Drop(stack_depth); |
699 __ PopTryHandler(); | 740 __ PopTryHandler(); |
700 return 0; | 741 return 0; |
701 } | 742 } |
702 | 743 |
703 | 744 |
704 #undef __ | 745 #undef __ |
705 | 746 |
706 | 747 |
707 } } // namespace v8::internal | 748 } } // namespace v8::internal |
OLD | NEW |