| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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/precompiler.h" | 5 #include "vm/precompiler.h" |
| 6 | 6 |
| 7 #include "vm/aot_optimizer.h" | 7 #include "vm/aot_optimizer.h" |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/ast_printer.h" | 9 #include "vm/ast_printer.h" |
| 10 #include "vm/branch_optimizer.h" | 10 #include "vm/branch_optimizer.h" |
| (...skipping 1890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1901 if (stackmaps_.IsNull()) return; | 1901 if (stackmaps_.IsNull()) return; |
| 1902 for (intptr_t i = 0; i < stackmaps_.Length(); i++) { | 1902 for (intptr_t i = 0; i < stackmaps_.Length(); i++) { |
| 1903 stackmap_ ^= stackmaps_.At(i); | 1903 stackmap_ ^= stackmaps_.At(i); |
| 1904 stackmap_ = DedupStackmap(stackmap_); | 1904 stackmap_ = DedupStackmap(stackmap_); |
| 1905 stackmaps_.SetAt(i, stackmap_); | 1905 stackmaps_.SetAt(i, stackmap_); |
| 1906 } | 1906 } |
| 1907 } | 1907 } |
| 1908 | 1908 |
| 1909 RawStackmap* DedupStackmap(const Stackmap& stackmap) { | 1909 RawStackmap* DedupStackmap(const Stackmap& stackmap) { |
| 1910 const Stackmap* canonical_stackmap = | 1910 const Stackmap* canonical_stackmap = |
| 1911 canonical_stackmaps_.Lookup(&stackmap); | 1911 canonical_stackmaps_.LookupValue(&stackmap); |
| 1912 if (canonical_stackmap == NULL) { | 1912 if (canonical_stackmap == NULL) { |
| 1913 canonical_stackmaps_.Insert( | 1913 canonical_stackmaps_.Insert( |
| 1914 &Stackmap::ZoneHandle(zone_, stackmap.raw())); | 1914 &Stackmap::ZoneHandle(zone_, stackmap.raw())); |
| 1915 return stackmap.raw(); | 1915 return stackmap.raw(); |
| 1916 } else { | 1916 } else { |
| 1917 return canonical_stackmap->raw(); | 1917 return canonical_stackmap->raw(); |
| 1918 } | 1918 } |
| 1919 } | 1919 } |
| 1920 | 1920 |
| 1921 private: | 1921 private: |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1949 code_ = function.CurrentCode(); | 1949 code_ = function.CurrentCode(); |
| 1950 stackmaps_ = code_.stackmaps(); | 1950 stackmaps_ = code_.stackmaps(); |
| 1951 if (stackmaps_.IsNull()) return; | 1951 if (stackmaps_.IsNull()) return; |
| 1952 | 1952 |
| 1953 stackmaps_ = DedupStackmapList(stackmaps_); | 1953 stackmaps_ = DedupStackmapList(stackmaps_); |
| 1954 code_.set_stackmaps(stackmaps_); | 1954 code_.set_stackmaps(stackmaps_); |
| 1955 } | 1955 } |
| 1956 | 1956 |
| 1957 RawArray* DedupStackmapList(const Array& stackmaps) { | 1957 RawArray* DedupStackmapList(const Array& stackmaps) { |
| 1958 const Array* canonical_stackmap_list = | 1958 const Array* canonical_stackmap_list = |
| 1959 canonical_stackmap_lists_.Lookup(&stackmaps); | 1959 canonical_stackmap_lists_.LookupValue(&stackmaps); |
| 1960 if (canonical_stackmap_list == NULL) { | 1960 if (canonical_stackmap_list == NULL) { |
| 1961 canonical_stackmap_lists_.Insert( | 1961 canonical_stackmap_lists_.Insert( |
| 1962 &Array::ZoneHandle(zone_, stackmaps.raw())); | 1962 &Array::ZoneHandle(zone_, stackmaps.raw())); |
| 1963 return stackmaps.raw(); | 1963 return stackmaps.raw(); |
| 1964 } else { | 1964 } else { |
| 1965 return canonical_stackmap_list->raw(); | 1965 return canonical_stackmap_list->raw(); |
| 1966 } | 1966 } |
| 1967 } | 1967 } |
| 1968 | 1968 |
| 1969 private: | 1969 private: |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1997 code_ = function.CurrentCode(); | 1997 code_ = function.CurrentCode(); |
| 1998 instructions_ = code_.instructions(); | 1998 instructions_ = code_.instructions(); |
| 1999 instructions_ = DedupOneInstructions(instructions_); | 1999 instructions_ = DedupOneInstructions(instructions_); |
| 2000 code_.SetActiveInstructions(instructions_.raw()); | 2000 code_.SetActiveInstructions(instructions_.raw()); |
| 2001 code_.set_instructions(instructions_.raw()); | 2001 code_.set_instructions(instructions_.raw()); |
| 2002 function.SetInstructions(code_); // Update cached entry point. | 2002 function.SetInstructions(code_); // Update cached entry point. |
| 2003 } | 2003 } |
| 2004 | 2004 |
| 2005 RawInstructions* DedupOneInstructions(const Instructions& instructions) { | 2005 RawInstructions* DedupOneInstructions(const Instructions& instructions) { |
| 2006 const Instructions* canonical_instructions = | 2006 const Instructions* canonical_instructions = |
| 2007 canonical_instructions_set_.Lookup(&instructions); | 2007 canonical_instructions_set_.LookupValue(&instructions); |
| 2008 if (canonical_instructions == NULL) { | 2008 if (canonical_instructions == NULL) { |
| 2009 canonical_instructions_set_.Insert( | 2009 canonical_instructions_set_.Insert( |
| 2010 &Instructions::ZoneHandle(zone_, instructions.raw())); | 2010 &Instructions::ZoneHandle(zone_, instructions.raw())); |
| 2011 return instructions.raw(); | 2011 return instructions.raw(); |
| 2012 } else { | 2012 } else { |
| 2013 return canonical_instructions->raw(); | 2013 return canonical_instructions->raw(); |
| 2014 } | 2014 } |
| 2015 } | 2015 } |
| 2016 | 2016 |
| 2017 private: | 2017 private: |
| (...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2848 CompilationPipeline::New(thread->zone(), function); | 2848 CompilationPipeline::New(thread->zone(), function); |
| 2849 | 2849 |
| 2850 ASSERT(FLAG_precompiled_mode); | 2850 ASSERT(FLAG_precompiled_mode); |
| 2851 const bool optimized = function.IsOptimizable(); // False for natives. | 2851 const bool optimized = function.IsOptimizable(); // False for natives. |
| 2852 return PrecompileFunctionHelper(pipeline, function, optimized); | 2852 return PrecompileFunctionHelper(pipeline, function, optimized); |
| 2853 } | 2853 } |
| 2854 | 2854 |
| 2855 #endif // DART_PRECOMPILER | 2855 #endif // DART_PRECOMPILER |
| 2856 | 2856 |
| 2857 } // namespace dart | 2857 } // namespace dart |
| OLD | NEW |