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

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

Issue 10952002: Reapply "Deoptimization support in inlined code." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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/deopt_instructions.h ('k') | runtime/vm/flow_graph.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/deopt_instructions.h" 5 #include "vm/deopt_instructions.h"
6 6
7 #include "vm/assembler_macros.h" 7 #include "vm/assembler_macros.h"
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 #include "vm/locations.h" 9 #include "vm/locations.h"
10 #include "vm/parser.h" 10 #include "vm/parser.h"
(...skipping 10 matching lines...) Expand all
21 from_frame_(NULL), 21 from_frame_(NULL),
22 from_frame_size_(0), 22 from_frame_size_(0),
23 registers_copy_(NULL), 23 registers_copy_(NULL),
24 xmm_registers_copy_(NULL), 24 xmm_registers_copy_(NULL),
25 num_args_(num_args), 25 num_args_(num_args),
26 isolate_(Isolate::Current()) { 26 isolate_(Isolate::Current()) {
27 from_frame_ = isolate_->deopt_frame_copy(); 27 from_frame_ = isolate_->deopt_frame_copy();
28 from_frame_size_ = isolate_->deopt_frame_copy_size(); 28 from_frame_size_ = isolate_->deopt_frame_copy_size();
29 registers_copy_ = isolate_->deopt_cpu_registers_copy(); 29 registers_copy_ = isolate_->deopt_cpu_registers_copy();
30 xmm_registers_copy_ = isolate_->deopt_xmm_registers_copy(); 30 xmm_registers_copy_ = isolate_->deopt_xmm_registers_copy();
31 caller_fp_ = GetFromFp();
31 } 32 }
32 33
33 34
34 intptr_t* DeoptimizationContext::GetFromFpAddress() const { 35 intptr_t DeoptimizationContext::GetFromFp() const {
35 return &from_frame_[from_frame_size_ - 1 - num_args_ - 1]; 36 return from_frame_[from_frame_size_ - 1 - num_args_ - 1];
36 } 37 }
37 38
38 39
39 intptr_t* DeoptimizationContext::GetFromPcAddress() const { 40 intptr_t DeoptimizationContext::GetFromPc() const {
40 return &from_frame_[from_frame_size_ - 1 - num_args_]; 41 return from_frame_[from_frame_size_ - 1 - num_args_];
42 }
43
44 intptr_t DeoptimizationContext::GetCallerFp() const {
45 return caller_fp_;
46 }
47
48 void DeoptimizationContext::SetCallerFp(intptr_t caller_fp) {
49 caller_fp_ = caller_fp;
41 } 50 }
42 51
43 // Deoptimization instruction moving value from optimized frame at 52 // Deoptimization instruction moving value from optimized frame at
44 // 'from_index' to specified slots in the unoptimized frame. 53 // 'from_index' to specified slots in the unoptimized frame.
45 // 'from_index' represents the slot index of the frame (0 being first argument) 54 // 'from_index' represents the slot index of the frame (0 being first argument)
46 // and accounts for saved return address, frame pointer and pc marker. 55 // and accounts for saved return address, frame pointer and pc marker.
47 class DeoptStackSlotInstr : public DeoptInstr { 56 class DeoptStackSlotInstr : public DeoptInstr {
48 public: 57 public:
49 explicit DeoptStackSlotInstr(intptr_t from_index) 58 explicit DeoptStackSlotInstr(intptr_t from_index)
50 : stack_slot_index_(from_index) { 59 : stack_slot_index_(from_index) {
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 DeoptCallerFpInstr() {} 336 DeoptCallerFpInstr() {}
328 337
329 virtual intptr_t from_index() const { return 0; } 338 virtual intptr_t from_index() const { return 0; }
330 virtual DeoptInstr::Kind kind() const { return kSetCallerFp; } 339 virtual DeoptInstr::Kind kind() const { return kSetCallerFp; }
331 340
332 virtual const char* ToCString() const { 341 virtual const char* ToCString() const {
333 return "callerfp"; 342 return "callerfp";
334 } 343 }
335 344
336 void Execute(DeoptimizationContext* deopt_context, intptr_t to_index) { 345 void Execute(DeoptimizationContext* deopt_context, intptr_t to_index) {
337 intptr_t* from_addr = deopt_context->GetFromFpAddress(); 346 intptr_t from = deopt_context->GetCallerFp();
338 intptr_t* to_addr = deopt_context->GetToFrameAddressAt(to_index); 347 intptr_t* to_addr = deopt_context->GetToFrameAddressAt(to_index);
339 *to_addr = *from_addr; 348 *to_addr = from;
349 deopt_context->SetCallerFp(reinterpret_cast<intptr_t>(to_addr));
340 } 350 }
341 351
342 private: 352 private:
343 DISALLOW_COPY_AND_ASSIGN(DeoptCallerFpInstr); 353 DISALLOW_COPY_AND_ASSIGN(DeoptCallerFpInstr);
344 }; 354 };
345 355
346 356
347 // Deoptimization instruction copying the caller return address from optimized 357 // Deoptimization instruction copying the caller return address from optimized
348 // frame. 358 // frame.
349 class DeoptCallerPcInstr : public DeoptInstr { 359 class DeoptCallerPcInstr : public DeoptInstr {
350 public: 360 public:
351 DeoptCallerPcInstr() {} 361 DeoptCallerPcInstr() {}
352 362
353 virtual intptr_t from_index() const { return 0; } 363 virtual intptr_t from_index() const { return 0; }
354 virtual DeoptInstr::Kind kind() const { return kSetCallerPc; } 364 virtual DeoptInstr::Kind kind() const { return kSetCallerPc; }
355 365
356 virtual const char* ToCString() const { 366 virtual const char* ToCString() const {
357 return "callerpc"; 367 return "callerpc";
358 } 368 }
359 369
360 void Execute(DeoptimizationContext* deopt_context, intptr_t to_index) { 370 void Execute(DeoptimizationContext* deopt_context, intptr_t to_index) {
361 intptr_t* from_addr = deopt_context->GetFromPcAddress(); 371 intptr_t from = deopt_context->GetFromPc();
362 intptr_t* to_addr = deopt_context->GetToFrameAddressAt(to_index); 372 intptr_t* to_addr = deopt_context->GetToFrameAddressAt(to_index);
363 *to_addr = *from_addr; 373 *to_addr = from;
364 } 374 }
365 375
366 private: 376 private:
367 DISALLOW_COPY_AND_ASSIGN(DeoptCallerPcInstr); 377 DISALLOW_COPY_AND_ASSIGN(DeoptCallerPcInstr);
368 }; 378 };
369 379
370 380
371 DeoptInstr* DeoptInstr::Create(intptr_t kind_as_int, intptr_t from_index) { 381 DeoptInstr* DeoptInstr::Create(intptr_t kind_as_int, intptr_t from_index) {
372 Kind kind = static_cast<Kind>(kind_as_int); 382 Kind kind = static_cast<Kind>(kind_as_int);
373 switch (kind) { 383 switch (kind) {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 const intptr_t len = instructions_.length(); 488 const intptr_t len = instructions_.length();
479 const DeoptInfo& deopt_info = DeoptInfo::Handle(DeoptInfo::New(len)); 489 const DeoptInfo& deopt_info = DeoptInfo::Handle(DeoptInfo::New(len));
480 for (intptr_t i = 0; i < len; i++) { 490 for (intptr_t i = 0; i < len; i++) {
481 DeoptInstr* instr = instructions_[i]; 491 DeoptInstr* instr = instructions_[i];
482 deopt_info.SetAt(i, instr->kind(), instr->from_index()); 492 deopt_info.SetAt(i, instr->kind(), instr->from_index());
483 } 493 }
484 return deopt_info.raw(); 494 return deopt_info.raw();
485 } 495 }
486 496
487 } // namespace dart 497 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/deopt_instructions.h ('k') | runtime/vm/flow_graph.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698