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

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

Issue 10134069: Inline type check where type argument that we check against is instantiated. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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 | « no previous file | runtime/vm/code_generator_ia32.cc » ('j') | runtime/vm/code_generator_ia32.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/code_generator.h" 5 #include "vm/code_generator.h"
6 6
7 #include "vm/code_patcher.h" 7 #include "vm/code_patcher.h"
8 #include "vm/compiler.h" 8 #include "vm/compiler.h"
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 // The list of disallowed cases will decrease as they are implemented in 403 // The list of disallowed cases will decrease as they are implemented in
404 // inlined assembly. 404 // inlined assembly.
405 if (!type.IsInstantiated()) return; 405 if (!type.IsInstantiated()) return;
406 // TODO(srdjan): Implement assembly code for checking type arguments then 406 // TODO(srdjan): Implement assembly code for checking type arguments then
407 // remove this check. 407 // remove this check.
408 if (Class::Handle(type.type_class()).HasTypeArguments()) { 408 if (Class::Handle(type.type_class()).HasTypeArguments()) {
409 const AbstractTypeArguments& type_arguments = 409 const AbstractTypeArguments& type_arguments =
410 AbstractTypeArguments::Handle(type.arguments()); 410 AbstractTypeArguments::Handle(type.arguments());
411 const bool is_raw_type = type_arguments.IsNull() || 411 const bool is_raw_type = type_arguments.IsNull() ||
412 type_arguments.IsRaw(type_arguments.Length()); 412 type_arguments.IsRaw(type_arguments.Length());
413 if (!is_raw_type) { 413 if (!is_raw_type && !type_arguments.IsNull()) {
regis 2012/04/26 00:36:17 No need to check && !type_arguments.IsNull()
srdjan 2012/04/26 18:08:37 Done.
414 return; 414 // We cannot inline tests for instances with more than one type argument
415 // or if it's class has not been resolved (malformed type).
regis 2012/04/26 00:36:17 its class
regis 2012/04/26 00:36:17 I do not think you can encounter a malformed type
srdjan 2012/04/26 18:08:37 I misunderstood your explanation of malformed type
416 if (type_arguments.Length() != 1) {
417 // We can handle only one argument so far
regis 2012/04/26 00:36:17 far.
srdjan 2012/04/26 18:08:37 Done.
418 return;
419 }
420 const AbstractType& type_argument_0 =
regis 2012/04/26 00:36:17 type_argument instead of type_argument_0?
srdjan 2012/04/26 18:08:37 Removed that code.
421 AbstractType::ZoneHandle(type_arguments.TypeAt(0));
regis 2012/04/26 00:36:17 Why a ZoneHandle?
srdjan 2012/04/26 18:08:37 Handle
422 if (type_argument_0.IsType() && !type_argument_0.HasResolvedTypeClass()) {
regis 2012/04/26 00:36:17 Are you checking for IsMalformed()? But how can th
srdjan 2012/04/26 18:08:37 Converted to assert added comment why it can't be
423 return;
424 }
415 } 425 }
416 } 426 }
417 StackFrameIterator iterator(StackFrameIterator::kDontValidateFrames); 427 StackFrameIterator iterator(StackFrameIterator::kDontValidateFrames);
418 StackFrame* caller_frame = GetTopDartFrame(&iterator, false); 428 StackFrame* caller_frame = GetTopDartFrame(&iterator, false);
419 ASSERT(caller_frame != NULL); 429 ASSERT(caller_frame != NULL);
420 const Code& code = Code::Handle(caller_frame->LookupDartCode()); 430 const Code& code = Code::Handle(caller_frame->LookupDartCode());
421 ASSERT(!code.IsNull()); 431 ASSERT(!code.IsNull());
422 uword loc = code.GetTypeTestAtNodeId(node_id); 432 uword loc = code.GetTypeTestAtNodeId(node_id);
423 if (loc != 0) { 433 if (loc != 0) {
424 // Found type test cache. 434 // Found type test cache.
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after
1478 } 1488 }
1479 } 1489 }
1480 } 1490 }
1481 // The cache is null terminated, therefore the loop above should never 1491 // The cache is null terminated, therefore the loop above should never
1482 // terminate by itself. 1492 // terminate by itself.
1483 UNREACHABLE(); 1493 UNREACHABLE();
1484 return Code::null(); 1494 return Code::null();
1485 } 1495 }
1486 1496
1487 } // namespace dart 1497 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/code_generator_ia32.cc » ('j') | runtime/vm/code_generator_ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698