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_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/hydrogen-osr.h" | 10 #include "src/hydrogen-osr.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 SaveCallerDoubles(); | 186 SaveCallerDoubles(); |
187 } | 187 } |
188 } | 188 } |
189 | 189 |
190 // Possibly allocate a local context. | 190 // Possibly allocate a local context. |
191 int heap_slots = info_->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 191 int heap_slots = info_->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
192 if (heap_slots > 0) { | 192 if (heap_slots > 0) { |
193 Comment(";;; Allocate local context"); | 193 Comment(";;; Allocate local context"); |
194 bool need_write_barrier = true; | 194 bool need_write_barrier = true; |
195 // Argument to NewContext is the function, which is still in rdi. | 195 // Argument to NewContext is the function, which is still in rdi. |
196 if (heap_slots <= FastNewContextStub::kMaximumSlots) { | 196 if (FLAG_harmony_scoping && info()->scope()->is_global_scope()) { |
| 197 __ Push(rdi); |
| 198 __ Push(info()->scope()->GetScopeInfo()); |
| 199 __ CallRuntime(Runtime::kNewGlobalContext, 2); |
| 200 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { |
197 FastNewContextStub stub(isolate(), heap_slots); | 201 FastNewContextStub stub(isolate(), heap_slots); |
198 __ CallStub(&stub); | 202 __ CallStub(&stub); |
199 // Result of FastNewContextStub is always in new space. | 203 // Result of FastNewContextStub is always in new space. |
200 need_write_barrier = false; | 204 need_write_barrier = false; |
201 } else { | 205 } else { |
202 __ Push(rdi); | 206 __ Push(rdi); |
203 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 207 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
204 } | 208 } |
205 RecordSafepoint(Safepoint::kNoLazyDeopt); | 209 RecordSafepoint(Safepoint::kNoLazyDeopt); |
206 // Context is returned in rax. It replaces the context passed to us. | 210 // Context is returned in rax. It replaces the context passed to us. |
(...skipping 5653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5860 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5864 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5861 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5865 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5862 } | 5866 } |
5863 | 5867 |
5864 | 5868 |
5865 #undef __ | 5869 #undef __ |
5866 | 5870 |
5867 } } // namespace v8::internal | 5871 } } // namespace v8::internal |
5868 | 5872 |
5869 #endif // V8_TARGET_ARCH_X64 | 5873 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |