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

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

Issue 2608373002: Move Null type to the Bottom in the VM (fixes #28025). (Closed)
Patch Set: work in progress Created 3 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/flow_graph_compiler.h" 8 #include "vm/flow_graph_compiler.h"
9 9
10 #include "vm/ast_printer.h" 10 #include "vm/ast_printer.h"
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 return SubtypeTestCache::null(); 543 return SubtypeTestCache::null();
544 } 544 }
545 } 545 }
546 return GenerateUninstantiatedTypeTest(token_pos, type, is_instance_lbl, 546 return GenerateUninstantiatedTypeTest(token_pos, type, is_instance_lbl,
547 is_not_instance_lbl); 547 is_not_instance_lbl);
548 } 548 }
549 549
550 550
551 // If instanceof type test cannot be performed successfully at compile time and 551 // If instanceof type test cannot be performed successfully at compile time and
552 // therefore eliminated, optimize it by adding inlined tests for: 552 // therefore eliminated, optimize it by adding inlined tests for:
553 // - NULL -> return false. 553 // - NULL -> return type == Null (type is not Object or dynamic).
554 // - Smi -> compile time subtype check (only if dst class is not parameterized). 554 // - Smi -> compile time subtype check (only if dst class is not parameterized).
555 // - Class equality (only if class is not parameterized). 555 // - Class equality (only if class is not parameterized).
556 // Inputs: 556 // Inputs:
557 // - R0: object. 557 // - R0: object.
558 // - R1: instantiator type arguments or raw_null. 558 // - R1: instantiator type arguments or raw_null.
559 // Returns: 559 // Returns:
560 // - true or false in R0. 560 // - true or false in R0.
561 void FlowGraphCompiler::GenerateInstanceOf(TokenPosition token_pos, 561 void FlowGraphCompiler::GenerateInstanceOf(TokenPosition token_pos,
562 intptr_t deopt_id, 562 intptr_t deopt_id,
563 const AbstractType& type, 563 const AbstractType& type,
564 bool negate_result, 564 bool negate_result,
565 LocationSummary* locs) { 565 LocationSummary* locs) {
566 ASSERT(type.IsFinalized() && !type.IsMalformed() && !type.IsMalbounded()); 566 ASSERT(type.IsFinalized() && !type.IsMalformed() && !type.IsMalbounded());
567 567
568 // Preserve instantiator type arguments (R1). 568 // Preserve instantiator type arguments (R1).
569 __ Push(R1); 569 __ Push(R1);
570 570
571 Label is_instance, is_not_instance; 571 Label is_instance, is_not_instance;
572 // If type is instantiated and non-parameterized, we can inline code 572 // If type is instantiated and non-parameterized, we can inline code
573 // checking whether the tested instance is a Smi. 573 // checking whether the tested instance is a Smi.
574 if (type.IsInstantiated()) { 574 if (type.IsInstantiated()) {
575 // A null object is only an instance of Object and dynamic, which has 575 // A null object is only an instance of Null, Object, and dynamic.
576 // already been checked above (if the type is instantiated). So we can 576 // Object and dynamic have already been checked above (if the type is
577 // return false here if the instance is null (and if the type is 577 // instantiated). So we can return false here if the instance is null,
578 // instantiated). 578 // unless the type is Null (and if the type is instantiated).
579 // We can only inline this null check if the type is instantiated at compile 579 // We can only inline this null check if the type is instantiated at compile
580 // time, since an uninstantiated type at compile time could be Object or 580 // time, since an uninstantiated type at compile time could be Null, Object,
581 // dynamic at run time. 581 // or dynamic at run time.
582 __ CompareObject(R0, Object::null_object()); 582 __ CompareObject(R0, Object::null_object());
583 __ b(type.IsNullType() ? &is_instance : &is_not_instance, EQ); 583 __ b(type.IsNullType() ? &is_instance : &is_not_instance, EQ);
584 } 584 }
585 585
586 // Generate inline instanceof test. 586 // Generate inline instanceof test.
587 SubtypeTestCache& test_cache = SubtypeTestCache::ZoneHandle(zone()); 587 SubtypeTestCache& test_cache = SubtypeTestCache::ZoneHandle(zone());
588 test_cache = 588 test_cache =
589 GenerateInlineInstanceof(token_pos, type, &is_instance, &is_not_instance); 589 GenerateInlineInstanceof(token_pos, type, &is_instance, &is_not_instance);
590 590
591 // test_cache is null if there is no fall-through. 591 // test_cache is null if there is no fall-through.
(...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after
1911 DRegister dreg = EvenDRegisterOf(reg); 1911 DRegister dreg = EvenDRegisterOf(reg);
1912 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); 1912 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex));
1913 } 1913 }
1914 1914
1915 1915
1916 #undef __ 1916 #undef __
1917 1917
1918 } // namespace dart 1918 } // namespace dart
1919 1919
1920 #endif // defined TARGET_ARCH_ARM 1920 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698