| 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 UNREACHABLE(); | 297 UNREACHABLE(); |
| 298 } | 298 } |
| 299 | 299 |
| 300 | 300 |
| 301 void FastCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { | 301 void FastCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { |
| 302 UNREACHABLE(); | 302 UNREACHABLE(); |
| 303 } | 303 } |
| 304 | 304 |
| 305 | 305 |
| 306 void FastCodeGenerator::VisitDoWhileStatement(DoWhileStatement* stmt) { | 306 void FastCodeGenerator::VisitDoWhileStatement(DoWhileStatement* stmt) { |
| 307 UNREACHABLE(); | 307 Comment cmnt(masm_, "[ DoWhileStatement"); |
| 308 increment_loop_depth(); |
| 309 Label body, exit; |
| 310 |
| 311 // Emit the test at the bottom of the loop. |
| 312 __ bind(&body); |
| 313 Visit(stmt->body()); |
| 314 |
| 315 // We are not in an expression context because we have been compiling |
| 316 // statements. Set up a test expression context for the condition. |
| 317 ASSERT_EQ(NULL, true_label_); |
| 318 ASSERT_EQ(NULL, false_label_); |
| 319 true_label_ = &body; |
| 320 false_label_ = &exit; |
| 321 ASSERT(stmt->cond()->context() == Expression::kTest); |
| 322 Visit(stmt->cond()); |
| 323 |
| 324 __ bind(&exit); |
| 325 |
| 326 decrement_loop_depth(); |
| 308 } | 327 } |
| 309 | 328 |
| 310 | 329 |
| 311 void FastCodeGenerator::VisitWhileStatement(WhileStatement* stmt) { | 330 void FastCodeGenerator::VisitWhileStatement(WhileStatement* stmt) { |
| 312 UNREACHABLE(); | 331 Comment cmnt(masm_, "[ WhileStatement"); |
| 332 increment_loop_depth(); |
| 333 Label test, body, exit; |
| 334 |
| 335 // Emit the test at the bottom of the loop. |
| 336 __ jmp(&test); |
| 337 |
| 338 __ bind(&body); |
| 339 Visit(stmt->body()); |
| 340 |
| 341 __ bind(&test); |
| 342 // We are not in an expression context because we have been compiling |
| 343 // statements. Set up a test expression context for the condition. |
| 344 ASSERT_EQ(NULL, true_label_); |
| 345 ASSERT_EQ(NULL, false_label_); |
| 346 true_label_ = &body; |
| 347 false_label_ = &exit; |
| 348 ASSERT(stmt->cond()->context() == Expression::kTest); |
| 349 Visit(stmt->cond()); |
| 350 |
| 351 __ bind(&exit); |
| 352 |
| 353 decrement_loop_depth(); |
| 313 } | 354 } |
| 314 | 355 |
| 315 | 356 |
| 316 void FastCodeGenerator::VisitForStatement(ForStatement* stmt) { | 357 void FastCodeGenerator::VisitForStatement(ForStatement* stmt) { |
| 317 Comment cmnt(masm_, "[ ForStatement"); | 358 Comment cmnt(masm_, "[ ForStatement"); |
| 318 Label test, body, exit; | 359 Label test, body, exit; |
| 319 if (stmt->init() != NULL) Visit(stmt->init()); | 360 if (stmt->init() != NULL) Visit(stmt->init()); |
| 320 | 361 |
| 321 increment_loop_depth(); | 362 increment_loop_depth(); |
| 322 // Emit the test at the bottom of the loop (even if empty). | 363 // Emit the test at the bottom of the loop (even if empty). |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 | 518 |
| 478 void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) { | 519 void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) { |
| 479 UNREACHABLE(); | 520 UNREACHABLE(); |
| 480 } | 521 } |
| 481 | 522 |
| 482 | 523 |
| 483 #undef __ | 524 #undef __ |
| 484 | 525 |
| 485 | 526 |
| 486 } } // namespace v8::internal | 527 } } // namespace v8::internal |
| OLD | NEW |