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 3747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3758 // Record the source position of the statement as this code which | 3758 // Record the source position of the statement as this code which |
3759 // is after the code for the body actually belongs to the loop | 3759 // is after the code for the body actually belongs to the loop |
3760 // statement and not the body. | 3760 // statement and not the body. |
3761 CodeForStatementPosition(node); | 3761 CodeForStatementPosition(node); |
3762 Visit(node->next()); | 3762 Visit(node->next()); |
3763 } | 3763 } |
3764 } | 3764 } |
3765 | 3765 |
3766 // The update expression resets the type of the loop variable. So we | 3766 // The update expression resets the type of the loop variable. So we |
3767 // set it to smi before compiling the test expression. | 3767 // set it to smi before compiling the test expression. |
3768 if (node->is_fast_smi_loop()) { | 3768 if (node->is_fast_smi_loop() && has_valid_frame()) { |
3769 // Set number type of the loop variable to smi. | 3769 // Set number type of the loop variable to smi. |
3770 Slot* slot = node->loop_variable()->slot(); | 3770 Slot* slot = node->loop_variable()->slot(); |
3771 ASSERT(slot->type() == Slot::LOCAL); | 3771 ASSERT(slot->type() == Slot::LOCAL); |
3772 frame_->SetTypeForLocalAt(slot->index(), NumberInfo::Smi()); | 3772 frame_->SetTypeForLocalAt(slot->index(), NumberInfo::Smi()); |
3773 if (FLAG_debug_code) { | 3773 if (FLAG_debug_code) { |
3774 frame_->PushLocalAt(slot->index()); | 3774 frame_->PushLocalAt(slot->index()); |
3775 Result var = frame_->Pop(); | 3775 Result var = frame_->Pop(); |
3776 var.ToRegister(); | 3776 var.ToRegister(); |
3777 __ AbortIfNotSmi(var.reg(), "Loop variable not a smi."); | 3777 __ AbortIfNotSmi(var.reg(), "Loop variable not a smi."); |
3778 } | 3778 } |
(...skipping 8468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12247 | 12247 |
12248 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) | 12248 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) |
12249 // tagged as a small integer. | 12249 // tagged as a small integer. |
12250 __ bind(&runtime); | 12250 __ bind(&runtime); |
12251 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 12251 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); |
12252 } | 12252 } |
12253 | 12253 |
12254 #undef __ | 12254 #undef __ |
12255 | 12255 |
12256 } } // namespace v8::internal | 12256 } } // namespace v8::internal |
OLD | NEW |