| 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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 __ CallStub(&stack_stub); | 368 __ CallStub(&stack_stub); |
| 369 __ jmp(&stack_check_success); | 369 __ jmp(&stack_check_success); |
| 370 | 370 |
| 371 __ bind(&exit); | 371 __ bind(&exit); |
| 372 | 372 |
| 373 decrement_loop_depth(); | 373 decrement_loop_depth(); |
| 374 } | 374 } |
| 375 | 375 |
| 376 | 376 |
| 377 void FastCodeGenerator::VisitForStatement(ForStatement* stmt) { | 377 void FastCodeGenerator::VisitForStatement(ForStatement* stmt) { |
| 378 Comment cmnt(masm_, "[ ForStatement"); | 378 UNREACHABLE(); |
| 379 Label test, body, exit, stack_limit_hit, stack_check_success; | |
| 380 if (stmt->init() != NULL) Visit(stmt->init()); | |
| 381 | |
| 382 increment_loop_depth(); | |
| 383 // Emit the test at the bottom of the loop (even if empty). | |
| 384 __ jmp(&test); | |
| 385 __ bind(&body); | |
| 386 Visit(stmt->body()); | |
| 387 | |
| 388 // Check stack before looping. | |
| 389 __ StackLimitCheck(&stack_limit_hit); | |
| 390 __ bind(&stack_check_success); | |
| 391 | |
| 392 if (stmt->next() != NULL) Visit(stmt->next()); | |
| 393 | |
| 394 __ bind(&test); | |
| 395 | |
| 396 if (stmt->cond() == NULL) { | |
| 397 // For an empty test jump to the top of the loop. | |
| 398 __ jmp(&body); | |
| 399 } else { | |
| 400 // We are not in an expression context because we have been compiling | |
| 401 // statements. Set up a test expression context for the condition. | |
| 402 ASSERT_EQ(NULL, true_label_); | |
| 403 ASSERT_EQ(NULL, false_label_); | |
| 404 | |
| 405 true_label_ = &body; | |
| 406 false_label_ = &exit; | |
| 407 ASSERT(stmt->cond()->context() == Expression::kTest); | |
| 408 Visit(stmt->cond()); | |
| 409 true_label_ = NULL; | |
| 410 false_label_ = NULL; | |
| 411 } | |
| 412 | |
| 413 __ bind(&stack_limit_hit); | |
| 414 StackCheckStub stack_stub; | |
| 415 __ CallStub(&stack_stub); | |
| 416 __ jmp(&stack_check_success); | |
| 417 | |
| 418 __ bind(&exit); | |
| 419 decrement_loop_depth(); | |
| 420 } | 379 } |
| 421 | 380 |
| 422 | 381 |
| 423 void FastCodeGenerator::VisitForInStatement(ForInStatement* stmt) { | 382 void FastCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
| 424 UNREACHABLE(); | 383 UNREACHABLE(); |
| 425 } | 384 } |
| 426 | 385 |
| 427 | 386 |
| 428 void FastCodeGenerator::VisitTryCatchStatement(TryCatchStatement* stmt) { | 387 void FastCodeGenerator::VisitTryCatchStatement(TryCatchStatement* stmt) { |
| 429 UNREACHABLE(); | 388 UNREACHABLE(); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 | 510 |
| 552 void FastCodeGenerator::VisitThrow(Throw* expr) { | 511 void FastCodeGenerator::VisitThrow(Throw* expr) { |
| 553 UNREACHABLE(); | 512 UNREACHABLE(); |
| 554 } | 513 } |
| 555 | 514 |
| 556 | 515 |
| 557 #undef __ | 516 #undef __ |
| 558 | 517 |
| 559 | 518 |
| 560 } } // namespace v8::internal | 519 } } // namespace v8::internal |
| OLD | NEW |