| 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/call-optimization.h" | 7 #include "src/ic/call-optimization.h" |
| 8 #include "src/ic/handler-compiler.h" | 8 #include "src/ic/handler-compiler.h" |
| 9 #include "src/ic/ic.h" | 9 #include "src/ic/ic.h" |
| 10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 } | 174 } |
| 175 | 175 |
| 176 Isolate* isolate = masm->isolate(); | 176 Isolate* isolate = masm->isolate(); |
| 177 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); | 177 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); |
| 178 bool call_data_undefined = false; | 178 bool call_data_undefined = false; |
| 179 // Put call data in place. | 179 // Put call data in place. |
| 180 if (api_call_info->data()->IsUndefined()) { | 180 if (api_call_info->data()->IsUndefined()) { |
| 181 call_data_undefined = true; | 181 call_data_undefined = true; |
| 182 __ LoadRoot(data, Heap::kUndefinedValueRootIndex); | 182 __ LoadRoot(data, Heap::kUndefinedValueRootIndex); |
| 183 } else { | 183 } else { |
| 184 __ movp(data, FieldOperand(callee, JSFunction::kSharedFunctionInfoOffset)); | 184 if (optimization.is_constant_call()) { |
| 185 __ movp(data, FieldOperand(data, SharedFunctionInfo::kFunctionDataOffset)); | 185 __ movp(data, |
| 186 __ movp(data, FieldOperand(data, FunctionTemplateInfo::kCallCodeOffset)); | 186 FieldOperand(callee, JSFunction::kSharedFunctionInfoOffset)); |
| 187 __ movp(data, |
| 188 FieldOperand(data, SharedFunctionInfo::kFunctionDataOffset)); |
| 189 __ movp(data, FieldOperand(data, FunctionTemplateInfo::kCallCodeOffset)); |
| 190 } else { |
| 191 __ movp(data, |
| 192 FieldOperand(callee, FunctionTemplateInfo::kCallCodeOffset)); |
| 193 } |
| 187 __ movp(data, FieldOperand(data, CallHandlerInfo::kDataOffset)); | 194 __ movp(data, FieldOperand(data, CallHandlerInfo::kDataOffset)); |
| 188 } | 195 } |
| 189 | 196 |
| 190 if (api_call_info->fast_handler()->IsCode()) { | 197 if (api_call_info->fast_handler()->IsCode()) { |
| 191 // Just tail call into the fast handler if present. | 198 // Just tail call into the fast handler if present. |
| 192 __ Jump(handle(Code::cast(api_call_info->fast_handler())), | 199 __ Jump(handle(Code::cast(api_call_info->fast_handler())), |
| 193 RelocInfo::CODE_TARGET); | 200 RelocInfo::CODE_TARGET); |
| 194 return; | 201 return; |
| 195 } | 202 } |
| 196 | 203 |
| 197 // Put api_function_address in place. | 204 // Put api_function_address in place. |
| 198 Address function_address = v8::ToCData<Address>(api_call_info->callback()); | 205 Address function_address = v8::ToCData<Address>(api_call_info->callback()); |
| 199 __ Move(api_function_address, function_address, | 206 __ Move(api_function_address, function_address, |
| 200 RelocInfo::EXTERNAL_REFERENCE); | 207 RelocInfo::EXTERNAL_REFERENCE); |
| 201 | 208 |
| 202 // Jump to stub. | 209 // Jump to stub. |
| 203 CallApiAccessorStub stub(isolate, is_store, call_data_undefined); | 210 CallApiAccessorStub stub(isolate, is_store, call_data_undefined, |
| 211 !optimization.is_constant_call()); |
| 204 __ TailCallStub(&stub); | 212 __ TailCallStub(&stub); |
| 205 } | 213 } |
| 206 | 214 |
| 207 | 215 |
| 208 void PropertyHandlerCompiler::GenerateCheckPropertyCell( | 216 void PropertyHandlerCompiler::GenerateCheckPropertyCell( |
| 209 MacroAssembler* masm, Handle<JSGlobalObject> global, Handle<Name> name, | 217 MacroAssembler* masm, Handle<JSGlobalObject> global, Handle<Name> name, |
| 210 Register scratch, Label* miss) { | 218 Register scratch, Label* miss) { |
| 211 Handle<PropertyCell> cell = JSGlobalObject::EnsurePropertyCell(global, name); | 219 Handle<PropertyCell> cell = JSGlobalObject::EnsurePropertyCell(global, name); |
| 212 DCHECK(cell->value()->IsTheHole()); | 220 DCHECK(cell->value()->IsTheHole()); |
| 213 Factory* factory = masm->isolate()->factory(); | 221 Factory* factory = masm->isolate()->factory(); |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 // Return the generated code. | 808 // Return the generated code. |
| 801 return GetCode(kind(), Code::NORMAL, name); | 809 return GetCode(kind(), Code::NORMAL, name); |
| 802 } | 810 } |
| 803 | 811 |
| 804 | 812 |
| 805 #undef __ | 813 #undef __ |
| 806 } // namespace internal | 814 } // namespace internal |
| 807 } // namespace v8 | 815 } // namespace v8 |
| 808 | 816 |
| 809 #endif // V8_TARGET_ARCH_X64 | 817 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |