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

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

Issue 1191243003: [turbofan] Factor out the function specific part from the frame state operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Tweaks 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 | « test/unittests/compiler/instruction-selector-unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 const Operator* locals_op = common()->StateValues(locals_count_); 51 const Operator* locals_op = common()->StateValues(locals_count_);
52 52
53 ZoneVector<Node*> local_inputs(locals_count_, nullptr, zone()); 53 ZoneVector<Node*> local_inputs(locals_count_, nullptr, zone());
54 for (int i = 0; i < locals_count_; i++) { 54 for (int i = 0; i < locals_count_; i++) {
55 local_inputs[i] = jsgraph()->Int32Constant(i + first_const); 55 local_inputs[i] = jsgraph()->Int32Constant(i + first_const);
56 } 56 }
57 Node* locals = 57 Node* locals =
58 graph()->NewNode(locals_op, locals_count_, &local_inputs.front()); 58 graph()->NewNode(locals_op, locals_count_, &local_inputs.front());
59 59
60 const FrameStateFunctionInfo* state_info =
61 common()->CreateFrameStateFunctionInfo(
62 FrameStateType::kJavaScriptFunction, 0, locals_count_,
63 Handle<SharedFunctionInfo>());
64
60 const Operator* op = common()->FrameState( 65 const Operator* op = common()->FrameState(
61 JS_FRAME, BailoutId(ast_num), OutputFrameStateCombine::Ignore()); 66 BailoutId(ast_num), OutputFrameStateCombine::Ignore(), state_info);
62 Node* result = graph()->NewNode(op, empty_values_, locals, empty_values_, 67 Node* result = graph()->NewNode(op, empty_values_, locals, empty_values_,
63 jsgraph()->UndefinedConstant(), 68 jsgraph()->UndefinedConstant(),
64 jsgraph()->UndefinedConstant()); 69 jsgraph()->UndefinedConstant());
65 70
66 current_block_->Checkpoint(result); 71 current_block_->Checkpoint(result);
67 return result; 72 return result;
68 } 73 }
69 74
70 void Bind(int var) { current_block()->Bind(var); } 75 void Bind(int var) { current_block()->Bind(var); }
71 void Lookup(int var) { current_block()->Lookup(var); } 76 void Lookup(int var) { current_block()->Lookup(var); }
(...skipping 14 matching lines...) Expand all
86 } 91 }
87 92
88 bool MatchAndExplain(Node* frame_state, 93 bool MatchAndExplain(Node* frame_state,
89 MatchResultListener* listener) const override { 94 MatchResultListener* listener) const override {
90 if (frame_state == NULL) { 95 if (frame_state == NULL) {
91 *listener << "which is NULL"; 96 *listener << "which is NULL";
92 return false; 97 return false;
93 } 98 }
94 DCHECK(frame_state->opcode() == IrOpcode::kFrameState); 99 DCHECK(frame_state->opcode() == IrOpcode::kFrameState);
95 100
96 FrameStateCallInfo state_info = 101 FrameStateInfo state_info = OpParameter<FrameStateInfo>(frame_state);
97 OpParameter<FrameStateCallInfo>(frame_state);
98 int ast_num = state_info.bailout_id().ToInt(); 102 int ast_num = state_info.bailout_id().ToInt();
99 int first_const = intconst_from_bailout_id(ast_num, locals_count_); 103 int first_const = intconst_from_bailout_id(ast_num, locals_count_);
100 104
101 if (empty_values_ != frame_state->InputAt(0)) { 105 if (empty_values_ != frame_state->InputAt(0)) {
102 *listener << "whose parameters are " << frame_state->InputAt(0) 106 *listener << "whose parameters are " << frame_state->InputAt(0)
103 << " but should have been " << empty_values_ << " (empty)"; 107 << " but should have been " << empty_values_ << " (empty)";
104 return false; 108 return false;
105 } 109 }
106 if (empty_values_ != frame_state->InputAt(2)) { 110 if (empty_values_ != frame_state->InputAt(2)) {
107 *listener << "whose expression stack is " << frame_state->InputAt(2) 111 *listener << "whose expression stack is " << frame_state->InputAt(2)
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 EXPECT_THAT(c1_in_loop, IsCheckpointModuloLiveness(".L.L")); 368 EXPECT_THAT(c1_in_loop, IsCheckpointModuloLiveness(".L.L"));
365 EXPECT_THAT(c2_in_loop, IsCheckpointModuloLiveness("LL.L")); 369 EXPECT_THAT(c2_in_loop, IsCheckpointModuloLiveness("LL.L"));
366 370
367 EXPECT_THAT(c1_end, IsCheckpointModuloLiveness(".LL.")); 371 EXPECT_THAT(c1_end, IsCheckpointModuloLiveness(".LL."));
368 EXPECT_THAT(c2_end, IsCheckpointModuloLiveness("....")); 372 EXPECT_THAT(c2_end, IsCheckpointModuloLiveness("...."));
369 } 373 }
370 374
371 } // namespace compiler 375 } // namespace compiler
372 } // namespace internal 376 } // namespace internal
373 } // namespace v8 377 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/instruction-selector-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698