OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 | 339 |
340 | 340 |
341 // Defined in ic.cc. | 341 // Defined in ic.cc. |
342 Object* CallIC_Miss(Arguments args); | 342 Object* CallIC_Miss(Arguments args); |
343 | 343 |
344 // The generated code does not accept smi keys. | 344 // The generated code does not accept smi keys. |
345 // The generated code falls through if both probes miss. | 345 // The generated code falls through if both probes miss. |
346 void CallICBase::GenerateMonomorphicCacheProbe(MacroAssembler* masm, | 346 void CallICBase::GenerateMonomorphicCacheProbe(MacroAssembler* masm, |
347 int argc, | 347 int argc, |
348 Code::Kind kind, | 348 Code::Kind kind, |
349 Code::ExtraICState extra_state) { | 349 ExtraICState extra_state) { |
350 // ----------- S t a t e ------------- | 350 // ----------- S t a t e ------------- |
351 // -- a1 : receiver | 351 // -- a1 : receiver |
352 // -- a2 : name | 352 // -- a2 : name |
353 // ----------------------------------- | 353 // ----------------------------------- |
354 Label number, non_number, non_string, boolean, probe, miss; | 354 Label number, non_number, non_string, boolean, probe, miss; |
355 | 355 |
356 // Probe the stub cache. | 356 // Probe the stub cache. |
357 Code::Flags flags = Code::ComputeFlags(kind, | 357 Code::Flags flags = Code::ComputeFlags(kind, |
358 MONOMORPHIC, | 358 MONOMORPHIC, |
359 extra_state, | 359 extra_state, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 GenerateFunctionTailCall(masm, argc, &miss, t0); | 441 GenerateFunctionTailCall(masm, argc, &miss, t0); |
442 | 442 |
443 // Cache miss: Jump to runtime. | 443 // Cache miss: Jump to runtime. |
444 __ bind(&miss); | 444 __ bind(&miss); |
445 } | 445 } |
446 | 446 |
447 | 447 |
448 void CallICBase::GenerateMiss(MacroAssembler* masm, | 448 void CallICBase::GenerateMiss(MacroAssembler* masm, |
449 int argc, | 449 int argc, |
450 IC::UtilityId id, | 450 IC::UtilityId id, |
451 Code::ExtraICState extra_state) { | 451 ExtraICState extra_state) { |
452 // ----------- S t a t e ------------- | 452 // ----------- S t a t e ------------- |
453 // -- a2 : name | 453 // -- a2 : name |
454 // -- ra : return address | 454 // -- ra : return address |
455 // ----------------------------------- | 455 // ----------------------------------- |
456 Isolate* isolate = masm->isolate(); | 456 Isolate* isolate = masm->isolate(); |
457 | 457 |
458 if (id == IC::kCallIC_Miss) { | 458 if (id == IC::kCallIC_Miss) { |
459 __ IncrementCounter(isolate->counters()->call_miss(), 1, a3, t0); | 459 __ IncrementCounter(isolate->counters()->call_miss(), 1, a3, t0); |
460 } else { | 460 } else { |
461 __ IncrementCounter(isolate->counters()->keyed_call_miss(), 1, a3, t0); | 461 __ IncrementCounter(isolate->counters()->keyed_call_miss(), 1, a3, t0); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 __ InvokeFunction(a1, | 505 __ InvokeFunction(a1, |
506 actual, | 506 actual, |
507 JUMP_FUNCTION, | 507 JUMP_FUNCTION, |
508 NullCallWrapper(), | 508 NullCallWrapper(), |
509 call_kind); | 509 call_kind); |
510 } | 510 } |
511 | 511 |
512 | 512 |
513 void CallIC::GenerateMegamorphic(MacroAssembler* masm, | 513 void CallIC::GenerateMegamorphic(MacroAssembler* masm, |
514 int argc, | 514 int argc, |
515 Code::ExtraICState extra_ic_state) { | 515 ExtraICState extra_ic_state) { |
516 // ----------- S t a t e ------------- | 516 // ----------- S t a t e ------------- |
517 // -- a2 : name | 517 // -- a2 : name |
518 // -- ra : return address | 518 // -- ra : return address |
519 // ----------------------------------- | 519 // ----------------------------------- |
520 | 520 |
521 // Get the receiver of the function from the stack into a1. | 521 // Get the receiver of the function from the stack into a1. |
522 __ lw(a1, MemOperand(sp, argc * kPointerSize)); | 522 __ lw(a1, MemOperand(sp, argc * kPointerSize)); |
523 GenerateMonomorphicCacheProbe(masm, argc, Code::CALL_IC, extra_ic_state); | 523 GenerateMonomorphicCacheProbe(masm, argc, Code::CALL_IC, extra_ic_state); |
524 GenerateMiss(masm, argc, extra_ic_state); | 524 GenerateMiss(masm, argc, extra_ic_state); |
525 } | 525 } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 | 602 |
603 GenerateDictionaryLoad(masm, &slow_load, a0, a2, a1, a3, t0); | 603 GenerateDictionaryLoad(masm, &slow_load, a0, a2, a1, a3, t0); |
604 __ IncrementCounter(counters->keyed_call_generic_lookup_dict(), 1, a0, a3); | 604 __ IncrementCounter(counters->keyed_call_generic_lookup_dict(), 1, a0, a3); |
605 __ jmp(&do_call); | 605 __ jmp(&do_call); |
606 | 606 |
607 __ bind(&lookup_monomorphic_cache); | 607 __ bind(&lookup_monomorphic_cache); |
608 __ IncrementCounter(counters->keyed_call_generic_lookup_cache(), 1, a0, a3); | 608 __ IncrementCounter(counters->keyed_call_generic_lookup_cache(), 1, a0, a3); |
609 GenerateMonomorphicCacheProbe(masm, | 609 GenerateMonomorphicCacheProbe(masm, |
610 argc, | 610 argc, |
611 Code::KEYED_CALL_IC, | 611 Code::KEYED_CALL_IC, |
612 Code::kNoExtraICState); | 612 kNoExtraICState); |
613 // Fall through on miss. | 613 // Fall through on miss. |
614 | 614 |
615 __ bind(&slow_call); | 615 __ bind(&slow_call); |
616 // This branch is taken if: | 616 // This branch is taken if: |
617 // - the receiver requires boxing or access check, | 617 // - the receiver requires boxing or access check, |
618 // - the key is neither smi nor a unique name, | 618 // - the key is neither smi nor a unique name, |
619 // - the value loaded is not a function, | 619 // - the value loaded is not a function, |
620 // - there is hope that the runtime will create a monomorphic call stub, | 620 // - there is hope that the runtime will create a monomorphic call stub, |
621 // that will get fetched next time. | 621 // that will get fetched next time. |
622 __ IncrementCounter(counters->keyed_call_generic_slow(), 1, a0, a3); | 622 __ IncrementCounter(counters->keyed_call_generic_slow(), 1, a0, a3); |
(...skipping 25 matching lines...) Expand all Loading... |
648 | 648 |
649 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { | 649 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { |
650 // ----------- S t a t e ------------- | 650 // ----------- S t a t e ------------- |
651 // -- a2 : name | 651 // -- a2 : name |
652 // -- ra : return address | 652 // -- ra : return address |
653 // -- a0 : receiver | 653 // -- a0 : receiver |
654 // ----------------------------------- | 654 // ----------------------------------- |
655 | 655 |
656 // Probe the stub cache. | 656 // Probe the stub cache. |
657 Code::Flags flags = Code::ComputeFlags( | 657 Code::Flags flags = Code::ComputeFlags( |
658 Code::HANDLER, MONOMORPHIC, Code::kNoExtraICState, | 658 Code::HANDLER, MONOMORPHIC, kNoExtraICState, |
659 Code::NORMAL, Code::LOAD_IC); | 659 Code::NORMAL, Code::LOAD_IC); |
660 masm->isolate()->stub_cache()->GenerateProbe( | 660 masm->isolate()->stub_cache()->GenerateProbe( |
661 masm, flags, a0, a2, a3, t0, t1, t2); | 661 masm, flags, a0, a2, a3, t0, t1, t2); |
662 | 662 |
663 // Cache miss: Jump to runtime. | 663 // Cache miss: Jump to runtime. |
664 GenerateMiss(masm); | 664 GenerateMiss(masm); |
665 } | 665 } |
666 | 666 |
667 | 667 |
668 void LoadIC::GenerateNormal(MacroAssembler* masm) { | 668 void LoadIC::GenerateNormal(MacroAssembler* masm) { |
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1685 } else { | 1685 } else { |
1686 ASSERT(Assembler::IsBne(branch_instr)); | 1686 ASSERT(Assembler::IsBne(branch_instr)); |
1687 patcher.ChangeBranchCondition(eq); | 1687 patcher.ChangeBranchCondition(eq); |
1688 } | 1688 } |
1689 } | 1689 } |
1690 | 1690 |
1691 | 1691 |
1692 } } // namespace v8::internal | 1692 } } // namespace v8::internal |
1693 | 1693 |
1694 #endif // V8_TARGET_ARCH_MIPS | 1694 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |