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

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

Issue 1584223006: Remove signature classes from the VM. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: sync Created 4 years, 11 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/debugger_api_impl.cc ('k') | runtime/vm/flow_graph_builder.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/deferred_objects.h" 5 #include "vm/deferred_objects.h"
6 6
7 #include "vm/code_patcher.h" 7 #include "vm/code_patcher.h"
8 #include "vm/compiler.h" 8 #include "vm/compiler.h"
9 #include "vm/deopt_instructions.h" 9 #include "vm/deopt_instructions.h"
10 #include "vm/flags.h" 10 #include "vm/flags.h"
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 value = GetValue(i); 297 value = GetValue(i);
298 context.SetAt(context_index, value); 298 context.SetAt(context_index, value);
299 if (FLAG_trace_deoptimization_verbose) { 299 if (FLAG_trace_deoptimization_verbose) {
300 OS::PrintErr(" ctx@%" Pd " (offset %" Pd ") <- %s\n", 300 OS::PrintErr(" ctx@%" Pd " (offset %" Pd ") <- %s\n",
301 context_index, 301 context_index,
302 offset.Value(), 302 offset.Value(),
303 value.ToCString()); 303 value.ToCString());
304 } 304 }
305 } 305 }
306 } 306 }
307 } else if (cls.id() == kClosureCid) {
308 // TODO(regis): It would be better to programmatically add these fields to
309 // the VM Closure class. Declaring them in the Dart class _Closure does not
310 // work, because the class is prefinalized and CalculateFieldOffsets is
311 // therefore not called. Resetting the finalization state may be an option.
312 const Closure& closure = Closure::Cast(*object_);
313
314 Smi& offset = Smi::Handle();
315 Object& value = Object::Handle();
316
317 for (intptr_t i = 0; i < field_count_; i++) {
318 offset ^= GetFieldOffset(i);
319 if (offset.Value() == Closure::type_arguments_offset()) {
320 TypeArguments& arguments = TypeArguments::Handle();
321 arguments ^= GetValue(i);
322 closure.SetTypeArguments(arguments);
323 if (FLAG_trace_deoptimization_verbose) {
324 OS::PrintErr(" closure@type_arguments (offset %" Pd ") <- %s\n",
325 offset.Value(),
326 value.ToCString());
327 }
328 } else if (offset.Value() == Closure::function_offset()) {
329 Function& function = Function::Handle();
330 function ^= GetValue(i);
331 closure.set_function(function);
332 if (FLAG_trace_deoptimization_verbose) {
333 OS::PrintErr(" closure@function (offset %" Pd ") <- %s\n",
334 offset.Value(),
335 value.ToCString());
336 }
337 } else {
338 ASSERT(offset.Value() == Closure::context_offset());
339 Context& context = Context::Handle();
340 context ^= GetValue(i);
341 closure.set_context(context);
342 if (FLAG_trace_deoptimization_verbose) {
343 OS::PrintErr(" closure@context (offset %" Pd ") <- %s\n",
344 offset.Value(),
345 value.ToCString());
346 }
347 }
348 }
307 } else { 349 } else {
308 const Instance& obj = Instance::Cast(*object_); 350 const Instance& obj = Instance::Cast(*object_);
309 351
310 Smi& offset = Smi::Handle(); 352 Smi& offset = Smi::Handle();
311 Field& field = Field::Handle(); 353 Field& field = Field::Handle();
312 Object& value = Object::Handle(); 354 Object& value = Object::Handle();
313 const Array& offset_map = Array::Handle(cls.OffsetToFieldMap()); 355 const Array& offset_map = Array::Handle(cls.OffsetToFieldMap());
314 356
315 for (intptr_t i = 0; i < field_count_; i++) { 357 for (intptr_t i = 0; i < field_count_; i++) {
316 offset ^= GetFieldOffset(i); 358 offset ^= GetFieldOffset(i);
317 field ^= offset_map.At(offset.Value() / kWordSize); 359 field ^= offset_map.At(offset.Value() / kWordSize);
318 value = GetValue(i); 360 value = GetValue(i);
319 if (!field.IsNull()) { 361 if (!field.IsNull()) {
320 obj.SetField(field, value); 362 obj.SetField(field, value);
321 if (FLAG_trace_deoptimization_verbose) { 363 if (FLAG_trace_deoptimization_verbose) {
322 OS::PrintErr(" %s <- %s\n", 364 OS::PrintErr(" %s <- %s\n",
323 String::Handle(field.name()).ToCString(), 365 String::Handle(field.name()).ToCString(),
324 value.ToCString()); 366 value.ToCString());
325 } 367 }
326 } else { 368 } else {
327 ASSERT(cls.IsSignatureClass() || 369 ASSERT(offset.Value() == cls.type_arguments_field_offset());
328 (offset.Value() == cls.type_arguments_field_offset()));
329 obj.SetFieldAtOffset(offset.Value(), value); 370 obj.SetFieldAtOffset(offset.Value(), value);
330 if (FLAG_trace_deoptimization_verbose) { 371 if (FLAG_trace_deoptimization_verbose) {
331 OS::PrintErr(" null Field @ offset(%" Pd ") <- %s\n", 372 OS::PrintErr(" null Field @ offset(%" Pd ") <- %s\n",
332 offset.Value(), 373 offset.Value(),
333 value.ToCString()); 374 value.ToCString());
334 } 375 }
335 } 376 }
336 } 377 }
337 } 378 }
338 } 379 }
339 380
340 } // namespace dart 381 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/debugger_api_impl.cc ('k') | runtime/vm/flow_graph_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698