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

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

Issue 2418673002: Fix unoptimized code calling a disabled code when --verify-on-transition is enabled. (Closed)
Patch Set: dbc Created 4 years, 2 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 | « no previous file | runtime/vm/simulator_dbc.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/code_generator.h" 5 #include "vm/code_generator.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/ast.h" 8 #include "vm/ast.h"
9 #include "vm/code_patcher.h" 9 #include "vm/code_patcher.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 1846 matching lines...) Expand 10 before | Expand all | Expand 10 after
1857 } 1857 }
1858 // Reduce the chance of triggering optimization while the function is 1858 // Reduce the chance of triggering optimization while the function is
1859 // being optimized in the background. INT_MIN should ensure that it 1859 // being optimized in the background. INT_MIN should ensure that it
1860 // takes long time to trigger optimization. 1860 // takes long time to trigger optimization.
1861 // Note that the background compilation queue rejects duplicate entries. 1861 // Note that the background compilation queue rejects duplicate entries.
1862 function.set_usage_counter(INT_MIN); 1862 function.set_usage_counter(INT_MIN);
1863 BackgroundCompiler::EnsureInit(thread); 1863 BackgroundCompiler::EnsureInit(thread);
1864 ASSERT(isolate->background_compiler() != NULL); 1864 ASSERT(isolate->background_compiler() != NULL);
1865 isolate->background_compiler()->CompileOptimized(function); 1865 isolate->background_compiler()->CompileOptimized(function);
1866 // Continue in the same code. 1866 // Continue in the same code.
1867 const Code& code = Code::Handle(zone, function.CurrentCode()); 1867 arguments.SetReturn(function);
1868 ASSERT(!code.IsDisabled());
1869 arguments.SetReturn(code);
1870 return; 1868 return;
1871 } 1869 }
1872 } 1870 }
1873 1871
1874 // Reset usage counter for reoptimization before calling optimizer to 1872 // Reset usage counter for reoptimization before calling optimizer to
1875 // prevent recursive triggering of function optimization. 1873 // prevent recursive triggering of function optimization.
1876 function.set_usage_counter(0); 1874 function.set_usage_counter(0);
1877 if (FLAG_trace_compiler || FLAG_trace_optimizing_compiler) { 1875 if (FLAG_trace_compiler || FLAG_trace_optimizing_compiler) {
1878 if (function.HasOptimizedCode()) { 1876 if (function.HasOptimizedCode()) {
1879 THR_Print("ReCompiling function: '%s' \n", 1877 THR_Print("ReCompiling function: '%s' \n",
1880 function.ToFullyQualifiedCString()); 1878 function.ToFullyQualifiedCString());
1881 } 1879 }
1882 } 1880 }
1883 const Error& error = Error::Handle( 1881 const Error& error = Error::Handle(
1884 zone, Compiler::CompileOptimizedFunction(thread, function)); 1882 zone, Compiler::CompileOptimizedFunction(thread, function));
1885 if (!error.IsNull()) { 1883 if (!error.IsNull()) {
1886 Exceptions::PropagateError(error); 1884 Exceptions::PropagateError(error);
1887 } 1885 }
1888 const Code& optimized_code = Code::Handle(zone, function.CurrentCode()); 1886 const Code& optimized_code = Code::Handle(zone, function.CurrentCode());
1889 ASSERT(!optimized_code.IsNull()); 1887 ASSERT(!optimized_code.IsNull());
1890 } 1888 }
1891 const Code& code = Code::Handle(zone, function.CurrentCode()); 1889 arguments.SetReturn(function);
1892 ASSERT(!code.IsDisabled());
1893 arguments.SetReturn(code);
1894 #else 1890 #else
1895 UNREACHABLE(); 1891 UNREACHABLE();
1896 #endif // !DART_PRECOMPILED_RUNTIME 1892 #endif // !DART_PRECOMPILED_RUNTIME
1897 } 1893 }
1898 1894
1899 1895
1900 // The caller must be a static call in a Dart frame, or an entry frame. 1896 // The caller must be a static call in a Dart frame, or an entry frame.
1901 // Patch static call to point to valid code's entry point. 1897 // Patch static call to point to valid code's entry point.
1902 DEFINE_RUNTIME_ENTRY(FixCallersTarget, 0) { 1898 DEFINE_RUNTIME_ENTRY(FixCallersTarget, 0) {
1903 StackFrameIterator iterator(StackFrameIterator::kDontValidateFrames); 1899 StackFrameIterator iterator(StackFrameIterator::kDontValidateFrames);
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
2349 const intptr_t elm_size = old_data.ElementSizeInBytes(); 2345 const intptr_t elm_size = old_data.ElementSizeInBytes();
2350 const TypedData& new_data = 2346 const TypedData& new_data =
2351 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); 2347 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld));
2352 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); 2348 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size);
2353 typed_data_cell.SetAt(0, new_data); 2349 typed_data_cell.SetAt(0, new_data);
2354 arguments.SetReturn(new_data); 2350 arguments.SetReturn(new_data);
2355 } 2351 }
2356 2352
2357 2353
2358 } // namespace dart 2354 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/simulator_dbc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698