OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 } | 185 } |
186 int remaining = locals_count % kMaxPushes; | 186 int remaining = locals_count % kMaxPushes; |
187 // Emit the remaining pushes. | 187 // Emit the remaining pushes. |
188 __ PushMultipleTimes(x10 , remaining); | 188 __ PushMultipleTimes(x10 , remaining); |
189 } | 189 } |
190 } | 190 } |
191 } | 191 } |
192 | 192 |
193 bool function_in_register_x1 = true; | 193 bool function_in_register_x1 = true; |
194 | 194 |
195 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 195 if (info->scope()->num_heap_slots() > 0) { |
196 if (heap_slots > 0) { | |
197 // Argument to NewContext is the function, which is still in x1. | 196 // Argument to NewContext is the function, which is still in x1. |
198 Comment cmnt(masm_, "[ Allocate context"); | 197 Comment cmnt(masm_, "[ Allocate context"); |
199 bool need_write_barrier = true; | 198 bool need_write_barrier = true; |
| 199 int slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
200 if (info->scope()->is_script_scope()) { | 200 if (info->scope()->is_script_scope()) { |
201 __ Mov(x10, Operand(info->scope()->GetScopeInfo(info->isolate()))); | 201 __ Mov(x10, Operand(info->scope()->GetScopeInfo(info->isolate()))); |
202 __ Push(x1, x10); | 202 __ Push(x1, x10); |
203 __ CallRuntime(Runtime::kNewScriptContext, 2); | 203 __ CallRuntime(Runtime::kNewScriptContext, 2); |
204 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { | 204 } else if (slots <= FastNewContextStub::kMaximumSlots) { |
205 FastNewContextStub stub(isolate(), heap_slots); | 205 FastNewContextStub stub(isolate(), slots); |
206 __ CallStub(&stub); | 206 __ CallStub(&stub); |
207 // Result of FastNewContextStub is always in new space. | 207 // Result of FastNewContextStub is always in new space. |
208 need_write_barrier = false; | 208 need_write_barrier = false; |
209 } else { | 209 } else { |
210 __ Push(x1); | 210 __ Push(x1); |
211 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 211 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
212 } | 212 } |
213 function_in_register_x1 = false; | 213 function_in_register_x1 = false; |
214 // Context is returned in x0. It replaces the context passed to us. | 214 // Context is returned in x0. It replaces the context passed to us. |
215 // It's saved in the stack and kept live in cp. | 215 // It's saved in the stack and kept live in cp. |
(...skipping 5322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5538 } | 5538 } |
5539 | 5539 |
5540 return INTERRUPT; | 5540 return INTERRUPT; |
5541 } | 5541 } |
5542 | 5542 |
5543 | 5543 |
5544 } // namespace internal | 5544 } // namespace internal |
5545 } // namespace v8 | 5545 } // namespace v8 |
5546 | 5546 |
5547 #endif // V8_TARGET_ARCH_ARM64 | 5547 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |