OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/ic/handler-compiler.h" | 7 #include "src/ic/handler-compiler.h" |
8 | 8 |
9 #include "src/api-arguments.h" | 9 #include "src/api-arguments.h" |
10 #include "src/field-type.h" | 10 #include "src/field-type.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 int accessor_index) { | 164 int accessor_index) { |
165 DCHECK(!accessor_holder.is(scratch)); | 165 DCHECK(!accessor_holder.is(scratch)); |
166 // Copy return value. | 166 // Copy return value. |
167 __ pop(scratch); | 167 __ pop(scratch); |
168 | 168 |
169 if (is_store) { | 169 if (is_store) { |
170 // Discard stack arguments. | 170 // Discard stack arguments. |
171 __ add(esp, Immediate(StoreWithVectorDescriptor::kStackArgumentsCount * | 171 __ add(esp, Immediate(StoreWithVectorDescriptor::kStackArgumentsCount * |
172 kPointerSize)); | 172 kPointerSize)); |
173 } | 173 } |
174 | 174 // Write the receiver and arguments to stack frame. |
175 // receiver | |
176 __ push(receiver); | 175 __ push(receiver); |
177 // Write the arguments to stack frame. | |
178 if (is_store) { | 176 if (is_store) { |
179 DCHECK(!receiver.is(store_parameter)); | 177 DCHECK(!AreAliased(receiver, scratch, store_parameter)); |
180 DCHECK(!scratch.is(store_parameter)); | |
181 __ push(store_parameter); | 178 __ push(store_parameter); |
182 } | 179 } |
183 __ push(scratch); | 180 __ push(scratch); |
184 // Stack now matches JSFunction abi. | 181 // Stack now matches JSFunction abi. |
185 DCHECK(optimization.is_simple_api_call()); | 182 DCHECK(optimization.is_simple_api_call()); |
186 | 183 |
187 // Abi for CallApiCallbackStub. | 184 // Abi for CallApiCallbackStub. |
188 Register callee = edi; | 185 Register callee = edi; |
189 Register data = ebx; | 186 Register data = ebx; |
190 Register holder = ecx; | 187 Register holder = ecx; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 __ cmp(FieldOperand(scratch, PropertyCell::kValueOffset), | 264 __ cmp(FieldOperand(scratch, PropertyCell::kValueOffset), |
268 Immediate(isolate->factory()->the_hole_value())); | 265 Immediate(isolate->factory()->the_hole_value())); |
269 __ j(not_equal, miss); | 266 __ j(not_equal, miss); |
270 } | 267 } |
271 | 268 |
272 | 269 |
273 void NamedStoreHandlerCompiler::GenerateStoreViaSetter( | 270 void NamedStoreHandlerCompiler::GenerateStoreViaSetter( |
274 MacroAssembler* masm, Handle<Map> map, Register receiver, Register holder, | 271 MacroAssembler* masm, Handle<Map> map, Register receiver, Register holder, |
275 int accessor_index, int expected_arguments, Register scratch) { | 272 int accessor_index, int expected_arguments, Register scratch) { |
276 // ----------- S t a t e ------------- | 273 // ----------- S t a t e ------------- |
277 // -- esp[0] : return address | 274 // -- esp[12] : value |
| 275 // -- esp[8] : slot |
| 276 // -- esp[4] : vector |
| 277 // -- esp[0] : return address |
278 // ----------------------------------- | 278 // ----------------------------------- |
| 279 __ LoadParameterFromStack<Descriptor>(value(), Descriptor::kValue); |
| 280 |
279 { | 281 { |
280 FrameScope scope(masm, StackFrame::INTERNAL); | 282 FrameScope scope(masm, StackFrame::INTERNAL); |
281 | 283 |
282 // Save context register | 284 // Save context register |
283 __ push(esi); | 285 __ push(esi); |
284 // Save value register, so we can restore it later. | 286 // Save value register, so we can restore it later. |
285 __ push(value()); | 287 __ push(value()); |
286 | 288 |
287 if (accessor_index >= 0) { | 289 if (accessor_index >= 0) { |
288 DCHECK(!holder.is(scratch)); | 290 DCHECK(!holder.is(scratch)); |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined(isolate())); | 626 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined(isolate())); |
625 // Call the runtime system to load the interceptor. | 627 // Call the runtime system to load the interceptor. |
626 __ pop(scratch2()); // save old return address | 628 __ pop(scratch2()); // save old return address |
627 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), | 629 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), |
628 holder()); | 630 holder()); |
629 __ push(scratch2()); // restore old return address | 631 __ push(scratch2()); // restore old return address |
630 | 632 |
631 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor); | 633 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor); |
632 } | 634 } |
633 | 635 |
| 636 void NamedStoreHandlerCompiler::ZapStackArgumentsRegisterAliases() { |
| 637 // Zap register aliases of the arguments passed on the stack to ensure they |
| 638 // are properly loaded by the handler (debug-only). |
| 639 STATIC_ASSERT(Descriptor::kPassLastArgsOnStack); |
| 640 STATIC_ASSERT(Descriptor::kStackArgumentsCount == 3); |
| 641 __ mov(Descriptor::ValueRegister(), Immediate(kDebugZapValue)); |
| 642 __ mov(Descriptor::SlotRegister(), Immediate(kDebugZapValue)); |
| 643 __ mov(Descriptor::VectorRegister(), Immediate(kDebugZapValue)); |
| 644 } |
634 | 645 |
635 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( | 646 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( |
636 Handle<JSObject> object, Handle<Name> name, Handle<AccessorInfo> callback, | 647 Handle<JSObject> object, Handle<Name> name, Handle<AccessorInfo> callback, |
637 LanguageMode language_mode) { | 648 LanguageMode language_mode) { |
638 Register holder_reg = Frontend(name); | 649 Register holder_reg = Frontend(name); |
| 650 __ LoadParameterFromStack<Descriptor>(value(), Descriptor::kValue); |
639 | 651 |
640 __ pop(scratch1()); // remove the return address | 652 __ pop(scratch1()); // remove the return address |
641 // Discard stack arguments. | 653 // Discard stack arguments. |
642 __ add(esp, Immediate(StoreWithVectorDescriptor::kStackArgumentsCount * | 654 __ add(esp, Immediate(StoreWithVectorDescriptor::kStackArgumentsCount * |
643 kPointerSize)); | 655 kPointerSize)); |
644 __ push(receiver()); | 656 __ push(receiver()); |
645 __ push(holder_reg); | 657 __ push(holder_reg); |
646 // If the callback cannot leak, then push the callback directly, | 658 // If the callback cannot leak, then push the callback directly, |
647 // otherwise wrap it in a weak cell. | 659 // otherwise wrap it in a weak cell. |
648 if (callback->data()->IsUndefined(isolate()) || callback->data()->IsSmi()) { | 660 if (callback->data()->IsUndefined(isolate()) || callback->data()->IsSmi()) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 // Return the generated code. | 716 // Return the generated code. |
705 return GetCode(kind(), name); | 717 return GetCode(kind(), name); |
706 } | 718 } |
707 | 719 |
708 | 720 |
709 #undef __ | 721 #undef __ |
710 } // namespace internal | 722 } // namespace internal |
711 } // namespace v8 | 723 } // namespace v8 |
712 | 724 |
713 #endif // V8_TARGET_ARCH_IA32 | 725 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |