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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 Label success; | 587 Label success; |
588 __ jmp(&success); | 588 __ jmp(&success); |
589 GenerateRestoreName(miss, name); | 589 GenerateRestoreName(miss, name); |
590 if (IC::ICUseVector(kind())) PopVectorAndSlot(); | 590 if (IC::ICUseVector(kind())) PopVectorAndSlot(); |
591 TailCallBuiltin(masm(), MissBuiltin(kind())); | 591 TailCallBuiltin(masm(), MissBuiltin(kind())); |
592 __ bind(&success); | 592 __ bind(&success); |
593 } | 593 } |
594 } | 594 } |
595 | 595 |
596 | 596 |
| 597 void NamedLoadHandlerCompiler::GenerateLoadCallback( |
| 598 Register reg, Handle<AccessorInfo> callback) { |
| 599 DCHECK(!AreAliased(scratch2(), scratch3(), receiver())); |
| 600 DCHECK(!AreAliased(scratch2(), scratch3(), reg)); |
| 601 |
| 602 // Insert additional parameters into the stack frame above return address. |
| 603 __ pop(scratch3()); // Get return address to place it below. |
| 604 |
| 605 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property |
| 606 // name below the exit frame to make GC aware of them. |
| 607 STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0); |
| 608 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1); |
| 609 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2); |
| 610 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3); |
| 611 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4); |
| 612 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5); |
| 613 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6); |
| 614 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7); |
| 615 |
| 616 __ push(receiver()); // receiver |
| 617 // Push data from AccessorInfo. |
| 618 Handle<Object> data(callback->data(), isolate()); |
| 619 if (data->IsUndefined() || data->IsSmi()) { |
| 620 __ push(Immediate(data)); |
| 621 } else { |
| 622 Handle<WeakCell> cell = |
| 623 isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data)); |
| 624 // The callback is alive if this instruction is executed, |
| 625 // so the weak cell is not cleared and points to data. |
| 626 __ GetWeakValue(scratch2(), cell); |
| 627 __ push(scratch2()); |
| 628 } |
| 629 __ push(Immediate(isolate()->factory()->undefined_value())); // ReturnValue |
| 630 // ReturnValue default value |
| 631 __ push(Immediate(isolate()->factory()->undefined_value())); |
| 632 __ push(Immediate(reinterpret_cast<int>(isolate()))); |
| 633 __ push(reg); // holder |
| 634 __ push(Immediate(Smi::FromInt(0))); // should_throw_on_error -> false |
| 635 |
| 636 __ push(name()); // name |
| 637 __ push(scratch3()); // Restore return address. |
| 638 |
| 639 // Abi for CallApiGetter |
| 640 Register getter_address = ApiGetterDescriptor::function_address(); |
| 641 Address function_address = v8::ToCData<Address>(callback->getter()); |
| 642 __ mov(getter_address, Immediate(function_address)); |
| 643 |
| 644 CallApiGetterStub stub(isolate()); |
| 645 __ TailCallStub(&stub); |
| 646 } |
| 647 |
| 648 |
597 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { | 649 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { |
598 // Return the constant value. | 650 // Return the constant value. |
599 __ LoadObject(eax, value); | 651 __ LoadObject(eax, value); |
600 __ ret(0); | 652 __ ret(0); |
601 } | 653 } |
602 | 654 |
603 | 655 |
604 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup( | 656 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup( |
605 LookupIterator* it, Register holder_reg) { | 657 LookupIterator* it, Register holder_reg) { |
606 DCHECK(holder()->HasNamedInterceptor()); | 658 DCHECK(holder()->HasNamedInterceptor()); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 // Return the generated code. | 803 // Return the generated code. |
752 return GetCode(kind(), name); | 804 return GetCode(kind(), name); |
753 } | 805 } |
754 | 806 |
755 | 807 |
756 #undef __ | 808 #undef __ |
757 } // namespace internal | 809 } // namespace internal |
758 } // namespace v8 | 810 } // namespace v8 |
759 | 811 |
760 #endif // V8_TARGET_ARCH_IA32 | 812 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |