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

Side by Side Diff: runtime/vm/intrinsifier_ia32.cc

Issue 1162033005: Fix http://dartbug.com/23578: (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Update to ToT. Created 5 years, 6 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
OLDNEW
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 // 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 const intptr_t field_offset = cls.type_arguments_field_offset(); 47 const intptr_t field_offset = cls.type_arguments_field_offset();
48 ASSERT(field_offset != Class::kNoTypeArguments); 48 ASSERT(field_offset != Class::kNoTypeArguments);
49 return field_offset; 49 return field_offset;
50 } 50 }
51 51
52 52
53 // Intrinsify only for Smi value and index. Non-smi values need a store buffer 53 // Intrinsify only for Smi value and index. Non-smi values need a store buffer
54 // update. Array length is always a Smi. 54 // update. Array length is always a Smi.
55 void Intrinsifier::ObjectArraySetIndexed(Assembler* assembler) { 55 void Intrinsifier::ObjectArraySetIndexed(Assembler* assembler) {
56 Label fall_through; 56 Label fall_through;
57 if (Isolate::Current()->TypeChecksEnabled()) { 57 if (Isolate::Current()->flags().type_checks()) {
58 const intptr_t type_args_field_offset = 58 const intptr_t type_args_field_offset =
59 ComputeObjectArrayTypeArgumentsOffset(); 59 ComputeObjectArrayTypeArgumentsOffset();
60 // Inline simple tests (Smi, null), fallthrough if not positive. 60 // Inline simple tests (Smi, null), fallthrough if not positive.
61 const Immediate& raw_null = 61 const Immediate& raw_null =
62 Immediate(reinterpret_cast<intptr_t>(Object::null())); 62 Immediate(reinterpret_cast<intptr_t>(Object::null()));
63 Label checked_ok; 63 Label checked_ok;
64 __ movl(EDI, Address(ESP, + 1 * kWordSize)); // Value. 64 __ movl(EDI, Address(ESP, + 1 * kWordSize)); // Value.
65 // Null value is valid for any type. 65 // Null value is valid for any type.
66 __ cmpl(EDI, raw_null); 66 __ cmpl(EDI, raw_null);
67 __ j(EQUAL, &checked_ok, Assembler::kNearJump); 67 __ j(EQUAL, &checked_ok, Assembler::kNearJump);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 148
149 __ Bind(&fall_through); 149 __ Bind(&fall_through);
150 } 150 }
151 151
152 152
153 // Add an element to growable array if it doesn't need to grow, otherwise 153 // Add an element to growable array if it doesn't need to grow, otherwise
154 // call into regular code. 154 // call into regular code.
155 // On stack: growable array (+2), value (+1), return-address (+0). 155 // On stack: growable array (+2), value (+1), return-address (+0).
156 void Intrinsifier::GrowableArray_add(Assembler* assembler) { 156 void Intrinsifier::GrowableArray_add(Assembler* assembler) {
157 // In checked mode we need to type-check the incoming argument. 157 // In checked mode we need to type-check the incoming argument.
158 if (Isolate::Current()->TypeChecksEnabled()) return; 158 if (Isolate::Current()->flags().type_checks()) return;
159 159
160 Label fall_through; 160 Label fall_through;
161 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Array. 161 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Array.
162 __ movl(EBX, FieldAddress(EAX, GrowableObjectArray::length_offset())); 162 __ movl(EBX, FieldAddress(EAX, GrowableObjectArray::length_offset()));
163 // EBX: length. 163 // EBX: length.
164 __ movl(EDI, FieldAddress(EAX, GrowableObjectArray::data_offset())); 164 __ movl(EDI, FieldAddress(EAX, GrowableObjectArray::data_offset()));
165 // EDI: data. 165 // EDI: data.
166 // Compare length with capacity. 166 // Compare length with capacity.
167 __ cmpl(EBX, FieldAddress(EDI, Array::length_offset())); 167 __ cmpl(EBX, FieldAddress(EDI, Array::length_offset()));
168 __ j(EQUAL, &fall_through); // Must grow data. 168 __ j(EQUAL, &fall_through); // Must grow data.
(...skipping 1955 matching lines...) Expand 10 before | Expand all | Expand 10 after
2124 Isolate::current_tag_offset()); 2124 Isolate::current_tag_offset());
2125 // Set return value to Isolate::current_tag_. 2125 // Set return value to Isolate::current_tag_.
2126 __ movl(EAX, current_tag_addr); 2126 __ movl(EAX, current_tag_addr);
2127 __ ret(); 2127 __ ret();
2128 } 2128 }
2129 2129
2130 #undef __ 2130 #undef __
2131 } // namespace dart 2131 } // namespace dart
2132 2132
2133 #endif // defined TARGET_ARCH_IA32 2133 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698