| 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 1651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1662 } | 1662 } |
| 1663 } | 1663 } |
| 1664 | 1664 |
| 1665 if (node->break_target()->is_linked()) { | 1665 if (node->break_target()->is_linked()) { |
| 1666 node->break_target()->Bind(); | 1666 node->break_target()->Bind(); |
| 1667 } | 1667 } |
| 1668 } | 1668 } |
| 1669 | 1669 |
| 1670 | 1670 |
| 1671 void CodeGenerator::VisitForInStatement(ForInStatement* node) { | 1671 void CodeGenerator::VisitForInStatement(ForInStatement* node) { |
| 1672 ASSERT(!in_spilled_code()); |
| 1672 VirtualFrame::SpilledScope spilled_scope(this); | 1673 VirtualFrame::SpilledScope spilled_scope(this); |
| 1673 Comment cmnt(masm_, "[ ForInStatement"); | 1674 Comment cmnt(masm_, "[ ForInStatement"); |
| 1674 CodeForStatementPosition(node); | 1675 CodeForStatementPosition(node); |
| 1675 | 1676 |
| 1676 // We keep stuff on the stack while the body is executing. | 1677 // We keep stuff on the stack while the body is executing. |
| 1677 // Record it, so that a break/continue crossing this statement | 1678 // Record it, so that a break/continue crossing this statement |
| 1678 // can restore the stack. | 1679 // can restore the stack. |
| 1679 const int kForInStackSize = 5 * kPointerSize; | 1680 const int kForInStackSize = 5 * kPointerSize; |
| 1680 break_stack_height_ += kForInStackSize; | 1681 break_stack_height_ += kForInStackSize; |
| 1681 node->set_break_stack_height(break_stack_height_); | 1682 node->set_break_stack_height(break_stack_height_); |
| 1682 node->break_target()->Initialize(this); | 1683 node->break_target()->Initialize(this); |
| 1683 node->continue_target()->Initialize(this); | 1684 node->continue_target()->Initialize(this); |
| 1684 | 1685 |
| 1685 JumpTarget primitive(this); | 1686 JumpTarget primitive(this); |
| 1686 JumpTarget jsobject(this); | 1687 JumpTarget jsobject(this); |
| 1687 JumpTarget fixed_array(this); | 1688 JumpTarget fixed_array(this); |
| 1688 JumpTarget entry(this); | 1689 JumpTarget entry(this, JumpTarget::BIDIRECTIONAL); |
| 1689 JumpTarget end_del_check(this); | 1690 JumpTarget end_del_check(this); |
| 1690 JumpTarget cleanup(this); | |
| 1691 JumpTarget exit(this); | 1691 JumpTarget exit(this); |
| 1692 | 1692 |
| 1693 // Get the object to enumerate over (converted to JSObject). | 1693 // Get the object to enumerate over (converted to JSObject). |
| 1694 LoadAndSpill(node->enumerable()); | 1694 LoadAndSpill(node->enumerable()); |
| 1695 | 1695 |
| 1696 // Both SpiderMonkey and kjs ignore null and undefined in contrast | 1696 // Both SpiderMonkey and kjs ignore null and undefined in contrast |
| 1697 // to the specification. 12.6.4 mandates a call to ToObject. | 1697 // to the specification. 12.6.4 mandates a call to ToObject. |
| 1698 frame_->EmitPop(r0); | 1698 frame_->EmitPop(r0); |
| 1699 __ cmp(r0, Operand(Factory::undefined_value())); | 1699 __ cmp(r0, Operand(Factory::undefined_value())); |
| 1700 exit.Branch(eq); | 1700 exit.Branch(eq); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1772 entry.Bind(); | 1772 entry.Bind(); |
| 1773 | 1773 |
| 1774 // sp[0] : index | 1774 // sp[0] : index |
| 1775 // sp[1] : array/enum cache length | 1775 // sp[1] : array/enum cache length |
| 1776 // sp[2] : array or enum cache | 1776 // sp[2] : array or enum cache |
| 1777 // sp[3] : 0 or map | 1777 // sp[3] : 0 or map |
| 1778 // sp[4] : enumerable | 1778 // sp[4] : enumerable |
| 1779 __ ldr(r0, frame_->ElementAt(0)); // load the current count | 1779 __ ldr(r0, frame_->ElementAt(0)); // load the current count |
| 1780 __ ldr(r1, frame_->ElementAt(1)); // load the length | 1780 __ ldr(r1, frame_->ElementAt(1)); // load the length |
| 1781 __ cmp(r0, Operand(r1)); // compare to the array length | 1781 __ cmp(r0, Operand(r1)); // compare to the array length |
| 1782 cleanup.Branch(hs); | 1782 node->break_target()->Branch(hs); |
| 1783 | 1783 |
| 1784 __ ldr(r0, frame_->ElementAt(0)); | 1784 __ ldr(r0, frame_->ElementAt(0)); |
| 1785 | 1785 |
| 1786 // Get the i'th entry of the array. | 1786 // Get the i'th entry of the array. |
| 1787 __ ldr(r2, frame_->ElementAt(2)); | 1787 __ ldr(r2, frame_->ElementAt(2)); |
| 1788 __ add(r2, r2, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 1788 __ add(r2, r2, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
| 1789 __ ldr(r3, MemOperand(r2, r0, LSL, kPointerSizeLog2 - kSmiTagSize)); | 1789 __ ldr(r3, MemOperand(r2, r0, LSL, kPointerSizeLog2 - kSmiTagSize)); |
| 1790 | 1790 |
| 1791 // Get Map or 0. | 1791 // Get Map or 0. |
| 1792 __ ldr(r2, frame_->ElementAt(3)); | 1792 __ ldr(r2, frame_->ElementAt(3)); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1848 VisitAndSpill(node->body()); | 1848 VisitAndSpill(node->body()); |
| 1849 | 1849 |
| 1850 // Next. | 1850 // Next. |
| 1851 node->continue_target()->Bind(); | 1851 node->continue_target()->Bind(); |
| 1852 frame_->EmitPop(r0); | 1852 frame_->EmitPop(r0); |
| 1853 __ add(r0, r0, Operand(Smi::FromInt(1))); | 1853 __ add(r0, r0, Operand(Smi::FromInt(1))); |
| 1854 frame_->EmitPush(r0); | 1854 frame_->EmitPush(r0); |
| 1855 entry.Jump(); | 1855 entry.Jump(); |
| 1856 | 1856 |
| 1857 // Cleanup. | 1857 // Cleanup. |
| 1858 cleanup.Bind(); | |
| 1859 node->break_target()->Bind(); | 1858 node->break_target()->Bind(); |
| 1860 frame_->Drop(5); | 1859 frame_->Drop(5); |
| 1861 | 1860 |
| 1862 // Exit. | 1861 // Exit. |
| 1863 exit.Bind(); | 1862 exit.Bind(); |
| 1864 | 1863 |
| 1865 break_stack_height_ -= kForInStackSize; | 1864 break_stack_height_ -= kForInStackSize; |
| 1866 } | 1865 } |
| 1867 | 1866 |
| 1868 | 1867 |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2463 | 2462 |
| 2464 // Update the write barrier for the array address. | 2463 // Update the write barrier for the array address. |
| 2465 __ mov(r3, Operand(offset)); | 2464 __ mov(r3, Operand(offset)); |
| 2466 __ RecordWrite(r1, r3, r2); | 2465 __ RecordWrite(r1, r3, r2); |
| 2467 } | 2466 } |
| 2468 } | 2467 } |
| 2469 } | 2468 } |
| 2470 | 2469 |
| 2471 | 2470 |
| 2472 void CodeGenerator::VisitCatchExtensionObject(CatchExtensionObject* node) { | 2471 void CodeGenerator::VisitCatchExtensionObject(CatchExtensionObject* node) { |
| 2472 ASSERT(!in_spilled_code()); |
| 2473 VirtualFrame::SpilledScope spilled_scope(this); | 2473 VirtualFrame::SpilledScope spilled_scope(this); |
| 2474 // Call runtime routine to allocate the catch extension object and | 2474 // Call runtime routine to allocate the catch extension object and |
| 2475 // assign the exception value to the catch variable. | 2475 // assign the exception value to the catch variable. |
| 2476 Comment cmnt(masm_, "[CatchExtensionObject "); | 2476 Comment cmnt(masm_, "[ CatchExtensionObject"); |
| 2477 LoadAndSpill(node->key()); | 2477 LoadAndSpill(node->key()); |
| 2478 LoadAndSpill(node->value()); | 2478 LoadAndSpill(node->value()); |
| 2479 __ CallRuntime(Runtime::kCreateCatchExtensionObject, 2); | 2479 Result result = |
| 2480 frame_->EmitPush(r0); | 2480 frame_->CallRuntime(Runtime::kCreateCatchExtensionObject, 2); |
| 2481 frame_->EmitPush(result.reg()); |
| 2481 } | 2482 } |
| 2482 | 2483 |
| 2483 | 2484 |
| 2484 void CodeGenerator::VisitAssignment(Assignment* node) { | 2485 void CodeGenerator::VisitAssignment(Assignment* node) { |
| 2485 VirtualFrame::SpilledScope spilled_scope(this); | 2486 VirtualFrame::SpilledScope spilled_scope(this); |
| 2486 Comment cmnt(masm_, "[ Assignment"); | 2487 Comment cmnt(masm_, "[ Assignment"); |
| 2487 CodeForStatementPosition(node); | 2488 CodeForStatementPosition(node); |
| 2488 | 2489 |
| 2489 Reference target(this, node->target()); | 2490 Reference target(this, node->target()); |
| 2490 if (target.is_illegal()) { | 2491 if (target.is_illegal()) { |
| (...skipping 2216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4707 __ mov(r2, Operand(0)); | 4708 __ mov(r2, Operand(0)); |
| 4708 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); | 4709 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); |
| 4709 __ Jump(Handle<Code>(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)), | 4710 __ Jump(Handle<Code>(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)), |
| 4710 RelocInfo::CODE_TARGET); | 4711 RelocInfo::CODE_TARGET); |
| 4711 } | 4712 } |
| 4712 | 4713 |
| 4713 | 4714 |
| 4714 #undef __ | 4715 #undef __ |
| 4715 | 4716 |
| 4716 } } // namespace v8::internal | 4717 } } // namespace v8::internal |
| OLD | NEW |