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