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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 } | 175 } |
176 } | 176 } |
177 | 177 |
178 bool function_in_register = true; | 178 bool function_in_register = true; |
179 | 179 |
180 // Possibly allocate a local context. | 180 // Possibly allocate a local context. |
181 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 181 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
182 if (heap_slots > 0) { | 182 if (heap_slots > 0) { |
183 Comment cmnt(masm_, "[ Allocate context"); | 183 Comment cmnt(masm_, "[ Allocate context"); |
184 // Argument to NewContext is the function, which is still in edi. | 184 // Argument to NewContext is the function, which is still in edi. |
185 __ push(edi); | |
186 if (FLAG_harmony_scoping && info->scope()->is_global_scope()) { | 185 if (FLAG_harmony_scoping && info->scope()->is_global_scope()) { |
| 186 __ push(edi); |
187 __ Push(info->scope()->GetScopeInfo()); | 187 __ Push(info->scope()->GetScopeInfo()); |
188 __ CallRuntime(Runtime::kNewGlobalContext, 2); | 188 __ CallRuntime(Runtime::kNewGlobalContext, 2); |
189 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { | 189 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { |
190 FastNewContextStub stub(heap_slots); | 190 FastNewContextStub stub(heap_slots); |
191 __ CallStub(&stub); | 191 __ CallStub(&stub); |
192 } else { | 192 } else { |
| 193 __ push(edi); |
193 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 194 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
194 } | 195 } |
195 function_in_register = false; | 196 function_in_register = false; |
196 // Context is returned in both eax and esi. It replaces the context | 197 // Context is returned in eax. It replaces the context passed to us. |
197 // passed to us. It's saved in the stack and kept live in esi. | 198 // It's saved in the stack and kept live in esi. |
198 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), esi); | 199 __ mov(esi, eax); |
| 200 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), eax); |
199 | 201 |
200 // Copy parameters into context if necessary. | 202 // Copy parameters into context if necessary. |
201 int num_parameters = info->scope()->num_parameters(); | 203 int num_parameters = info->scope()->num_parameters(); |
202 for (int i = 0; i < num_parameters; i++) { | 204 for (int i = 0; i < num_parameters; i++) { |
203 Variable* var = scope()->parameter(i); | 205 Variable* var = scope()->parameter(i); |
204 if (var->IsContextSlot()) { | 206 if (var->IsContextSlot()) { |
205 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 207 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
206 (num_parameters - 1 - i) * kPointerSize; | 208 (num_parameters - 1 - i) * kPointerSize; |
207 // Load parameter from stack. | 209 // Load parameter from stack. |
208 __ mov(eax, Operand(ebp, parameter_offset)); | 210 __ mov(eax, Operand(ebp, parameter_offset)); |
(...skipping 4683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4892 | 4894 |
4893 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4895 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
4894 Assembler::target_address_at(call_target_address)); | 4896 Assembler::target_address_at(call_target_address)); |
4895 return OSR_AFTER_STACK_CHECK; | 4897 return OSR_AFTER_STACK_CHECK; |
4896 } | 4898 } |
4897 | 4899 |
4898 | 4900 |
4899 } } // namespace v8::internal | 4901 } } // namespace v8::internal |
4900 | 4902 |
4901 #endif // V8_TARGET_ARCH_IA32 | 4903 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |