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

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

Issue 8592008: Factor out code part for instanceof, and hardwire "is bool" check. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 1 month 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 | no next file » | 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 #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/code_generator.h" 8 #include "vm/code_generator.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 type_class, 1456 type_class,
1457 TypeArguments::Handle())) { 1457 TypeArguments::Handle())) {
1458 __ PushObject(negate_result ? bool_false : bool_true); 1458 __ PushObject(negate_result ? bool_false : bool_true);
1459 } else { 1459 } else {
1460 __ PushObject(negate_result ? bool_true : bool_false); 1460 __ PushObject(negate_result ? bool_true : bool_false);
1461 } 1461 }
1462 __ jmp(&done, Assembler::kNearJump); 1462 __ jmp(&done, Assembler::kNearJump);
1463 1463
1464 // Compare if the classes are equal. 1464 // Compare if the classes are equal.
1465 __ Bind(&compare_classes); 1465 __ Bind(&compare_classes);
1466 if (type_class.is_interface()) { 1466 const Class* compare_class = NULL;
1467 if (type.IsStringInterface()) { 1467 if (type.IsStringInterface()) {
1468 Label runtime_call; 1468 compare_class = &Class::ZoneHandle(
1469 __ movl(ECX, FieldAddress(EAX, Object::class_offset())); 1469 Isolate::Current()->object_store()->one_byte_string_class());
1470 const Class& one_byte_string_class = Class::ZoneHandle( 1470 } else if (type.IsBoolInterface()) {
1471 Isolate::Current()->object_store()->one_byte_string_class()); 1471 compare_class = &Class::ZoneHandle(
1472 __ CompareObject(ECX, one_byte_string_class); 1472 Isolate::Current()->object_store()->bool_class());
1473 __ j(NOT_EQUAL, &runtime_call, Assembler::kNearJump); 1473 } else if (!type_class.is_interface()) {
1474 __ PushObject(negate_result ? bool_false : bool_true); 1474 compare_class = &type_class;
1475 __ jmp(&done, Assembler::kNearJump); 1475 }
1476 __ Bind(&runtime_call); 1476 if (compare_class != NULL) {
1477 }
1478 } else { // type_class is not an interface.
1479 Label runtime_call; 1477 Label runtime_call;
1480 __ movl(ECX, FieldAddress(EAX, Object::class_offset())); 1478 __ movl(ECX, FieldAddress(EAX, Object::class_offset()));
1481 __ CompareObject(ECX, type_class); 1479 __ CompareObject(ECX, *compare_class);
1482 __ j(NOT_EQUAL, &runtime_call, Assembler::kNearJump); 1480 __ j(NOT_EQUAL, &runtime_call, Assembler::kNearJump);
1483 __ PushObject(negate_result ? bool_false : bool_true); 1481 __ PushObject(negate_result ? bool_false : bool_true);
1484 __ jmp(&done, Assembler::kNearJump); 1482 __ jmp(&done, Assembler::kNearJump);
1485 __ Bind(&runtime_call); 1483 __ Bind(&runtime_call);
1486 } 1484 }
1487 } 1485 }
1488 } 1486 }
1489 const Object& result = Object::ZoneHandle(); 1487 const Object& result = Object::ZoneHandle();
1490 __ PushObject(result); // Make room for the result of the runtime call. 1488 __ PushObject(result); // Make room for the result of the runtime call.
1491 __ pushl(EAX); // Push the instance. 1489 __ pushl(EAX); // Push the instance.
(...skipping 17 matching lines...) Expand all
1509 __ Bind(&negate_done); 1507 __ Bind(&negate_done);
1510 __ pushl(EAX); 1508 __ pushl(EAX);
1511 } 1509 }
1512 __ Bind(&done); 1510 __ Bind(&done);
1513 } 1511 }
1514 1512
1515 1513
1516 // Jumps to label if ECX equals the given class. 1514 // Jumps to label if ECX equals the given class.
1517 // Inputs: 1515 // Inputs:
1518 // - ECX: tested class. 1516 // - ECX: tested class.
1519 void CodeGenerator::TestClassAndJump(const Class& cls, Label *label) { 1517 void CodeGenerator::TestClassAndJump(const Class& cls, Label* label) {
1520 __ CompareObject(ECX, cls); 1518 __ CompareObject(ECX, cls);
1521 __ j(EQUAL, label, Assembler::kNearJump); 1519 __ j(EQUAL, label, Assembler::kNearJump);
1522 } 1520 }
1523 1521
1524 1522
1525 static const Class* CoreClass(const char* c_name) { 1523 static const Class* CoreClass(const char* c_name) {
1526 const String& class_name = String::Handle(String::NewSymbol(c_name)); 1524 const String& class_name = String::Handle(String::NewSymbol(c_name));
1527 const Class& cls = Class::ZoneHandle(Library::Handle( 1525 const Class& cls = Class::ZoneHandle(Library::Handle(
1528 Library::CoreImplLibrary()).LookupClass(class_name)); 1526 Library::CoreImplLibrary()).LookupClass(class_name));
1529 ASSERT(!cls.IsNull()); 1527 ASSERT(!cls.IsNull());
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after
2761 message_buffer, kMessageBufferSize, 2759 message_buffer, kMessageBufferSize,
2762 format, args); 2760 format, args);
2763 va_end(args); 2761 va_end(args);
2764 Isolate::Current()->long_jump_base()->Jump(1, message_buffer); 2762 Isolate::Current()->long_jump_base()->Jump(1, message_buffer);
2765 UNREACHABLE(); 2763 UNREACHABLE();
2766 } 2764 }
2767 2765
2768 } // namespace dart 2766 } // namespace dart
2769 2767
2770 #endif // defined TARGET_ARCH_IA32 2768 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698