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

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

Issue 1175803003: Inline instanceOf and 'as' operations; fix a bug in code emission (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: c Created 5 years, 6 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
« no previous file with comments | « runtime/vm/flow_graph_compiler_mips.cc ('k') | runtime/vm/flow_graph_optimizer.h » ('j') | 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) 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_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/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 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 // checking whether the tested instance is a Smi. 597 // checking whether the tested instance is a Smi.
598 if (type.IsInstantiated()) { 598 if (type.IsInstantiated()) {
599 // A null object is only an instance of Object and dynamic, which has 599 // A null object is only an instance of Object and dynamic, which has
600 // already been checked above (if the type is instantiated). So we can 600 // already been checked above (if the type is instantiated). So we can
601 // return false here if the instance is null (and if the type is 601 // return false here if the instance is null (and if the type is
602 // instantiated). 602 // instantiated).
603 // We can only inline this null check if the type is instantiated at compile 603 // We can only inline this null check if the type is instantiated at compile
604 // time, since an uninstantiated type at compile time could be Object or 604 // time, since an uninstantiated type at compile time could be Object or
605 // dynamic at run time. 605 // dynamic at run time.
606 __ CompareObject(RAX, Object::null_object(), PP); 606 __ CompareObject(RAX, Object::null_object(), PP);
607 __ j(EQUAL, &is_not_instance); 607 __ j(EQUAL, type.IsNullType() ? &is_instance : &is_not_instance);
608 } 608 }
609 609
610 // Generate inline instanceof test. 610 // Generate inline instanceof test.
611 SubtypeTestCache& test_cache = SubtypeTestCache::ZoneHandle(); 611 SubtypeTestCache& test_cache = SubtypeTestCache::ZoneHandle();
612 test_cache = GenerateInlineInstanceof(token_pos, type, 612 test_cache = GenerateInlineInstanceof(token_pos, type,
613 &is_instance, &is_not_instance); 613 &is_instance, &is_not_instance);
614 614
615 // test_cache is null if there is no fall-through. 615 // test_cache is null if there is no fall-through.
616 Label done; 616 Label done;
617 if (!test_cache.IsNull()) { 617 if (!test_cache.IsNull()) {
(...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1751 __ movups(reg, Address(RSP, 0)); 1751 __ movups(reg, Address(RSP, 0));
1752 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); 1752 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP);
1753 } 1753 }
1754 1754
1755 1755
1756 #undef __ 1756 #undef __
1757 1757
1758 } // namespace dart 1758 } // namespace dart
1759 1759
1760 #endif // defined TARGET_ARCH_X64 1760 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_mips.cc ('k') | runtime/vm/flow_graph_optimizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698