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

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

Issue 15692005: Fix a bug in optimized ARM code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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/code_generator.cc ('k') | runtime/vm/flow_graph_compiler.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/deopt_instructions.h" 5 #include "vm/deopt_instructions.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/code_patcher.h" 8 #include "vm/code_patcher.h"
9 #include "vm/intermediate_language.h" 9 #include "vm/intermediate_language.h"
10 #include "vm/locations.h" 10 #include "vm/locations.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 67
68 void DeoptimizationContext::SetCallerFp(intptr_t caller_fp) { 68 void DeoptimizationContext::SetCallerFp(intptr_t caller_fp) {
69 caller_fp_ = caller_fp; 69 caller_fp_ = caller_fp;
70 } 70 }
71 71
72 72
73 // Deoptimization instruction moving value from optimized frame at 73 // Deoptimization instruction moving value from optimized frame at
74 // 'from_index' to specified slots in the unoptimized frame. 74 // 'from_index' to specified slots in the unoptimized frame.
75 // 'from_index' represents the slot index of the frame (0 being first argument) 75 // 'from_index' represents the slot index of the frame (0 being first argument)
76 // and accounts for saved return address, frame pointer and pc marker. 76 // and accounts for saved return address, frame pointer, pool pointer and pc
77 // marker.
77 class DeoptStackSlotInstr : public DeoptInstr { 78 class DeoptStackSlotInstr : public DeoptInstr {
78 public: 79 public:
79 explicit DeoptStackSlotInstr(intptr_t from_index) 80 explicit DeoptStackSlotInstr(intptr_t from_index)
80 : stack_slot_index_(from_index) { 81 : stack_slot_index_(from_index) {
81 ASSERT(stack_slot_index_ >= 0); 82 ASSERT(stack_slot_index_ >= 0);
82 } 83 }
83 84
84 virtual intptr_t from_index() const { return stack_slot_index_; } 85 virtual intptr_t from_index() const { return stack_slot_index_; }
85 virtual DeoptInstr::Kind kind() const { return kStackSlot; } 86 virtual DeoptInstr::Kind kind() const { return kStackSlot; }
86 87
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 } 509 }
509 const Code& code = 510 const Code& code =
510 Code::Handle(deopt_context->isolate(), function.unoptimized_code()); 511 Code::Handle(deopt_context->isolate(), function.unoptimized_code());
511 ASSERT(!code.IsNull()); 512 ASSERT(!code.IsNull());
512 const intptr_t pc_marker = 513 const intptr_t pc_marker =
513 code.EntryPoint() + Assembler::kEntryPointToPcMarkerOffset; 514 code.EntryPoint() + Assembler::kEntryPointToPcMarkerOffset;
514 *to_addr = pc_marker; 515 *to_addr = pc_marker;
515 // Increment the deoptimization counter. This effectively increments each 516 // Increment the deoptimization counter. This effectively increments each
516 // function occurring in the optimized frame. 517 // function occurring in the optimized frame.
517 function.set_deoptimization_counter(function.deoptimization_counter() + 1); 518 function.set_deoptimization_counter(function.deoptimization_counter() + 1);
518 if (FLAG_trace_deoptimization) { 519 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) {
519 OS::PrintErr("Deoptimizing %s (count %d)\n", 520 OS::PrintErr("Deoptimizing %s (count %d)\n",
520 function.ToFullyQualifiedCString(), 521 function.ToFullyQualifiedCString(),
521 function.deoptimization_counter()); 522 function.deoptimization_counter());
522 } 523 }
523 // Clear invocation counter so that hopefully the function gets reoptimized 524 // Clear invocation counter so that hopefully the function gets reoptimized
524 // only after more feedback has been collected. 525 // only after more feedback has been collected.
525 function.set_usage_counter(0); 526 function.set_usage_counter(0);
526 if (function.HasOptimizedCode()) function.SwitchToUnoptimizedCode(); 527 if (function.HasOptimizedCode()) function.SwitchToUnoptimizedCode();
527 } 528 }
528 529
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 // Add object. 857 // Add object.
857 const intptr_t result = object_table_.Length(); 858 const intptr_t result = object_table_.Length();
858 object_table_.Add(obj); 859 object_table_.Add(obj);
859 return result; 860 return result;
860 } 861 }
861 862
862 863
863 intptr_t DeoptInfoBuilder::CalculateStackIndex(const Location& from_loc) const { 864 intptr_t DeoptInfoBuilder::CalculateStackIndex(const Location& from_loc) const {
864 return from_loc.stack_index() < 0 ? 865 return from_loc.stack_index() < 0 ?
865 from_loc.stack_index() + num_args_ : 866 from_loc.stack_index() + num_args_ :
866 from_loc.stack_index() + num_args_ - kFirstLocalSlotFromFp + 1; 867 from_loc.stack_index() + num_args_ + kDartFrameFixedSize;
867 } 868 }
868 869
869 870
870 void DeoptInfoBuilder::AddReturnAddress(const Function& function, 871 void DeoptInfoBuilder::AddReturnAddress(const Function& function,
871 intptr_t deopt_id, 872 intptr_t deopt_id,
872 intptr_t to_index) { 873 intptr_t to_index) {
873 // Check that deopt_id exists. 874 // Check that deopt_id exists.
874 // TODO(vegorov): verify after deoptimization targets as well. 875 // TODO(vegorov): verify after deoptimization targets as well.
875 #ifdef DEBUG 876 #ifdef DEBUG
876 const Code& code = Code::Handle(function.unoptimized_code()); 877 const Code& code = Code::Handle(function.unoptimized_code());
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 Smi* offset, 1110 Smi* offset,
1110 DeoptInfo* info, 1111 DeoptInfo* info,
1111 Smi* reason) { 1112 Smi* reason) {
1112 intptr_t i = index * kEntrySize; 1113 intptr_t i = index * kEntrySize;
1113 *offset ^= table.At(i); 1114 *offset ^= table.At(i);
1114 *info ^= table.At(i + 1); 1115 *info ^= table.At(i + 1);
1115 *reason ^= table.At(i + 2); 1116 *reason ^= table.At(i + 2);
1116 } 1117 }
1117 1118
1118 } // namespace dart 1119 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/flow_graph_compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698