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

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

Issue 1934733002: Don’t cache constants in initializer expressions (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Review comments Created 4 years, 7 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/parser.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 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 do_stacktrace = true; 1275 do_stacktrace = true;
1276 } 1276 }
1277 } 1277 }
1278 if (do_deopt) { 1278 if (do_deopt) {
1279 // TODO(turnidge): Consider using DeoptimizeAt instead. 1279 // TODO(turnidge): Consider using DeoptimizeAt instead.
1280 DeoptimizeFunctionsOnStack(); 1280 DeoptimizeFunctionsOnStack();
1281 } 1281 }
1282 if (FLAG_support_debugger && do_stacktrace) { 1282 if (FLAG_support_debugger && do_stacktrace) {
1283 String& var_name = String::Handle(); 1283 String& var_name = String::Handle();
1284 Instance& var_value = Instance::Handle(); 1284 Instance& var_value = Instance::Handle();
1285 // Collecting the stack trace and accessing local variables
1286 // of frames may trigger parsing of functions to compute
1287 // variable descriptors of functions. Parsing may trigger
1288 // code execution, e.g. to compute compile-time constants. Thus,
1289 // disable FLAG_stacktrace_every during trace collection to prevent
1290 // recursive stack trace collection.
1291 intptr_t saved_stacktrace_every = FLAG_stacktrace_every;
1292 FLAG_stacktrace_every = 0;
1285 DebuggerStackTrace* stack = isolate->debugger()->StackTrace(); 1293 DebuggerStackTrace* stack = isolate->debugger()->StackTrace();
1286 intptr_t num_frames = stack->Length(); 1294 intptr_t num_frames = stack->Length();
1287 for (intptr_t i = 0; i < num_frames; i++) { 1295 for (intptr_t i = 0; i < num_frames; i++) {
1288 ActivationFrame* frame = stack->FrameAt(i); 1296 ActivationFrame* frame = stack->FrameAt(i);
1289 // Variable locations and number are unknown when precompiling. 1297 // Variable locations and number are unknown when precompiling.
1290 const int num_vars = 1298 const int num_vars =
1291 FLAG_precompiled_runtime ? 0 : frame->NumLocalVariables(); 1299 FLAG_precompiled_runtime ? 0 : frame->NumLocalVariables();
1292 TokenPosition unused = TokenPosition::kNoSource; 1300 TokenPosition unused = TokenPosition::kNoSource;
1293 for (intptr_t v = 0; v < num_vars; v++) { 1301 for (intptr_t v = 0; v < num_vars; v++) {
1294 frame->VariableAt(v, &var_name, &unused, &unused, &var_value); 1302 frame->VariableAt(v, &var_name, &unused, &unused, &var_value);
1295 } 1303 }
1296 } 1304 }
1305 FLAG_stacktrace_every = saved_stacktrace_every;
1297 } 1306 }
1298 1307
1299 const Error& error = Error::Handle(thread->HandleInterrupts()); 1308 const Error& error = Error::Handle(thread->HandleInterrupts());
1300 if (!error.IsNull()) { 1309 if (!error.IsNull()) {
1301 Exceptions::PropagateError(error); 1310 Exceptions::PropagateError(error);
1302 UNREACHABLE(); 1311 UNREACHABLE();
1303 } 1312 }
1304 1313
1305 if ((stack_overflow_flags & Thread::kOsrRequest) != 0) { 1314 if ((stack_overflow_flags & Thread::kOsrRequest) != 0) {
1306 ASSERT(FLAG_use_osr); 1315 ASSERT(FLAG_use_osr);
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
1841 const intptr_t elm_size = old_data.ElementSizeInBytes(); 1850 const intptr_t elm_size = old_data.ElementSizeInBytes();
1842 const TypedData& new_data = 1851 const TypedData& new_data =
1843 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); 1852 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld));
1844 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); 1853 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size);
1845 typed_data_cell.SetAt(0, new_data); 1854 typed_data_cell.SetAt(0, new_data);
1846 arguments.SetReturn(new_data); 1855 arguments.SetReturn(new_data);
1847 } 1856 }
1848 1857
1849 1858
1850 } // namespace dart 1859 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698