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_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
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 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 // Input parameters: | 977 // Input parameters: |
978 // T0: Address (i.e. object) being stored into. | 978 // T0: Address (i.e. object) being stored into. |
979 void StubCode::GenerateUpdateStoreBufferStub(Assembler* assembler) { | 979 void StubCode::GenerateUpdateStoreBufferStub(Assembler* assembler) { |
980 // Save values being destroyed. | 980 // Save values being destroyed. |
981 __ TraceSimMsg("UpdateStoreBufferStub"); | 981 __ TraceSimMsg("UpdateStoreBufferStub"); |
982 __ addiu(SP, SP, Immediate(-3 * kWordSize)); | 982 __ addiu(SP, SP, Immediate(-3 * kWordSize)); |
983 __ sw(T3, Address(SP, 2 * kWordSize)); | 983 __ sw(T3, Address(SP, 2 * kWordSize)); |
984 __ sw(T2, Address(SP, 1 * kWordSize)); | 984 __ sw(T2, Address(SP, 1 * kWordSize)); |
985 __ sw(T1, Address(SP, 0 * kWordSize)); | 985 __ sw(T1, Address(SP, 0 * kWordSize)); |
986 | 986 |
| 987 Label add_to_buffer; |
| 988 // Check whether this object has already been remembered. Skip adding to the |
| 989 // store buffer if the object is in the store buffer already. |
| 990 // Spilled: T1, T2, T3. |
| 991 // T0: Address being stored. |
| 992 __ lw(T2, FieldAddress(T0, Object::tags_offset())); |
| 993 __ andi(T1, T2, Immediate(1 << RawObject::kRememberedBit)); |
| 994 __ beq(T1, ZR, &add_to_buffer); |
| 995 __ lw(T1, Address(SP, 0 * kWordSize)); |
| 996 __ lw(T2, Address(SP, 1 * kWordSize)); |
| 997 __ lw(T3, Address(SP, 2 * kWordSize)); |
| 998 __ addiu(SP, SP, Immediate(3 * kWordSize)); |
| 999 __ Ret(); |
| 1000 |
| 1001 __ Bind(&add_to_buffer); |
| 1002 __ ori(T2, T2, Immediate(1 << RawObject::kRememberedBit)); |
| 1003 __ sw(T2, FieldAddress(T0, Object::tags_offset())); |
| 1004 |
987 // Load the isolate out of the context. | 1005 // Load the isolate out of the context. |
988 // Spilled: T1, T2, T3. | 1006 // Spilled: T1, T2, T3. |
989 // T0: Address being stored. | 1007 // T0: Address being stored. |
990 __ lw(T1, FieldAddress(CTX, Context::isolate_offset())); | 1008 __ lw(T1, FieldAddress(CTX, Context::isolate_offset())); |
991 | 1009 |
992 // Load top_ out of the StoreBufferBlock and add the address to the pointers_. | 1010 // Load the StoreBuffer block out of the isolate. Then load top_ out of the |
| 1011 // StoreBufferBlock and add the address to the pointers_. |
993 // T1: Isolate. | 1012 // T1: Isolate. |
994 intptr_t store_buffer_offset = Isolate::store_buffer_block_offset(); | 1013 __ lw(T1, Address(T1, Isolate::store_buffer_offset())); |
995 __ lw(T2, Address(T1, store_buffer_offset + StoreBufferBlock::top_offset())); | 1014 __ lw(T2, Address(T1, StoreBufferBlock::top_offset())); |
996 __ sll(T3, T2, 2); | 1015 __ sll(T3, T2, 2); |
997 __ addu(T3, T1, T3); | 1016 __ addu(T3, T1, T3); |
998 __ sw(T0, | 1017 __ sw(T0, Address(T3, StoreBufferBlock::pointers_offset())); |
999 Address(T3, store_buffer_offset + StoreBufferBlock::pointers_offset())); | |
1000 | 1018 |
1001 // Increment top_ and check for overflow. | 1019 // Increment top_ and check for overflow. |
1002 // T2: top_ | 1020 // T2: top_ |
1003 // T1: Isolate | 1021 // T1: StoreBufferBlock |
1004 Label L; | 1022 Label L; |
1005 __ AddImmediate(T2, 1); | 1023 __ AddImmediate(T2, 1); |
1006 __ sw(T2, Address(T1, store_buffer_offset + StoreBufferBlock::top_offset())); | 1024 __ sw(T2, Address(T1, StoreBufferBlock::top_offset())); |
1007 __ addiu(CMPRES, T2, Immediate(-StoreBufferBlock::kSize)); | 1025 __ addiu(CMPRES, T2, Immediate(-StoreBufferBlock::kSize)); |
1008 // Restore values. | 1026 // Restore values. |
1009 __ lw(T1, Address(SP, 0 * kWordSize)); | 1027 __ lw(T1, Address(SP, 0 * kWordSize)); |
1010 __ lw(T2, Address(SP, 1 * kWordSize)); | 1028 __ lw(T2, Address(SP, 1 * kWordSize)); |
1011 __ lw(T3, Address(SP, 2 * kWordSize)); | 1029 __ lw(T3, Address(SP, 2 * kWordSize)); |
1012 __ beq(CMPRES, ZR, &L); | 1030 __ beq(CMPRES, ZR, &L); |
1013 __ delay_slot()->addiu(SP, SP, Immediate(3 * kWordSize)); | 1031 __ delay_slot()->addiu(SP, SP, Immediate(3 * kWordSize)); |
1014 __ Ret(); | 1032 __ Ret(); |
1015 | 1033 |
1016 // Handle overflow: Call the runtime leaf function. | 1034 // Handle overflow: Call the runtime leaf function. |
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2106 __ Bind(&done); | 2124 __ Bind(&done); |
2107 __ lw(T0, Address(SP, 0 * kWordSize)); | 2125 __ lw(T0, Address(SP, 0 * kWordSize)); |
2108 __ lw(T1, Address(SP, 1 * kWordSize)); | 2126 __ lw(T1, Address(SP, 1 * kWordSize)); |
2109 __ Ret(); | 2127 __ Ret(); |
2110 __ delay_slot()->addiu(SP, SP, Immediate(2 * kWordSize)); | 2128 __ delay_slot()->addiu(SP, SP, Immediate(2 * kWordSize)); |
2111 } | 2129 } |
2112 | 2130 |
2113 } // namespace dart | 2131 } // namespace dart |
2114 | 2132 |
2115 #endif // defined TARGET_ARCH_MIPS | 2133 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |