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

Side by Side Diff: test/unittests/compiler/liveness-analyzer-unittest.cc

Issue 2509623002: [turbofan] Sparse representation for state values (Closed)
Patch Set: Renaming and changing refs to pointers Created 4 years 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/js-graph.h" 5 #include "src/compiler/js-graph.h"
6 #include "src/compiler/linkage.h" 6 #include "src/compiler/linkage.h"
7 #include "src/compiler/liveness-analyzer.h" 7 #include "src/compiler/liveness-analyzer.h"
8 #include "src/compiler/node-matchers.h" 8 #include "src/compiler/node-matchers.h"
9 #include "src/compiler/state-values-utils.h" 9 #include "src/compiler/state-values-utils.h"
10 #include "test/unittests/compiler/graph-unittest.h" 10 #include "test/unittests/compiler/graph-unittest.h"
(...skipping 10 matching lines...) Expand all
21 21
22 class LivenessAnalysisTest : public GraphTest { 22 class LivenessAnalysisTest : public GraphTest {
23 public: 23 public:
24 explicit LivenessAnalysisTest(int locals_count = 4) 24 explicit LivenessAnalysisTest(int locals_count = 4)
25 : locals_count_(locals_count), 25 : locals_count_(locals_count),
26 machine_(zone(), MachineRepresentation::kWord32), 26 machine_(zone(), MachineRepresentation::kWord32),
27 javascript_(zone()), 27 javascript_(zone()),
28 jsgraph_(isolate(), graph(), common(), &javascript_, nullptr, 28 jsgraph_(isolate(), graph(), common(), &javascript_, nullptr,
29 &machine_), 29 &machine_),
30 analyzer_(locals_count, false, zone()), 30 analyzer_(locals_count, false, zone()),
31 empty_values_(graph()->NewNode(common()->StateValues(0), 0, nullptr)), 31 empty_values_(graph()->NewNode(
32 common()->StateValues(0, SparseInputMask::Dense()), 0, nullptr)),
32 next_checkpoint_id_(0), 33 next_checkpoint_id_(0),
33 current_block_(nullptr) {} 34 current_block_(nullptr) {}
34 35
35 protected: 36 protected:
36 JSGraph* jsgraph() { return &jsgraph_; } 37 JSGraph* jsgraph() { return &jsgraph_; }
37 38
38 LivenessAnalyzer* analyzer() { return &analyzer_; } 39 LivenessAnalyzer* analyzer() { return &analyzer_; }
39 void Run() { 40 void Run() {
40 StateValuesCache cache(jsgraph()); 41 StateValuesCache cache(jsgraph());
41 NonLiveFrameStateSlotReplacer replacer( 42 NonLiveFrameStateSlotReplacer replacer(
42 &cache, jsgraph()->UndefinedConstant(), analyzer()->local_count(), 43 &cache, jsgraph()->UndefinedConstant(), analyzer()->local_count(),
43 false, zone()); 44 false, zone());
44 analyzer()->Run(&replacer); 45 analyzer()->Run(&replacer);
45 } 46 }
46 47
47 Node* Checkpoint() { 48 Node* Checkpoint() {
48 int ast_num = next_checkpoint_id_++; 49 int ast_num = next_checkpoint_id_++;
49 int first_const = intconst_from_bailout_id(ast_num, locals_count_); 50 int first_const = intconst_from_bailout_id(ast_num, locals_count_);
50 51
51 const Operator* locals_op = common()->StateValues(locals_count_); 52 const Operator* locals_op =
53 common()->StateValues(locals_count_, SparseInputMask::Dense());
52 54
53 ZoneVector<Node*> local_inputs(locals_count_, nullptr, zone()); 55 ZoneVector<Node*> local_inputs(locals_count_, nullptr, zone());
54 for (int i = 0; i < locals_count_; i++) { 56 for (int i = 0; i < locals_count_; i++) {
55 local_inputs[i] = jsgraph()->Int32Constant(i + first_const); 57 local_inputs[i] = jsgraph()->Int32Constant(i + first_const);
56 } 58 }
57 Node* locals = 59 Node* locals =
58 graph()->NewNode(locals_op, locals_count_, &local_inputs.front()); 60 graph()->NewNode(locals_op, locals_count_, &local_inputs.front());
59 61
60 const FrameStateFunctionInfo* state_info = 62 const FrameStateFunctionInfo* state_info =
61 common()->CreateFrameStateFunctionInfo( 63 common()->CreateFrameStateFunctionInfo(
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 EXPECT_THAT(c1_in_loop, IsCheckpointModuloLiveness(".L.L")); 371 EXPECT_THAT(c1_in_loop, IsCheckpointModuloLiveness(".L.L"));
370 EXPECT_THAT(c2_in_loop, IsCheckpointModuloLiveness("LL.L")); 372 EXPECT_THAT(c2_in_loop, IsCheckpointModuloLiveness("LL.L"));
371 373
372 EXPECT_THAT(c1_end, IsCheckpointModuloLiveness(".LL.")); 374 EXPECT_THAT(c1_end, IsCheckpointModuloLiveness(".LL."));
373 EXPECT_THAT(c2_end, IsCheckpointModuloLiveness("....")); 375 EXPECT_THAT(c2_end, IsCheckpointModuloLiveness("...."));
374 } 376 }
375 377
376 } // namespace compiler 378 } // namespace compiler
377 } // namespace internal 379 } // namespace internal
378 } // namespace v8 380 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/js-create-lowering-unittest.cc ('k') | test/unittests/compiler/state-values-utils-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698