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_X64 | 5 #if V8_TARGET_ARCH_X64 |
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 __ Push(store_parameter); | 102 __ Push(store_parameter); |
103 } | 103 } |
104 __ PushReturnAddressFrom(scratch); | 104 __ PushReturnAddressFrom(scratch); |
105 // Stack now matches JSFunction abi. | 105 // Stack now matches JSFunction abi. |
106 | 106 |
107 // Abi for CallApiCallbackStub. | 107 // Abi for CallApiCallbackStub. |
108 Register callee = rdi; | 108 Register callee = rdi; |
109 Register data = rbx; | 109 Register data = rbx; |
110 Register holder = rcx; | 110 Register holder = rcx; |
111 Register api_function_address = rdx; | 111 Register api_function_address = rdx; |
112 scratch = no_reg; | 112 Register context = rsi; |
113 | 113 |
114 // Put callee in place. | 114 // Put callee in place. |
115 __ LoadAccessor(callee, accessor_holder, accessor_index, | 115 __ LoadAccessor(callee, accessor_holder, accessor_index, |
116 is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER); | 116 is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER); |
117 | 117 |
118 // Put holder in place. | 118 // Put holder in place. |
119 CallOptimization::HolderLookup holder_lookup; | 119 CallOptimization::HolderLookup holder_lookup; |
120 optimization.LookupHolderOfExpectedType(receiver_map, &holder_lookup); | 120 optimization.LookupHolderOfExpectedType(receiver_map, &holder_lookup); |
121 switch (holder_lookup) { | 121 switch (holder_lookup) { |
122 case CallOptimization::kHolderIsReceiver: | 122 case CallOptimization::kHolderIsReceiver: |
(...skipping 25 matching lines...) Expand all Loading... |
148 FieldOperand(callee, FunctionTemplateInfo::kCallCodeOffset)); | 148 FieldOperand(callee, FunctionTemplateInfo::kCallCodeOffset)); |
149 } | 149 } |
150 __ movp(data, FieldOperand(data, CallHandlerInfo::kDataOffset)); | 150 __ movp(data, FieldOperand(data, CallHandlerInfo::kDataOffset)); |
151 } | 151 } |
152 | 152 |
153 // Put api_function_address in place. | 153 // Put api_function_address in place. |
154 Address function_address = v8::ToCData<Address>(api_call_info->callback()); | 154 Address function_address = v8::ToCData<Address>(api_call_info->callback()); |
155 __ Move(api_function_address, function_address, | 155 __ Move(api_function_address, function_address, |
156 RelocInfo::EXTERNAL_REFERENCE); | 156 RelocInfo::EXTERNAL_REFERENCE); |
157 | 157 |
| 158 // Put context in place. |
| 159 const bool is_lazy = !optimization.is_constant_call(); |
| 160 if (is_lazy) { |
| 161 // load context from holder |
| 162 __ movp(scratch, FieldOperand(holder, HeapObject::kMapOffset)); |
| 163 __ GetMapConstructor(scratch, scratch, context); |
| 164 __ movp(context, FieldOperand(scratch, JSFunction::kContextOffset)); |
| 165 } else { |
| 166 // load context from callee |
| 167 __ movp(context, FieldOperand(callee, JSFunction::kContextOffset)); |
| 168 } |
| 169 |
158 // Jump to stub. | 170 // Jump to stub. |
159 CallApiCallbackStub stub(isolate, is_store, !optimization.is_constant_call()); | 171 CallApiCallbackStub stub(isolate, is_store, is_lazy); |
160 __ TailCallStub(&stub); | 172 __ TailCallStub(&stub); |
161 } | 173 } |
162 | 174 |
163 | 175 |
164 void PropertyHandlerCompiler::GenerateCheckPropertyCell( | 176 void PropertyHandlerCompiler::GenerateCheckPropertyCell( |
165 MacroAssembler* masm, Handle<JSGlobalObject> global, Handle<Name> name, | 177 MacroAssembler* masm, Handle<JSGlobalObject> global, Handle<Name> name, |
166 Register scratch, Label* miss) { | 178 Register scratch, Label* miss) { |
167 Handle<PropertyCell> cell = JSGlobalObject::EnsureEmptyPropertyCell( | 179 Handle<PropertyCell> cell = JSGlobalObject::EnsureEmptyPropertyCell( |
168 global, name, PropertyCellType::kInvalidated); | 180 global, name, PropertyCellType::kInvalidated); |
169 Isolate* isolate = masm->isolate(); | 181 Isolate* isolate = masm->isolate(); |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 Register NamedStoreHandlerCompiler::value() { | 423 Register NamedStoreHandlerCompiler::value() { |
412 return StoreDescriptor::ValueRegister(); | 424 return StoreDescriptor::ValueRegister(); |
413 } | 425 } |
414 | 426 |
415 | 427 |
416 #undef __ | 428 #undef __ |
417 } // namespace internal | 429 } // namespace internal |
418 } // namespace v8 | 430 } // namespace v8 |
419 | 431 |
420 #endif // V8_TARGET_ARCH_X64 | 432 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |