OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved.7 | 1 // Copyright 2012 the V8 project authors. All rights reserved.7 |
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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // Result of FastNewFunctionContextStub is always in new space. | 192 // Result of FastNewFunctionContextStub is always in new space. |
193 need_write_barrier = false; | 193 need_write_barrier = false; |
194 } | 194 } |
195 RecordSafepoint(deopt_mode); | 195 RecordSafepoint(deopt_mode); |
196 | 196 |
197 // Context is returned in both v0. It replaces the context passed to us. | 197 // Context is returned in both v0. It replaces the context passed to us. |
198 // It's saved in the stack and kept live in cp. | 198 // It's saved in the stack and kept live in cp. |
199 __ mov(cp, v0); | 199 __ mov(cp, v0); |
200 __ sw(v0, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 200 __ sw(v0, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
201 // Copy any necessary parameters into the context. | 201 // Copy any necessary parameters into the context. |
202 int num_parameters = info()->scope()->num_parameters(); | 202 int num_parameters = scope()->num_parameters(); |
203 int first_parameter = info()->scope()->has_this_declaration() ? -1 : 0; | 203 int first_parameter = scope()->has_this_declaration() ? -1 : 0; |
204 for (int i = first_parameter; i < num_parameters; i++) { | 204 for (int i = first_parameter; i < num_parameters; i++) { |
205 Variable* var = (i == -1) ? info()->scope()->receiver() | 205 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); |
206 : info()->scope()->parameter(i); | |
207 if (var->IsContextSlot()) { | 206 if (var->IsContextSlot()) { |
208 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 207 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
209 (num_parameters - 1 - i) * kPointerSize; | 208 (num_parameters - 1 - i) * kPointerSize; |
210 // Load parameter from stack. | 209 // Load parameter from stack. |
211 __ lw(a0, MemOperand(fp, parameter_offset)); | 210 __ lw(a0, MemOperand(fp, parameter_offset)); |
212 // Store it in the context. | 211 // Store it in the context. |
213 MemOperand target = ContextMemOperand(cp, var->index()); | 212 MemOperand target = ContextMemOperand(cp, var->index()); |
214 __ sw(a0, target); | 213 __ sw(a0, target); |
215 // Update the write barrier. This clobbers a3 and a0. | 214 // Update the write barrier. This clobbers a3 and a0. |
216 if (need_write_barrier) { | 215 if (need_write_barrier) { |
(...skipping 5323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5540 __ lw(result, FieldMemOperand(scratch, | 5539 __ lw(result, FieldMemOperand(scratch, |
5541 FixedArray::kHeaderSize - kPointerSize)); | 5540 FixedArray::kHeaderSize - kPointerSize)); |
5542 __ bind(deferred->exit()); | 5541 __ bind(deferred->exit()); |
5543 __ bind(&done); | 5542 __ bind(&done); |
5544 } | 5543 } |
5545 | 5544 |
5546 #undef __ | 5545 #undef __ |
5547 | 5546 |
5548 } // namespace internal | 5547 } // namespace internal |
5549 } // namespace v8 | 5548 } // namespace v8 |
OLD | NEW |