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

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

Issue 10948007: Revert "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();
32 } 31 }
33 32
34 33
35 intptr_t DeoptimizationContext::GetFromFp() const { 34 intptr_t* DeoptimizationContext::GetFromFpAddress() const {
36 return from_frame_[from_frame_size_ - 1 - num_args_ - 1]; 35 return &from_frame_[from_frame_size_ - 1 - num_args_ - 1];
37 } 36 }
38 37
39 38
40 intptr_t DeoptimizationContext::GetFromPc() const { 39 intptr_t* DeoptimizationContext::GetFromPcAddress() const {
41 return from_frame_[from_frame_size_ - 1 - num_args_]; 40 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;
50 } 41 }
51 42
52 // Deoptimization instruction moving value from optimized frame at 43 // Deoptimization instruction moving value from optimized frame at
53 // 'from_index' to specified slots in the unoptimized frame. 44 // 'from_index' to specified slots in the unoptimized frame.
54 // 'from_index' represents the slot index of the frame (0 being first argument) 45 // 'from_index' represents the slot index of the frame (0 being first argument)
55 // and accounts for saved return address, frame pointer and pc marker. 46 // and accounts for saved return address, frame pointer and pc marker.
56 class DeoptStackSlotInstr : public DeoptInstr { 47 class DeoptStackSlotInstr : public DeoptInstr {
57 public: 48 public:
58 explicit DeoptStackSlotInstr(intptr_t from_index) 49 explicit DeoptStackSlotInstr(intptr_t from_index)
59 : stack_slot_index_(from_index) { 50 : stack_slot_index_(from_index) {
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 DeoptCallerFpInstr() {} 327 DeoptCallerFpInstr() {}
337 328
338 virtual intptr_t from_index() const { return 0; } 329 virtual intptr_t from_index() const { return 0; }
339 virtual DeoptInstr::Kind kind() const { return kSetCallerFp; } 330 virtual DeoptInstr::Kind kind() const { return kSetCallerFp; }
340 331
341 virtual const char* ToCString() const { 332 virtual const char* ToCString() const {
342 return "callerfp"; 333 return "callerfp";
343 } 334 }
344 335
345 void Execute(DeoptimizationContext* deopt_context, intptr_t to_index) { 336 void Execute(DeoptimizationContext* deopt_context, intptr_t to_index) {
346 intptr_t from = deopt_context->GetCallerFp(); 337 intptr_t* from_addr = deopt_context->GetFromFpAddress();
347 intptr_t* to_addr = deopt_context->GetToFrameAddressAt(to_index); 338 intptr_t* to_addr = deopt_context->GetToFrameAddressAt(to_index);
348 *to_addr = from; 339 *to_addr = *from_addr;
349 deopt_context->SetCallerFp(reinterpret_cast<intptr_t>(to_addr));
350 } 340 }
351 341
352 private: 342 private:
353 DISALLOW_COPY_AND_ASSIGN(DeoptCallerFpInstr); 343 DISALLOW_COPY_AND_ASSIGN(DeoptCallerFpInstr);
354 }; 344 };
355 345
356 346
357 // Deoptimization instruction copying the caller return address from optimized 347 // Deoptimization instruction copying the caller return address from optimized
358 // frame. 348 // frame.
359 class DeoptCallerPcInstr : public DeoptInstr { 349 class DeoptCallerPcInstr : public DeoptInstr {
360 public: 350 public:
361 DeoptCallerPcInstr() {} 351 DeoptCallerPcInstr() {}
362 352
363 virtual intptr_t from_index() const { return 0; } 353 virtual intptr_t from_index() const { return 0; }
364 virtual DeoptInstr::Kind kind() const { return kSetCallerPc; } 354 virtual DeoptInstr::Kind kind() const { return kSetCallerPc; }
365 355
366 virtual const char* ToCString() const { 356 virtual const char* ToCString() const {
367 return "callerpc"; 357 return "callerpc";
368 } 358 }
369 359
370 void Execute(DeoptimizationContext* deopt_context, intptr_t to_index) { 360 void Execute(DeoptimizationContext* deopt_context, intptr_t to_index) {
371 intptr_t from = deopt_context->GetFromPc(); 361 intptr_t* from_addr = deopt_context->GetFromPcAddress();
372 intptr_t* to_addr = deopt_context->GetToFrameAddressAt(to_index); 362 intptr_t* to_addr = deopt_context->GetToFrameAddressAt(to_index);
373 *to_addr = from; 363 *to_addr = *from_addr;
374 } 364 }
375 365
376 private: 366 private:
377 DISALLOW_COPY_AND_ASSIGN(DeoptCallerPcInstr); 367 DISALLOW_COPY_AND_ASSIGN(DeoptCallerPcInstr);
378 }; 368 };
379 369
380 370
381 DeoptInstr* DeoptInstr::Create(intptr_t kind_as_int, intptr_t from_index) { 371 DeoptInstr* DeoptInstr::Create(intptr_t kind_as_int, intptr_t from_index) {
382 Kind kind = static_cast<Kind>(kind_as_int); 372 Kind kind = static_cast<Kind>(kind_as_int);
383 switch (kind) { 373 switch (kind) {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 const intptr_t len = instructions_.length(); 478 const intptr_t len = instructions_.length();
489 const DeoptInfo& deopt_info = DeoptInfo::Handle(DeoptInfo::New(len)); 479 const DeoptInfo& deopt_info = DeoptInfo::Handle(DeoptInfo::New(len));
490 for (intptr_t i = 0; i < len; i++) { 480 for (intptr_t i = 0; i < len; i++) {
491 DeoptInstr* instr = instructions_[i]; 481 DeoptInstr* instr = instructions_[i];
492 deopt_info.SetAt(i, instr->kind(), instr->from_index()); 482 deopt_info.SetAt(i, instr->kind(), instr->from_index());
493 } 483 }
494 return deopt_info.raw(); 484 return deopt_info.raw();
495 } 485 }
496 486
497 } // namespace dart 487 } // 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