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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
309 Label body, exit; | 309 Label body, exit; |
310 | 310 |
311 // Emit the test at the bottom of the loop. | 311 // Emit the test at the bottom of the loop. |
312 __ bind(&body); | 312 __ bind(&body); |
313 Visit(stmt->body()); | 313 Visit(stmt->body()); |
314 | 314 |
315 // We are not in an expression context because we have been compiling | 315 // We are not in an expression context because we have been compiling |
316 // statements. Set up a test expression context for the condition. | 316 // statements. Set up a test expression context for the condition. |
317 ASSERT_EQ(NULL, true_label_); | 317 ASSERT_EQ(NULL, true_label_); |
318 ASSERT_EQ(NULL, false_label_); | 318 ASSERT_EQ(NULL, false_label_); |
319 true_label_ = &body; | 319 true_label_ = &body; |
Lasse Reichstein
2009/11/10 09:35:34
We should probably have some scoped object that se
fschneider
2009/11/10 09:57:18
Good point.
| |
320 false_label_ = &exit; | 320 false_label_ = &exit; |
321 ASSERT(stmt->cond()->context() == Expression::kTest); | 321 ASSERT(stmt->cond()->context() == Expression::kTest); |
322 Visit(stmt->cond()); | 322 Visit(stmt->cond()); |
323 true_label_ = NULL; | |
324 false_label_ = NULL; | |
323 | 325 |
324 __ bind(&exit); | 326 __ bind(&exit); |
325 | 327 |
326 decrement_loop_depth(); | 328 decrement_loop_depth(); |
327 } | 329 } |
328 | 330 |
329 | 331 |
330 void FastCodeGenerator::VisitWhileStatement(WhileStatement* stmt) { | 332 void FastCodeGenerator::VisitWhileStatement(WhileStatement* stmt) { |
331 Comment cmnt(masm_, "[ WhileStatement"); | 333 Comment cmnt(masm_, "[ WhileStatement"); |
332 increment_loop_depth(); | 334 increment_loop_depth(); |
333 Label test, body, exit; | 335 Label test, body, exit; |
334 | 336 |
335 // Emit the test at the bottom of the loop. | 337 // Emit the test at the bottom of the loop. |
336 __ jmp(&test); | 338 __ jmp(&test); |
337 | 339 |
338 __ bind(&body); | 340 __ bind(&body); |
339 Visit(stmt->body()); | 341 Visit(stmt->body()); |
340 | 342 |
341 __ bind(&test); | 343 __ bind(&test); |
342 // We are not in an expression context because we have been compiling | 344 // We are not in an expression context because we have been compiling |
343 // statements. Set up a test expression context for the condition. | 345 // statements. Set up a test expression context for the condition. |
344 ASSERT_EQ(NULL, true_label_); | 346 ASSERT_EQ(NULL, true_label_); |
345 ASSERT_EQ(NULL, false_label_); | 347 ASSERT_EQ(NULL, false_label_); |
346 true_label_ = &body; | 348 true_label_ = &body; |
347 false_label_ = &exit; | 349 false_label_ = &exit; |
348 ASSERT(stmt->cond()->context() == Expression::kTest); | 350 ASSERT(stmt->cond()->context() == Expression::kTest); |
349 Visit(stmt->cond()); | 351 Visit(stmt->cond()); |
352 true_label_ = NULL; | |
353 false_label_ = NULL; | |
350 | 354 |
351 __ bind(&exit); | 355 __ bind(&exit); |
352 | 356 |
353 decrement_loop_depth(); | 357 decrement_loop_depth(); |
354 } | 358 } |
355 | 359 |
356 | 360 |
357 void FastCodeGenerator::VisitForStatement(ForStatement* stmt) { | 361 void FastCodeGenerator::VisitForStatement(ForStatement* stmt) { |
358 Comment cmnt(masm_, "[ ForStatement"); | 362 Comment cmnt(masm_, "[ ForStatement"); |
359 Label test, body, exit; | 363 Label test, body, exit; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
518 | 522 |
519 void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) { | 523 void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) { |
520 UNREACHABLE(); | 524 UNREACHABLE(); |
521 } | 525 } |
522 | 526 |
523 | 527 |
524 #undef __ | 528 #undef __ |
525 | 529 |
526 | 530 |
527 } } // namespace v8::internal | 531 } } // namespace v8::internal |
OLD | NEW |