OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // Emit the remaining pushes. | 177 // Emit the remaining pushes. |
178 for (int i = 0; i < remaining; i++) { | 178 for (int i = 0; i < remaining; i++) { |
179 __ push(eax); | 179 __ push(eax); |
180 } | 180 } |
181 } | 181 } |
182 } | 182 } |
183 | 183 |
184 bool function_in_register = true; | 184 bool function_in_register = true; |
185 | 185 |
186 // Possibly allocate a local context. | 186 // Possibly allocate a local context. |
187 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 187 if (info->scope()->num_heap_slots() > 0) { |
188 if (heap_slots > 0) { | |
189 Comment cmnt(masm_, "[ Allocate context"); | 188 Comment cmnt(masm_, "[ Allocate context"); |
190 bool need_write_barrier = true; | 189 bool need_write_barrier = true; |
| 190 int slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
191 // Argument to NewContext is the function, which is still in edi. | 191 // Argument to NewContext is the function, which is still in edi. |
192 if (info->scope()->is_script_scope()) { | 192 if (info->scope()->is_script_scope()) { |
193 __ push(edi); | 193 __ push(edi); |
194 __ Push(info->scope()->GetScopeInfo(info->isolate())); | 194 __ Push(info->scope()->GetScopeInfo(info->isolate())); |
195 __ CallRuntime(Runtime::kNewScriptContext, 2); | 195 __ CallRuntime(Runtime::kNewScriptContext, 2); |
196 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { | 196 } else if (slots <= FastNewContextStub::kMaximumSlots) { |
197 FastNewContextStub stub(isolate(), heap_slots); | 197 FastNewContextStub stub(isolate(), slots); |
198 __ CallStub(&stub); | 198 __ CallStub(&stub); |
199 // Result of FastNewContextStub is always in new space. | 199 // Result of FastNewContextStub is always in new space. |
200 need_write_barrier = false; | 200 need_write_barrier = false; |
201 } else { | 201 } else { |
202 __ push(edi); | 202 __ push(edi); |
203 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 203 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
204 } | 204 } |
205 function_in_register = false; | 205 function_in_register = false; |
206 // Context is returned in eax. It replaces the context passed to us. | 206 // Context is returned in eax. It replaces the context passed to us. |
207 // It's saved in the stack and kept live in esi. | 207 // It's saved in the stack and kept live in esi. |
(...skipping 5220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5428 Assembler::target_address_at(call_target_address, | 5428 Assembler::target_address_at(call_target_address, |
5429 unoptimized_code)); | 5429 unoptimized_code)); |
5430 return OSR_AFTER_STACK_CHECK; | 5430 return OSR_AFTER_STACK_CHECK; |
5431 } | 5431 } |
5432 | 5432 |
5433 | 5433 |
5434 } // namespace internal | 5434 } // namespace internal |
5435 } // namespace v8 | 5435 } // namespace v8 |
5436 | 5436 |
5437 #endif // V8_TARGET_ARCH_X87 | 5437 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |