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 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
6 | 6 |
7 #include "src/crankshaft/ia32/lithium-codegen-ia32.h" | 7 #include "src/crankshaft/ia32/lithium-codegen-ia32.h" |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/builtins/builtins-constructor.h" |
10 #include "src/code-factory.h" | 11 #include "src/code-factory.h" |
11 #include "src/code-stubs.h" | 12 #include "src/code-stubs.h" |
12 #include "src/codegen.h" | 13 #include "src/codegen.h" |
13 #include "src/crankshaft/hydrogen-osr.h" | 14 #include "src/crankshaft/hydrogen-osr.h" |
14 #include "src/deoptimizer.h" | 15 #include "src/deoptimizer.h" |
15 #include "src/ia32/frames-ia32.h" | 16 #include "src/ia32/frames-ia32.h" |
16 #include "src/ic/ic.h" | 17 #include "src/ic/ic.h" |
17 #include "src/ic/stub-cache.h" | 18 #include "src/ic/stub-cache.h" |
18 | 19 |
19 namespace v8 { | 20 namespace v8 { |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 bool need_write_barrier = true; | 170 bool need_write_barrier = true; |
170 // Argument to NewContext is the function, which is still in edi. | 171 // Argument to NewContext is the function, which is still in edi. |
171 int slots = info_->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 172 int slots = info_->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
172 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; | 173 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; |
173 if (info()->scope()->is_script_scope()) { | 174 if (info()->scope()->is_script_scope()) { |
174 __ push(edi); | 175 __ push(edi); |
175 __ Push(info()->scope()->scope_info()); | 176 __ Push(info()->scope()->scope_info()); |
176 __ CallRuntime(Runtime::kNewScriptContext); | 177 __ CallRuntime(Runtime::kNewScriptContext); |
177 deopt_mode = Safepoint::kLazyDeopt; | 178 deopt_mode = Safepoint::kLazyDeopt; |
178 } else { | 179 } else { |
179 if (slots <= FastNewFunctionContextStub::MaximumSlots()) { | 180 if (slots <= |
180 FastNewFunctionContextStub stub(isolate(), | 181 ConstructorBuiltinsAssembler::MaximumFunctionContextSlots()) { |
181 info()->scope()->scope_type()); | 182 Callable callable = CodeFactory::FastNewFunctionContext( |
| 183 isolate(), info()->scope()->scope_type()); |
182 __ mov(FastNewFunctionContextDescriptor::SlotsRegister(), | 184 __ mov(FastNewFunctionContextDescriptor::SlotsRegister(), |
183 Immediate(slots)); | 185 Immediate(slots)); |
184 __ CallStub(&stub); | 186 __ Call(callable.code(), RelocInfo::CODE_TARGET); |
185 // Result of FastNewFunctionContextStub is always in new space. | 187 // Result of the FastNewFunctionContext builtin is always in new space. |
186 need_write_barrier = false; | 188 need_write_barrier = false; |
187 } else { | 189 } else { |
188 __ Push(edi); | 190 __ Push(edi); |
189 __ Push(Smi::FromInt(info()->scope()->scope_type())); | 191 __ Push(Smi::FromInt(info()->scope()->scope_type())); |
190 __ CallRuntime(Runtime::kNewFunctionContext); | 192 __ CallRuntime(Runtime::kNewFunctionContext); |
191 } | 193 } |
192 } | 194 } |
193 RecordSafepoint(deopt_mode); | 195 RecordSafepoint(deopt_mode); |
194 | 196 |
195 // Context is returned in eax. It replaces the context passed to us. | 197 // Context is returned in eax. It replaces the context passed to us. |
(...skipping 4954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5150 __ bind(deferred->exit()); | 5152 __ bind(deferred->exit()); |
5151 __ bind(&done); | 5153 __ bind(&done); |
5152 } | 5154 } |
5153 | 5155 |
5154 #undef __ | 5156 #undef __ |
5155 | 5157 |
5156 } // namespace internal | 5158 } // namespace internal |
5157 } // namespace v8 | 5159 } // namespace v8 |
5158 | 5160 |
5159 #endif // V8_TARGET_ARCH_IA32 | 5161 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |