| OLD | NEW |
| 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 "lib/mirrors.h" | 9 #include "lib/mirrors.h" |
| 10 #include "vm/code_observers.h" | 10 #include "vm/code_observers.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "vm/thread.h" | 24 #include "vm/thread.h" |
| 25 #include "vm/timer.h" | 25 #include "vm/timer.h" |
| 26 #include "vm/visitor.h" | 26 #include "vm/visitor.h" |
| 27 | 27 |
| 28 namespace dart { | 28 namespace dart { |
| 29 | 29 |
| 30 DEFINE_FLAG(bool, report_usage_count, false, | 30 DEFINE_FLAG(bool, report_usage_count, false, |
| 31 "Track function usage and report."); | 31 "Track function usage and report."); |
| 32 DEFINE_FLAG(bool, trace_isolates, false, | 32 DEFINE_FLAG(bool, trace_isolates, false, |
| 33 "Trace isolate creation and shut down."); | 33 "Trace isolate creation and shut down."); |
| 34 | 34 DECLARE_FLAG(bool, trace_deoptimization_verbose); |
| 35 | 35 |
| 36 class IsolateMessageHandler : public MessageHandler { | 36 class IsolateMessageHandler : public MessageHandler { |
| 37 public: | 37 public: |
| 38 explicit IsolateMessageHandler(Isolate* isolate); | 38 explicit IsolateMessageHandler(Isolate* isolate); |
| 39 ~IsolateMessageHandler(); | 39 ~IsolateMessageHandler(); |
| 40 | 40 |
| 41 const char* name() const; | 41 const char* name() const; |
| 42 void MessageNotify(Message::Priority priority); | 42 void MessageNotify(Message::Priority priority); |
| 43 bool HandleMessage(Message* message); | 43 bool HandleMessage(Message* message); |
| 44 | 44 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 | 248 |
| 249 | 249 |
| 250 #if defined(DEBUG) | 250 #if defined(DEBUG) |
| 251 // static | 251 // static |
| 252 void BaseIsolate::AssertCurrent(BaseIsolate* isolate) { | 252 void BaseIsolate::AssertCurrent(BaseIsolate* isolate) { |
| 253 ASSERT(isolate == Isolate::Current()); | 253 ASSERT(isolate == Isolate::Current()); |
| 254 } | 254 } |
| 255 #endif | 255 #endif |
| 256 | 256 |
| 257 | 257 |
| 258 void DeferredDouble::Materialize() { |
| 259 RawDouble** double_slot = reinterpret_cast<RawDouble**>(slot()); |
| 260 *double_slot = Double::New(value()); |
| 261 |
| 262 if (FLAG_trace_deoptimization_verbose) { |
| 263 OS::PrintErr("materializing double at %"Px": %g\n", |
| 264 reinterpret_cast<uword>(slot()), value()); |
| 265 } |
| 266 } |
| 267 |
| 268 |
| 269 void DeferredMint::Materialize() { |
| 270 RawMint** mint_slot = reinterpret_cast<RawMint**>(slot()); |
| 271 ASSERT(!Smi::IsValid64(value())); |
| 272 *mint_slot = Mint::New(value()); |
| 273 |
| 274 if (FLAG_trace_deoptimization_verbose) { |
| 275 OS::PrintErr("materializing mint at %"Px": %"Pd64"\n", |
| 276 reinterpret_cast<uword>(slot()), value()); |
| 277 } |
| 278 } |
| 279 |
| 280 |
| 281 void DeferredFloat32x4::Materialize() { |
| 282 RawFloat32x4** float32x4_slot = reinterpret_cast<RawFloat32x4**>(slot()); |
| 283 RawFloat32x4* raw_float32x4 = Float32x4::New(value()); |
| 284 *float32x4_slot = raw_float32x4; |
| 285 |
| 286 if (FLAG_trace_deoptimization_verbose) { |
| 287 float x = raw_float32x4->x(); |
| 288 float y = raw_float32x4->y(); |
| 289 float z = raw_float32x4->z(); |
| 290 float w = raw_float32x4->w(); |
| 291 OS::PrintErr("materializing Float32x4 at %"Px": %g,%g,%g,%g\n", |
| 292 reinterpret_cast<uword>(slot()), x, y, z, w); |
| 293 } |
| 294 } |
| 295 |
| 296 |
| 297 void DeferredUint32x4::Materialize() { |
| 298 RawUint32x4** uint32x4_slot = reinterpret_cast<RawUint32x4**>(slot()); |
| 299 RawUint32x4* raw_uint32x4 = Uint32x4::New(value()); |
| 300 *uint32x4_slot = raw_uint32x4; |
| 301 |
| 302 if (FLAG_trace_deoptimization_verbose) { |
| 303 uint32_t x = raw_uint32x4->x(); |
| 304 uint32_t y = raw_uint32x4->y(); |
| 305 uint32_t z = raw_uint32x4->z(); |
| 306 uint32_t w = raw_uint32x4->w(); |
| 307 OS::PrintErr("materializing Uint32x4 at %"Px": %x,%x,%x,%x\n", |
| 308 reinterpret_cast<uword>(slot()), x, y, z, w); |
| 309 } |
| 310 } |
| 311 |
| 312 |
| 258 Isolate::Isolate() | 313 Isolate::Isolate() |
| 259 : store_buffer_block_(), | 314 : store_buffer_block_(), |
| 260 store_buffer_(), | 315 store_buffer_(), |
| 261 message_notify_callback_(NULL), | 316 message_notify_callback_(NULL), |
| 262 name_(NULL), | 317 name_(NULL), |
| 263 start_time_(OS::GetCurrentTimeMicros()), | 318 start_time_(OS::GetCurrentTimeMicros()), |
| 264 main_port_(0), | 319 main_port_(0), |
| 265 heap_(NULL), | 320 heap_(NULL), |
| 266 object_store_(NULL), | 321 object_store_(NULL), |
| 267 top_context_(Context::null()), | 322 top_context_(Context::null()), |
| (...skipping 12 matching lines...) Expand all Loading... |
| 280 stack_limit_(0), | 335 stack_limit_(0), |
| 281 saved_stack_limit_(0), | 336 saved_stack_limit_(0), |
| 282 message_handler_(NULL), | 337 message_handler_(NULL), |
| 283 spawn_data_(0), | 338 spawn_data_(0), |
| 284 gc_prologue_callbacks_(), | 339 gc_prologue_callbacks_(), |
| 285 gc_epilogue_callbacks_(), | 340 gc_epilogue_callbacks_(), |
| 286 deopt_cpu_registers_copy_(NULL), | 341 deopt_cpu_registers_copy_(NULL), |
| 287 deopt_fpu_registers_copy_(NULL), | 342 deopt_fpu_registers_copy_(NULL), |
| 288 deopt_frame_copy_(NULL), | 343 deopt_frame_copy_(NULL), |
| 289 deopt_frame_copy_size_(0), | 344 deopt_frame_copy_size_(0), |
| 290 deferred_doubles_(NULL), | 345 deferred_objects_(NULL) { |
| 291 deferred_mints_(NULL) { | |
| 292 } | 346 } |
| 293 | 347 |
| 294 | 348 |
| 295 Isolate::~Isolate() { | 349 Isolate::~Isolate() { |
| 296 delete [] name_; | 350 delete [] name_; |
| 297 delete heap_; | 351 delete heap_; |
| 298 delete object_store_; | 352 delete object_store_; |
| 299 delete api_state_; | 353 delete api_state_; |
| 300 delete stub_code_; | 354 delete stub_code_; |
| 301 delete debugger_; | 355 delete debugger_; |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 isolate->saved_stack_limit(), | 739 isolate->saved_stack_limit(), |
| 686 heap->Used(Heap::kNew) / KB, | 740 heap->Used(Heap::kNew) / KB, |
| 687 heap->Capacity(Heap::kNew) / KB, | 741 heap->Capacity(Heap::kNew) / KB, |
| 688 heap->Used(Heap::kOld) / KB, | 742 heap->Used(Heap::kOld) / KB, |
| 689 heap->Capacity(Heap::kOld) / KB); | 743 heap->Capacity(Heap::kOld) / KB); |
| 690 ASSERT(n < 256); | 744 ASSERT(n < 256); |
| 691 return strdup(buffer); | 745 return strdup(buffer); |
| 692 } | 746 } |
| 693 | 747 |
| 694 } // namespace dart | 748 } // namespace dart |
| OLD | NEW |