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

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

Issue 2716593002: Propagate this-specialization to regular (megamorphic) calls (Closed)
Patch Set: Cleanups 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
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::TrySpecializeICData(const ICData& ic_data,
Vyacheslav Egorov (Google) 2017/02/23 15:32:37 If we are placing this function on the FlowGraphCo
1753 intptr_t cid) {
1754 Zone* zone = Thread::Current()->zone();
1755 if (ic_data.NumArgsTested() != 1) return ic_data;
1756
1757 if ((ic_data.NumberOfUsedChecks() == 1) && ic_data.HasReceiverClassId(cid)) {
1758 return ic_data; // Nothing to do
1759 }
1760
1761 intptr_t count = 1;
1762 const Function& function =
1763 Function::Handle(zone, ic_data.GetTargetForReceiverClassId(cid, &count));
1764 // TODO(fschneider): Try looking up the function on the class if it is
1765 // not found in the ICData.
1766 if (!function.IsNull()) {
1767 const ICData& new_ic_data = ICData::ZoneHandle(
1768 zone, ICData::New(Function::Handle(zone, ic_data.Owner()),
1769 String::Handle(zone, ic_data.target_name()),
1770 Object::empty_array(), // Dummy argument descriptor.
1771 ic_data.deopt_id(), ic_data.NumArgsTested(), false));
1772 new_ic_data.SetDeoptReasons(ic_data.DeoptReasons());
1773 new_ic_data.AddReceiverCheck(cid, function, count);
1774 return new_ic_data;
1775 }
1776
1777 return ic_data;
1778 }
1779
1780
1752 #if !defined(TARGET_ARCH_DBC) 1781 #if !defined(TARGET_ARCH_DBC)
1753 // DBC emits calls very differently from other architectures due to its 1782 // DBC emits calls very differently from other architectures due to its
1754 // interpreted nature. 1783 // interpreted nature.
1755 void FlowGraphCompiler::EmitPolymorphicInstanceCall(const ICData& ic_data, 1784 void FlowGraphCompiler::EmitPolymorphicInstanceCall(const ICData& ic_data,
1756 intptr_t argument_count, 1785 intptr_t argument_count,
1757 const Array& argument_names, 1786 const Array& argument_names,
1758 intptr_t deopt_id, 1787 intptr_t deopt_id,
1759 TokenPosition token_pos, 1788 TokenPosition token_pos,
1760 LocationSummary* locs, 1789 LocationSummary* locs,
1761 bool complete) { 1790 bool complete) {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1853 1882
1854 1883
1855 void FlowGraphCompiler::FrameStateClear() { 1884 void FlowGraphCompiler::FrameStateClear() {
1856 ASSERT(!is_optimizing()); 1885 ASSERT(!is_optimizing());
1857 frame_state_.TruncateTo(0); 1886 frame_state_.TruncateTo(0);
1858 } 1887 }
1859 #endif // defined(DEBUG) && !defined(TARGET_ARCH_DBC) 1888 #endif // defined(DEBUG) && !defined(TARGET_ARCH_DBC)
1860 1889
1861 1890
1862 } // namespace dart 1891 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698