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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/ic/call-optimization.h" | 9 #include "src/ic/call-optimization.h" |
10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 static void CompileCallLoadPropertyWithInterceptor( | 121 static void CompileCallLoadPropertyWithInterceptor( |
122 MacroAssembler* masm, Register receiver, Register holder, Register name, | 122 MacroAssembler* masm, Register receiver, Register holder, Register name, |
123 Handle<JSObject> holder_obj, IC::UtilityId id) { | 123 Handle<JSObject> holder_obj, IC::UtilityId id) { |
124 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); | 124 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); |
125 __ CallExternalReference(ExternalReference(IC_Utility(id), masm->isolate()), | 125 __ CallExternalReference(ExternalReference(IC_Utility(id), masm->isolate()), |
126 NamedLoadHandlerCompiler::kInterceptorArgsLength); | 126 NamedLoadHandlerCompiler::kInterceptorArgsLength); |
127 } | 127 } |
128 | 128 |
129 | 129 |
130 // Generate call to api function. | 130 // Generate call to api function. |
131 void PropertyHandlerCompiler::GenerateFastApiCall( | 131 void PropertyHandlerCompiler::GenerateApiAccessorCall( |
132 MacroAssembler* masm, const CallOptimization& optimization, | 132 MacroAssembler* masm, const CallOptimization& optimization, |
133 Handle<Map> receiver_map, Register receiver, Register scratch_in, | 133 Handle<Map> receiver_map, Register receiver, Register scratch_in, |
134 bool is_store, int argc, Register* values) { | 134 bool is_store, Register store_parameter) { |
135 DCHECK(optimization.is_simple_api_call()); | 135 DCHECK(optimization.is_simple_api_call()); |
136 | 136 |
137 __ PopReturnAddressTo(scratch_in); | 137 __ PopReturnAddressTo(scratch_in); |
138 // receiver | 138 // receiver |
139 __ Push(receiver); | 139 __ Push(receiver); |
140 // Write the arguments to stack frame. | 140 // Write the arguments to stack frame. |
141 for (int i = 0; i < argc; i++) { | 141 if (is_store) { |
142 Register arg = values[argc - 1 - i]; | 142 DCHECK(!receiver.is(store_parameter)); |
143 DCHECK(!receiver.is(arg)); | 143 DCHECK(!scratch_in.is(store_parameter)); |
144 DCHECK(!scratch_in.is(arg)); | 144 __ Push(store_parameter); |
145 __ Push(arg); | |
146 } | 145 } |
147 __ PushReturnAddressFrom(scratch_in); | 146 __ PushReturnAddressFrom(scratch_in); |
148 // Stack now matches JSFunction abi. | 147 // Stack now matches JSFunction abi. |
149 | 148 |
150 // Abi for CallApiFunctionStub. | 149 // Abi for CallApiFunctionStub. |
151 Register callee = rax; | 150 Register callee = rax; |
152 Register call_data = rbx; | 151 Register call_data = rbx; |
153 Register holder = rcx; | 152 Register holder = rcx; |
154 Register api_function_address = rdx; | 153 Register api_function_address = rdx; |
155 Register scratch = rdi; // scratch_in is no longer valid. | 154 Register scratch = rdi; // scratch_in is no longer valid. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 } else { | 188 } else { |
190 __ Move(call_data, call_data_obj); | 189 __ Move(call_data, call_data_obj); |
191 } | 190 } |
192 | 191 |
193 // Put api_function_address in place. | 192 // Put api_function_address in place. |
194 Address function_address = v8::ToCData<Address>(api_call_info->callback()); | 193 Address function_address = v8::ToCData<Address>(api_call_info->callback()); |
195 __ Move(api_function_address, function_address, | 194 __ Move(api_function_address, function_address, |
196 RelocInfo::EXTERNAL_REFERENCE); | 195 RelocInfo::EXTERNAL_REFERENCE); |
197 | 196 |
198 // Jump to stub. | 197 // Jump to stub. |
199 CallApiFunctionStub stub(isolate, is_store, call_data_undefined, argc); | 198 CallApiAccessorStub stub(isolate, is_store, call_data_undefined); |
200 __ TailCallStub(&stub); | 199 __ TailCallStub(&stub); |
201 } | 200 } |
202 | 201 |
203 | 202 |
204 void PropertyHandlerCompiler::GenerateCheckPropertyCell( | 203 void PropertyHandlerCompiler::GenerateCheckPropertyCell( |
205 MacroAssembler* masm, Handle<JSGlobalObject> global, Handle<Name> name, | 204 MacroAssembler* masm, Handle<JSGlobalObject> global, Handle<Name> name, |
206 Register scratch, Label* miss) { | 205 Register scratch, Label* miss) { |
207 Handle<PropertyCell> cell = JSGlobalObject::EnsurePropertyCell(global, name); | 206 Handle<PropertyCell> cell = JSGlobalObject::EnsurePropertyCell(global, name); |
208 DCHECK(cell->value()->IsTheHole()); | 207 DCHECK(cell->value()->IsTheHole()); |
209 __ Move(scratch, cell); | 208 __ Move(scratch, cell); |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 // Return the generated code. | 741 // Return the generated code. |
743 return GetCode(kind(), Code::NORMAL, name); | 742 return GetCode(kind(), Code::NORMAL, name); |
744 } | 743 } |
745 | 744 |
746 | 745 |
747 #undef __ | 746 #undef __ |
748 } | 747 } |
749 } // namespace v8::internal | 748 } // namespace v8::internal |
750 | 749 |
751 #endif // V8_TARGET_ARCH_X64 | 750 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |