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

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

Issue 1343383003: VM: Store edge counters in one per-function array. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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_mips.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/globals.h" // Needed here to get TARGET_ARCH_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/code_patcher.h" 9 #include "vm/code_patcher.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 UNREACHABLE(); 225 UNREACHABLE();
226 return NULL; 226 return NULL;
227 } 227 }
228 228
229 229
230 230
231 intptr_t CodePatcher::InstanceCallSizeInBytes() { 231 intptr_t CodePatcher::InstanceCallSizeInBytes() {
232 return InstanceCall::kPatternSize; 232 return InstanceCall::kPatternSize;
233 } 233 }
234 234
235
236 // The expected code pattern of an edge counter in unoptimized code:
237 // b8 imm32 mov EAX, immediate
238 class EdgeCounter : public ValueObject {
239 public:
240 EdgeCounter(uword pc, const Code& ignored)
241 : end_(pc - FlowGraphCompiler::EdgeCounterIncrementSizeInBytes()) {
242 ASSERT(IsValid(end_));
243 }
244
245 static bool IsValid(uword end) {
246 return (*reinterpret_cast<uint8_t*>(end - 5) == 0xb8);
247 }
248
249 RawObject* edge_counter() const {
250 return *reinterpret_cast<RawObject**>(end_ - 4);
251 }
252
253 private:
254 uword end_;
255 };
256
257
258 RawObject* CodePatcher::GetEdgeCounterAt(uword pc, const Code& code) {
259 ASSERT(code.ContainsInstructionAt(pc));
260 EdgeCounter counter(pc, code);
261 return counter.edge_counter();
262 }
263
264 } // namespace dart 235 } // namespace dart
265 236
266 #endif // defined TARGET_ARCH_IA32 237 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/code_patcher_arm64.cc ('k') | runtime/vm/code_patcher_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698