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

Side by Side Diff: vm/code_generator_x64.cc

Issue 9046009: - Fix a couple near branches that were out of reach. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 11 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 | vm/stub_code_x64.cc » ('j') | vm/stub_code_x64.cc » ('J')
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_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
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 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after
1433 // already been checked above (if the type is instantiated). So we can 1433 // already been checked above (if the type is instantiated). So we can
1434 // return false here if the instance is null (and if the type is 1434 // return false here if the instance is null (and if the type is
1435 // instantiated). 1435 // instantiated).
1436 // We can only inline this null check if the type is instantiated at compile 1436 // We can only inline this null check if the type is instantiated at compile
1437 // time, since an uninstantiated type at compile time could be Object or 1437 // time, since an uninstantiated type at compile time could be Object or
1438 // Dynamic at run time. 1438 // Dynamic at run time.
1439 Label non_null; 1439 Label non_null;
1440 __ cmpq(RAX, raw_null); 1440 __ cmpq(RAX, raw_null);
1441 __ j(NOT_EQUAL, &non_null, Assembler::kNearJump); 1441 __ j(NOT_EQUAL, &non_null, Assembler::kNearJump);
1442 __ PushObject(negate_result ? bool_true : bool_false); 1442 __ PushObject(negate_result ? bool_true : bool_false);
1443 __ jmp(&done, Assembler::kNearJump); 1443 __ jmp(&done);
1444 1444
1445 __ Bind(&non_null); 1445 __ Bind(&non_null);
1446 1446
1447 const Class& type_class = Class::ZoneHandle(type.type_class()); 1447 const Class& type_class = Class::ZoneHandle(type.type_class());
1448 const bool requires_type_arguments = type_class.HasTypeArguments(); 1448 const bool requires_type_arguments = type_class.HasTypeArguments();
1449 // A Smi object cannot be the instance of a parameterized class. 1449 // A Smi object cannot be the instance of a parameterized class.
1450 // A class equality check is only applicable with a dst type of a 1450 // A class equality check is only applicable with a dst type of a
1451 // non-parameterized class or with a raw dst type of a parameterized class. 1451 // non-parameterized class or with a raw dst type of a parameterized class.
1452 if (requires_type_arguments) { 1452 if (requires_type_arguments) {
1453 const AbstractTypeArguments& type_arguments = 1453 const AbstractTypeArguments& type_arguments =
1454 AbstractTypeArguments::Handle(type.arguments()); 1454 AbstractTypeArguments::Handle(type.arguments());
1455 const bool is_raw_type = type_arguments.IsNull() || 1455 const bool is_raw_type = type_arguments.IsNull() ||
1456 type_arguments.IsDynamicTypes(type_arguments.Length()); 1456 type_arguments.IsDynamicTypes(type_arguments.Length());
1457 Label runtime_call; 1457 Label runtime_call;
1458 __ testq(RAX, Immediate(kSmiTagMask)); 1458 __ testq(RAX, Immediate(kSmiTagMask));
1459 __ j(ZERO, &runtime_call, Assembler::kNearJump); 1459 __ j(ZERO, &runtime_call, Assembler::kNearJump);
1460 // Object not Smi. 1460 // Object not Smi.
1461 if (is_raw_type) { 1461 if (is_raw_type) {
1462 if (type.IsListInterface()) { 1462 if (type.IsListInterface()) {
1463 Label push_result; 1463 Label push_result;
1464 // TODO(srdjan) also accept List<Object>. 1464 // TODO(srdjan) also accept List<Object>.
1465 __ movq(RCX, FieldAddress(RAX, Object::class_offset())); 1465 __ movq(RCX, FieldAddress(RAX, Object::class_offset()));
1466 __ CompareObject(RCX, *CoreClass("ObjectArray")); 1466 __ CompareObject(RCX, *CoreClass("ObjectArray"));
1467 __ j(EQUAL, &push_result, Assembler::kNearJump); 1467 __ j(EQUAL, &push_result, Assembler::kNearJump);
1468 __ CompareObject(RCX, *CoreClass("GrowableObjectArray")); 1468 __ CompareObject(RCX, *CoreClass("GrowableObjectArray"));
1469 __ j(NOT_EQUAL, &runtime_call, Assembler::kNearJump); 1469 __ j(NOT_EQUAL, &runtime_call, Assembler::kNearJump);
1470 __ Bind(&push_result); 1470 __ Bind(&push_result);
1471 __ PushObject(negate_result ? bool_false : bool_true); 1471 __ PushObject(negate_result ? bool_false : bool_true);
1472 __ jmp(&done, Assembler::kNearJump); 1472 __ jmp(&done);
1473 } else if (!type_class.is_interface()) { 1473 } else if (!type_class.is_interface()) {
1474 __ movq(RCX, FieldAddress(RAX, Object::class_offset())); 1474 __ movq(RCX, FieldAddress(RAX, Object::class_offset()));
1475 __ CompareObject(RCX, type_class); 1475 __ CompareObject(RCX, type_class);
1476 __ j(NOT_EQUAL, &runtime_call, Assembler::kNearJump); 1476 __ j(NOT_EQUAL, &runtime_call, Assembler::kNearJump);
1477 __ PushObject(negate_result ? bool_false : bool_true); 1477 __ PushObject(negate_result ? bool_false : bool_true);
1478 __ jmp(&done, Assembler::kNearJump); 1478 __ jmp(&done);
1479 } 1479 }
1480 } 1480 }
1481 __ Bind(&runtime_call); 1481 __ Bind(&runtime_call);
1482 // Fall through to runtime call. 1482 // Fall through to runtime call.
1483 } else { 1483 } else {
1484 Label compare_classes; 1484 Label compare_classes;
1485 __ testq(RAX, Immediate(kSmiTagMask)); 1485 __ testq(RAX, Immediate(kSmiTagMask));
1486 __ j(NOT_ZERO, &compare_classes, Assembler::kNearJump); 1486 __ j(NOT_ZERO, &compare_classes, Assembler::kNearJump);
1487 // Object is Smi. 1487 // Object is Smi.
1488 const Class& smi_class = Class::Handle(Smi::Class()); 1488 const Class& smi_class = Class::Handle(Smi::Class());
1489 // TODO(regis): We should introduce a SmiType. 1489 // TODO(regis): We should introduce a SmiType.
1490 if (smi_class.IsSubtypeOf(TypeArguments::Handle(), 1490 if (smi_class.IsSubtypeOf(TypeArguments::Handle(),
1491 type_class, 1491 type_class,
1492 TypeArguments::Handle())) { 1492 TypeArguments::Handle())) {
1493 __ PushObject(negate_result ? bool_false : bool_true); 1493 __ PushObject(negate_result ? bool_false : bool_true);
1494 } else { 1494 } else {
1495 __ PushObject(negate_result ? bool_true : bool_false); 1495 __ PushObject(negate_result ? bool_true : bool_false);
1496 } 1496 }
1497 __ jmp(&done, Assembler::kNearJump); 1497 __ jmp(&done);
1498 1498
1499 // Compare if the classes are equal. 1499 // Compare if the classes are equal.
1500 __ Bind(&compare_classes); 1500 __ Bind(&compare_classes);
1501 const Class* compare_class = NULL; 1501 const Class* compare_class = NULL;
1502 if (type.IsStringInterface()) { 1502 if (type.IsStringInterface()) {
1503 compare_class = &Class::ZoneHandle( 1503 compare_class = &Class::ZoneHandle(
1504 Isolate::Current()->object_store()->one_byte_string_class()); 1504 Isolate::Current()->object_store()->one_byte_string_class());
1505 } else if (type.IsBoolInterface()) { 1505 } else if (type.IsBoolInterface()) {
1506 compare_class = &Class::ZoneHandle( 1506 compare_class = &Class::ZoneHandle(
1507 Isolate::Current()->object_store()->bool_class()); 1507 Isolate::Current()->object_store()->bool_class());
(...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after
2801 message_buffer, kMessageBufferSize, 2801 message_buffer, kMessageBufferSize,
2802 format, args); 2802 format, args);
2803 va_end(args); 2803 va_end(args);
2804 Isolate::Current()->long_jump_base()->Jump(1, message_buffer); 2804 Isolate::Current()->long_jump_base()->Jump(1, message_buffer);
2805 UNREACHABLE(); 2805 UNREACHABLE();
2806 } 2806 }
2807 2807
2808 } // namespace dart 2808 } // namespace dart
2809 2809
2810 #endif // defined TARGET_ARCH_X64 2810 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « no previous file | vm/stub_code_x64.cc » ('j') | vm/stub_code_x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698