OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
877 | 877 |
878 DECLARE_LEAF_RUNTIME_ENTRY(void, StoreBufferBlockProcess, Isolate* isolate); | 878 DECLARE_LEAF_RUNTIME_ENTRY(void, StoreBufferBlockProcess, Isolate* isolate); |
879 | 879 |
880 // Helper stub to implement Assembler::StoreIntoObject. | 880 // Helper stub to implement Assembler::StoreIntoObject. |
881 // Input parameters: | 881 // Input parameters: |
882 // R0: address (i.e. object) being stored into. | 882 // R0: address (i.e. object) being stored into. |
883 void StubCode::GenerateUpdateStoreBufferStub(Assembler* assembler) { | 883 void StubCode::GenerateUpdateStoreBufferStub(Assembler* assembler) { |
884 // Save values being destroyed. | 884 // Save values being destroyed. |
885 __ PushList((1 << R1) | (1 << R2) | (1 << R3)); | 885 __ PushList((1 << R1) | (1 << R2) | (1 << R3)); |
886 | 886 |
| 887 Label add_to_buffer; |
| 888 // Check whether this object has already been remembered. Skip adding to the |
| 889 // store buffer if the object is in the store buffer already. |
| 890 // Spilled: R1, R2, R3 |
| 891 // R0: Address being stored |
| 892 __ ldr(R2, FieldAddress(R0, Object::tags_offset())); |
| 893 __ tst(R2, ShifterOperand(1 << RawObject::kRememberedBit)); |
| 894 __ b(&add_to_buffer, EQ); |
| 895 __ PopList((1 << R1) | (1 << R2) | (1 << R3)); |
| 896 __ Ret(); |
| 897 |
| 898 __ Bind(&add_to_buffer); |
| 899 __ orr(R2, R2, ShifterOperand(1 << RawObject::kRememberedBit)); |
| 900 __ str(R2, FieldAddress(R0, Object::tags_offset())); |
| 901 |
887 // Load the isolate out of the context. | 902 // Load the isolate out of the context. |
888 // Spilled: R1, R2, R3. | 903 // Spilled: R1, R2, R3. |
889 // R0: address being stored. | 904 // R0: address being stored. |
890 __ ldr(R1, FieldAddress(CTX, Context::isolate_offset())); | 905 __ ldr(R1, FieldAddress(CTX, Context::isolate_offset())); |
891 | 906 |
892 // Load top_ out of the StoreBufferBlock and add the address to the pointers_. | 907 // Load the StoreBuffer block out of the isolate. Then load top_ out of the |
| 908 // StoreBufferBlock and add the address to the pointers_. |
893 // R1: isolate. | 909 // R1: isolate. |
894 intptr_t store_buffer_offset = Isolate::store_buffer_block_offset(); | 910 __ ldr(R1, Address(R1, Isolate::store_buffer_offset())); |
895 __ LoadFromOffset(kLoadWord, R2, R1, | 911 __ ldr(R2, Address(R1, StoreBufferBlock::top_offset())); |
896 store_buffer_offset + StoreBufferBlock::top_offset()); | |
897 __ add(R3, R1, ShifterOperand(R2, LSL, 2)); | 912 __ add(R3, R1, ShifterOperand(R2, LSL, 2)); |
898 __ StoreToOffset(kStoreWord, R0, R3, | 913 __ str(R0, Address(R3, StoreBufferBlock::pointers_offset())); |
899 store_buffer_offset + StoreBufferBlock::pointers_offset()); | |
900 | 914 |
901 // Increment top_ and check for overflow. | 915 // Increment top_ and check for overflow. |
902 // R2: top_. | 916 // R2: top_. |
903 // R1: isolate. | 917 // R1: StoreBufferBlock. |
904 Label L; | 918 Label L; |
905 __ add(R2, R2, ShifterOperand(1)); | 919 __ add(R2, R2, ShifterOperand(1)); |
906 __ StoreToOffset(kStoreWord, R2, R1, | 920 __ str(R2, Address(R1, StoreBufferBlock::top_offset())); |
907 store_buffer_offset + StoreBufferBlock::top_offset()); | |
908 __ CompareImmediate(R2, StoreBufferBlock::kSize); | 921 __ CompareImmediate(R2, StoreBufferBlock::kSize); |
909 // Restore values. | 922 // Restore values. |
910 __ PopList((1 << R1) | (1 << R2) | (1 << R3)); | 923 __ PopList((1 << R1) | (1 << R2) | (1 << R3)); |
911 __ b(&L, EQ); | 924 __ b(&L, EQ); |
912 __ Ret(); | 925 __ Ret(); |
913 | 926 |
914 // Handle overflow: Call the runtime leaf function. | 927 // Handle overflow: Call the runtime leaf function. |
915 __ Bind(&L); | 928 __ Bind(&L); |
916 // Setup frame, push callee-saved registers. | 929 // Setup frame, push callee-saved registers. |
917 | 930 |
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1910 __ Bind(&reference_compare); | 1923 __ Bind(&reference_compare); |
1911 __ cmp(left, ShifterOperand(right)); | 1924 __ cmp(left, ShifterOperand(right)); |
1912 __ Bind(&done); | 1925 __ Bind(&done); |
1913 __ PopList((1 << R0) | (1 << R1) | (1 << R2)); | 1926 __ PopList((1 << R0) | (1 << R1) | (1 << R2)); |
1914 __ Ret(); | 1927 __ Ret(); |
1915 } | 1928 } |
1916 | 1929 |
1917 } // namespace dart | 1930 } // namespace dart |
1918 | 1931 |
1919 #endif // defined TARGET_ARCH_ARM | 1932 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |