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/field-type.h" | 9 #include "src/field-type.h" |
10 #include "src/ic/call-optimization.h" | 10 #include "src/ic/call-optimization.h" |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 | 231 |
232 void NamedStoreHandlerCompiler::GenerateStoreViaSetter( | 232 void NamedStoreHandlerCompiler::GenerateStoreViaSetter( |
233 MacroAssembler* masm, Handle<Map> map, Register receiver, Register holder, | 233 MacroAssembler* masm, Handle<Map> map, Register receiver, Register holder, |
234 int accessor_index, int expected_arguments, Register scratch) { | 234 int accessor_index, int expected_arguments, Register scratch) { |
235 // ----------- S t a t e ------------- | 235 // ----------- S t a t e ------------- |
236 // -- rsp[0] : return address | 236 // -- rsp[0] : return address |
237 // ----------------------------------- | 237 // ----------------------------------- |
238 { | 238 { |
239 FrameScope scope(masm, StackFrame::INTERNAL); | 239 FrameScope scope(masm, StackFrame::INTERNAL); |
240 | 240 |
| 241 // Save context register |
| 242 __ pushq(rsi); |
241 // Save value register, so we can restore it later. | 243 // Save value register, so we can restore it later. |
242 __ Push(value()); | 244 __ Push(value()); |
243 | 245 |
244 if (accessor_index >= 0) { | 246 if (accessor_index >= 0) { |
245 DCHECK(!holder.is(scratch)); | 247 DCHECK(!holder.is(scratch)); |
246 DCHECK(!receiver.is(scratch)); | 248 DCHECK(!receiver.is(scratch)); |
247 DCHECK(!value().is(scratch)); | 249 DCHECK(!value().is(scratch)); |
248 // Call the JavaScript setter with receiver and value on the stack. | 250 // Call the JavaScript setter with receiver and value on the stack. |
249 if (map->IsJSGlobalObjectMap()) { | 251 if (map->IsJSGlobalObjectMap()) { |
250 // Swap in the global receiver. | 252 // Swap in the global receiver. |
(...skipping 11 matching lines...) Expand all Loading... |
262 } else { | 264 } else { |
263 // If we generate a global code snippet for deoptimization only, remember | 265 // If we generate a global code snippet for deoptimization only, remember |
264 // the place to continue after deoptimization. | 266 // the place to continue after deoptimization. |
265 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); | 267 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); |
266 } | 268 } |
267 | 269 |
268 // We have to return the passed value, not the return value of the setter. | 270 // We have to return the passed value, not the return value of the setter. |
269 __ Pop(rax); | 271 __ Pop(rax); |
270 | 272 |
271 // Restore context register. | 273 // Restore context register. |
272 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 274 __ popq(rsi); |
273 } | 275 } |
274 __ ret(0); | 276 __ ret(0); |
275 } | 277 } |
276 | 278 |
277 | 279 |
278 void NamedLoadHandlerCompiler::GenerateLoadViaGetter( | 280 void NamedLoadHandlerCompiler::GenerateLoadViaGetter( |
279 MacroAssembler* masm, Handle<Map> map, Register receiver, Register holder, | 281 MacroAssembler* masm, Handle<Map> map, Register receiver, Register holder, |
280 int accessor_index, int expected_arguments, Register scratch) { | 282 int accessor_index, int expected_arguments, Register scratch) { |
281 // ----------- S t a t e ------------- | 283 // ----------- S t a t e ------------- |
282 // -- rax : receiver | 284 // -- rax : receiver |
283 // -- rcx : name | 285 // -- rcx : name |
284 // -- rsp[0] : return address | 286 // -- rsp[0] : return address |
285 // ----------------------------------- | 287 // ----------------------------------- |
286 { | 288 { |
287 FrameScope scope(masm, StackFrame::INTERNAL); | 289 FrameScope scope(masm, StackFrame::INTERNAL); |
288 | 290 |
| 291 // Save context register |
| 292 __ pushq(rsi); |
| 293 |
289 if (accessor_index >= 0) { | 294 if (accessor_index >= 0) { |
290 DCHECK(!holder.is(scratch)); | 295 DCHECK(!holder.is(scratch)); |
291 DCHECK(!receiver.is(scratch)); | 296 DCHECK(!receiver.is(scratch)); |
292 // Call the JavaScript getter with the receiver on the stack. | 297 // Call the JavaScript getter with the receiver on the stack. |
293 if (map->IsJSGlobalObjectMap()) { | 298 if (map->IsJSGlobalObjectMap()) { |
294 // Swap in the global receiver. | 299 // Swap in the global receiver. |
295 __ movp(scratch, | 300 __ movp(scratch, |
296 FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); | 301 FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); |
297 receiver = scratch; | 302 receiver = scratch; |
298 } | 303 } |
299 __ Push(receiver); | 304 __ Push(receiver); |
300 ParameterCount actual(0); | 305 ParameterCount actual(0); |
301 ParameterCount expected(expected_arguments); | 306 ParameterCount expected(expected_arguments); |
302 __ LoadAccessor(rdi, holder, accessor_index, ACCESSOR_GETTER); | 307 __ LoadAccessor(rdi, holder, accessor_index, ACCESSOR_GETTER); |
303 __ InvokeFunction(rdi, no_reg, expected, actual, CALL_FUNCTION, | 308 __ InvokeFunction(rdi, no_reg, expected, actual, CALL_FUNCTION, |
304 CheckDebugStepCallWrapper()); | 309 CheckDebugStepCallWrapper()); |
305 } else { | 310 } else { |
306 // If we generate a global code snippet for deoptimization only, remember | 311 // If we generate a global code snippet for deoptimization only, remember |
307 // the place to continue after deoptimization. | 312 // the place to continue after deoptimization. |
308 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); | 313 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); |
309 } | 314 } |
310 | 315 |
311 // Restore context register. | 316 // Restore context register. |
312 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 317 __ popq(rsi); |
313 } | 318 } |
314 __ ret(0); | 319 __ ret(0); |
315 } | 320 } |
316 | 321 |
317 | 322 |
318 static void StoreIC_PushArgs(MacroAssembler* masm) { | 323 static void StoreIC_PushArgs(MacroAssembler* masm) { |
319 Register receiver = StoreDescriptor::ReceiverRegister(); | 324 Register receiver = StoreDescriptor::ReceiverRegister(); |
320 Register name = StoreDescriptor::NameRegister(); | 325 Register name = StoreDescriptor::NameRegister(); |
321 Register value = StoreDescriptor::ValueRegister(); | 326 Register value = StoreDescriptor::ValueRegister(); |
322 | 327 |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 // Return the generated code. | 815 // Return the generated code. |
811 return GetCode(kind(), Code::NORMAL, name); | 816 return GetCode(kind(), Code::NORMAL, name); |
812 } | 817 } |
813 | 818 |
814 | 819 |
815 #undef __ | 820 #undef __ |
816 } // namespace internal | 821 } // namespace internal |
817 } // namespace v8 | 822 } // namespace v8 |
818 | 823 |
819 #endif // V8_TARGET_ARCH_X64 | 824 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |