OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 } | 204 } |
205 } | 205 } |
206 | 206 |
207 bool function_in_register = true; | 207 bool function_in_register = true; |
208 | 208 |
209 // Possibly allocate a local context. | 209 // Possibly allocate a local context. |
210 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 210 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
211 if (heap_slots > 0) { | 211 if (heap_slots > 0) { |
212 Comment cmnt(masm_, "[ Allocate context"); | 212 Comment cmnt(masm_, "[ Allocate context"); |
213 // Argument to NewContext is the function, which is still in a1. | 213 // Argument to NewContext is the function, which is still in a1. |
214 __ push(a1); | |
215 if (FLAG_harmony_scoping && info->scope()->is_global_scope()) { | 214 if (FLAG_harmony_scoping && info->scope()->is_global_scope()) { |
| 215 __ push(a1); |
216 __ Push(info->scope()->GetScopeInfo()); | 216 __ Push(info->scope()->GetScopeInfo()); |
217 __ CallRuntime(Runtime::kNewGlobalContext, 2); | 217 __ CallRuntime(Runtime::kNewGlobalContext, 2); |
218 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { | 218 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { |
219 FastNewContextStub stub(heap_slots); | 219 FastNewContextStub stub(heap_slots); |
220 __ CallStub(&stub); | 220 __ CallStub(&stub); |
221 } else { | 221 } else { |
| 222 __ push(a1); |
222 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 223 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
223 } | 224 } |
224 function_in_register = false; | 225 function_in_register = false; |
225 // Context is returned in both v0 and cp. It replaces the context | 226 // Context is returned in v0. It replaces the context passed to us. |
226 // passed to us. It's saved in the stack and kept live in cp. | 227 // It's saved in the stack and kept live in cp. |
227 __ sw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 228 __ mov(cp, v0); |
| 229 __ sw(v0, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
228 // Copy any necessary parameters into the context. | 230 // Copy any necessary parameters into the context. |
229 int num_parameters = info->scope()->num_parameters(); | 231 int num_parameters = info->scope()->num_parameters(); |
230 for (int i = 0; i < num_parameters; i++) { | 232 for (int i = 0; i < num_parameters; i++) { |
231 Variable* var = scope()->parameter(i); | 233 Variable* var = scope()->parameter(i); |
232 if (var->IsContextSlot()) { | 234 if (var->IsContextSlot()) { |
233 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 235 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
234 (num_parameters - 1 - i) * kPointerSize; | 236 (num_parameters - 1 - i) * kPointerSize; |
235 // Load parameter from stack. | 237 // Load parameter from stack. |
236 __ lw(a0, MemOperand(fp, parameter_offset)); | 238 __ lw(a0, MemOperand(fp, parameter_offset)); |
237 // Store it in the context. | 239 // Store it in the context. |
(...skipping 4721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4959 Assembler::target_address_at(pc_immediate_load_address)) == | 4961 Assembler::target_address_at(pc_immediate_load_address)) == |
4960 reinterpret_cast<uint32_t>( | 4962 reinterpret_cast<uint32_t>( |
4961 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4963 isolate->builtins()->OsrAfterStackCheck()->entry())); |
4962 return OSR_AFTER_STACK_CHECK; | 4964 return OSR_AFTER_STACK_CHECK; |
4963 } | 4965 } |
4964 | 4966 |
4965 | 4967 |
4966 } } // namespace v8::internal | 4968 } } // namespace v8::internal |
4967 | 4969 |
4968 #endif // V8_TARGET_ARCH_MIPS | 4970 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |