V8 Project
hydrogen-environment-liveness.h
Go to the documentation of this file.
1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_HYDROGEN_ENVIRONMENT_LIVENESS_H_
6 #define V8_HYDROGEN_ENVIRONMENT_LIVENESS_H_
7 
8 
9 #include "src/hydrogen.h"
10 
11 namespace v8 {
12 namespace internal {
13 
14 
15 // Trims live ranges of environment slots by doing explicit liveness analysis.
16 // Values in the environment are kept alive by every subsequent LInstruction
17 // that is assigned an LEnvironment, which creates register pressure and
18 // unnecessary spill slot moves. Therefore it is beneficial to trim the
19 // live ranges of environment slots by zapping them with a constant after
20 // the last lookup that refers to them.
21 // Slots are identified by their index and only affected if whitelisted in
22 // HOptimizedGraphBuilder::IsEligibleForEnvironmentLivenessAnalysis().
24  public:
25  explicit HEnvironmentLivenessAnalysisPhase(HGraph* graph);
26 
27  void Run();
28 
29  private:
30  void ZapEnvironmentSlot(int index, HSimulate* simulate);
31  void ZapEnvironmentSlotsInSuccessors(HBasicBlock* block, BitVector* live);
32  void ZapEnvironmentSlotsForInstruction(HEnvironmentMarker* marker);
33  void UpdateLivenessAtBlockEnd(HBasicBlock* block, BitVector* live);
35 #ifdef DEBUG
36  bool VerifyClosures(Handle<JSFunction> a, Handle<JSFunction> b);
37 #endif
38 
40 
41  // Largest number of local variables in any environment in the graph
42  // (including inlined environments).
44 
45  // Per-block data. All these lists are indexed by block_id.
49 
50  // List of all HEnvironmentMarker instructions for quick iteration/deletion.
51  // It is populated during the first pass over the graph, controlled by
52  // |collect_markers_|.
55 
56  // Keeps track of the last simulate seen, as well as the environment slots
57  // for which a new live range has started since (so they must not be zapped
58  // in that simulate when the end of another live range of theirs is found).
59  HSimulate* last_simulate_;
61 
63 };
64 
65 
66 } } // namespace v8::internal
67 
68 #endif /* V8_HYDROGEN_ENVIRONMENT_LIVENESS_H_ */
void UpdateLivenessAtInstruction(HInstruction *instr, BitVector *live)
void UpdateLivenessAtBlockEnd(HBasicBlock *block, BitVector *live)
DISALLOW_COPY_AND_ASSIGN(HEnvironmentLivenessAnalysisPhase)
void ZapEnvironmentSlotsInSuccessors(HBasicBlock *block, BitVector *live)
void ZapEnvironmentSlotsForInstruction(HEnvironmentMarker *marker)
HGraph * graph() const
Definition: hydrogen.h:2802
Debugger support for the V8 JavaScript engine.
Definition: accessors.cc:20