Fix bool type checks for checked mode. Fast case is now always executed.

Review URL: https://chromereviews.googleplex.com/3577016

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@224 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
srdjan@google.com 2011-10-07 14:51:45 +00:00
parent 57ef47426c
commit 3e702c53d7

View file

@ -1620,8 +1620,11 @@ void CodeGenerator::GenerateConditionTypeCheck(intptr_t token_index) {
__ j(EQUAL, &runtime_call, Assembler::kNearJump);
__ testl(EAX, Immediate(kSmiTagMask));
__ j(ZERO, &runtime_call, Assembler::kNearJump); // Call runtime for Smi.
const Type& bool_interface = Type::Handle(Type::BoolInterface());
const Class& bool_class = Class::ZoneHandle(bool_interface.type_class());
// This check should pass if the receiver's class implements the interface
// 'bool'. Check only class 'Bool' since it is the only legal implementation
// of the interface 'bool'.
const Class& bool_class =
Class::ZoneHandle(Isolate::Current()->object_store()->bool_class());
__ movl(ECX, FieldAddress(EAX, Object::class_offset()));
__ CompareObject(ECX, bool_class);
__ j(EQUAL, &done, Assembler::kNearJump);