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_X87 | 5 #if V8_TARGET_ARCH_X87 |
6 | 6 |
7 #include "src/crankshaft/x87/lithium-codegen-x87.h" | 7 #include "src/crankshaft/x87/lithium-codegen-x87.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/ic/ic.h" | 16 #include "src/ic/ic.h" |
16 #include "src/ic/stub-cache.h" | 17 #include "src/ic/stub-cache.h" |
17 #include "src/x87/frames-x87.h" | 18 #include "src/x87/frames-x87.h" |
18 | 19 |
19 namespace v8 { | 20 namespace v8 { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 bool need_write_barrier = true; | 140 bool need_write_barrier = true; |
140 // Argument to NewContext is the function, which is still in edi. | 141 // Argument to NewContext is the function, which is still in edi. |
141 int slots = info_->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 142 int slots = info_->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
142 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; | 143 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; |
143 if (info()->scope()->is_script_scope()) { | 144 if (info()->scope()->is_script_scope()) { |
144 __ push(edi); | 145 __ push(edi); |
145 __ Push(info()->scope()->scope_info()); | 146 __ Push(info()->scope()->scope_info()); |
146 __ CallRuntime(Runtime::kNewScriptContext); | 147 __ CallRuntime(Runtime::kNewScriptContext); |
147 deopt_mode = Safepoint::kLazyDeopt; | 148 deopt_mode = Safepoint::kLazyDeopt; |
148 } else { | 149 } else { |
149 if (slots <= FastNewFunctionContextStub::MaximumSlots()) { | 150 if (slots <= |
150 FastNewFunctionContextStub stub(isolate(), | 151 ConstructorBuiltinsAssembler::MaximumFunctionContextSlots()) { |
151 info()->scope()->scope_type()); | 152 Callable callable = CodeFactory::FastNewFunctionContext( |
| 153 isolate(), info()->scope()->scope_type()); |
152 __ mov(FastNewFunctionContextDescriptor::SlotsRegister(), | 154 __ mov(FastNewFunctionContextDescriptor::SlotsRegister(), |
153 Immediate(slots)); | 155 Immediate(slots)); |
154 __ CallStub(&stub); | 156 __ Call(callable.code(), RelocInfo::CODE_TARGET); |
155 // Result of FastNewFunctionContextStub is always in new space. | 157 // Result of the FastNewFunctionContext builtin is always in new space. |
156 need_write_barrier = false; | 158 need_write_barrier = false; |
157 } else { | 159 } else { |
158 __ push(edi); | 160 __ Push(edi); |
159 __ Push(Smi::FromInt(info()->scope()->scope_type())); | 161 __ Push(Smi::FromInt(info()->scope()->scope_type())); |
160 __ CallRuntime(Runtime::kNewFunctionContext); | 162 __ CallRuntime(Runtime::kNewFunctionContext); |
161 } | 163 } |
162 } | 164 } |
163 RecordSafepoint(deopt_mode); | 165 RecordSafepoint(deopt_mode); |
164 | 166 |
165 // Context is returned in eax. It replaces the context passed to us. | 167 // Context is returned in eax. It replaces the context passed to us. |
166 // It's saved in the stack and kept live in esi. | 168 // It's saved in the stack and kept live in esi. |
167 __ mov(esi, eax); | 169 __ mov(esi, eax); |
168 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), eax); | 170 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), eax); |
(...skipping 5481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5650 __ bind(deferred->exit()); | 5652 __ bind(deferred->exit()); |
5651 __ bind(&done); | 5653 __ bind(&done); |
5652 } | 5654 } |
5653 | 5655 |
5654 #undef __ | 5656 #undef __ |
5655 | 5657 |
5656 } // namespace internal | 5658 } // namespace internal |
5657 } // namespace v8 | 5659 } // namespace v8 |
5658 | 5660 |
5659 #endif // V8_TARGET_ARCH_X87 | 5661 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |