| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 | 197 |
| 198 if (info()->saves_caller_doubles()) { | 198 if (info()->saves_caller_doubles()) { |
| 199 SaveCallerDoubles(); | 199 SaveCallerDoubles(); |
| 200 } | 200 } |
| 201 | 201 |
| 202 // Possibly allocate a local context. | 202 // Possibly allocate a local context. |
| 203 int heap_slots = info()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 203 int heap_slots = info()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
| 204 if (heap_slots > 0) { | 204 if (heap_slots > 0) { |
| 205 Comment(";;; Allocate local context"); | 205 Comment(";;; Allocate local context"); |
| 206 // Argument to NewContext is the function, which is in a1. | 206 // Argument to NewContext is the function, which is in a1. |
| 207 __ push(a1); | |
| 208 if (heap_slots <= FastNewContextStub::kMaximumSlots) { | 207 if (heap_slots <= FastNewContextStub::kMaximumSlots) { |
| 209 FastNewContextStub stub(heap_slots); | 208 FastNewContextStub stub(heap_slots); |
| 210 __ CallStub(&stub); | 209 __ CallStub(&stub); |
| 211 } else { | 210 } else { |
| 211 __ push(a1); |
| 212 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 212 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
| 213 } | 213 } |
| 214 RecordSafepoint(Safepoint::kNoLazyDeopt); | 214 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 215 // Context is returned in both v0 and cp. It replaces the context | 215 // Context is returned in both v0. It replaces the context passed to us. |
| 216 // passed to us. It's saved in the stack and kept live in cp. | 216 // It's saved in the stack and kept live in cp. |
| 217 __ sw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 217 __ mov(cp, v0); |
| 218 __ sw(v0, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 218 // Copy any necessary parameters into the context. | 219 // Copy any necessary parameters into the context. |
| 219 int num_parameters = scope()->num_parameters(); | 220 int num_parameters = scope()->num_parameters(); |
| 220 for (int i = 0; i < num_parameters; i++) { | 221 for (int i = 0; i < num_parameters; i++) { |
| 221 Variable* var = scope()->parameter(i); | 222 Variable* var = scope()->parameter(i); |
| 222 if (var->IsContextSlot()) { | 223 if (var->IsContextSlot()) { |
| 223 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 224 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
| 224 (num_parameters - 1 - i) * kPointerSize; | 225 (num_parameters - 1 - i) * kPointerSize; |
| 225 // Load parameter from stack. | 226 // Load parameter from stack. |
| 226 __ lw(a0, MemOperand(fp, parameter_offset)); | 227 __ lw(a0, MemOperand(fp, parameter_offset)); |
| 227 // Store it in the context. | 228 // Store it in the context. |
| (...skipping 5587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5815 __ Subu(scratch, result, scratch); | 5816 __ Subu(scratch, result, scratch); |
| 5816 __ lw(result, FieldMemOperand(scratch, | 5817 __ lw(result, FieldMemOperand(scratch, |
| 5817 FixedArray::kHeaderSize - kPointerSize)); | 5818 FixedArray::kHeaderSize - kPointerSize)); |
| 5818 __ bind(&done); | 5819 __ bind(&done); |
| 5819 } | 5820 } |
| 5820 | 5821 |
| 5821 | 5822 |
| 5822 #undef __ | 5823 #undef __ |
| 5823 | 5824 |
| 5824 } } // namespace v8::internal | 5825 } } // namespace v8::internal |
| OLD | NEW |