| 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 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 | 746 |
| 747 | 747 |
| 748 // Generate code to check that a global property cell is empty. Create | 748 // Generate code to check that a global property cell is empty. Create |
| 749 // the property cell at compilation time if no cell exists for the | 749 // the property cell at compilation time if no cell exists for the |
| 750 // property. | 750 // property. |
| 751 static void GenerateCheckPropertyCell(MacroAssembler* masm, | 751 static void GenerateCheckPropertyCell(MacroAssembler* masm, |
| 752 Handle<GlobalObject> global, | 752 Handle<GlobalObject> global, |
| 753 Handle<Name> name, | 753 Handle<Name> name, |
| 754 Register scratch, | 754 Register scratch, |
| 755 Label* miss) { | 755 Label* miss) { |
| 756 Handle<JSGlobalPropertyCell> cell = | 756 Handle<PropertyCell> cell = |
| 757 GlobalObject::EnsurePropertyCell(global, name); | 757 GlobalObject::EnsurePropertyCell(global, name); |
| 758 ASSERT(cell->value()->IsTheHole()); | 758 ASSERT(cell->value()->IsTheHole()); |
| 759 Handle<Oddball> the_hole = masm->isolate()->factory()->the_hole_value(); | 759 Handle<Oddball> the_hole = masm->isolate()->factory()->the_hole_value(); |
| 760 if (Serializer::enabled()) { | 760 if (Serializer::enabled()) { |
| 761 __ mov(scratch, Immediate(cell)); | 761 __ mov(scratch, Immediate(cell)); |
| 762 __ cmp(FieldOperand(scratch, JSGlobalPropertyCell::kValueOffset), | 762 __ cmp(FieldOperand(scratch, PropertyCell::kValueOffset), |
| 763 Immediate(the_hole)); | 763 Immediate(the_hole)); |
| 764 } else { | 764 } else { |
| 765 __ cmp(Operand::ForCell(cell), Immediate(the_hole)); | 765 __ cmp(Operand::ForCell(cell), Immediate(the_hole)); |
| 766 } | 766 } |
| 767 __ j(not_equal, miss); | 767 __ j(not_equal, miss); |
| 768 } | 768 } |
| 769 | 769 |
| 770 | 770 |
| 771 // Both name_reg and receiver_reg are preserved on jumps to miss_label, | 771 // Both name_reg and receiver_reg are preserved on jumps to miss_label, |
| 772 // but may be destroyed if store is successful. | 772 // but may be destroyed if store is successful. |
| (...skipping 1972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2745 GenerateMissBranch(); | 2745 GenerateMissBranch(); |
| 2746 | 2746 |
| 2747 // Return the generated code. | 2747 // Return the generated code. |
| 2748 return GetCode(Code::INTERCEPTOR, name); | 2748 return GetCode(Code::INTERCEPTOR, name); |
| 2749 } | 2749 } |
| 2750 | 2750 |
| 2751 | 2751 |
| 2752 Handle<Code> CallStubCompiler::CompileCallGlobal( | 2752 Handle<Code> CallStubCompiler::CompileCallGlobal( |
| 2753 Handle<JSObject> object, | 2753 Handle<JSObject> object, |
| 2754 Handle<GlobalObject> holder, | 2754 Handle<GlobalObject> holder, |
| 2755 Handle<JSGlobalPropertyCell> cell, | 2755 Handle<PropertyCell> cell, |
| 2756 Handle<JSFunction> function, | 2756 Handle<JSFunction> function, |
| 2757 Handle<Name> name) { | 2757 Handle<Name> name) { |
| 2758 // ----------- S t a t e ------------- | 2758 // ----------- S t a t e ------------- |
| 2759 // -- ecx : name | 2759 // -- ecx : name |
| 2760 // -- esp[0] : return address | 2760 // -- esp[0] : return address |
| 2761 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | 2761 // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
| 2762 // -- ... | 2762 // -- ... |
| 2763 // -- esp[(argc + 1) * 4] : receiver | 2763 // -- esp[(argc + 1) * 4] : receiver |
| 2764 // ----------------------------------- | 2764 // ----------------------------------- |
| 2765 | 2765 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2928 __ bind(&miss); | 2928 __ bind(&miss); |
| 2929 TailCallBuiltin(masm(), MissBuiltin(kind())); | 2929 TailCallBuiltin(masm(), MissBuiltin(kind())); |
| 2930 | 2930 |
| 2931 // Return the generated code. | 2931 // Return the generated code. |
| 2932 return GetICCode(kind(), Code::INTERCEPTOR, name); | 2932 return GetICCode(kind(), Code::INTERCEPTOR, name); |
| 2933 } | 2933 } |
| 2934 | 2934 |
| 2935 | 2935 |
| 2936 Handle<Code> StoreStubCompiler::CompileStoreGlobal( | 2936 Handle<Code> StoreStubCompiler::CompileStoreGlobal( |
| 2937 Handle<GlobalObject> object, | 2937 Handle<GlobalObject> object, |
| 2938 Handle<JSGlobalPropertyCell> cell, | 2938 Handle<PropertyCell> cell, |
| 2939 Handle<Name> name) { | 2939 Handle<Name> name) { |
| 2940 Label miss; | 2940 Label miss; |
| 2941 | 2941 |
| 2942 // Check that the map of the global has not changed. | 2942 // Check that the map of the global has not changed. |
| 2943 __ cmp(FieldOperand(receiver(), HeapObject::kMapOffset), | 2943 __ cmp(FieldOperand(receiver(), HeapObject::kMapOffset), |
| 2944 Immediate(Handle<Map>(object->map()))); | 2944 Immediate(Handle<Map>(object->map()))); |
| 2945 __ j(not_equal, &miss); | 2945 __ j(not_equal, &miss); |
| 2946 | 2946 |
| 2947 // Compute the cell operand to use. | 2947 // Compute the cell operand to use. |
| 2948 __ mov(scratch1(), Immediate(cell)); | 2948 __ mov(scratch1(), Immediate(cell)); |
| 2949 Operand cell_operand = | 2949 Operand cell_operand = |
| 2950 FieldOperand(scratch1(), JSGlobalPropertyCell::kValueOffset); | 2950 FieldOperand(scratch1(), PropertyCell::kValueOffset); |
| 2951 | 2951 |
| 2952 // Check that the value in the cell is not the hole. If it is, this | 2952 // Check that the value in the cell is not the hole. If it is, this |
| 2953 // cell could have been deleted and reintroducing the global needs | 2953 // cell could have been deleted and reintroducing the global needs |
| 2954 // to update the property details in the property dictionary of the | 2954 // to update the property details in the property dictionary of the |
| 2955 // global object. We bail out to the runtime system to do that. | 2955 // global object. We bail out to the runtime system to do that. |
| 2956 __ cmp(cell_operand, factory()->the_hole_value()); | 2956 __ cmp(cell_operand, factory()->the_hole_value()); |
| 2957 __ j(equal, &miss); | 2957 __ j(equal, &miss); |
| 2958 | 2958 |
| 2959 // Store the value in the cell. | 2959 // Store the value in the cell. |
| 2960 __ mov(cell_operand, value()); | 2960 __ mov(cell_operand, value()); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3101 } | 3101 } |
| 3102 | 3102 |
| 3103 | 3103 |
| 3104 #undef __ | 3104 #undef __ |
| 3105 #define __ ACCESS_MASM(masm()) | 3105 #define __ ACCESS_MASM(masm()) |
| 3106 | 3106 |
| 3107 | 3107 |
| 3108 Handle<Code> LoadStubCompiler::CompileLoadGlobal( | 3108 Handle<Code> LoadStubCompiler::CompileLoadGlobal( |
| 3109 Handle<JSObject> object, | 3109 Handle<JSObject> object, |
| 3110 Handle<GlobalObject> global, | 3110 Handle<GlobalObject> global, |
| 3111 Handle<JSGlobalPropertyCell> cell, | 3111 Handle<PropertyCell> cell, |
| 3112 Handle<Name> name, | 3112 Handle<Name> name, |
| 3113 bool is_dont_delete) { | 3113 bool is_dont_delete) { |
| 3114 Label success, miss; | 3114 Label success, miss; |
| 3115 | 3115 |
| 3116 __ CheckMap(receiver(), Handle<Map>(object->map()), &miss, DO_SMI_CHECK); | 3116 __ CheckMap(receiver(), Handle<Map>(object->map()), &miss, DO_SMI_CHECK); |
| 3117 HandlerFrontendHeader( | 3117 HandlerFrontendHeader( |
| 3118 object, receiver(), Handle<JSObject>::cast(global), name, &miss); | 3118 object, receiver(), Handle<JSObject>::cast(global), name, &miss); |
| 3119 // Get the value from the cell. | 3119 // Get the value from the cell. |
| 3120 if (Serializer::enabled()) { | 3120 if (Serializer::enabled()) { |
| 3121 __ mov(eax, Immediate(cell)); | 3121 __ mov(eax, Immediate(cell)); |
| 3122 __ mov(eax, FieldOperand(eax, JSGlobalPropertyCell::kValueOffset)); | 3122 __ mov(eax, FieldOperand(eax, PropertyCell::kValueOffset)); |
| 3123 } else { | 3123 } else { |
| 3124 __ mov(eax, Operand::ForCell(cell)); | 3124 __ mov(eax, Operand::ForCell(cell)); |
| 3125 } | 3125 } |
| 3126 | 3126 |
| 3127 // Check for deleted property if property can actually be deleted. | 3127 // Check for deleted property if property can actually be deleted. |
| 3128 if (!is_dont_delete) { | 3128 if (!is_dont_delete) { |
| 3129 __ cmp(eax, factory()->the_hole_value()); | 3129 __ cmp(eax, factory()->the_hole_value()); |
| 3130 __ j(equal, &miss); | 3130 __ j(equal, &miss); |
| 3131 } else if (FLAG_debug_code) { | 3131 } else if (FLAG_debug_code) { |
| 3132 __ cmp(eax, factory()->the_hole_value()); | 3132 __ cmp(eax, factory()->the_hole_value()); |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3743 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); | 3743 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); |
| 3744 } | 3744 } |
| 3745 } | 3745 } |
| 3746 | 3746 |
| 3747 | 3747 |
| 3748 #undef __ | 3748 #undef __ |
| 3749 | 3749 |
| 3750 } } // namespace v8::internal | 3750 } } // namespace v8::internal |
| 3751 | 3751 |
| 3752 #endif // V8_TARGET_ARCH_IA32 | 3752 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |