| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 __ str(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 88 __ str(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 89 // Copy any necessary parameters into the context. | 89 // Copy any necessary parameters into the context. |
| 90 int num_parameters = fun->scope()->num_parameters(); | 90 int num_parameters = fun->scope()->num_parameters(); |
| 91 for (int i = 0; i < num_parameters; i++) { | 91 for (int i = 0; i < num_parameters; i++) { |
| 92 Slot* slot = fun->scope()->parameter(i)->slot(); | 92 Slot* slot = fun->scope()->parameter(i)->slot(); |
| 93 if (slot != NULL && slot->type() == Slot::CONTEXT) { | 93 if (slot != NULL && slot->type() == Slot::CONTEXT) { |
| 94 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 94 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
| 95 (num_parameters - 1 - i) * kPointerSize; | 95 (num_parameters - 1 - i) * kPointerSize; |
| 96 // Load parameter from stack. | 96 // Load parameter from stack. |
| 97 __ ldr(r0, MemOperand(fp, parameter_offset)); | 97 __ ldr(r0, MemOperand(fp, parameter_offset)); |
| 98 // Store it in the context | 98 // Store it in the context. |
| 99 __ str(r0, MemOperand(cp, Context::SlotOffset(slot->index()))); | 99 __ mov(r1, Operand(Context::SlotOffset(slot->index()))); |
| 100 __ str(r0, MemOperand(cp, r1)); |
| 101 // Update the write barrier. This clobbers all involved |
| 102 // registers, so we have use a third register to avoid |
| 103 // clobbering cp. |
| 104 __ mov(r2, Operand(cp)); |
| 105 __ RecordWrite(r2, r1, r0); |
| 106 |
| 100 } | 107 } |
| 101 } | 108 } |
| 102 } | 109 } |
| 103 | 110 |
| 104 Variable* arguments = fun->scope()->arguments()->AsVariable(); | 111 Variable* arguments = fun->scope()->arguments()->AsVariable(); |
| 105 if (arguments != NULL) { | 112 if (arguments != NULL) { |
| 106 // Function uses arguments object. | 113 // Function uses arguments object. |
| 107 Comment cmnt(masm_, "[ Allocate arguments object"); | 114 Comment cmnt(masm_, "[ Allocate arguments object"); |
| 108 if (!function_in_register) { | 115 if (!function_in_register) { |
| 109 // Load this again, if it's used by the local context below. | 116 // Load this again, if it's used by the local context below. |
| 110 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 117 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 111 } else { | 118 } else { |
| 112 __ mov(r3, r1); | 119 __ mov(r3, r1); |
| 113 } | 120 } |
| 114 // Receiver is just before the parameters on the caller's stack. | 121 // Receiver is just before the parameters on the caller's stack. |
| 115 __ add(r2, fp, Operand(StandardFrameConstants::kCallerSPOffset + | 122 __ add(r2, fp, Operand(StandardFrameConstants::kCallerSPOffset + |
| 116 fun->num_parameters() * kPointerSize)); | 123 fun->num_parameters() * kPointerSize)); |
| 117 __ mov(r1, Operand(Smi::FromInt(fun->num_parameters()))); | 124 __ mov(r1, Operand(Smi::FromInt(fun->num_parameters()))); |
| 118 __ stm(db_w, sp, r3.bit() | r2.bit() | r1.bit()); | 125 __ stm(db_w, sp, r3.bit() | r2.bit() | r1.bit()); |
| 119 | 126 |
| 120 // Arguments to ArgumentsAccessStub: | 127 // Arguments to ArgumentsAccessStub: |
| 121 // function, receiver address, parameter count. | 128 // function, receiver address, parameter count. |
| 122 // The stub will rewrite receiever and parameter count if the previous | 129 // The stub will rewrite receiever and parameter count if the previous |
| 123 // stack frame was an arguments adapter frame. | 130 // stack frame was an arguments adapter frame. |
| 124 ArgumentsAccessStub stub(ArgumentsAccessStub::NEW_OBJECT); | 131 ArgumentsAccessStub stub(ArgumentsAccessStub::NEW_OBJECT); |
| 125 __ CallStub(&stub); | 132 __ CallStub(&stub); |
| 126 // Duplicate the value; move-to-slot operation might clobber registers. | 133 // Duplicate the value; move-to-slot operation might clobber registers. |
| (...skipping 1639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1766 __ pop(result_register()); | 1773 __ pop(result_register()); |
| 1767 ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize); | 1774 ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize); |
| 1768 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 1775 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
| 1769 __ add(pc, r1, Operand(masm_->CodeObject())); | 1776 __ add(pc, r1, Operand(masm_->CodeObject())); |
| 1770 } | 1777 } |
| 1771 | 1778 |
| 1772 | 1779 |
| 1773 #undef __ | 1780 #undef __ |
| 1774 | 1781 |
| 1775 } } // namespace v8::internal | 1782 } } // namespace v8::internal |
| OLD | NEW |