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

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

Issue 2226893002: Optimize AOT's switchable calls for the monomorphic case. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: sync Created 4 years, 4 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/object_test.cc ('k') | runtime/vm/profiler.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) 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 1857 matching lines...) Expand 10 before | Expand all | Expand 10 after
1868 ASSERT(!target_code_.IsFunctionCode()); 1868 ASSERT(!target_code_.IsFunctionCode());
1869 // Allocation stub or AllocateContext or AllocateArray or ... 1869 // Allocation stub or AllocateContext or AllocateArray or ...
1870 } else { 1870 } else {
1871 // Static calls initially call the CallStaticFunction stub because 1871 // Static calls initially call the CallStaticFunction stub because
1872 // their target might not be compiled yet. After tree shaking, all 1872 // their target might not be compiled yet. After tree shaking, all
1873 // static call targets are compiled. 1873 // static call targets are compiled.
1874 // Cf. runtime entry PatchStaticCall called from CallStaticFunction 1874 // Cf. runtime entry PatchStaticCall called from CallStaticFunction
1875 // stub. 1875 // stub.
1876 ASSERT(target_.HasCode()); 1876 ASSERT(target_.HasCode());
1877 target_code_ ^= target_.CurrentCode(); 1877 target_code_ ^= target_.CurrentCode();
1878 uword pc = pc_offset_.Value() + code_.EntryPoint(); 1878 uword pc = pc_offset_.Value() + code_.PayloadStart();
1879 CodePatcher::PatchStaticCallAt(pc, code_, target_code_); 1879 CodePatcher::PatchStaticCallAt(pc, code_, target_code_);
1880 } 1880 }
1881 } 1881 }
1882 1882
1883 // We won't patch static calls anymore, so drop the static call table to 1883 // We won't patch static calls anymore, so drop the static call table to
1884 // save space. 1884 // save space.
1885 code_.set_static_calls_target_table(Object::empty_array()); 1885 code_.set_static_calls_target_table(Object::empty_array());
1886 } 1886 }
1887 1887
1888 private: 1888 private:
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1937 // arguments in addition to the receiver and use special stubs 1937 // arguments in addition to the receiver and use special stubs
1938 // with fast paths for Smi operations. 1938 // with fast paths for Smi operations.
1939 if (ic_.NumArgsTested() != 1) continue; 1939 if (ic_.NumArgsTested() != 1) continue;
1940 1940
1941 for (intptr_t j = 0; j < ic_.NumberOfChecks(); j++) { 1941 for (intptr_t j = 0; j < ic_.NumberOfChecks(); j++) {
1942 entry_ = ic_.GetTargetOrCodeAt(j); 1942 entry_ = ic_.GetTargetOrCodeAt(j);
1943 if (entry_.IsFunction()) { 1943 if (entry_.IsFunction()) {
1944 target_ ^= entry_.raw(); 1944 target_ ^= entry_.raw();
1945 ASSERT(target_.HasCode()); 1945 ASSERT(target_.HasCode());
1946 target_code_ = target_.CurrentCode(); 1946 target_code_ = target_.CurrentCode();
1947 entry_point_ = Smi::FromAlignedAddress(target_code_.EntryPoint()); 1947 entry_point_ =
1948 Smi::FromAlignedAddress(target_code_.UncheckedEntryPoint());
1948 ic_.SetCodeAt(j, target_code_); 1949 ic_.SetCodeAt(j, target_code_);
1949 ic_.SetEntryPointAt(j, entry_point_); 1950 ic_.SetEntryPointAt(j, entry_point_);
1950 } else { 1951 } else {
1951 // We've already seen and switched this ICData. 1952 // We've already seen and switched this ICData.
1952 ASSERT(entry_.IsCode()); 1953 ASSERT(entry_.IsCode());
1953 } 1954 }
1954 } 1955 }
1955 } else if (entry_.raw() == 1956 } else if (entry_.raw() ==
1956 StubCode::ICLookupThroughFunction_entry()->code()) { 1957 StubCode::ICLookupThroughFunction_entry()->code()) {
1957 target_code_ = StubCode::ICLookupThroughCode_entry()->code(); 1958 target_code_ = StubCode::ICLookupThroughCode_entry()->code();
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
2904 ASSERT(error.IsLanguageError() && 2905 ASSERT(error.IsLanguageError() &&
2905 LanguageError::Cast(error).kind() != Report::kBailout); 2906 LanguageError::Cast(error).kind() != Report::kBailout);
2906 return error.raw(); 2907 return error.raw();
2907 } 2908 }
2908 2909
2909 per_compile_timer.Stop(); 2910 per_compile_timer.Stop();
2910 2911
2911 if (trace_compiler) { 2912 if (trace_compiler) {
2912 THR_Print("--> '%s' entry: %#" Px " size: %" Pd " time: %" Pd64 " us\n", 2913 THR_Print("--> '%s' entry: %#" Px " size: %" Pd " time: %" Pd64 " us\n",
2913 function.ToFullyQualifiedCString(), 2914 function.ToFullyQualifiedCString(),
2914 Code::Handle(function.CurrentCode()).EntryPoint(), 2915 Code::Handle(function.CurrentCode()).PayloadStart(),
2915 Code::Handle(function.CurrentCode()).Size(), 2916 Code::Handle(function.CurrentCode()).Size(),
2916 per_compile_timer.TotalElapsedTime()); 2917 per_compile_timer.TotalElapsedTime());
2917 } 2918 }
2918 2919
2919 if (FLAG_disassemble && FlowGraphPrinter::ShouldPrint(function)) { 2920 if (FLAG_disassemble && FlowGraphPrinter::ShouldPrint(function)) {
2920 Disassembler::DisassembleCode(function, optimized); 2921 Disassembler::DisassembleCode(function, optimized);
2921 } else if (FLAG_disassemble_optimized && 2922 } else if (FLAG_disassemble_optimized &&
2922 optimized && 2923 optimized &&
2923 FlowGraphPrinter::ShouldPrint(function)) { 2924 FlowGraphPrinter::ShouldPrint(function)) {
2924 Disassembler::DisassembleCode(function, true); 2925 Disassembler::DisassembleCode(function, true);
(...skipping 25 matching lines...) Expand all
2950 CompilationPipeline::New(thread->zone(), function); 2951 CompilationPipeline::New(thread->zone(), function);
2951 2952
2952 ASSERT(FLAG_precompiled_mode); 2953 ASSERT(FLAG_precompiled_mode);
2953 const bool optimized = function.IsOptimizable(); // False for natives. 2954 const bool optimized = function.IsOptimizable(); // False for natives.
2954 return PrecompileFunctionHelper(pipeline, function, optimized); 2955 return PrecompileFunctionHelper(pipeline, function, optimized);
2955 } 2956 }
2956 2957
2957 #endif // DART_PRECOMPILER 2958 #endif // DART_PRECOMPILER
2958 2959
2959 } // namespace dart 2960 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object_test.cc ('k') | runtime/vm/profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698