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

Side by Side Diff: vm/intrinsifier_ia32.cc

Issue 9021025: Check all cases with "__ movl(FieldAddress" and converted them to StoreIntoObject where appropriate. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 9 years 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/code_generator_ia32.cc ('k') | vm/stub_code_ia32.cc » ('j') | no next file with comments »
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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // next object start and initialize the object. 119 // next object start and initialize the object.
120 __ movl(Address::Absolute(heap->TopAddress()), EBX); 120 __ movl(Address::Absolute(heap->TopAddress()), EBX);
121 __ addl(EAX, Immediate(kHeapObjectTag)); 121 __ addl(EAX, Immediate(kHeapObjectTag));
122 122
123 // EAX: new object start as a tagged pointer. 123 // EAX: new object start as a tagged pointer.
124 // EBX: new object end address. 124 // EBX: new object end address.
125 // Store class value for array. 125 // Store class value for array.
126 __ movl(EDI, FieldAddress(CTX, Context::isolate_offset())); 126 __ movl(EDI, FieldAddress(CTX, Context::isolate_offset()));
127 __ movl(EDI, Address(EDI, Isolate::object_store_offset())); 127 __ movl(EDI, Address(EDI, Isolate::object_store_offset()));
128 __ movl(EDI, Address(EDI, ObjectStore::array_class_offset())); 128 __ movl(EDI, Address(EDI, ObjectStore::array_class_offset()));
129 __ movl(FieldAddress(EAX, Instance::class_offset()), EDI); 129 __ StoreIntoObject(EAX, FieldAddress(EAX, Instance::class_offset()), EDI);
130 130
131 // Store the type argument field. 131 // Store the type argument field.
132 __ movl(EDI, Address(ESP, kTypeArgumentsOffset)); // type argument. 132 __ movl(EDI, Address(ESP, kTypeArgumentsOffset)); // type argument.
133 __ movl(FieldAddress(EAX, Array::type_arguments_offset()), EDI); 133 __ StoreIntoObject(EAX,
134 FieldAddress(EAX, Array::type_arguments_offset()),
135 EDI);
134 136
135 // Set the length field. 137 // Set the length field.
136 __ movl(EDI, Address(ESP, kArrayLengthOffset)); // Array Length. 138 __ movl(EDI, Address(ESP, kArrayLengthOffset)); // Array Length.
137 __ movl(FieldAddress(EAX, Array::length_offset()), EDI); 139 __ StoreIntoObject(EAX, FieldAddress(EAX, Array::length_offset()), EDI);
138 140
139 // Initialize all array elements to raw_null. 141 // Initialize all array elements to raw_null.
140 // EAX: new object start as a tagged pointer. 142 // EAX: new object start as a tagged pointer.
141 // EBX: new object end address. 143 // EBX: new object end address.
142 // EDI: iterator which initially points to the start of the variable 144 // EDI: iterator which initially points to the start of the variable
143 // data area to be initialized. 145 // data area to be initialized.
144 const Immediate raw_null = 146 const Immediate raw_null =
145 Immediate(reinterpret_cast<intptr_t>(Object::null())); 147 Immediate(reinterpret_cast<intptr_t>(Object::null()));
146 __ leal(EDI, FieldAddress(EAX, sizeof(RawArray))); 148 __ leal(EDI, FieldAddress(EAX, sizeof(RawArray)));
147 Label done; 149 Label done;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); 206 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump);
205 __ movl(EAX, Address(ESP, + 3 * kWordSize)); // Array. 207 __ movl(EAX, Address(ESP, + 3 * kWordSize)); // Array.
206 // Range check. 208 // Range check.
207 __ cmpl(EBX, FieldAddress(EAX, Array::length_offset())); 209 __ cmpl(EBX, FieldAddress(EAX, Array::length_offset()));
208 // Runtime throws exception. 210 // Runtime throws exception.
209 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump); 211 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump);
210 // Note that EBX is Smi, i.e, times 2. 212 // Note that EBX is Smi, i.e, times 2.
211 ASSERT(kSmiTagShift == 1); 213 ASSERT(kSmiTagShift == 1);
212 // Destroy ECX as we will not continue in the function. 214 // Destroy ECX as we will not continue in the function.
213 __ movl(ECX, Address(ESP, + 1 * kWordSize)); 215 __ movl(ECX, Address(ESP, + 1 * kWordSize));
214 __ movl(FieldAddress(EAX, EBX, TIMES_2, sizeof(RawArray)), ECX); 216 __ StoreIntoObject(EAX,
217 FieldAddress(EAX, EBX, TIMES_2, sizeof(RawArray)),
218 ECX);
215 // Caller is responsible of preserving the value if necessary. 219 // Caller is responsible of preserving the value if necessary.
216 __ ret(); 220 __ ret();
217 __ Bind(&fall_through); 221 __ Bind(&fall_through);
218 return false; 222 return false;
219 } 223 }
220 224
221 225
222 static intptr_t GetOffsetForField(const char* class_name_p, 226 static intptr_t GetOffsetForField(const char* class_name_p,
223 const char* field_name_p) { 227 const char* field_name_p) {
224 const String& class_name = String::Handle(String::NewSymbol(class_name_p)); 228 const String& class_name = String::Handle(String::NewSymbol(class_name_p));
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 __ shld(EDI, EAX); 474 __ shld(EDI, EAX);
471 // Result in EDI (high) and EBX (low). 475 // Result in EDI (high) and EBX (low).
472 const Class& mint_class = Class::ZoneHandle( 476 const Class& mint_class = Class::ZoneHandle(
473 Isolate::Current()->object_store()->mint_class()); 477 Isolate::Current()->object_store()->mint_class());
474 __ LoadObject(ECX, mint_class); 478 __ LoadObject(ECX, mint_class);
475 AssemblerMacros::TryAllocate(assembler, 479 AssemblerMacros::TryAllocate(assembler,
476 mint_class, 480 mint_class,
477 ECX, // Class register. 481 ECX, // Class register.
478 &fall_through, 482 &fall_through,
479 EAX); // Result register. 483 EAX); // Result register.
484 // EBX and EDI are not objects but integer values.
480 __ movl(FieldAddress(EAX, Mint::value_offset()), EBX); 485 __ movl(FieldAddress(EAX, Mint::value_offset()), EBX);
481 __ movl(FieldAddress(EAX, Mint::value_offset() + kWordSize), EDI); 486 __ movl(FieldAddress(EAX, Mint::value_offset() + kWordSize), EDI);
482 __ ret(); 487 __ ret();
483 __ Bind(&fall_through); 488 __ Bind(&fall_through);
484 return false; 489 return false;
485 } 490 }
486 491
487 492
488 static bool CompareIntegers(Assembler* assembler, Condition true_condition) { 493 static bool CompareIntegers(Assembler* assembler, Condition true_condition) {
489 Label fall_through, true_label; 494 Label fall_through, true_label;
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 __ cmpl(EBX, FieldAddress(EAX, Array::length_offset())); // Range check. 888 __ cmpl(EBX, FieldAddress(EAX, Array::length_offset())); // Range check.
884 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump); 889 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump);
885 890
886 // EBX is Smi, i.e, times 2. 891 // EBX is Smi, i.e, times 2.
887 ASSERT(kSmiTagShift == 1); 892 ASSERT(kSmiTagShift == 1);
888 __ movl(EDI, FieldAddress(EAX, EBX, TIMES_2, sizeof(RawArray))); // Result. 893 __ movl(EDI, FieldAddress(EAX, EBX, TIMES_2, sizeof(RawArray))); // Result.
889 const Immediate value = Immediate(reinterpret_cast<int32_t>(Smi::New(1))); 894 const Immediate value = Immediate(reinterpret_cast<int32_t>(Smi::New(1)));
890 __ addl(EBX, value); // _pos++. 895 __ addl(EBX, value); // _pos++.
891 __ j(OVERFLOW, &fall_through, Assembler::kNearJump); 896 __ j(OVERFLOW, &fall_through, Assembler::kNearJump);
892 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // Receiver. 897 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // Receiver.
893 __ movl(FieldAddress(EAX, pos_offset), EBX); // Store _pos. 898 __ StoreIntoObject(EAX, FieldAddress(EAX, pos_offset), EBX); // Store _pos.
894 __ movl(EAX, EDI); 899 __ movl(EAX, EDI);
895 __ ret(); 900 __ ret();
896 __ Bind(&fall_through); 901 __ Bind(&fall_through);
897 return false; 902 return false;
898 } 903 }
899 904
900 905
901 // Class 'FixedSizeArrayIterator': 906 // Class 'FixedSizeArrayIterator':
902 // bool hasNext() { 907 // bool hasNext() {
903 // return _length > _pos; 908 // return _length > _pos;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 } \ 1012 } \
1008 1013
1009 INTRINSIC_LIST(FIND_INTRINSICS); 1014 INTRINSIC_LIST(FIND_INTRINSICS);
1010 #undef FIND_INTRINSICS 1015 #undef FIND_INTRINSICS
1011 return false; 1016 return false;
1012 } 1017 }
1013 1018
1014 } // namespace dart 1019 } // namespace dart
1015 1020
1016 #endif // defined TARGET_ARCH_IA32 1021 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « vm/code_generator_ia32.cc ('k') | vm/stub_code_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698