OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 3410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3421 Visit(node->body()); | 3421 Visit(node->body()); |
3422 | 3422 |
3423 if (node->continue_target()->is_linked()) { | 3423 if (node->continue_target()->is_linked()) { |
3424 node->continue_target()->Bind(); | 3424 node->continue_target()->Bind(); |
3425 } | 3425 } |
3426 | 3426 |
3427 if (has_valid_frame()) { | 3427 if (has_valid_frame()) { |
3428 CodeForStatementPosition(node); | 3428 CodeForStatementPosition(node); |
3429 Slot* loop_var_slot = loop_var->slot(); | 3429 Slot* loop_var_slot = loop_var->slot(); |
3430 if (loop_var_slot->type() == Slot::LOCAL) { | 3430 if (loop_var_slot->type() == Slot::LOCAL) { |
3431 frame_->PushLocalAt(loop_var_slot->index()); | 3431 frame_->TakeLocalAt(loop_var_slot->index()); |
3432 } else { | 3432 } else { |
3433 ASSERT(loop_var_slot->type() == Slot::PARAMETER); | 3433 ASSERT(loop_var_slot->type() == Slot::PARAMETER); |
3434 frame_->PushParameterAt(loop_var_slot->index()); | 3434 frame_->TakeParameterAt(loop_var_slot->index()); |
3435 } | 3435 } |
3436 Result loop_var_result = frame_->Pop(); | 3436 Result loop_var_result = frame_->Pop(); |
3437 if (!loop_var_result.is_register()) { | 3437 if (!loop_var_result.is_register()) { |
3438 loop_var_result.ToRegister(); | 3438 loop_var_result.ToRegister(); |
3439 } | 3439 } |
3440 | 3440 Register loop_var_reg = loop_var_result.reg(); |
| 3441 frame_->Spill(loop_var_reg); |
3441 if (increments) { | 3442 if (increments) { |
3442 __ SmiAddConstant(loop_var_result.reg(), | 3443 __ SmiAddConstant(loop_var_reg, |
3443 loop_var_result.reg(), | 3444 loop_var_reg, |
3444 Smi::FromInt(1)); | 3445 Smi::FromInt(1)); |
3445 } else { | 3446 } else { |
3446 __ SmiSubConstant(loop_var_result.reg(), | 3447 __ SmiSubConstant(loop_var_reg, |
3447 loop_var_result.reg(), | 3448 loop_var_reg, |
3448 Smi::FromInt(1)); | 3449 Smi::FromInt(1)); |
3449 } | 3450 } |
3450 | 3451 |
3451 { | 3452 frame_->Push(&loop_var_result); |
3452 __ SmiCompare(loop_var_result.reg(), limit_value); | 3453 if (loop_var_slot->type() == Slot::LOCAL) { |
3453 Condition condition; | 3454 frame_->StoreToLocalAt(loop_var_slot->index()); |
3454 switch (compare_op) { | 3455 } else { |
3455 case Token::LT: | 3456 ASSERT(loop_var_slot->type() == Slot::PARAMETER); |
3456 condition = less; | 3457 frame_->StoreToParameterAt(loop_var_slot->index()); |
3457 break; | |
3458 case Token::LTE: | |
3459 condition = less_equal; | |
3460 break; | |
3461 case Token::GT: | |
3462 condition = greater; | |
3463 break; | |
3464 case Token::GTE: | |
3465 condition = greater_equal; | |
3466 break; | |
3467 default: | |
3468 condition = never; | |
3469 UNREACHABLE(); | |
3470 } | |
3471 loop.Branch(condition); | |
3472 } | 3458 } |
3473 loop_var_result.Unuse(); | 3459 frame_->Drop(); |
| 3460 |
| 3461 __ SmiCompare(loop_var_reg, limit_value); |
| 3462 Condition condition; |
| 3463 switch (compare_op) { |
| 3464 case Token::LT: |
| 3465 condition = less; |
| 3466 break; |
| 3467 case Token::LTE: |
| 3468 condition = less_equal; |
| 3469 break; |
| 3470 case Token::GT: |
| 3471 condition = greater; |
| 3472 break; |
| 3473 case Token::GTE: |
| 3474 condition = greater_equal; |
| 3475 break; |
| 3476 default: |
| 3477 condition = never; |
| 3478 UNREACHABLE(); |
| 3479 } |
| 3480 loop.Branch(condition); |
3474 } | 3481 } |
3475 if (node->break_target()->is_linked()) { | 3482 if (node->break_target()->is_linked()) { |
3476 node->break_target()->Bind(); | 3483 node->break_target()->Bind(); |
3477 } | 3484 } |
3478 DecrementLoopNesting(); | 3485 DecrementLoopNesting(); |
3479 } | 3486 } |
3480 | 3487 |
3481 | 3488 |
3482 void CodeGenerator::VisitForStatement(ForStatement* node) { | 3489 void CodeGenerator::VisitForStatement(ForStatement* node) { |
3483 ASSERT(!in_spilled_code()); | 3490 ASSERT(!in_spilled_code()); |
(...skipping 8566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12050 #undef __ | 12057 #undef __ |
12051 | 12058 |
12052 void RecordWriteStub::Generate(MacroAssembler* masm) { | 12059 void RecordWriteStub::Generate(MacroAssembler* masm) { |
12053 masm->RecordWriteHelper(object_, addr_, scratch_); | 12060 masm->RecordWriteHelper(object_, addr_, scratch_); |
12054 masm->ret(0); | 12061 masm->ret(0); |
12055 } | 12062 } |
12056 | 12063 |
12057 } } // namespace v8::internal | 12064 } } // namespace v8::internal |
12058 | 12065 |
12059 #endif // V8_TARGET_ARCH_X64 | 12066 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |