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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 } | 103 } |
104 | 104 |
105 | 105 |
106 // Generate code to check that a global property cell is empty. Create | 106 // Generate code to check that a global property cell is empty. Create |
107 // the property cell at compilation time if no cell exists for the | 107 // the property cell at compilation time if no cell exists for the |
108 // property. | 108 // property. |
109 void PropertyHandlerCompiler::GenerateCheckPropertyCell( | 109 void PropertyHandlerCompiler::GenerateCheckPropertyCell( |
110 MacroAssembler* masm, Handle<JSGlobalObject> global, Handle<Name> name, | 110 MacroAssembler* masm, Handle<JSGlobalObject> global, Handle<Name> name, |
111 Register scratch, Label* miss) { | 111 Register scratch, Label* miss) { |
112 Handle<PropertyCell> cell = JSGlobalObject::EnsurePropertyCell(global, name); | 112 Handle<PropertyCell> cell = JSGlobalObject::EnsurePropertyCell(global, name); |
113 DCHECK(cell->value()->IsTheHole()); | 113 Isolate* isolate = masm->isolate(); |
114 Handle<WeakCell> weak_cell = masm->isolate()->factory()->NewWeakCell(cell); | 114 DCHECK(cell->value()->IsTheHole(isolate)); |
| 115 Handle<WeakCell> weak_cell = isolate->factory()->NewWeakCell(cell); |
115 __ LoadWeakValue(scratch, weak_cell, miss); | 116 __ LoadWeakValue(scratch, weak_cell, miss); |
116 __ Ldr(scratch, FieldMemOperand(scratch, PropertyCell::kValueOffset)); | 117 __ Ldr(scratch, FieldMemOperand(scratch, PropertyCell::kValueOffset)); |
117 __ JumpIfNotRoot(scratch, Heap::kTheHoleValueRootIndex, miss); | 118 __ JumpIfNotRoot(scratch, Heap::kTheHoleValueRootIndex, miss); |
118 } | 119 } |
119 | 120 |
120 | 121 |
121 static void PushInterceptorArguments(MacroAssembler* masm, Register receiver, | 122 static void PushInterceptorArguments(MacroAssembler* masm, Register receiver, |
122 Register holder, Register name, | 123 Register holder, Register name, |
123 Handle<JSObject> holder_obj) { | 124 Handle<JSObject> holder_obj) { |
124 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex == 0); | 125 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex == 0); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 break; | 191 break; |
191 case CallOptimization::kHolderNotFound: | 192 case CallOptimization::kHolderNotFound: |
192 UNREACHABLE(); | 193 UNREACHABLE(); |
193 break; | 194 break; |
194 } | 195 } |
195 | 196 |
196 Isolate* isolate = masm->isolate(); | 197 Isolate* isolate = masm->isolate(); |
197 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); | 198 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); |
198 bool call_data_undefined = false; | 199 bool call_data_undefined = false; |
199 // Put call data in place. | 200 // Put call data in place. |
200 if (api_call_info->data()->IsUndefined()) { | 201 if (api_call_info->data()->IsUndefined(isolate)) { |
201 call_data_undefined = true; | 202 call_data_undefined = true; |
202 __ LoadRoot(data, Heap::kUndefinedValueRootIndex); | 203 __ LoadRoot(data, Heap::kUndefinedValueRootIndex); |
203 } else { | 204 } else { |
204 if (optimization.is_constant_call()) { | 205 if (optimization.is_constant_call()) { |
205 __ Ldr(data, | 206 __ Ldr(data, |
206 FieldMemOperand(callee, JSFunction::kSharedFunctionInfoOffset)); | 207 FieldMemOperand(callee, JSFunction::kSharedFunctionInfoOffset)); |
207 __ Ldr(data, | 208 __ Ldr(data, |
208 FieldMemOperand(data, SharedFunctionInfo::kFunctionDataOffset)); | 209 FieldMemOperand(data, SharedFunctionInfo::kFunctionDataOffset)); |
209 __ Ldr(data, | 210 __ Ldr(data, |
210 FieldMemOperand(data, FunctionTemplateInfo::kCallCodeOffset)); | 211 FieldMemOperand(data, FunctionTemplateInfo::kCallCodeOffset)); |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 // Return the constant value. | 599 // Return the constant value. |
599 __ LoadObject(x0, value); | 600 __ LoadObject(x0, value); |
600 __ Ret(); | 601 __ Ret(); |
601 } | 602 } |
602 | 603 |
603 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup( | 604 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup( |
604 LookupIterator* it, Register holder_reg) { | 605 LookupIterator* it, Register holder_reg) { |
605 DCHECK(!AreAliased(receiver(), this->name(), scratch1(), scratch2(), | 606 DCHECK(!AreAliased(receiver(), this->name(), scratch1(), scratch2(), |
606 scratch3())); | 607 scratch3())); |
607 DCHECK(holder()->HasNamedInterceptor()); | 608 DCHECK(holder()->HasNamedInterceptor()); |
608 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); | 609 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined(isolate())); |
609 | 610 |
610 // Compile the interceptor call, followed by inline code to load the | 611 // Compile the interceptor call, followed by inline code to load the |
611 // property from further up the prototype chain if the call fails. | 612 // property from further up the prototype chain if the call fails. |
612 // Check that the maps haven't changed. | 613 // Check that the maps haven't changed. |
613 DCHECK(holder_reg.is(receiver()) || holder_reg.is(scratch1())); | 614 DCHECK(holder_reg.is(receiver()) || holder_reg.is(scratch1())); |
614 | 615 |
615 // Preserve the receiver register explicitly whenever it is different from the | 616 // Preserve the receiver register explicitly whenever it is different from the |
616 // holder and it is needed should the interceptor return without any result. | 617 // holder and it is needed should the interceptor return without any result. |
617 // The ACCESSOR case needs the receiver to be passed into C++ code, the FIELD | 618 // The ACCESSOR case needs the receiver to be passed into C++ code, the FIELD |
618 // case might cause a miss during the prototype check. | 619 // case might cause a miss during the prototype check. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 // Leave the internal frame. | 658 // Leave the internal frame. |
658 } | 659 } |
659 | 660 |
660 GenerateLoadPostInterceptor(it, holder_reg); | 661 GenerateLoadPostInterceptor(it, holder_reg); |
661 } | 662 } |
662 | 663 |
663 | 664 |
664 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { | 665 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { |
665 // Call the runtime system to load the interceptor. | 666 // Call the runtime system to load the interceptor. |
666 DCHECK(holder()->HasNamedInterceptor()); | 667 DCHECK(holder()->HasNamedInterceptor()); |
667 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); | 668 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined(isolate())); |
668 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), | 669 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), |
669 holder()); | 670 holder()); |
670 | 671 |
671 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor); | 672 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor); |
672 } | 673 } |
673 | 674 |
674 | 675 |
675 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( | 676 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( |
676 Handle<JSObject> object, Handle<Name> name, Handle<AccessorInfo> callback, | 677 Handle<JSObject> object, Handle<Name> name, Handle<AccessorInfo> callback, |
677 LanguageMode language_mode) { | 678 LanguageMode language_mode) { |
678 ASM_LOCATION("NamedStoreHandlerCompiler::CompileStoreCallback"); | 679 ASM_LOCATION("NamedStoreHandlerCompiler::CompileStoreCallback"); |
679 Register holder_reg = Frontend(name); | 680 Register holder_reg = Frontend(name); |
680 | 681 |
681 // Stub never generated for non-global objects that require access checks. | 682 // Stub never generated for non-global objects that require access checks. |
682 DCHECK(holder()->IsJSGlobalProxy() || !holder()->IsAccessCheckNeeded()); | 683 DCHECK(holder()->IsJSGlobalProxy() || !holder()->IsAccessCheckNeeded()); |
683 | 684 |
684 // receiver() and holder_reg can alias. | 685 // receiver() and holder_reg can alias. |
685 DCHECK(!AreAliased(receiver(), scratch1(), scratch2(), value())); | 686 DCHECK(!AreAliased(receiver(), scratch1(), scratch2(), value())); |
686 DCHECK(!AreAliased(holder_reg, scratch1(), scratch2(), value())); | 687 DCHECK(!AreAliased(holder_reg, scratch1(), scratch2(), value())); |
687 // If the callback cannot leak, then push the callback directly, | 688 // If the callback cannot leak, then push the callback directly, |
688 // otherwise wrap it in a weak cell. | 689 // otherwise wrap it in a weak cell. |
689 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { | 690 if (callback->data()->IsUndefined(isolate()) || callback->data()->IsSmi()) { |
690 __ Mov(scratch1(), Operand(callback)); | 691 __ Mov(scratch1(), Operand(callback)); |
691 } else { | 692 } else { |
692 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); | 693 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); |
693 __ Mov(scratch1(), Operand(cell)); | 694 __ Mov(scratch1(), Operand(cell)); |
694 } | 695 } |
695 __ Mov(scratch2(), Operand(name)); | 696 __ Mov(scratch2(), Operand(name)); |
696 __ Push(receiver(), holder_reg, scratch1(), scratch2(), value()); | 697 __ Push(receiver(), holder_reg, scratch1(), scratch2(), value()); |
697 __ Push(Smi::FromInt(language_mode)); | 698 __ Push(Smi::FromInt(language_mode)); |
698 | 699 |
699 // Do tail-call to the runtime system. | 700 // Do tail-call to the runtime system. |
700 __ TailCallRuntime(Runtime::kStoreCallbackProperty); | 701 __ TailCallRuntime(Runtime::kStoreCallbackProperty); |
701 | 702 |
702 // Return the generated code. | 703 // Return the generated code. |
703 return GetCode(kind(), name); | 704 return GetCode(kind(), name); |
704 } | 705 } |
705 | 706 |
706 | 707 |
707 #undef __ | 708 #undef __ |
708 } // namespace internal | 709 } // namespace internal |
709 } // namespace v8 | 710 } // namespace v8 |
710 | 711 |
711 #endif // V8_TARGET_ARCH_IA32 | 712 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |