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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); | 297 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); |
298 __ CallRuntime(id, NamedLoadHandlerCompiler::kInterceptorArgsLength); | 298 __ CallRuntime(id, NamedLoadHandlerCompiler::kInterceptorArgsLength); |
299 } | 299 } |
300 | 300 |
301 | 301 |
302 static void StoreIC_PushArgs(MacroAssembler* masm) { | 302 static void StoreIC_PushArgs(MacroAssembler* masm) { |
303 Register receiver = StoreDescriptor::ReceiverRegister(); | 303 Register receiver = StoreDescriptor::ReceiverRegister(); |
304 Register name = StoreDescriptor::NameRegister(); | 304 Register name = StoreDescriptor::NameRegister(); |
305 Register value = StoreDescriptor::ValueRegister(); | 305 Register value = StoreDescriptor::ValueRegister(); |
306 | 306 |
307 if (FLAG_vector_stores) { | 307 DCHECK(!ebx.is(receiver) && !ebx.is(name) && !ebx.is(value)); |
308 Register slot = VectorStoreICDescriptor::SlotRegister(); | |
309 Register vector = VectorStoreICDescriptor::VectorRegister(); | |
310 | 308 |
311 __ xchg(receiver, Operand(esp, 0)); | 309 __ pop(ebx); |
312 __ push(name); | 310 __ push(receiver); |
313 __ push(value); | 311 __ push(name); |
314 __ push(slot); | 312 __ push(value); |
315 __ push(vector); | 313 __ push(ebx); |
316 __ push(receiver); // which contains the return address. | |
317 } else { | |
318 DCHECK(!ebx.is(receiver) && !ebx.is(name) && !ebx.is(value)); | |
319 __ pop(ebx); | |
320 __ push(receiver); | |
321 __ push(name); | |
322 __ push(value); | |
323 __ push(ebx); | |
324 } | |
325 } | 314 } |
326 | 315 |
327 | 316 |
328 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) { | 317 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) { |
329 // Return address is on the stack. | 318 // Return address is on the stack. |
330 StoreIC_PushArgs(masm); | 319 StoreIC_PushArgs(masm); |
331 | 320 |
332 // Do tail-call to runtime routine. | 321 // Do tail-call to runtime routine. |
333 __ TailCallRuntime(Runtime::kStoreIC_Slow, FLAG_vector_stores ? 5 : 3, 1); | 322 __ TailCallRuntime(Runtime::kStoreIC_Slow, 3, 1); |
334 } | 323 } |
335 | 324 |
336 | 325 |
337 void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) { | 326 void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) { |
338 // Return address is on the stack. | 327 // Return address is on the stack. |
339 StoreIC_PushArgs(masm); | 328 StoreIC_PushArgs(masm); |
340 | 329 |
341 // Do tail-call to runtime routine. | 330 // Do tail-call to runtime routine. |
342 __ TailCallRuntime(Runtime::kKeyedStoreIC_Slow, FLAG_vector_stores ? 5 : 3, | 331 __ TailCallRuntime(Runtime::kKeyedStoreIC_Slow, 3, 1); |
343 1); | |
344 } | 332 } |
345 | 333 |
346 | 334 |
347 #undef __ | 335 #undef __ |
348 #define __ ACCESS_MASM(masm()) | 336 #define __ ACCESS_MASM(masm()) |
349 | 337 |
350 | 338 |
351 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, | 339 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, |
352 Handle<Name> name) { | 340 Handle<Name> name) { |
353 if (!label->is_unused()) { | 341 if (!label->is_unused()) { |
354 __ bind(label); | 342 __ bind(label); |
355 __ mov(this->name(), Immediate(name)); | 343 __ mov(this->name(), Immediate(name)); |
356 } | 344 } |
357 } | 345 } |
358 | 346 |
359 | 347 |
360 void NamedStoreHandlerCompiler::GenerateRestoreName(Handle<Name> name) { | 348 void NamedStoreHandlerCompiler::GenerateRestoreName(Handle<Name> name) { |
361 __ mov(this->name(), Immediate(name)); | 349 __ mov(this->name(), Immediate(name)); |
362 } | 350 } |
363 | 351 |
364 | 352 |
365 void NamedStoreHandlerCompiler::GeneratePushMap(Register map_reg, | 353 void NamedStoreHandlerCompiler::GeneratePushMap(Register map_reg, |
366 Register scratch) { | 354 Register scratch) { |
367 // current after GeneratePushMap | 355 // Get the return address, push the argument and then continue. |
368 // ------------------------------------------------- | 356 __ pop(scratch); |
369 // ret addr slot | |
370 // vector vector | |
371 // sp -> slot map | |
372 // sp -> ret addr | |
373 // | |
374 __ xchg(map_reg, Operand(esp, 0)); | |
375 __ xchg(map_reg, Operand(esp, 2 * kPointerSize)); | |
376 __ push(map_reg); | 357 __ push(map_reg); |
| 358 __ push(scratch); |
377 } | 359 } |
378 | 360 |
379 | 361 |
380 void NamedStoreHandlerCompiler::GenerateRestoreMap(Handle<Map> transition, | 362 void NamedStoreHandlerCompiler::GenerateRestoreMap(Handle<Map> transition, |
381 Register map_reg, | 363 Register map_reg, |
382 Register scratch, | 364 Register scratch, |
383 Label* miss) { | 365 Label* miss) { |
384 Handle<WeakCell> cell = Map::WeakCellForMap(transition); | 366 Handle<WeakCell> cell = Map::WeakCellForMap(transition); |
385 DCHECK(!map_reg.is(scratch)); | 367 DCHECK(!map_reg.is(scratch)); |
386 __ LoadWeakValue(map_reg, cell, miss); | 368 __ LoadWeakValue(map_reg, cell, miss); |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 __ bind(&success); | 568 __ bind(&success); |
587 } | 569 } |
588 } | 570 } |
589 | 571 |
590 | 572 |
591 void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) { | 573 void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) { |
592 if (!miss->is_unused()) { | 574 if (!miss->is_unused()) { |
593 Label success; | 575 Label success; |
594 __ jmp(&success); | 576 __ jmp(&success); |
595 GenerateRestoreName(miss, name); | 577 GenerateRestoreName(miss, name); |
596 if (IC::ICUseVector(kind())) PopVectorAndSlot(); | |
597 TailCallBuiltin(masm(), MissBuiltin(kind())); | 578 TailCallBuiltin(masm(), MissBuiltin(kind())); |
598 __ bind(&success); | 579 __ bind(&success); |
599 } | 580 } |
600 } | 581 } |
601 | 582 |
602 | 583 |
603 void NamedLoadHandlerCompiler::GenerateLoadCallback( | 584 void NamedLoadHandlerCompiler::GenerateLoadCallback( |
604 Register reg, Handle<ExecutableAccessorInfo> callback) { | 585 Register reg, Handle<ExecutableAccessorInfo> callback) { |
605 // Insert additional parameters into the stack frame above return address. | 586 // Insert additional parameters into the stack frame above return address. |
606 DCHECK(!scratch3().is(reg)); | 587 DCHECK(!scratch3().is(reg)); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 // Return the generated code. | 804 // Return the generated code. |
824 return GetCode(kind(), Code::NORMAL, name); | 805 return GetCode(kind(), Code::NORMAL, name); |
825 } | 806 } |
826 | 807 |
827 | 808 |
828 #undef __ | 809 #undef __ |
829 } // namespace internal | 810 } // namespace internal |
830 } // namespace v8 | 811 } // namespace v8 |
831 | 812 |
832 #endif // V8_TARGET_ARCH_IA32 | 813 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |