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/crankshaft/arm/lithium-codegen-arm.h" | 5 #include "src/crankshaft/arm/lithium-codegen-arm.h" |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/builtins/builtins-constructor.h" |
8 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
10 #include "src/crankshaft/arm/lithium-gap-resolver-arm.h" | 11 #include "src/crankshaft/arm/lithium-gap-resolver-arm.h" |
11 #include "src/crankshaft/hydrogen-osr.h" | 12 #include "src/crankshaft/hydrogen-osr.h" |
12 #include "src/ic/ic.h" | 13 #include "src/ic/ic.h" |
13 #include "src/ic/stub-cache.h" | 14 #include "src/ic/stub-cache.h" |
14 | 15 |
15 namespace v8 { | 16 namespace v8 { |
16 namespace internal { | 17 namespace internal { |
17 | 18 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 bool need_write_barrier = true; | 158 bool need_write_barrier = true; |
158 // Argument to NewContext is the function, which is in r1. | 159 // Argument to NewContext is the function, which is in r1. |
159 int slots = info()->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 160 int slots = info()->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
160 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; | 161 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; |
161 if (info()->scope()->is_script_scope()) { | 162 if (info()->scope()->is_script_scope()) { |
162 __ push(r1); | 163 __ push(r1); |
163 __ Push(info()->scope()->scope_info()); | 164 __ Push(info()->scope()->scope_info()); |
164 __ CallRuntime(Runtime::kNewScriptContext); | 165 __ CallRuntime(Runtime::kNewScriptContext); |
165 deopt_mode = Safepoint::kLazyDeopt; | 166 deopt_mode = Safepoint::kLazyDeopt; |
166 } else { | 167 } else { |
167 if (slots <= FastNewFunctionContextStub::MaximumSlots()) { | 168 if (slots <= |
168 FastNewFunctionContextStub stub(isolate(), | 169 ConstructorBuiltinsAssembler::MaximumFunctionContextSlots()) { |
169 info()->scope()->scope_type()); | 170 Callable callable = CodeFactory::FastNewFunctionContext( |
| 171 isolate(), info()->scope()->scope_type()); |
170 __ mov(FastNewFunctionContextDescriptor::SlotsRegister(), | 172 __ mov(FastNewFunctionContextDescriptor::SlotsRegister(), |
171 Operand(slots)); | 173 Operand(slots)); |
172 __ CallStub(&stub); | 174 __ Call(callable.code(), RelocInfo::CODE_TARGET); |
173 // Result of FastNewFunctionContextStub is always in new space. | 175 // Result of the FastNewFunctionContext builtin is always in new space. |
174 need_write_barrier = false; | 176 need_write_barrier = false; |
175 } else { | 177 } else { |
176 __ push(r1); | 178 __ push(r1); |
177 __ Push(Smi::FromInt(info()->scope()->scope_type())); | 179 __ Push(Smi::FromInt(info()->scope()->scope_type())); |
178 __ CallRuntime(Runtime::kNewFunctionContext); | 180 __ CallRuntime(Runtime::kNewFunctionContext); |
179 } | 181 } |
180 } | 182 } |
181 RecordSafepoint(deopt_mode); | 183 RecordSafepoint(deopt_mode); |
182 | 184 |
183 // Context is returned in both r0 and cp. It replaces the context | 185 // Context is returned in both r0 and cp. It replaces the context |
(...skipping 5200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5384 __ ldr(result, FieldMemOperand(scratch, | 5386 __ ldr(result, FieldMemOperand(scratch, |
5385 FixedArray::kHeaderSize - kPointerSize)); | 5387 FixedArray::kHeaderSize - kPointerSize)); |
5386 __ bind(deferred->exit()); | 5388 __ bind(deferred->exit()); |
5387 __ bind(&done); | 5389 __ bind(&done); |
5388 } | 5390 } |
5389 | 5391 |
5390 #undef __ | 5392 #undef __ |
5391 | 5393 |
5392 } // namespace internal | 5394 } // namespace internal |
5393 } // namespace v8 | 5395 } // namespace v8 |
OLD | NEW |