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

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

Issue 10942025: Convert String and List to abstract classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated to tip-of-tree. Created 8 years, 2 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
OLDNEW
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" // Needed here to get TARGET_ARCH_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/flow_graph_compiler.h" 8 #include "vm/flow_graph_compiler.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 type_arguments.IsRaw(type_arguments.Length()); 141 type_arguments.IsRaw(type_arguments.Length());
142 if (is_raw_type) { 142 if (is_raw_type) {
143 const Register kClassIdReg = ECX; 143 const Register kClassIdReg = ECX;
144 // Dynamic type argument, check only classes. 144 // Dynamic type argument, check only classes.
145 // List is a very common case. 145 // List is a very common case.
146 __ LoadClassId(kClassIdReg, kInstanceReg); 146 __ LoadClassId(kClassIdReg, kInstanceReg);
147 if (!type_class.is_interface()) { 147 if (!type_class.is_interface()) {
148 __ cmpl(kClassIdReg, Immediate(type_class.id())); 148 __ cmpl(kClassIdReg, Immediate(type_class.id()));
149 __ j(EQUAL, is_instance_lbl); 149 __ j(EQUAL, is_instance_lbl);
150 } 150 }
151 if (type.IsListInterface()) { 151 if (type.IsListType()) {
152 GenerateListTypeCheck(kClassIdReg, is_instance_lbl); 152 GenerateListTypeCheck(kClassIdReg, is_instance_lbl);
153 } 153 }
154 return GenerateSubtype1TestCacheLookup( 154 return GenerateSubtype1TestCacheLookup(
155 token_pos, type_class, is_instance_lbl, is_not_instance_lbl); 155 token_pos, type_class, is_instance_lbl, is_not_instance_lbl);
156 } 156 }
157 // If one type argument only, check if type argument is Object or Dynamic. 157 // If one type argument only, check if type argument is Object or Dynamic.
158 if (type_arguments.Length() == 1) { 158 if (type_arguments.Length() == 1) {
159 const AbstractType& tp_argument = AbstractType::ZoneHandle( 159 const AbstractType& tp_argument = AbstractType::ZoneHandle(
160 type_arguments.TypeAt(0)); 160 type_arguments.TypeAt(0));
161 ASSERT(!tp_argument.IsMalformed()); 161 ASSERT(!tp_argument.IsMalformed());
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 __ jmp(is_not_instance_lbl); 250 __ jmp(is_not_instance_lbl);
251 return false; 251 return false;
252 } 252 }
253 // Custom checking for numbers (Smi, Mint, Bigint and Double). 253 // Custom checking for numbers (Smi, Mint, Bigint and Double).
254 // Note that instance is not Smi (checked above). 254 // Note that instance is not Smi (checked above).
255 if (type.IsSubtypeOf(Type::Handle(Type::Number()), NULL)) { 255 if (type.IsSubtypeOf(Type::Handle(Type::Number()), NULL)) {
256 GenerateNumberTypeCheck( 256 GenerateNumberTypeCheck(
257 kClassIdReg, type, is_instance_lbl, is_not_instance_lbl); 257 kClassIdReg, type, is_instance_lbl, is_not_instance_lbl);
258 return false; 258 return false;
259 } 259 }
260 if (type.IsStringInterface()) { 260 if (type.IsStringType()) {
261 GenerateStringTypeCheck(kClassIdReg, is_instance_lbl, is_not_instance_lbl); 261 GenerateStringTypeCheck(kClassIdReg, is_instance_lbl, is_not_instance_lbl);
262 return false; 262 return false;
263 } 263 }
264 // Otherwise fallthrough. 264 // Otherwise fallthrough.
265 return true; 265 return true;
266 } 266 }
267 267
268 268
269 // Uses SubtypeTestCache to store instance class and result. 269 // Uses SubtypeTestCache to store instance class and result.
270 // EAX: instance to test. 270 // EAX: instance to test.
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 __ popl(ECX); 1377 __ popl(ECX);
1378 __ popl(EAX); 1378 __ popl(EAX);
1379 } 1379 }
1380 1380
1381 1381
1382 #undef __ 1382 #undef __
1383 1383
1384 } // namespace dart 1384 } // namespace dart
1385 1385
1386 #endif // defined TARGET_ARCH_IA32 1386 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698