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

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

Issue 2716593002: Propagate this-specialization to regular (megamorphic) calls (Closed)
Patch Set: Add new Canonicalize call to make use of type data Created 3 years, 9 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.h ('k') | runtime/vm/flow_graph_inliner.cc » ('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_XXX. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX.
6 6
7 #include "vm/flow_graph_compiler.h" 7 #include "vm/flow_graph_compiler.h"
8 8
9 #include "vm/bit_vector.h" 9 #include "vm/bit_vector.h"
10 #include "vm/cha.h" 10 #include "vm/cha.h"
(...skipping 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after
1742 code_source_map_builder_->BeginCodeSourceRange(assembler()->CodeSize()); 1742 code_source_map_builder_->BeginCodeSourceRange(assembler()->CodeSize());
1743 } 1743 }
1744 1744
1745 1745
1746 void FlowGraphCompiler::EndCodeSourceRange(TokenPosition token_pos) { 1746 void FlowGraphCompiler::EndCodeSourceRange(TokenPosition token_pos) {
1747 code_source_map_builder_->EndCodeSourceRange(assembler()->CodeSize(), 1747 code_source_map_builder_->EndCodeSourceRange(assembler()->CodeSize(),
1748 token_pos); 1748 token_pos);
1749 } 1749 }
1750 1750
1751 1751
1752 const ICData& FlowGraphCompiler::TrySpecializeICDataByReceiverCid(
1753 const ICData& ic_data,
1754 intptr_t cid) {
1755 Zone* zone = Thread::Current()->zone();
1756 if (ic_data.NumArgsTested() != 1) return ic_data;
1757
1758 if ((ic_data.NumberOfUsedChecks() == 1) && ic_data.HasReceiverClassId(cid)) {
1759 return ic_data; // Nothing to do
1760 }
1761
1762 intptr_t count = 1;
1763 const Function& function =
1764 Function::Handle(zone, ic_data.GetTargetForReceiverClassId(cid, &count));
1765 // TODO(fschneider): Try looking up the function on the class if it is
1766 // not found in the ICData.
1767 if (!function.IsNull()) {
1768 const ICData& new_ic_data = ICData::ZoneHandle(
1769 zone, ICData::New(Function::Handle(zone, ic_data.Owner()),
1770 String::Handle(zone, ic_data.target_name()),
1771 Object::empty_array(), // Dummy argument descriptor.
1772 ic_data.deopt_id(), ic_data.NumArgsTested(), false));
1773 new_ic_data.SetDeoptReasons(ic_data.DeoptReasons());
1774 new_ic_data.AddReceiverCheck(cid, function, count);
1775 return new_ic_data;
1776 }
1777
1778 return ic_data;
1779 }
1780
1781
1752 #if !defined(TARGET_ARCH_DBC) 1782 #if !defined(TARGET_ARCH_DBC)
1753 // DBC emits calls very differently from other architectures due to its 1783 // DBC emits calls very differently from other architectures due to its
1754 // interpreted nature. 1784 // interpreted nature.
1755 void FlowGraphCompiler::EmitPolymorphicInstanceCall(const ICData& ic_data, 1785 void FlowGraphCompiler::EmitPolymorphicInstanceCall(const ICData& ic_data,
1756 intptr_t argument_count, 1786 intptr_t argument_count,
1757 const Array& argument_names, 1787 const Array& argument_names,
1758 intptr_t deopt_id, 1788 intptr_t deopt_id,
1759 TokenPosition token_pos, 1789 TokenPosition token_pos,
1760 LocationSummary* locs, 1790 LocationSummary* locs,
1761 bool complete) { 1791 bool complete) {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1853 1883
1854 1884
1855 void FlowGraphCompiler::FrameStateClear() { 1885 void FlowGraphCompiler::FrameStateClear() {
1856 ASSERT(!is_optimizing()); 1886 ASSERT(!is_optimizing());
1857 frame_state_.TruncateTo(0); 1887 frame_state_.TruncateTo(0);
1858 } 1888 }
1859 #endif // defined(DEBUG) && !defined(TARGET_ARCH_DBC) 1889 #endif // defined(DEBUG) && !defined(TARGET_ARCH_DBC)
1860 1890
1861 1891
1862 } // namespace dart 1892 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler.h ('k') | runtime/vm/flow_graph_inliner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698