| 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 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 } | 607 } |
| 608 | 608 |
| 609 | 609 |
| 610 Operand LCodeGen::HighOperand(LOperand* op) { | 610 Operand LCodeGen::HighOperand(LOperand* op) { |
| 611 ASSERT(op->IsDoubleStackSlot()); | 611 ASSERT(op->IsDoubleStackSlot()); |
| 612 return Operand(ebp, StackSlotOffset(op->index()) + kPointerSize); | 612 return Operand(ebp, StackSlotOffset(op->index()) + kPointerSize); |
| 613 } | 613 } |
| 614 | 614 |
| 615 | 615 |
| 616 void LCodeGen::WriteTranslation(LEnvironment* environment, | 616 void LCodeGen::WriteTranslation(LEnvironment* environment, |
| 617 Translation* translation, | 617 Translation* translation) { |
| 618 int* pushed_arguments_index, | |
| 619 int* pushed_arguments_count) { | |
| 620 if (environment == NULL) return; | 618 if (environment == NULL) return; |
| 621 | 619 |
| 622 // The translation includes one command per value in the environment. | 620 // The translation includes one command per value in the environment. |
| 623 int translation_size = environment->values()->length(); | 621 int translation_size = environment->translation_size(); |
| 624 // The output frame height does not include the parameters. | 622 // The output frame height does not include the parameters. |
| 625 int height = translation_size - environment->parameter_count(); | 623 int height = translation_size - environment->parameter_count(); |
| 626 | 624 |
| 627 // Function parameters are arguments to the outermost environment. The | 625 WriteTranslation(environment->outer(), translation); |
| 628 // arguments index points to the first element of a sequence of tagged | |
| 629 // values on the stack that represent the arguments. This needs to be | |
| 630 // kept in sync with the LArgumentsElements implementation. | |
| 631 *pushed_arguments_index = -environment->parameter_count(); | |
| 632 *pushed_arguments_count = environment->parameter_count(); | |
| 633 | |
| 634 WriteTranslation(environment->outer(), | |
| 635 translation, | |
| 636 pushed_arguments_index, | |
| 637 pushed_arguments_count); | |
| 638 bool has_closure_id = !info()->closure().is_null() && | 626 bool has_closure_id = !info()->closure().is_null() && |
| 639 !info()->closure().is_identical_to(environment->closure()); | 627 !info()->closure().is_identical_to(environment->closure()); |
| 640 int closure_id = has_closure_id | 628 int closure_id = has_closure_id |
| 641 ? DefineDeoptimizationLiteral(environment->closure()) | 629 ? DefineDeoptimizationLiteral(environment->closure()) |
| 642 : Translation::kSelfLiteralId; | 630 : Translation::kSelfLiteralId; |
| 643 switch (environment->frame_type()) { | 631 switch (environment->frame_type()) { |
| 644 case JS_FUNCTION: | 632 case JS_FUNCTION: |
| 645 translation->BeginJSFrame(environment->ast_id(), closure_id, height); | 633 translation->BeginJSFrame(environment->ast_id(), closure_id, height); |
| 646 break; | 634 break; |
| 647 case JS_CONSTRUCT: | 635 case JS_CONSTRUCT: |
| (...skipping 12 matching lines...) Expand all Loading... |
| 660 case ARGUMENTS_ADAPTOR: | 648 case ARGUMENTS_ADAPTOR: |
| 661 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); | 649 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); |
| 662 break; | 650 break; |
| 663 case STUB: | 651 case STUB: |
| 664 translation->BeginCompiledStubFrame(); | 652 translation->BeginCompiledStubFrame(); |
| 665 break; | 653 break; |
| 666 default: | 654 default: |
| 667 UNREACHABLE(); | 655 UNREACHABLE(); |
| 668 } | 656 } |
| 669 | 657 |
| 670 // Inlined frames which push their arguments cause the index to be | |
| 671 // bumped and another stack area to be used for materialization, | |
| 672 // otherwise actual argument values are unknown for inlined frames. | |
| 673 bool arguments_known = true; | |
| 674 int arguments_index = *pushed_arguments_index; | |
| 675 int arguments_count = *pushed_arguments_count; | |
| 676 if (environment->entry() != NULL) { | |
| 677 arguments_known = environment->entry()->arguments_pushed(); | |
| 678 arguments_index = arguments_index < 0 | |
| 679 ? GetStackSlotCount() : arguments_index + arguments_count; | |
| 680 arguments_count = environment->entry()->arguments_count() + 1; | |
| 681 if (environment->entry()->arguments_pushed()) { | |
| 682 *pushed_arguments_index = arguments_index; | |
| 683 *pushed_arguments_count = arguments_count; | |
| 684 } | |
| 685 } | |
| 686 | |
| 687 for (int i = 0; i < translation_size; ++i) { | 658 for (int i = 0; i < translation_size; ++i) { |
| 688 LOperand* value = environment->values()->at(i); | 659 LOperand* value = environment->values()->at(i); |
| 689 // spilled_registers_ and spilled_double_registers_ are either | 660 // spilled_registers_ and spilled_double_registers_ are either |
| 690 // both NULL or both set. | 661 // both NULL or both set. |
| 691 if (environment->spilled_registers() != NULL && value != NULL) { | 662 if (environment->spilled_registers() != NULL && value != NULL) { |
| 692 if (value->IsRegister() && | 663 if (value->IsRegister() && |
| 693 environment->spilled_registers()[value->index()] != NULL) { | 664 environment->spilled_registers()[value->index()] != NULL) { |
| 694 translation->MarkDuplicate(); | 665 translation->MarkDuplicate(); |
| 695 AddToTranslation(translation, | 666 AddToTranslation(translation, |
| 696 environment->spilled_registers()[value->index()], | 667 environment->spilled_registers()[value->index()], |
| 697 environment->HasTaggedValueAt(i), | 668 environment->HasTaggedValueAt(i), |
| 698 environment->HasUint32ValueAt(i), | 669 environment->HasUint32ValueAt(i)); |
| 699 arguments_known, | |
| 700 arguments_index, | |
| 701 arguments_count); | |
| 702 } else if ( | 670 } else if ( |
| 703 value->IsDoubleRegister() && | 671 value->IsDoubleRegister() && |
| 704 environment->spilled_double_registers()[value->index()] != NULL) { | 672 environment->spilled_double_registers()[value->index()] != NULL) { |
| 705 translation->MarkDuplicate(); | 673 translation->MarkDuplicate(); |
| 706 AddToTranslation( | 674 AddToTranslation( |
| 707 translation, | 675 translation, |
| 708 environment->spilled_double_registers()[value->index()], | 676 environment->spilled_double_registers()[value->index()], |
| 709 false, | 677 false, |
| 710 false, | 678 false); |
| 711 arguments_known, | |
| 712 arguments_index, | |
| 713 arguments_count); | |
| 714 } | 679 } |
| 715 } | 680 } |
| 716 | 681 |
| 682 // TODO(mstarzinger): Introduce marker operands to indicate that this value |
| 683 // is not present and must be reconstructed from the deoptimizer. Currently |
| 684 // this is only used for the arguments object. |
| 685 if (value == NULL) { |
| 686 int arguments_count = environment->values()->length() - translation_size; |
| 687 translation->BeginArgumentsObject(arguments_count); |
| 688 for (int i = 0; i < arguments_count; ++i) { |
| 689 LOperand* value = environment->values()->at(translation_size + i); |
| 690 ASSERT(environment->spilled_registers() == NULL || |
| 691 !value->IsRegister() || |
| 692 environment->spilled_registers()[value->index()] == NULL); |
| 693 ASSERT(environment->spilled_registers() == NULL || |
| 694 !value->IsDoubleRegister() || |
| 695 environment->spilled_double_registers()[value->index()] == NULL); |
| 696 AddToTranslation(translation, |
| 697 value, |
| 698 environment->HasTaggedValueAt(translation_size + i), |
| 699 environment->HasUint32ValueAt(translation_size + i)); |
| 700 } |
| 701 continue; |
| 702 } |
| 703 |
| 717 AddToTranslation(translation, | 704 AddToTranslation(translation, |
| 718 value, | 705 value, |
| 719 environment->HasTaggedValueAt(i), | 706 environment->HasTaggedValueAt(i), |
| 720 environment->HasUint32ValueAt(i), | 707 environment->HasUint32ValueAt(i)); |
| 721 arguments_known, | |
| 722 arguments_index, | |
| 723 arguments_count); | |
| 724 } | 708 } |
| 725 } | 709 } |
| 726 | 710 |
| 727 | 711 |
| 728 void LCodeGen::AddToTranslation(Translation* translation, | 712 void LCodeGen::AddToTranslation(Translation* translation, |
| 729 LOperand* op, | 713 LOperand* op, |
| 730 bool is_tagged, | 714 bool is_tagged, |
| 731 bool is_uint32, | 715 bool is_uint32) { |
| 732 bool arguments_known, | 716 if (op->IsStackSlot()) { |
| 733 int arguments_index, | |
| 734 int arguments_count) { | |
| 735 if (op == NULL) { | |
| 736 // TODO(twuerthinger): Introduce marker operands to indicate that this value | |
| 737 // is not present and must be reconstructed from the deoptimizer. Currently | |
| 738 // this is only used for the arguments object. | |
| 739 translation->StoreArgumentsObject( | |
| 740 arguments_known, arguments_index, arguments_count); | |
| 741 } else if (op->IsStackSlot()) { | |
| 742 if (is_tagged) { | 717 if (is_tagged) { |
| 743 translation->StoreStackSlot(op->index()); | 718 translation->StoreStackSlot(op->index()); |
| 744 } else if (is_uint32) { | 719 } else if (is_uint32) { |
| 745 translation->StoreUint32StackSlot(op->index()); | 720 translation->StoreUint32StackSlot(op->index()); |
| 746 } else { | 721 } else { |
| 747 translation->StoreInt32StackSlot(op->index()); | 722 translation->StoreInt32StackSlot(op->index()); |
| 748 } | 723 } |
| 749 } else if (op->IsDoubleStackSlot()) { | 724 } else if (op->IsDoubleStackSlot()) { |
| 750 translation->StoreDoubleStackSlot(op->index()); | 725 translation->StoreDoubleStackSlot(op->index()); |
| 751 } else if (op->IsArgument()) { | 726 } else if (op->IsArgument()) { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 // 0 ..................................................... size-1 | 832 // 0 ..................................................... size-1 |
| 858 // [parameters] [locals] [expression stack including arguments] | 833 // [parameters] [locals] [expression stack including arguments] |
| 859 | 834 |
| 860 // Layout of the translation: | 835 // Layout of the translation: |
| 861 // 0 ........................................................ size - 1 + 4 | 836 // 0 ........................................................ size - 1 + 4 |
| 862 // [expression stack including arguments] [locals] [4 words] [parameters] | 837 // [expression stack including arguments] [locals] [4 words] [parameters] |
| 863 // |>------------ translation_size ------------<| | 838 // |>------------ translation_size ------------<| |
| 864 | 839 |
| 865 int frame_count = 0; | 840 int frame_count = 0; |
| 866 int jsframe_count = 0; | 841 int jsframe_count = 0; |
| 867 int args_index = 0; | |
| 868 int args_count = 0; | |
| 869 for (LEnvironment* e = environment; e != NULL; e = e->outer()) { | 842 for (LEnvironment* e = environment; e != NULL; e = e->outer()) { |
| 870 ++frame_count; | 843 ++frame_count; |
| 871 if (e->frame_type() == JS_FUNCTION) { | 844 if (e->frame_type() == JS_FUNCTION) { |
| 872 ++jsframe_count; | 845 ++jsframe_count; |
| 873 } | 846 } |
| 874 } | 847 } |
| 875 Translation translation(&translations_, frame_count, jsframe_count, zone()); | 848 Translation translation(&translations_, frame_count, jsframe_count, zone()); |
| 876 WriteTranslation(environment, &translation, &args_index, &args_count); | 849 WriteTranslation(environment, &translation); |
| 877 int deoptimization_index = deoptimizations_.length(); | 850 int deoptimization_index = deoptimizations_.length(); |
| 878 int pc_offset = masm()->pc_offset(); | 851 int pc_offset = masm()->pc_offset(); |
| 879 environment->Register(deoptimization_index, | 852 environment->Register(deoptimization_index, |
| 880 translation.index(), | 853 translation.index(), |
| 881 (mode == Safepoint::kLazyDeopt) ? pc_offset : -1); | 854 (mode == Safepoint::kLazyDeopt) ? pc_offset : -1); |
| 882 deoptimizations_.Add(environment, zone()); | 855 deoptimizations_.Add(environment, zone()); |
| 883 } | 856 } |
| 884 } | 857 } |
| 885 | 858 |
| 886 | 859 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 __ jmp(entry, RelocInfo::RUNTIME_ENTRY); | 894 __ jmp(entry, RelocInfo::RUNTIME_ENTRY); |
| 922 | 895 |
| 923 __ bind(&no_deopt); | 896 __ bind(&no_deopt); |
| 924 __ mov(FieldOperand(ebx, SharedFunctionInfo::kStressDeoptCounterOffset), | 897 __ mov(FieldOperand(ebx, SharedFunctionInfo::kStressDeoptCounterOffset), |
| 925 eax); | 898 eax); |
| 926 __ pop(ebx); | 899 __ pop(ebx); |
| 927 __ pop(eax); | 900 __ pop(eax); |
| 928 __ popfd(); | 901 __ popfd(); |
| 929 } | 902 } |
| 930 | 903 |
| 931 if (FLAG_trap_on_deopt) { | 904 if (FLAG_trap_on_deopt && info()->IsOptimizing()) { |
| 932 Label done; | 905 Label done; |
| 933 if (cc != no_condition) { | 906 if (cc != no_condition) { |
| 934 __ j(NegateCondition(cc), &done, Label::kNear); | 907 __ j(NegateCondition(cc), &done, Label::kNear); |
| 935 } | 908 } |
| 936 __ int3(); | 909 __ int3(); |
| 937 __ bind(&done); | 910 __ bind(&done); |
| 938 } | 911 } |
| 939 | 912 |
| 940 ASSERT(info()->IsStub() || frame_is_built_); | 913 ASSERT(info()->IsStub() || frame_is_built_); |
| 941 if (cc == no_condition && frame_is_built_) { | 914 if (cc == no_condition && frame_is_built_) { |
| (...skipping 1757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2699 // A Smi is not an instance of anything. | 2672 // A Smi is not an instance of anything. |
| 2700 __ JumpIfSmi(object, &false_result); | 2673 __ JumpIfSmi(object, &false_result); |
| 2701 | 2674 |
| 2702 // This is the inlined call site instanceof cache. The two occurences of the | 2675 // This is the inlined call site instanceof cache. The two occurences of the |
| 2703 // hole value will be patched to the last map/result pair generated by the | 2676 // hole value will be patched to the last map/result pair generated by the |
| 2704 // instanceof stub. | 2677 // instanceof stub. |
| 2705 Label cache_miss; | 2678 Label cache_miss; |
| 2706 Register map = ToRegister(instr->temp()); | 2679 Register map = ToRegister(instr->temp()); |
| 2707 __ mov(map, FieldOperand(object, HeapObject::kMapOffset)); | 2680 __ mov(map, FieldOperand(object, HeapObject::kMapOffset)); |
| 2708 __ bind(deferred->map_check()); // Label for calculating code patching. | 2681 __ bind(deferred->map_check()); // Label for calculating code patching. |
| 2709 Handle<JSGlobalPropertyCell> cache_cell = | 2682 Handle<Cell> cache_cell = factory()->NewCell(factory()->the_hole_value()); |
| 2710 factory()->NewJSGlobalPropertyCell(factory()->the_hole_value()); | 2683 __ cmp(map, Operand::ForCell(cache_cell)); // Patched to cached map. |
| 2711 __ cmp(map, Operand::Cell(cache_cell)); // Patched to cached map. | |
| 2712 __ j(not_equal, &cache_miss, Label::kNear); | 2684 __ j(not_equal, &cache_miss, Label::kNear); |
| 2713 __ mov(eax, factory()->the_hole_value()); // Patched to either true or false. | 2685 __ mov(eax, factory()->the_hole_value()); // Patched to either true or false. |
| 2714 __ jmp(&done); | 2686 __ jmp(&done); |
| 2715 | 2687 |
| 2716 // The inlined call site cache did not match. Check for null and string | 2688 // The inlined call site cache did not match. Check for null and string |
| 2717 // before calling the deferred code. | 2689 // before calling the deferred code. |
| 2718 __ bind(&cache_miss); | 2690 __ bind(&cache_miss); |
| 2719 // Null is not an instance of anything. | 2691 // Null is not an instance of anything. |
| 2720 __ cmp(object, factory()->null_value()); | 2692 __ cmp(object, factory()->null_value()); |
| 2721 __ j(equal, &false_result); | 2693 __ j(equal, &false_result); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2883 | 2855 |
| 2884 EmitReturn(instr, false); | 2856 EmitReturn(instr, false); |
| 2885 if (no_frame_start != -1) { | 2857 if (no_frame_start != -1) { |
| 2886 info()->AddNoFrameRange(no_frame_start, masm_->pc_offset()); | 2858 info()->AddNoFrameRange(no_frame_start, masm_->pc_offset()); |
| 2887 } | 2859 } |
| 2888 } | 2860 } |
| 2889 | 2861 |
| 2890 | 2862 |
| 2891 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { | 2863 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { |
| 2892 Register result = ToRegister(instr->result()); | 2864 Register result = ToRegister(instr->result()); |
| 2893 __ mov(result, Operand::Cell(instr->hydrogen()->cell())); | 2865 __ mov(result, Operand::ForCell(instr->hydrogen()->cell())); |
| 2894 if (instr->hydrogen()->RequiresHoleCheck()) { | 2866 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 2895 __ cmp(result, factory()->the_hole_value()); | 2867 __ cmp(result, factory()->the_hole_value()); |
| 2896 DeoptimizeIf(equal, instr->environment()); | 2868 DeoptimizeIf(equal, instr->environment()); |
| 2897 } | 2869 } |
| 2898 } | 2870 } |
| 2899 | 2871 |
| 2900 | 2872 |
| 2901 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { | 2873 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { |
| 2902 ASSERT(ToRegister(instr->context()).is(esi)); | 2874 ASSERT(ToRegister(instr->context()).is(esi)); |
| 2903 ASSERT(ToRegister(instr->global_object()).is(edx)); | 2875 ASSERT(ToRegister(instr->global_object()).is(edx)); |
| 2904 ASSERT(ToRegister(instr->result()).is(eax)); | 2876 ASSERT(ToRegister(instr->result()).is(eax)); |
| 2905 | 2877 |
| 2906 __ mov(ecx, instr->name()); | 2878 __ mov(ecx, instr->name()); |
| 2907 RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET : | 2879 RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET : |
| 2908 RelocInfo::CODE_TARGET_CONTEXT; | 2880 RelocInfo::CODE_TARGET_CONTEXT; |
| 2909 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 2881 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
| 2910 CallCode(ic, mode, instr); | 2882 CallCode(ic, mode, instr); |
| 2911 } | 2883 } |
| 2912 | 2884 |
| 2913 | 2885 |
| 2914 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { | 2886 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { |
| 2915 Register value = ToRegister(instr->value()); | 2887 Register value = ToRegister(instr->value()); |
| 2916 Handle<JSGlobalPropertyCell> cell_handle = instr->hydrogen()->cell(); | 2888 Handle<PropertyCell> cell_handle = instr->hydrogen()->cell(); |
| 2917 | 2889 |
| 2918 // If the cell we are storing to contains the hole it could have | 2890 // If the cell we are storing to contains the hole it could have |
| 2919 // been deleted from the property dictionary. In that case, we need | 2891 // been deleted from the property dictionary. In that case, we need |
| 2920 // to update the property details in the property dictionary to mark | 2892 // to update the property details in the property dictionary to mark |
| 2921 // it as no longer deleted. We deoptimize in that case. | 2893 // it as no longer deleted. We deoptimize in that case. |
| 2922 if (instr->hydrogen()->RequiresHoleCheck()) { | 2894 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 2923 __ cmp(Operand::Cell(cell_handle), factory()->the_hole_value()); | 2895 __ cmp(Operand::ForCell(cell_handle), factory()->the_hole_value()); |
| 2924 DeoptimizeIf(equal, instr->environment()); | 2896 DeoptimizeIf(equal, instr->environment()); |
| 2925 } | 2897 } |
| 2926 | 2898 |
| 2927 // Store the value. | 2899 // Store the value. |
| 2928 __ mov(Operand::Cell(cell_handle), value); | 2900 __ mov(Operand::ForCell(cell_handle), value); |
| 2929 // Cells are always rescanned, so no write barrier here. | 2901 // Cells are always rescanned, so no write barrier here. |
| 2930 } | 2902 } |
| 2931 | 2903 |
| 2932 | 2904 |
| 2933 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { | 2905 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { |
| 2934 ASSERT(ToRegister(instr->context()).is(esi)); | 2906 ASSERT(ToRegister(instr->context()).is(esi)); |
| 2935 ASSERT(ToRegister(instr->global_object()).is(edx)); | 2907 ASSERT(ToRegister(instr->global_object()).is(edx)); |
| 2936 ASSERT(ToRegister(instr->value()).is(eax)); | 2908 ASSERT(ToRegister(instr->value()).is(eax)); |
| 2937 | 2909 |
| 2938 __ mov(ecx, instr->name()); | 2910 __ mov(ecx, instr->name()); |
| (...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4246 __ Set(eax, Immediate(instr->arity())); | 4218 __ Set(eax, Immediate(instr->arity())); |
| 4247 __ mov(ebx, instr->hydrogen()->property_cell()); | 4219 __ mov(ebx, instr->hydrogen()->property_cell()); |
| 4248 ElementsKind kind = instr->hydrogen()->elements_kind(); | 4220 ElementsKind kind = instr->hydrogen()->elements_kind(); |
| 4249 bool disable_allocation_sites = | 4221 bool disable_allocation_sites = |
| 4250 (AllocationSiteInfo::GetMode(kind) == TRACK_ALLOCATION_SITE); | 4222 (AllocationSiteInfo::GetMode(kind) == TRACK_ALLOCATION_SITE); |
| 4251 | 4223 |
| 4252 if (instr->arity() == 0) { | 4224 if (instr->arity() == 0) { |
| 4253 ArrayNoArgumentConstructorStub stub(kind, disable_allocation_sites); | 4225 ArrayNoArgumentConstructorStub stub(kind, disable_allocation_sites); |
| 4254 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); | 4226 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 4255 } else if (instr->arity() == 1) { | 4227 } else if (instr->arity() == 1) { |
| 4228 Label done; |
| 4229 if (IsFastPackedElementsKind(kind)) { |
| 4230 Label packed_case; |
| 4231 // We might need a change here |
| 4232 // look at the first argument |
| 4233 __ mov(ecx, Operand(esp, 0)); |
| 4234 __ test(ecx, ecx); |
| 4235 __ j(zero, &packed_case); |
| 4236 |
| 4237 ElementsKind holey_kind = GetHoleyElementsKind(kind); |
| 4238 ArraySingleArgumentConstructorStub stub(holey_kind, |
| 4239 disable_allocation_sites); |
| 4240 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 4241 __ jmp(&done); |
| 4242 __ bind(&packed_case); |
| 4243 } |
| 4244 |
| 4256 ArraySingleArgumentConstructorStub stub(kind, disable_allocation_sites); | 4245 ArraySingleArgumentConstructorStub stub(kind, disable_allocation_sites); |
| 4257 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); | 4246 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 4247 __ bind(&done); |
| 4258 } else { | 4248 } else { |
| 4259 ArrayNArgumentsConstructorStub stub(kind, disable_allocation_sites); | 4249 ArrayNArgumentsConstructorStub stub(kind, disable_allocation_sites); |
| 4260 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); | 4250 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 4261 } | 4251 } |
| 4262 } | 4252 } |
| 4263 | 4253 |
| 4264 | 4254 |
| 4265 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { | 4255 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { |
| 4266 CallRuntime(instr->function(), instr->arity(), instr); | 4256 CallRuntime(instr->function(), instr->arity(), instr); |
| 4267 } | 4257 } |
| (...skipping 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5767 DeoptimizeIf(not_equal, instr->environment()); | 5757 DeoptimizeIf(not_equal, instr->environment()); |
| 5768 } | 5758 } |
| 5769 } | 5759 } |
| 5770 } | 5760 } |
| 5771 | 5761 |
| 5772 | 5762 |
| 5773 void LCodeGen::DoCheckFunction(LCheckFunction* instr) { | 5763 void LCodeGen::DoCheckFunction(LCheckFunction* instr) { |
| 5774 Handle<JSFunction> target = instr->hydrogen()->target(); | 5764 Handle<JSFunction> target = instr->hydrogen()->target(); |
| 5775 if (instr->hydrogen()->target_in_new_space()) { | 5765 if (instr->hydrogen()->target_in_new_space()) { |
| 5776 Register reg = ToRegister(instr->value()); | 5766 Register reg = ToRegister(instr->value()); |
| 5777 Handle<JSGlobalPropertyCell> cell = | 5767 Handle<Cell> cell = isolate()->factory()->NewCell(target); |
| 5778 isolate()->factory()->NewJSGlobalPropertyCell(target); | 5768 __ cmp(reg, Operand::ForCell(cell)); |
| 5779 __ cmp(reg, Operand::Cell(cell)); | |
| 5780 } else { | 5769 } else { |
| 5781 Operand operand = ToOperand(instr->value()); | 5770 Operand operand = ToOperand(instr->value()); |
| 5782 __ cmp(operand, target); | 5771 __ cmp(operand, target); |
| 5783 } | 5772 } |
| 5784 DeoptimizeIf(not_equal, instr->environment()); | 5773 DeoptimizeIf(not_equal, instr->environment()); |
| 5785 } | 5774 } |
| 5786 | 5775 |
| 5787 | 5776 |
| 5788 void LCodeGen::DoCheckMapCommon(Register reg, | 5777 void LCodeGen::DoCheckMapCommon(Register reg, |
| 5789 Handle<Map> map, | 5778 Handle<Map> map, |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6515 FixedArray::kHeaderSize - kPointerSize)); | 6504 FixedArray::kHeaderSize - kPointerSize)); |
| 6516 __ bind(&done); | 6505 __ bind(&done); |
| 6517 } | 6506 } |
| 6518 | 6507 |
| 6519 | 6508 |
| 6520 #undef __ | 6509 #undef __ |
| 6521 | 6510 |
| 6522 } } // namespace v8::internal | 6511 } } // namespace v8::internal |
| 6523 | 6512 |
| 6524 #endif // V8_TARGET_ARCH_IA32 | 6513 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |