| 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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); | 130 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); |
| 131 __ mov(eax, scratch1); | 131 __ mov(eax, scratch1); |
| 132 __ ret(0); | 132 __ ret(0); |
| 133 } | 133 } |
| 134 | 134 |
| 135 | 135 |
| 136 // Generate call to api function. | 136 // Generate call to api function. |
| 137 // This function uses push() to generate smaller, faster code than | 137 // This function uses push() to generate smaller, faster code than |
| 138 // the version above. It is an optimization that should will be removed | 138 // the version above. It is an optimization that should will be removed |
| 139 // when api call ICs are generated in hydrogen. | 139 // when api call ICs are generated in hydrogen. |
| 140 void PropertyHandlerCompiler::GenerateFastApiCall( | 140 void PropertyHandlerCompiler::GenerateApiAccessorCall( |
| 141 MacroAssembler* masm, const CallOptimization& optimization, | 141 MacroAssembler* masm, const CallOptimization& optimization, |
| 142 Handle<Map> receiver_map, Register receiver, Register scratch_in, | 142 Handle<Map> receiver_map, Register receiver, Register scratch_in, |
| 143 bool is_store, int argc, Register* values) { | 143 bool is_store, Register store_parameter) { |
| 144 // Copy return value. | 144 // Copy return value. |
| 145 __ pop(scratch_in); | 145 __ pop(scratch_in); |
| 146 // receiver | 146 // receiver |
| 147 __ push(receiver); | 147 __ push(receiver); |
| 148 // Write the arguments to stack frame. | 148 // Write the arguments to stack frame. |
| 149 for (int i = 0; i < argc; i++) { | 149 if (is_store) { |
| 150 Register arg = values[argc - 1 - i]; | 150 DCHECK(!receiver.is(store_parameter)); |
| 151 DCHECK(!receiver.is(arg)); | 151 DCHECK(!scratch_in.is(store_parameter)); |
| 152 DCHECK(!scratch_in.is(arg)); | 152 __ push(store_parameter); |
| 153 __ push(arg); | |
| 154 } | 153 } |
| 155 __ push(scratch_in); | 154 __ push(scratch_in); |
| 156 // Stack now matches JSFunction abi. | 155 // Stack now matches JSFunction abi. |
| 157 DCHECK(optimization.is_simple_api_call()); | 156 DCHECK(optimization.is_simple_api_call()); |
| 158 | 157 |
| 159 // Abi for CallApiFunctionStub. | 158 // Abi for CallApiFunctionStub. |
| 160 Register callee = eax; | 159 Register callee = eax; |
| 161 Register call_data = ebx; | 160 Register call_data = ebx; |
| 162 Register holder = ecx; | 161 Register holder = ecx; |
| 163 Register api_function_address = edx; | 162 Register api_function_address = edx; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 __ mov(call_data, Immediate(isolate->factory()->undefined_value())); | 196 __ mov(call_data, Immediate(isolate->factory()->undefined_value())); |
| 198 } else { | 197 } else { |
| 199 __ mov(call_data, call_data_obj); | 198 __ mov(call_data, call_data_obj); |
| 200 } | 199 } |
| 201 | 200 |
| 202 // Put api_function_address in place. | 201 // Put api_function_address in place. |
| 203 Address function_address = v8::ToCData<Address>(api_call_info->callback()); | 202 Address function_address = v8::ToCData<Address>(api_call_info->callback()); |
| 204 __ mov(api_function_address, Immediate(function_address)); | 203 __ mov(api_function_address, Immediate(function_address)); |
| 205 | 204 |
| 206 // Jump to stub. | 205 // Jump to stub. |
| 207 CallApiFunctionStub stub(isolate, is_store, call_data_undefined, argc); | 206 CallApiAccessorStub stub(isolate, is_store, call_data_undefined); |
| 208 __ TailCallStub(&stub); | 207 __ TailCallStub(&stub); |
| 209 } | 208 } |
| 210 | 209 |
| 211 | 210 |
| 212 // Generate code to check that a global property cell is empty. Create | 211 // Generate code to check that a global property cell is empty. Create |
| 213 // the property cell at compilation time if no cell exists for the | 212 // the property cell at compilation time if no cell exists for the |
| 214 // property. | 213 // property. |
| 215 void PropertyHandlerCompiler::GenerateCheckPropertyCell( | 214 void PropertyHandlerCompiler::GenerateCheckPropertyCell( |
| 216 MacroAssembler* masm, Handle<JSGlobalObject> global, Handle<Name> name, | 215 MacroAssembler* masm, Handle<JSGlobalObject> global, Handle<Name> name, |
| 217 Register scratch, Label* miss) { | 216 Register scratch, Label* miss) { |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 // Return the generated code. | 754 // Return the generated code. |
| 756 return GetCode(kind(), Code::NORMAL, name); | 755 return GetCode(kind(), Code::NORMAL, name); |
| 757 } | 756 } |
| 758 | 757 |
| 759 | 758 |
| 760 #undef __ | 759 #undef __ |
| 761 } | 760 } |
| 762 } // namespace v8::internal | 761 } // namespace v8::internal |
| 763 | 762 |
| 764 #endif // V8_TARGET_ARCH_IA32 | 763 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |