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 2662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2673 __ JumpIfSmi(object, &false_result); | 2673 __ JumpIfSmi(object, &false_result); |
2674 | 2674 |
2675 // 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 |
2676 // 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 |
2677 // instanceof stub. | 2677 // instanceof stub. |
2678 Label cache_miss; | 2678 Label cache_miss; |
2679 Register map = ToRegister(instr->temp()); | 2679 Register map = ToRegister(instr->temp()); |
2680 __ mov(map, FieldOperand(object, HeapObject::kMapOffset)); | 2680 __ mov(map, FieldOperand(object, HeapObject::kMapOffset)); |
2681 __ bind(deferred->map_check()); // Label for calculating code patching. | 2681 __ bind(deferred->map_check()); // Label for calculating code patching. |
2682 Handle<Cell> cache_cell = factory()->NewCell(factory()->the_hole_value()); | 2682 Handle<Cell> cache_cell = factory()->NewCell(factory()->the_hole_value()); |
2683 __ cmp(map, Operand::Cell(cache_cell)); // Patched to cached map. | 2683 __ cmp(map, Operand::ForCell(cache_cell)); // Patched to cached map. |
2684 __ j(not_equal, &cache_miss, Label::kNear); | 2684 __ j(not_equal, &cache_miss, Label::kNear); |
2685 __ 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. |
2686 __ jmp(&done); | 2686 __ jmp(&done); |
2687 | 2687 |
2688 // 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 |
2689 // before calling the deferred code. | 2689 // before calling the deferred code. |
2690 __ bind(&cache_miss); | 2690 __ bind(&cache_miss); |
2691 // Null is not an instance of anything. | 2691 // Null is not an instance of anything. |
2692 __ cmp(object, factory()->null_value()); | 2692 __ cmp(object, factory()->null_value()); |
2693 __ j(equal, &false_result); | 2693 __ j(equal, &false_result); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2855 | 2855 |
2856 EmitReturn(instr, false); | 2856 EmitReturn(instr, false); |
2857 if (no_frame_start != -1) { | 2857 if (no_frame_start != -1) { |
2858 info()->AddNoFrameRange(no_frame_start, masm_->pc_offset()); | 2858 info()->AddNoFrameRange(no_frame_start, masm_->pc_offset()); |
2859 } | 2859 } |
2860 } | 2860 } |
2861 | 2861 |
2862 | 2862 |
2863 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { | 2863 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { |
2864 Register result = ToRegister(instr->result()); | 2864 Register result = ToRegister(instr->result()); |
2865 __ mov(result, Operand::Cell(instr->hydrogen()->cell())); | 2865 __ mov(result, Operand::ForCell(instr->hydrogen()->cell())); |
2866 if (instr->hydrogen()->RequiresHoleCheck()) { | 2866 if (instr->hydrogen()->RequiresHoleCheck()) { |
2867 __ cmp(result, factory()->the_hole_value()); | 2867 __ cmp(result, factory()->the_hole_value()); |
2868 DeoptimizeIf(equal, instr->environment()); | 2868 DeoptimizeIf(equal, instr->environment()); |
2869 } | 2869 } |
2870 } | 2870 } |
2871 | 2871 |
2872 | 2872 |
2873 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { | 2873 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { |
2874 ASSERT(ToRegister(instr->context()).is(esi)); | 2874 ASSERT(ToRegister(instr->context()).is(esi)); |
2875 ASSERT(ToRegister(instr->global_object()).is(edx)); | 2875 ASSERT(ToRegister(instr->global_object()).is(edx)); |
2876 ASSERT(ToRegister(instr->result()).is(eax)); | 2876 ASSERT(ToRegister(instr->result()).is(eax)); |
2877 | 2877 |
2878 __ mov(ecx, instr->name()); | 2878 __ mov(ecx, instr->name()); |
2879 RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET : | 2879 RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET : |
2880 RelocInfo::CODE_TARGET_CONTEXT; | 2880 RelocInfo::CODE_TARGET_CONTEXT; |
2881 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 2881 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
2882 CallCode(ic, mode, instr); | 2882 CallCode(ic, mode, instr); |
2883 } | 2883 } |
2884 | 2884 |
2885 | 2885 |
2886 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { | 2886 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { |
2887 Register value = ToRegister(instr->value()); | 2887 Register value = ToRegister(instr->value()); |
2888 Handle<JSGlobalPropertyCell> cell_handle = instr->hydrogen()->cell(); | 2888 Handle<JSGlobalPropertyCell> cell_handle = instr->hydrogen()->cell(); |
2889 | 2889 |
2890 // 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 |
2891 // been deleted from the property dictionary. In that case, we need | 2891 // been deleted from the property dictionary. In that case, we need |
2892 // to update the property details in the property dictionary to mark | 2892 // to update the property details in the property dictionary to mark |
2893 // it as no longer deleted. We deoptimize in that case. | 2893 // it as no longer deleted. We deoptimize in that case. |
2894 if (instr->hydrogen()->RequiresHoleCheck()) { | 2894 if (instr->hydrogen()->RequiresHoleCheck()) { |
2895 __ cmp(Operand::Cell(cell_handle), factory()->the_hole_value()); | 2895 __ cmp(Operand::ForCell(cell_handle), factory()->the_hole_value()); |
2896 DeoptimizeIf(equal, instr->environment()); | 2896 DeoptimizeIf(equal, instr->environment()); |
2897 } | 2897 } |
2898 | 2898 |
2899 // Store the value. | 2899 // Store the value. |
2900 __ mov(Operand::Cell(cell_handle), value); | 2900 __ mov(Operand::ForCell(cell_handle), value); |
2901 // Cells are always rescanned, so no write barrier here. | 2901 // Cells are always rescanned, so no write barrier here. |
2902 } | 2902 } |
2903 | 2903 |
2904 | 2904 |
2905 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { | 2905 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { |
2906 ASSERT(ToRegister(instr->context()).is(esi)); | 2906 ASSERT(ToRegister(instr->context()).is(esi)); |
2907 ASSERT(ToRegister(instr->global_object()).is(edx)); | 2907 ASSERT(ToRegister(instr->global_object()).is(edx)); |
2908 ASSERT(ToRegister(instr->value()).is(eax)); | 2908 ASSERT(ToRegister(instr->value()).is(eax)); |
2909 | 2909 |
2910 __ mov(ecx, instr->name()); | 2910 __ mov(ecx, instr->name()); |
(...skipping 2829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5740 } | 5740 } |
5741 } | 5741 } |
5742 } | 5742 } |
5743 | 5743 |
5744 | 5744 |
5745 void LCodeGen::DoCheckFunction(LCheckFunction* instr) { | 5745 void LCodeGen::DoCheckFunction(LCheckFunction* instr) { |
5746 Handle<JSFunction> target = instr->hydrogen()->target(); | 5746 Handle<JSFunction> target = instr->hydrogen()->target(); |
5747 if (instr->hydrogen()->target_in_new_space()) { | 5747 if (instr->hydrogen()->target_in_new_space()) { |
5748 Register reg = ToRegister(instr->value()); | 5748 Register reg = ToRegister(instr->value()); |
5749 Handle<Cell> cell = isolate()->factory()->NewCell(target); | 5749 Handle<Cell> cell = isolate()->factory()->NewCell(target); |
5750 __ cmp(reg, Operand::Cell(cell)); | 5750 __ cmp(reg, Operand::ForCell(cell)); |
5751 } else { | 5751 } else { |
5752 Operand operand = ToOperand(instr->value()); | 5752 Operand operand = ToOperand(instr->value()); |
5753 __ cmp(operand, target); | 5753 __ cmp(operand, target); |
5754 } | 5754 } |
5755 DeoptimizeIf(not_equal, instr->environment()); | 5755 DeoptimizeIf(not_equal, instr->environment()); |
5756 } | 5756 } |
5757 | 5757 |
5758 | 5758 |
5759 void LCodeGen::DoCheckMapCommon(Register reg, | 5759 void LCodeGen::DoCheckMapCommon(Register reg, |
5760 Handle<Map> map, | 5760 Handle<Map> map, |
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6486 FixedArray::kHeaderSize - kPointerSize)); | 6486 FixedArray::kHeaderSize - kPointerSize)); |
6487 __ bind(&done); | 6487 __ bind(&done); |
6488 } | 6488 } |
6489 | 6489 |
6490 | 6490 |
6491 #undef __ | 6491 #undef __ |
6492 | 6492 |
6493 } } // namespace v8::internal | 6493 } } // namespace v8::internal |
6494 | 6494 |
6495 #endif // V8_TARGET_ARCH_IA32 | 6495 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |