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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 } | 195 } |
196 } | 196 } |
197 | 197 |
198 bool function_in_register = true; | 198 bool function_in_register = true; |
199 | 199 |
200 // Possibly allocate a local context. | 200 // Possibly allocate a local context. |
201 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 201 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
202 if (heap_slots > 0) { | 202 if (heap_slots > 0) { |
203 // Argument to NewContext is the function, which is still in r1. | 203 // Argument to NewContext is the function, which is still in r1. |
204 Comment cmnt(masm_, "[ Allocate context"); | 204 Comment cmnt(masm_, "[ Allocate context"); |
205 __ push(r1); | |
206 if (FLAG_harmony_scoping && info->scope()->is_global_scope()) { | 205 if (FLAG_harmony_scoping && info->scope()->is_global_scope()) { |
| 206 __ push(r1); |
207 __ Push(info->scope()->GetScopeInfo()); | 207 __ Push(info->scope()->GetScopeInfo()); |
208 __ CallRuntime(Runtime::kNewGlobalContext, 2); | 208 __ CallRuntime(Runtime::kNewGlobalContext, 2); |
209 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { | 209 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { |
210 FastNewContextStub stub(heap_slots); | 210 FastNewContextStub stub(heap_slots); |
211 __ CallStub(&stub); | 211 __ CallStub(&stub); |
212 } else { | 212 } else { |
| 213 __ push(r1); |
213 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 214 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
214 } | 215 } |
215 function_in_register = false; | 216 function_in_register = false; |
216 // Context is returned in both r0 and cp. It replaces the context | 217 // Context is returned in r0. It replaces the context passed to us. |
217 // passed to us. It's saved in the stack and kept live in cp. | 218 // It's saved in the stack and kept live in cp. |
218 __ str(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 219 __ mov(cp, r0); |
| 220 __ str(r0, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
219 // Copy any necessary parameters into the context. | 221 // Copy any necessary parameters into the context. |
220 int num_parameters = info->scope()->num_parameters(); | 222 int num_parameters = info->scope()->num_parameters(); |
221 for (int i = 0; i < num_parameters; i++) { | 223 for (int i = 0; i < num_parameters; i++) { |
222 Variable* var = scope()->parameter(i); | 224 Variable* var = scope()->parameter(i); |
223 if (var->IsContextSlot()) { | 225 if (var->IsContextSlot()) { |
224 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 226 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
225 (num_parameters - 1 - i) * kPointerSize; | 227 (num_parameters - 1 - i) * kPointerSize; |
226 // Load parameter from stack. | 228 // Load parameter from stack. |
227 __ ldr(r0, MemOperand(fp, parameter_offset)); | 229 __ ldr(r0, MemOperand(fp, parameter_offset)); |
228 // Store it in the context. | 230 // Store it in the context. |
(...skipping 4674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4903 ASSERT(Memory::uint32_at(interrupt_address_pointer) == | 4905 ASSERT(Memory::uint32_at(interrupt_address_pointer) == |
4904 reinterpret_cast<uint32_t>( | 4906 reinterpret_cast<uint32_t>( |
4905 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4907 isolate->builtins()->OsrAfterStackCheck()->entry())); |
4906 return OSR_AFTER_STACK_CHECK; | 4908 return OSR_AFTER_STACK_CHECK; |
4907 } | 4909 } |
4908 | 4910 |
4909 | 4911 |
4910 } } // namespace v8::internal | 4912 } } // namespace v8::internal |
4911 | 4913 |
4912 #endif // V8_TARGET_ARCH_ARM | 4914 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |