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

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

Issue 14935005: Implement a variation of scalar replacement for non-escaping allocations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address comments Created 7 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/object.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) 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/isolate.h" 5 #include "vm/isolate.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "platform/json.h" 9 #include "platform/json.h"
10 #include "lib/mirrors.h" 10 #include "lib/mirrors.h"
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 uint32_t x = raw_uint32x4->x(); 304 uint32_t x = raw_uint32x4->x();
305 uint32_t y = raw_uint32x4->y(); 305 uint32_t y = raw_uint32x4->y();
306 uint32_t z = raw_uint32x4->z(); 306 uint32_t z = raw_uint32x4->z();
307 uint32_t w = raw_uint32x4->w(); 307 uint32_t w = raw_uint32x4->w();
308 OS::PrintErr("materializing Uint32x4 at %"Px": %x,%x,%x,%x\n", 308 OS::PrintErr("materializing Uint32x4 at %"Px": %x,%x,%x,%x\n",
309 reinterpret_cast<uword>(slot()), x, y, z, w); 309 reinterpret_cast<uword>(slot()), x, y, z, w);
310 } 310 }
311 } 311 }
312 312
313 313
314 void DeferredObjectRef::Materialize() {
315 DeferredObject* obj = Isolate::Current()->GetDeferredObject(index());
316 *slot() = obj->object();
317 if (FLAG_trace_deoptimization_verbose) {
318 OS::PrintErr("writing instance ref at %"Px": %s\n",
319 reinterpret_cast<uword>(slot()),
320 Instance::Handle(obj->object()).ToCString());
321 }
322 }
323
324
325 RawInstance* DeferredObject::object() {
326 if (object_ == NULL) {
327 Materialize();
328 }
329 return object_->raw();
330 }
331
332
333 void DeferredObject::Materialize() {
334 Class& cls = Class::Handle();
335 cls ^= GetClass();
336
337 if (FLAG_trace_deoptimization_verbose) {
338 OS::PrintErr("materializing instance of %s (%"Px", %"Pd" fields)\n",
339 cls.ToCString(),
340 reinterpret_cast<uword>(args_),
341 field_count_);
342 }
343
344 const Instance& obj = Instance::ZoneHandle(Instance::New(cls));
345
346 Field& field = Field::Handle();
347 Object& value = Object::Handle();
348 for (intptr_t i = 0; i < field_count_; i++) {
349 field ^= GetField(i);
350 value = GetValue(i);
351 obj.SetField(field, value);
352
353 if (FLAG_trace_deoptimization_verbose) {
354 OS::PrintErr(" %s <- %s\n",
355 String::Handle(field.name()).ToCString(),
356 value.ToCString());
357 }
358 }
359
360 object_ = &obj;
361 }
362
363
314 Isolate::Isolate() 364 Isolate::Isolate()
315 : store_buffer_(), 365 : store_buffer_(),
316 message_notify_callback_(NULL), 366 message_notify_callback_(NULL),
317 name_(NULL), 367 name_(NULL),
318 start_time_(OS::GetCurrentTimeMicros()), 368 start_time_(OS::GetCurrentTimeMicros()),
319 main_port_(0), 369 main_port_(0),
320 heap_(NULL), 370 heap_(NULL),
321 object_store_(NULL), 371 object_store_(NULL),
322 top_context_(Context::null()), 372 top_context_(Context::null()),
323 top_exit_frame_info_(0), 373 top_exit_frame_info_(0),
(...skipping 13 matching lines...) Expand all
337 message_handler_(NULL), 387 message_handler_(NULL),
338 spawn_data_(0), 388 spawn_data_(0),
339 is_runnable_(false), 389 is_runnable_(false),
340 running_state_(kIsolateWaiting), 390 running_state_(kIsolateWaiting),
341 gc_prologue_callbacks_(), 391 gc_prologue_callbacks_(),
342 gc_epilogue_callbacks_(), 392 gc_epilogue_callbacks_(),
343 deopt_cpu_registers_copy_(NULL), 393 deopt_cpu_registers_copy_(NULL),
344 deopt_fpu_registers_copy_(NULL), 394 deopt_fpu_registers_copy_(NULL),
345 deopt_frame_copy_(NULL), 395 deopt_frame_copy_(NULL),
346 deopt_frame_copy_size_(0), 396 deopt_frame_copy_size_(0),
397 deferred_boxes_(NULL),
398 deferred_object_refs_(NULL),
399 deferred_objects_count_(0),
347 deferred_objects_(NULL), 400 deferred_objects_(NULL),
348 stacktrace_(NULL), 401 stacktrace_(NULL),
349 stack_frame_index_(-1) { 402 stack_frame_index_(-1) {
350 } 403 }
351 404
352 405
353 Isolate::~Isolate() { 406 Isolate::~Isolate() {
354 delete [] name_; 407 delete [] name_;
355 delete heap_; 408 delete heap_;
356 delete object_store_; 409 delete object_store_;
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 return isolate->GetStatusStackFrame(frame_index); 1040 return isolate->GetStatusStackFrame(frame_index);
988 } 1041 }
989 } 1042 }
990 1043
991 // TODO(tball): "/isolate/<handle>/stacktrace/<frame-index>"/disassemble" 1044 // TODO(tball): "/isolate/<handle>/stacktrace/<frame-index>"/disassemble"
992 1045
993 return NULL; // Unimplemented query. 1046 return NULL; // Unimplemented query.
994 } 1047 }
995 1048
996 1049
1050 static void FillDeferredSlots(DeferredSlot** slot_list) {
1051 DeferredSlot* slot = *slot_list;
1052 *slot_list = NULL;
1053
1054 while (slot != NULL) {
1055 DeferredSlot* current = slot;
1056 slot = slot->next();
1057
1058 current->Materialize();
1059
1060 delete current;
1061 }
1062 }
1063
1064
1065 void Isolate::MaterializeDeferredBoxes() {
1066 FillDeferredSlots(&deferred_boxes_);
1067 }
1068
1069
1070 void Isolate::MaterializeDeferredObjects() {
1071 FillDeferredSlots(&deferred_object_refs_);
1072 }
1073
1074
997 static char* GetRootScriptUri(Isolate* isolate) { 1075 static char* GetRootScriptUri(Isolate* isolate) {
998 const Library& library = 1076 const Library& library =
999 Library::Handle(isolate->object_store()->root_library()); 1077 Library::Handle(isolate->object_store()->root_library());
1000 ASSERT(!library.IsNull()); 1078 ASSERT(!library.IsNull());
1001 const String& script_name = String::Handle(library.url()); 1079 const String& script_name = String::Handle(library.url());
1002 return isolate->current_zone()->MakeCopyOfString(script_name.ToCString()); 1080 return isolate->current_zone()->MakeCopyOfString(script_name.ToCString());
1003 } 1081 }
1004 1082
1005 1083
1006 IsolateSpawnState::IsolateSpawnState(const Function& func, 1084 IsolateSpawnState::IsolateSpawnState(const Function& func,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 return func.raw(); 1155 return func.raw();
1078 } 1156 }
1079 1157
1080 1158
1081 void IsolateSpawnState::Cleanup() { 1159 void IsolateSpawnState::Cleanup() {
1082 SwitchIsolateScope switch_scope(isolate()); 1160 SwitchIsolateScope switch_scope(isolate());
1083 Dart::ShutdownIsolate(); 1161 Dart::ShutdownIsolate();
1084 } 1162 }
1085 1163
1086 } // namespace dart 1164 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698