Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: vm/intrinsifier_ia32.cc

Issue 9072011: - Add a size field to the header. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « vm/freelist.h ('k') | vm/object.h » ('j') | vm/stub_code_x64.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 // The intrinsic code below is executed before a method has built its frame. 5 // The intrinsic code below is executed before a method has built its frame.
6 // The return address is on the stack and the arguments below it. 6 // The return address is on the stack and the arguments below it.
7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved. 7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved.
8 // Each intrinsification method returns true if the corresponding 8 // Each intrinsification method returns true if the corresponding
9 // Dart method was intrinsified. 9 // Dart method was intrinsified.
10 10
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 const intptr_t kTypeArgumentsOffset = 2 * kWordSize; 91 const intptr_t kTypeArgumentsOffset = 2 * kWordSize;
92 const intptr_t kArrayLengthOffset = 1 * kWordSize; 92 const intptr_t kArrayLengthOffset = 1 * kWordSize;
93 Label fall_through; 93 Label fall_through;
94 94
95 // Compute the size to be allocated, it is based on the array length 95 // Compute the size to be allocated, it is based on the array length
96 // and it computed as: 96 // and it computed as:
97 // RoundedAllocationSize((array_length * kwordSize) + sizeof(RawArray)). 97 // RoundedAllocationSize((array_length * kwordSize) + sizeof(RawArray)).
98 __ movl(EDI, Address(ESP, kArrayLengthOffset)); // Array Length. 98 __ movl(EDI, Address(ESP, kArrayLengthOffset)); // Array Length.
99 // Assert that length is a Smi. 99 // Assert that length is a Smi.
100 __ testl(EDI, Immediate(kSmiTagSize)); 100 __ testl(EDI, Immediate(kSmiTagSize));
101 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); 101 __ j(NOT_ZERO, &fall_through);
102 intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; 102 intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1;
103 __ leal(EDI, Address(EDI, TIMES_2, fixed_size)); // EDI is a Smi. 103 __ leal(EDI, Address(EDI, TIMES_2, fixed_size)); // EDI is a Smi.
104 ASSERT(kSmiTagShift == 1); 104 ASSERT(kSmiTagShift == 1);
105 __ andl(EDI, Immediate(-kObjectAlignment)); 105 __ andl(EDI, Immediate(-kObjectAlignment));
106 106
107 Heap* heap = Isolate::Current()->heap(); 107 Heap* heap = Isolate::Current()->heap();
108 108
109 // EDI: size to allocate. 109 // EDI: allocation size.
110 __ movl(EAX, Address::Absolute(heap->TopAddress())); 110 __ movl(EAX, Address::Absolute(heap->TopAddress()));
111 __ leal(EBX, Address(EAX, EDI, TIMES_1, 0)); 111 __ leal(EBX, Address(EAX, EDI, TIMES_1, 0));
112 112
113 // Check if the allocation fits into the remaining space. 113 // Check if the allocation fits into the remaining space.
114 // EAX: potential new object start. 114 // EAX: potential new object start.
115 // EBX: potential next object start. 115 // EBX: potential next object start.
116 // EDI: allocation size.
116 __ cmpl(EBX, Address::Absolute(heap->EndAddress())); 117 __ cmpl(EBX, Address::Absolute(heap->EndAddress()));
117 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump); 118 __ j(ABOVE_EQUAL, &fall_through);
118 119
119 // Successfully allocated the object(s), now update top to point to 120 // Successfully allocated the object(s), now update top to point to
120 // next object start and initialize the object. 121 // next object start and initialize the object.
121 __ movl(Address::Absolute(heap->TopAddress()), EBX); 122 __ movl(Address::Absolute(heap->TopAddress()), EBX);
122 __ addl(EAX, Immediate(kHeapObjectTag)); 123 __ addl(EAX, Immediate(kHeapObjectTag));
123 124
125 // Initialize the tags.
124 // EAX: new object start as a tagged pointer. 126 // EAX: new object start as a tagged pointer.
125 // EBX: new object end address. 127 // EBX: new object end address.
128 // EDI: allocation size.
129 {
130 Label size_tag_overflow, done;
131 __ cmpl(EDI, Immediate(RawObject::SizeTag::kMaxSizeTag));
132 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump);
133 __ shll(EDI, Immediate(RawObject::kSizeTagBit - kObjectAlignmentLog2));
134 __ movl(FieldAddress(EAX, Array::tags_offset()), EDI); // Tags.
135 __ jmp(&done);
136
137 __ Bind(&size_tag_overflow);
138 __ movl(FieldAddress(EAX, Array::tags_offset()), Immediate(0));
139 __ Bind(&done);
140 }
141
126 // Store class value for array. 142 // Store class value for array.
143 // EAX: new object start as a tagged pointer.
144 // EBX: new object end address.
127 __ movl(EDI, FieldAddress(CTX, Context::isolate_offset())); 145 __ movl(EDI, FieldAddress(CTX, Context::isolate_offset()));
128 __ movl(EDI, Address(EDI, Isolate::object_store_offset())); 146 __ movl(EDI, Address(EDI, Isolate::object_store_offset()));
129 __ movl(EDI, Address(EDI, ObjectStore::array_class_offset())); 147 __ movl(EDI, Address(EDI, ObjectStore::array_class_offset()));
130 __ StoreIntoObject(EAX, FieldAddress(EAX, Array::class_offset()), EDI); 148 __ StoreIntoObject(EAX, FieldAddress(EAX, Array::class_offset()), EDI);
131 149
132 // Initialize the tags.
133 __ movl(FieldAddress(EAX, Array::tags_offset()), Immediate(0));
134
135 // Store the type argument field. 150 // Store the type argument field.
136 __ movl(EDI, Address(ESP, kTypeArgumentsOffset)); // type argument. 151 __ movl(EDI, Address(ESP, kTypeArgumentsOffset)); // type argument.
137 __ StoreIntoObject(EAX, 152 __ StoreIntoObject(EAX,
138 FieldAddress(EAX, Array::type_arguments_offset()), 153 FieldAddress(EAX, Array::type_arguments_offset()),
139 EDI); 154 EDI);
140 155
141 // Set the length field. 156 // Set the length field.
142 __ movl(EDI, Address(ESP, kArrayLengthOffset)); // Array Length. 157 __ movl(EDI, Address(ESP, kArrayLengthOffset)); // Array Length.
143 __ StoreIntoObject(EAX, FieldAddress(EAX, Array::length_offset()), EDI); 158 __ StoreIntoObject(EAX, FieldAddress(EAX, Array::length_offset()), EDI);
144 159
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 } \ 1060 } \
1046 1061
1047 INTRINSIC_LIST(FIND_INTRINSICS); 1062 INTRINSIC_LIST(FIND_INTRINSICS);
1048 #undef FIND_INTRINSICS 1063 #undef FIND_INTRINSICS
1049 return false; 1064 return false;
1050 } 1065 }
1051 1066
1052 } // namespace dart 1067 } // namespace dart
1053 1068
1054 #endif // defined TARGET_ARCH_IA32 1069 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « vm/freelist.h ('k') | vm/object.h » ('j') | vm/stub_code_x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698