OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 } | 277 } |
278 | 278 |
279 // Code generation state must be reset. | 279 // Code generation state must be reset. |
280 ASSERT(!has_cc()); | 280 ASSERT(!has_cc()); |
281 ASSERT(state_ == NULL); | 281 ASSERT(state_ == NULL); |
282 ASSERT(!function_return_is_shadowed_); | 282 ASSERT(!function_return_is_shadowed_); |
283 function_return_.Unuse(); | 283 function_return_.Unuse(); |
284 DeleteFrame(); | 284 DeleteFrame(); |
285 | 285 |
286 // Process any deferred code using the register allocator. | 286 // Process any deferred code using the register allocator. |
287 ProcessDeferred(); | 287 if (HasStackOverflow()) { |
| 288 ClearDeferred(); |
| 289 } else { |
| 290 ProcessDeferred(); |
| 291 } |
288 | 292 |
289 allocator_ = NULL; | 293 allocator_ = NULL; |
290 scope_ = NULL; | 294 scope_ = NULL; |
291 } | 295 } |
292 | 296 |
293 | 297 |
294 MemOperand CodeGenerator::SlotOperand(Slot* slot, Register tmp) { | 298 MemOperand CodeGenerator::SlotOperand(Slot* slot, Register tmp) { |
295 // Currently, this assertion will fail if we try to assign to | 299 // Currently, this assertion will fail if we try to assign to |
296 // a constant variable that is constant because it is read-only | 300 // a constant variable that is constant because it is read-only |
297 // (such as the variable referring to a named function expression). | 301 // (such as the variable referring to a named function expression). |
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1126 int original_height = frame_->height(); | 1130 int original_height = frame_->height(); |
1127 #endif | 1131 #endif |
1128 VirtualFrame::SpilledScope spilled_scope(this); | 1132 VirtualFrame::SpilledScope spilled_scope(this); |
1129 Comment cmnt(masm_, "[ Block"); | 1133 Comment cmnt(masm_, "[ Block"); |
1130 CodeForStatementPosition(node); | 1134 CodeForStatementPosition(node); |
1131 node->break_target()->Initialize(this); | 1135 node->break_target()->Initialize(this); |
1132 VisitStatementsAndSpill(node->statements()); | 1136 VisitStatementsAndSpill(node->statements()); |
1133 if (node->break_target()->is_linked()) { | 1137 if (node->break_target()->is_linked()) { |
1134 node->break_target()->Bind(); | 1138 node->break_target()->Bind(); |
1135 } | 1139 } |
| 1140 node->break_target()->Unuse(); |
1136 ASSERT(!has_valid_frame() || frame_->height() == original_height); | 1141 ASSERT(!has_valid_frame() || frame_->height() == original_height); |
1137 } | 1142 } |
1138 | 1143 |
1139 | 1144 |
1140 void CodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { | 1145 void CodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { |
1141 VirtualFrame::SpilledScope spilled_scope(this); | 1146 VirtualFrame::SpilledScope spilled_scope(this); |
1142 __ mov(r0, Operand(pairs)); | 1147 __ mov(r0, Operand(pairs)); |
1143 frame_->EmitPush(r0); | 1148 frame_->EmitPush(r0); |
1144 frame_->EmitPush(cp); | 1149 frame_->EmitPush(cp); |
1145 __ mov(r0, Operand(Smi::FromInt(is_eval() ? 1 : 0))); | 1150 __ mov(r0, Operand(Smi::FromInt(is_eval() ? 1 : 0))); |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1587 } | 1592 } |
1588 } | 1593 } |
1589 | 1594 |
1590 if (fall_through.is_linked()) { | 1595 if (fall_through.is_linked()) { |
1591 fall_through.Bind(); | 1596 fall_through.Bind(); |
1592 } | 1597 } |
1593 | 1598 |
1594 if (node->break_target()->is_linked()) { | 1599 if (node->break_target()->is_linked()) { |
1595 node->break_target()->Bind(); | 1600 node->break_target()->Bind(); |
1596 } | 1601 } |
| 1602 node->break_target()->Unuse(); |
1597 ASSERT(!has_valid_frame() || frame_->height() == original_height); | 1603 ASSERT(!has_valid_frame() || frame_->height() == original_height); |
1598 } | 1604 } |
1599 | 1605 |
1600 | 1606 |
1601 void CodeGenerator::VisitLoopStatement(LoopStatement* node) { | 1607 void CodeGenerator::VisitLoopStatement(LoopStatement* node) { |
1602 #ifdef DEBUG | 1608 #ifdef DEBUG |
1603 int original_height = frame_->height(); | 1609 int original_height = frame_->height(); |
1604 #endif | 1610 #endif |
1605 VirtualFrame::SpilledScope spilled_scope(this); | 1611 VirtualFrame::SpilledScope spilled_scope(this); |
1606 Comment cmnt(masm_, "[ LoopStatement"); | 1612 Comment cmnt(masm_, "[ LoopStatement"); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1774 } | 1780 } |
1775 } | 1781 } |
1776 } | 1782 } |
1777 break; | 1783 break; |
1778 } | 1784 } |
1779 } | 1785 } |
1780 | 1786 |
1781 if (node->break_target()->is_linked()) { | 1787 if (node->break_target()->is_linked()) { |
1782 node->break_target()->Bind(); | 1788 node->break_target()->Bind(); |
1783 } | 1789 } |
| 1790 node->continue_target()->Unuse(); |
| 1791 node->break_target()->Unuse(); |
1784 ASSERT(!has_valid_frame() || frame_->height() == original_height); | 1792 ASSERT(!has_valid_frame() || frame_->height() == original_height); |
1785 } | 1793 } |
1786 | 1794 |
1787 | 1795 |
1788 void CodeGenerator::VisitForInStatement(ForInStatement* node) { | 1796 void CodeGenerator::VisitForInStatement(ForInStatement* node) { |
1789 #ifdef DEBUG | 1797 #ifdef DEBUG |
1790 int original_height = frame_->height(); | 1798 int original_height = frame_->height(); |
1791 #endif | 1799 #endif |
1792 ASSERT(!in_spilled_code()); | 1800 ASSERT(!in_spilled_code()); |
1793 VirtualFrame::SpilledScope spilled_scope(this); | 1801 VirtualFrame::SpilledScope spilled_scope(this); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1964 __ add(r0, r0, Operand(Smi::FromInt(1))); | 1972 __ add(r0, r0, Operand(Smi::FromInt(1))); |
1965 frame_->EmitPush(r0); | 1973 frame_->EmitPush(r0); |
1966 entry.Jump(); | 1974 entry.Jump(); |
1967 | 1975 |
1968 // Cleanup. | 1976 // Cleanup. |
1969 node->break_target()->Bind(); | 1977 node->break_target()->Bind(); |
1970 frame_->Drop(5); | 1978 frame_->Drop(5); |
1971 | 1979 |
1972 // Exit. | 1980 // Exit. |
1973 exit.Bind(); | 1981 exit.Bind(); |
| 1982 node->continue_target()->Unuse(); |
| 1983 node->break_target()->Unuse(); |
1974 ASSERT(frame_->height() == original_height); | 1984 ASSERT(frame_->height() == original_height); |
1975 } | 1985 } |
1976 | 1986 |
1977 | 1987 |
1978 void CodeGenerator::VisitTryCatch(TryCatch* node) { | 1988 void CodeGenerator::VisitTryCatch(TryCatch* node) { |
1979 #ifdef DEBUG | 1989 #ifdef DEBUG |
1980 int original_height = frame_->height(); | 1990 int original_height = frame_->height(); |
1981 #endif | 1991 #endif |
1982 VirtualFrame::SpilledScope spilled_scope(this); | 1992 VirtualFrame::SpilledScope spilled_scope(this); |
1983 Comment cmnt(masm_, "[ TryCatch"); | 1993 Comment cmnt(masm_, "[ TryCatch"); |
(...skipping 3152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5136 __ mov(r2, Operand(0)); | 5146 __ mov(r2, Operand(0)); |
5137 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); | 5147 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); |
5138 __ Jump(Handle<Code>(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)), | 5148 __ Jump(Handle<Code>(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)), |
5139 RelocInfo::CODE_TARGET); | 5149 RelocInfo::CODE_TARGET); |
5140 } | 5150 } |
5141 | 5151 |
5142 | 5152 |
5143 #undef __ | 5153 #undef __ |
5144 | 5154 |
5145 } } // namespace v8::internal | 5155 } } // namespace v8::internal |
OLD | NEW |