| 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 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 | 730 |
| 731 | 731 |
| 732 // Generate code to check that a global property cell is empty. Create | 732 // Generate code to check that a global property cell is empty. Create |
| 733 // the property cell at compilation time if no cell exists for the | 733 // the property cell at compilation time if no cell exists for the |
| 734 // property. | 734 // property. |
| 735 static void GenerateCheckPropertyCell(MacroAssembler* masm, | 735 static void GenerateCheckPropertyCell(MacroAssembler* masm, |
| 736 Handle<GlobalObject> global, | 736 Handle<GlobalObject> global, |
| 737 Handle<Name> name, | 737 Handle<Name> name, |
| 738 Register scratch, | 738 Register scratch, |
| 739 Label* miss) { | 739 Label* miss) { |
| 740 Handle<JSGlobalPropertyCell> cell = | 740 Handle<PropertyCell> cell = |
| 741 GlobalObject::EnsurePropertyCell(global, name); | 741 GlobalObject::EnsurePropertyCell(global, name); |
| 742 ASSERT(cell->value()->IsTheHole()); | 742 ASSERT(cell->value()->IsTheHole()); |
| 743 __ Move(scratch, cell); | 743 __ Move(scratch, cell); |
| 744 __ Cmp(FieldOperand(scratch, Cell::kValueOffset), | 744 __ Cmp(FieldOperand(scratch, Cell::kValueOffset), |
| 745 masm->isolate()->factory()->the_hole_value()); | 745 masm->isolate()->factory()->the_hole_value()); |
| 746 __ j(not_equal, miss); | 746 __ j(not_equal, miss); |
| 747 } | 747 } |
| 748 | 748 |
| 749 | 749 |
| 750 // Both name_reg and receiver_reg are preserved on jumps to miss_label, | 750 // Both name_reg and receiver_reg are preserved on jumps to miss_label, |
| (...skipping 1687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2438 | 2438 |
| 2439 | 2439 |
| 2440 Handle<Code> CallStubCompiler::CompileCallConstant( | 2440 Handle<Code> CallStubCompiler::CompileCallConstant( |
| 2441 Handle<Object> object, | 2441 Handle<Object> object, |
| 2442 Handle<JSObject> holder, | 2442 Handle<JSObject> holder, |
| 2443 Handle<Name> name, | 2443 Handle<Name> name, |
| 2444 CheckType check, | 2444 CheckType check, |
| 2445 Handle<JSFunction> function) { | 2445 Handle<JSFunction> function) { |
| 2446 if (HasCustomCallGenerator(function)) { | 2446 if (HasCustomCallGenerator(function)) { |
| 2447 Handle<Code> code = CompileCustomCall(object, holder, | 2447 Handle<Code> code = CompileCustomCall(object, holder, |
| 2448 Handle<JSGlobalPropertyCell>::null(), | 2448 Handle<PropertyCell>::null(), |
| 2449 function, Handle<String>::cast(name)); | 2449 function, Handle<String>::cast(name)); |
| 2450 // A null handle means bail out to the regular compiler code below. | 2450 // A null handle means bail out to the regular compiler code below. |
| 2451 if (!code.is_null()) return code; | 2451 if (!code.is_null()) return code; |
| 2452 } | 2452 } |
| 2453 | 2453 |
| 2454 Label success; | 2454 Label success; |
| 2455 | 2455 |
| 2456 CompileHandlerFrontend(object, holder, name, check, &success); | 2456 CompileHandlerFrontend(object, holder, name, check, &success); |
| 2457 __ bind(&success); | 2457 __ bind(&success); |
| 2458 CompileHandlerBackend(function); | 2458 CompileHandlerBackend(function); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2518 GenerateMissBranch(); | 2518 GenerateMissBranch(); |
| 2519 | 2519 |
| 2520 // Return the generated code. | 2520 // Return the generated code. |
| 2521 return GetCode(Code::INTERCEPTOR, name); | 2521 return GetCode(Code::INTERCEPTOR, name); |
| 2522 } | 2522 } |
| 2523 | 2523 |
| 2524 | 2524 |
| 2525 Handle<Code> CallStubCompiler::CompileCallGlobal( | 2525 Handle<Code> CallStubCompiler::CompileCallGlobal( |
| 2526 Handle<JSObject> object, | 2526 Handle<JSObject> object, |
| 2527 Handle<GlobalObject> holder, | 2527 Handle<GlobalObject> holder, |
| 2528 Handle<JSGlobalPropertyCell> cell, | 2528 Handle<PropertyCell> cell, |
| 2529 Handle<JSFunction> function, | 2529 Handle<JSFunction> function, |
| 2530 Handle<Name> name) { | 2530 Handle<Name> name) { |
| 2531 // ----------- S t a t e ------------- | 2531 // ----------- S t a t e ------------- |
| 2532 // rcx : function name | 2532 // rcx : function name |
| 2533 // rsp[0] : return address | 2533 // rsp[0] : return address |
| 2534 // rsp[8] : argument argc | 2534 // rsp[8] : argument argc |
| 2535 // rsp[16] : argument argc - 1 | 2535 // rsp[16] : argument argc - 1 |
| 2536 // ... | 2536 // ... |
| 2537 // rsp[argc * 8] : argument 1 | 2537 // rsp[argc * 8] : argument 1 |
| 2538 // rsp[(argc + 1) * 8] : argument 0 = receiver | 2538 // rsp[(argc + 1) * 8] : argument 0 = receiver |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2701 __ bind(&miss); | 2701 __ bind(&miss); |
| 2702 TailCallBuiltin(masm(), MissBuiltin(kind())); | 2702 TailCallBuiltin(masm(), MissBuiltin(kind())); |
| 2703 | 2703 |
| 2704 // Return the generated code. | 2704 // Return the generated code. |
| 2705 return GetICCode(kind(), Code::INTERCEPTOR, name); | 2705 return GetICCode(kind(), Code::INTERCEPTOR, name); |
| 2706 } | 2706 } |
| 2707 | 2707 |
| 2708 | 2708 |
| 2709 Handle<Code> StoreStubCompiler::CompileStoreGlobal( | 2709 Handle<Code> StoreStubCompiler::CompileStoreGlobal( |
| 2710 Handle<GlobalObject> object, | 2710 Handle<GlobalObject> object, |
| 2711 Handle<JSGlobalPropertyCell> cell, | 2711 Handle<PropertyCell> cell, |
| 2712 Handle<Name> name) { | 2712 Handle<Name> name) { |
| 2713 Label miss; | 2713 Label miss; |
| 2714 | 2714 |
| 2715 // Check that the map of the global has not changed. | 2715 // Check that the map of the global has not changed. |
| 2716 __ Cmp(FieldOperand(receiver(), HeapObject::kMapOffset), | 2716 __ Cmp(FieldOperand(receiver(), HeapObject::kMapOffset), |
| 2717 Handle<Map>(object->map())); | 2717 Handle<Map>(object->map())); |
| 2718 __ j(not_equal, &miss); | 2718 __ j(not_equal, &miss); |
| 2719 | 2719 |
| 2720 // Compute the cell operand to use. | 2720 // Compute the cell operand to use. |
| 2721 __ Move(scratch1(), cell); | 2721 __ Move(scratch1(), cell); |
| 2722 Operand cell_operand = | 2722 Operand cell_operand = |
| 2723 FieldOperand(scratch1(), JSGlobalPropertyCell::kValueOffset); | 2723 FieldOperand(scratch1(), PropertyCell::kValueOffset); |
| 2724 | 2724 |
| 2725 // Check that the value in the cell is not the hole. If it is, this | 2725 // Check that the value in the cell is not the hole. If it is, this |
| 2726 // cell could have been deleted and reintroducing the global needs | 2726 // cell could have been deleted and reintroducing the global needs |
| 2727 // to update the property details in the property dictionary of the | 2727 // to update the property details in the property dictionary of the |
| 2728 // global object. We bail out to the runtime system to do that. | 2728 // global object. We bail out to the runtime system to do that. |
| 2729 __ CompareRoot(cell_operand, Heap::kTheHoleValueRootIndex); | 2729 __ CompareRoot(cell_operand, Heap::kTheHoleValueRootIndex); |
| 2730 __ j(equal, &miss); | 2730 __ j(equal, &miss); |
| 2731 | 2731 |
| 2732 // Store the value in the cell. | 2732 // Store the value in the cell. |
| 2733 __ movq(cell_operand, value()); | 2733 __ movq(cell_operand, value()); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2881 } | 2881 } |
| 2882 | 2882 |
| 2883 | 2883 |
| 2884 #undef __ | 2884 #undef __ |
| 2885 #define __ ACCESS_MASM(masm()) | 2885 #define __ ACCESS_MASM(masm()) |
| 2886 | 2886 |
| 2887 | 2887 |
| 2888 Handle<Code> LoadStubCompiler::CompileLoadGlobal( | 2888 Handle<Code> LoadStubCompiler::CompileLoadGlobal( |
| 2889 Handle<JSObject> object, | 2889 Handle<JSObject> object, |
| 2890 Handle<GlobalObject> global, | 2890 Handle<GlobalObject> global, |
| 2891 Handle<JSGlobalPropertyCell> cell, | 2891 Handle<PropertyCell> cell, |
| 2892 Handle<Name> name, | 2892 Handle<Name> name, |
| 2893 bool is_dont_delete) { | 2893 bool is_dont_delete) { |
| 2894 Label success, miss; | 2894 Label success, miss; |
| 2895 // TODO(verwaest): Directly store to rax. Currently we cannot do this, since | 2895 // TODO(verwaest): Directly store to rax. Currently we cannot do this, since |
| 2896 // rax is used as receiver(), which we would otherwise clobber before a | 2896 // rax is used as receiver(), which we would otherwise clobber before a |
| 2897 // potential miss. | 2897 // potential miss. |
| 2898 | 2898 |
| 2899 __ CheckMap(receiver(), Handle<Map>(object->map()), &miss, DO_SMI_CHECK); | 2899 __ CheckMap(receiver(), Handle<Map>(object->map()), &miss, DO_SMI_CHECK); |
| 2900 HandlerFrontendHeader( | 2900 HandlerFrontendHeader( |
| 2901 object, receiver(), Handle<JSObject>::cast(global), name, &miss); | 2901 object, receiver(), Handle<JSObject>::cast(global), name, &miss); |
| 2902 | 2902 |
| 2903 // Get the value from the cell. | 2903 // Get the value from the cell. |
| 2904 __ Move(rbx, cell); | 2904 __ Move(rbx, cell); |
| 2905 __ movq(rbx, FieldOperand(rbx, JSGlobalPropertyCell::kValueOffset)); | 2905 __ movq(rbx, FieldOperand(rbx, PropertyCell::kValueOffset)); |
| 2906 | 2906 |
| 2907 // Check for deleted property if property can actually be deleted. | 2907 // Check for deleted property if property can actually be deleted. |
| 2908 if (!is_dont_delete) { | 2908 if (!is_dont_delete) { |
| 2909 __ CompareRoot(rbx, Heap::kTheHoleValueRootIndex); | 2909 __ CompareRoot(rbx, Heap::kTheHoleValueRootIndex); |
| 2910 __ j(equal, &miss); | 2910 __ j(equal, &miss); |
| 2911 } else if (FLAG_debug_code) { | 2911 } else if (FLAG_debug_code) { |
| 2912 __ CompareRoot(rbx, Heap::kTheHoleValueRootIndex); | 2912 __ CompareRoot(rbx, Heap::kTheHoleValueRootIndex); |
| 2913 __ Check(not_equal, "DontDelete cells can't contain the hole"); | 2913 __ Check(not_equal, "DontDelete cells can't contain the hole"); |
| 2914 } | 2914 } |
| 2915 | 2915 |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3486 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); | 3486 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); |
| 3487 } | 3487 } |
| 3488 } | 3488 } |
| 3489 | 3489 |
| 3490 | 3490 |
| 3491 #undef __ | 3491 #undef __ |
| 3492 | 3492 |
| 3493 } } // namespace v8::internal | 3493 } } // namespace v8::internal |
| 3494 | 3494 |
| 3495 #endif // V8_TARGET_ARCH_X64 | 3495 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |