Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/assembler_macros.h" | 9 #include "vm/assembler_macros.h" |
| 10 #include "vm/code_generator.h" | 10 #include "vm/code_generator.h" |
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 650 // R13: Points to new space object. | 650 // R13: Points to new space object. |
| 651 __ movq(Address(R13, Scavenger::top_offset()), R12); | 651 __ movq(Address(R13, Scavenger::top_offset()), R12); |
| 652 __ addq(RAX, Immediate(kHeapObjectTag)); | 652 __ addq(RAX, Immediate(kHeapObjectTag)); |
| 653 | 653 |
| 654 // RAX: new object start as a tagged pointer. | 654 // RAX: new object start as a tagged pointer. |
| 655 // R12: new object end address. | 655 // R12: new object end address. |
| 656 // RBX: array element type. | 656 // RBX: array element type. |
| 657 // R10: Array length as Smi. | 657 // R10: Array length as Smi. |
| 658 | 658 |
| 659 // Store the type argument field. | 659 // Store the type argument field. |
| 660 __ StoreIntoObject(RAX, | 660 __ StoreIntoObjectNoBarrier( |
| 661 FieldAddress(RAX, Array::type_arguments_offset()), | 661 RAX, FieldAddress(RAX, Array::type_arguments_offset()), RBX); |
| 662 RBX); | |
| 663 | 662 |
| 664 // Set the length field. | 663 // Set the length field. |
| 665 __ StoreIntoObject(RAX, FieldAddress(RAX, Array::length_offset()), R10); | 664 __ StoreIntoObjectNoBarrier( |
| 665 RAX, FieldAddress(RAX, Array::length_offset()), R10); | |
| 666 | 666 |
| 667 // Calculate the size tag. | 667 // Calculate the size tag. |
| 668 // RAX: new object start as a tagged pointer. | 668 // RAX: new object start as a tagged pointer. |
| 669 // R12: new object end address. | 669 // R12: new object end address. |
| 670 // R10: Array length as Smi. | 670 // R10: Array length as Smi. |
| 671 { | 671 { |
| 672 Label size_tag_overflow, done; | 672 Label size_tag_overflow, done; |
| 673 __ leaq(RBX, Address(R10, TIMES_4, fixed_size)); // R10 is Smi. | 673 __ leaq(RBX, Address(R10, TIMES_4, fixed_size)); // R10 is Smi. |
| 674 ASSERT(kSmiTagShift == 1); | 674 ASSERT(kSmiTagShift == 1); |
| 675 __ andq(RBX, Immediate(-kObjectAlignment)); | 675 __ andq(RBX, Immediate(-kObjectAlignment)); |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1061 __ popq(RAX); // Pop the new context object. | 1061 __ popq(RAX); // Pop the new context object. |
| 1062 // RAX: new object | 1062 // RAX: new object |
| 1063 // Restore the frame pointer. | 1063 // Restore the frame pointer. |
| 1064 __ LeaveFrame(); | 1064 __ LeaveFrame(); |
| 1065 __ ret(); | 1065 __ ret(); |
| 1066 } | 1066 } |
| 1067 | 1067 |
| 1068 | 1068 |
| 1069 // Helper stub to implement Assembler::StoreIntoObject. | 1069 // Helper stub to implement Assembler::StoreIntoObject. |
| 1070 // Input parameters: | 1070 // Input parameters: |
| 1071 // RAX: Address being stored | |
| 1071 void StubCode::GenerateUpdateStoreBufferStub(Assembler* assembler) { | 1072 void StubCode::GenerateUpdateStoreBufferStub(Assembler* assembler) { |
| 1072 __ Unimplemented("StubCode::GenerateUpdateStoreBufferStub"); | 1073 // Save registers being destroyed. |
| 1074 __ pushq(CTX); | |
| 1075 __ pushq(RBX); | |
| 1076 | |
| 1077 // Load the isolate out of the context. | |
| 1078 // RAX: Address being stored | |
| 1079 __ movq(CTX, FieldAddress(CTX, Context::isolate_offset())); | |
| 1080 | |
| 1081 // Load top_ out of the StoreBufferBlock and add teh address to the pointers_. | |
|
srdjan
2012/06/20 23:28:27
s/teh/the/
| |
| 1082 // RAX: Address being stored | |
| 1083 // CTX: Isolate | |
| 1084 intptr_t store_buffer_offset = Isolate::store_buffer_offset(); | |
| 1085 __ movl(RBX, | |
|
srdjan
2012/06/20 23:28:27
movq?
Ivan Posva
2012/06/20 23:48:01
top_ in StoreBufferBlock is an int32_t. I had thes
| |
| 1086 Address(CTX, store_buffer_offset + StoreBufferBlock::top_offset())); | |
| 1087 __ movq(Address(CTX, | |
| 1088 RBX, TIMES_4, | |
| 1089 store_buffer_offset + StoreBufferBlock::pointers_offset()), | |
| 1090 RAX); | |
| 1091 | |
| 1092 // Increment top_ and check for overflow. | |
| 1093 // RBX: top_ | |
| 1094 // CTX: Isolate | |
| 1095 Label L; | |
| 1096 __ incq(RBX); | |
| 1097 __ movl(Address(CTX, store_buffer_offset + StoreBufferBlock::top_offset()), | |
| 1098 RBX); | |
|
srdjan
2012/06/20 23:28:27
movq?
| |
| 1099 __ cmpl(RBX, Immediate(StoreBufferBlock::kSize)); | |
|
srdjan
2012/06/20 23:28:27
cmpq?
| |
| 1100 __ j(NOT_EQUAL, &L, Assembler::kNearJump); | |
| 1101 | |
| 1102 // Handle overflow: Reset the top_ pointer. | |
| 1103 // CTX: Isolate | |
| 1104 __ movl(RBX, Immediate(0)); | |
| 1105 __ movl(Address(CTX, store_buffer_offset + StoreBufferBlock::top_offset()), | |
|
srdjan
2012/06/20 23:28:27
movq (both).
| |
| 1106 RBX); | |
| 1107 | |
| 1108 __ Bind(&L); | |
| 1109 // Restore values. | |
| 1110 __ popq(RBX); | |
| 1111 __ popq(CTX); | |
| 1073 __ ret(); | 1112 __ ret(); |
| 1074 } | 1113 } |
| 1075 | 1114 |
| 1076 | 1115 |
| 1077 // Called for inline allocation of objects. | 1116 // Called for inline allocation of objects. |
| 1078 // Input parameters: | 1117 // Input parameters: |
| 1079 // RSP + 16 : type arguments object (only if class is parameterized). | 1118 // RSP + 16 : type arguments object (only if class is parameterized). |
| 1080 // RSP + 8 : type arguments of instantiator (only if class is parameterized). | 1119 // RSP + 8 : type arguments of instantiator (only if class is parameterized). |
| 1081 // RSP : points to return address. | 1120 // RSP : points to return address. |
| 1082 void StubCode::GenerateAllocationStubForClass(Assembler* assembler, | 1121 void StubCode::GenerateAllocationStubForClass(Assembler* assembler, |
| (...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1830 // TOS + 2: instance. | 1869 // TOS + 2: instance. |
| 1831 // TOS + 3: cache array. | 1870 // TOS + 3: cache array. |
| 1832 // Result in RCX: null -> not found, otherwise result (true or false). | 1871 // Result in RCX: null -> not found, otherwise result (true or false). |
| 1833 void StubCode::GenerateSubtype3TestCacheStub(Assembler* assembler) { | 1872 void StubCode::GenerateSubtype3TestCacheStub(Assembler* assembler) { |
| 1834 GenerateSubtypeNTestCacheStub(assembler, 3); | 1873 GenerateSubtypeNTestCacheStub(assembler, 3); |
| 1835 } | 1874 } |
| 1836 | 1875 |
| 1837 } // namespace dart | 1876 } // namespace dart |
| 1838 | 1877 |
| 1839 #endif // defined TARGET_ARCH_X64 | 1878 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |