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_X64 | 7 #if V8_TARGET_ARCH_X64 |
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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // Emit the remaining pushes. | 176 // Emit the remaining pushes. |
177 for (int i = 0; i < remaining; i++) { | 177 for (int i = 0; i < remaining; i++) { |
178 __ Push(rdx); | 178 __ Push(rdx); |
179 } | 179 } |
180 } | 180 } |
181 } | 181 } |
182 | 182 |
183 bool function_in_register = true; | 183 bool function_in_register = true; |
184 | 184 |
185 // Possibly allocate a local context. | 185 // Possibly allocate a local context. |
186 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 186 if (info->scope()->num_heap_slots() > 0) { |
187 if (heap_slots > 0) { | |
188 Comment cmnt(masm_, "[ Allocate context"); | 187 Comment cmnt(masm_, "[ Allocate context"); |
189 bool need_write_barrier = true; | 188 bool need_write_barrier = true; |
| 189 int slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
190 // Argument to NewContext is the function, which is still in rdi. | 190 // Argument to NewContext is the function, which is still in rdi. |
191 if (info->scope()->is_script_scope()) { | 191 if (info->scope()->is_script_scope()) { |
192 __ Push(rdi); | 192 __ Push(rdi); |
193 __ Push(info->scope()->GetScopeInfo(info->isolate())); | 193 __ Push(info->scope()->GetScopeInfo(info->isolate())); |
194 __ CallRuntime(Runtime::kNewScriptContext, 2); | 194 __ CallRuntime(Runtime::kNewScriptContext, 2); |
195 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { | 195 } else if (slots <= FastNewContextStub::kMaximumSlots) { |
196 FastNewContextStub stub(isolate(), heap_slots); | 196 FastNewContextStub stub(isolate(), slots); |
197 __ CallStub(&stub); | 197 __ CallStub(&stub); |
198 // Result of FastNewContextStub is always in new space. | 198 // Result of FastNewContextStub is always in new space. |
199 need_write_barrier = false; | 199 need_write_barrier = false; |
200 } else { | 200 } else { |
201 __ Push(rdi); | 201 __ Push(rdi); |
202 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 202 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
203 } | 203 } |
204 function_in_register = false; | 204 function_in_register = false; |
205 // Context is returned in rax. It replaces the context passed to us. | 205 // Context is returned in rax. It replaces the context passed to us. |
206 // It's saved in the stack and kept live in rsi. | 206 // It's saved in the stack and kept live in rsi. |
(...skipping 5245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5452 Assembler::target_address_at(call_target_address, | 5452 Assembler::target_address_at(call_target_address, |
5453 unoptimized_code)); | 5453 unoptimized_code)); |
5454 return OSR_AFTER_STACK_CHECK; | 5454 return OSR_AFTER_STACK_CHECK; |
5455 } | 5455 } |
5456 | 5456 |
5457 | 5457 |
5458 } // namespace internal | 5458 } // namespace internal |
5459 } // namespace v8 | 5459 } // namespace v8 |
5460 | 5460 |
5461 #endif // V8_TARGET_ARCH_X64 | 5461 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |