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

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

Issue 1175523002: Object pool with support for untagged entries. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « runtime/vm/code_patcher_arm64.cc ('k') | runtime/vm/code_patcher_x64.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) 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/globals.h" // Needed here to get TARGET_ARCH_MIPS. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
7 7
8 #include "vm/code_patcher.h" 8 #include "vm/code_patcher.h"
9 9
10 #include "vm/instructions.h" 10 #include "vm/instructions.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 77 }
78 78
79 79
80 // This class pattern matches on a load from the object pool. Loading on 80 // This class pattern matches on a load from the object pool. Loading on
81 // MIPS is complicated because it can take four possible different forms. 81 // MIPS is complicated because it can take four possible different forms.
82 // We match backwards from the end of the sequence so we can reuse the code 82 // We match backwards from the end of the sequence so we can reuse the code
83 // for matching object pool loads at calls. 83 // for matching object pool loads at calls.
84 class EdgeCounter : public ValueObject { 84 class EdgeCounter : public ValueObject {
85 public: 85 public:
86 EdgeCounter(uword pc, const Code& code) 86 EdgeCounter(uword pc, const Code& code)
87 : end_(pc - kAdjust), object_pool_(Array::Handle(code.ObjectPool())) { 87 : end_(pc - kAdjust),
88 object_pool_(ObjectPool::Handle(code.GetObjectPool())) {
88 // An IsValid predicate is complicated and duplicates the code in the 89 // An IsValid predicate is complicated and duplicates the code in the
89 // decoding function. Instead we rely on decoding the pattern which 90 // decoding function. Instead we rely on decoding the pattern which
90 // will assert partial validity. 91 // will assert partial validity.
91 } 92 }
92 93
93 RawObject* edge_counter() const { 94 RawObject* edge_counter() const {
94 Register ignored; 95 Register ignored;
95 intptr_t index; 96 intptr_t index;
96 InstructionPattern::DecodeLoadWordFromPool(end_, &ignored, &index); 97 InstructionPattern::DecodeLoadWordFromPool(end_, &ignored, &index);
97 ASSERT(ignored == T0); 98 ASSERT(ignored == T0);
98 return object_pool_.At(index); 99 return object_pool_.ObjectAt(index);
99 } 100 }
100 101
101 private: 102 private:
102 // The object pool load is followed by the fixed-size edge counter 103 // The object pool load is followed by the fixed-size edge counter
103 // incrementing code: 104 // incrementing code:
104 // lw r9, 11(r8) 105 // lw r9, 11(r8)
105 // addiu r9, r9, 2 106 // addiu r9, r9, 2
106 // sw r9, 11(r8) 107 // sw r9, 11(r8)
107 static const intptr_t kAdjust = 3 * Instr::kInstrSize; 108 static const intptr_t kAdjust = 3 * Instr::kInstrSize;
108 109
109 uword end_; 110 uword end_;
110 const Array& object_pool_; 111 const ObjectPool& object_pool_;
111 }; 112 };
112 113
113 114
114 RawObject* CodePatcher::GetEdgeCounterAt(uword pc, const Code& code) { 115 RawObject* CodePatcher::GetEdgeCounterAt(uword pc, const Code& code) {
115 ASSERT(code.ContainsInstructionAt(pc)); 116 ASSERT(code.ContainsInstructionAt(pc));
116 EdgeCounter counter(pc, code); 117 EdgeCounter counter(pc, code);
117 return counter.edge_counter(); 118 return counter.edge_counter();
118 } 119 }
119 120
120 } // namespace dart 121 } // namespace dart
121 122
122 #endif // defined TARGET_ARCH_MIPS 123 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/code_patcher_arm64.cc ('k') | runtime/vm/code_patcher_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698