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

Side by Side Diff: test/cctest/compiler/test-changes-lowering.cc

Issue 658543002: Better typing and type verification (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/types-inl.h ('k') | test/cctest/compiler/test-js-constant-cache.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 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 <limits> 5 #include <limits>
6 6
7 #include "src/compiler/change-lowering.h" 7 #include "src/compiler/change-lowering.h"
8 #include "src/compiler/control-builders.h" 8 #include "src/compiler/control-builders.h"
9 #include "src/compiler/generic-node-inl.h" 9 #include "src/compiler/generic-node-inl.h"
10 #include "src/compiler/js-graph.h" 10 #include "src/compiler/js-graph.h"
11 #include "src/compiler/node-properties-inl.h" 11 #include "src/compiler/node-properties-inl.h"
12 #include "src/compiler/pipeline.h" 12 #include "src/compiler/pipeline.h"
13 #include "src/compiler/typer.h" 13 #include "src/compiler/simplified-lowering.h"
14 #include "src/compiler/verifier.h" 14 #include "src/compiler/verifier.h"
15 #include "src/execution.h" 15 #include "src/execution.h"
16 #include "src/globals.h" 16 #include "src/globals.h"
17 #include "src/parser.h" 17 #include "src/parser.h"
18 #include "src/rewriter.h" 18 #include "src/rewriter.h"
19 #include "src/scopes.h" 19 #include "src/scopes.h"
20 #include "test/cctest/cctest.h" 20 #include "test/cctest/cctest.h"
21 #include "test/cctest/compiler/codegen-tester.h" 21 #include "test/cctest/compiler/codegen-tester.h"
22 #include "test/cctest/compiler/function-tester.h" 22 #include "test/cctest/compiler/function-tester.h"
23 #include "test/cctest/compiler/graph-builder-tester.h" 23 #include "test/cctest/compiler/graph-builder-tester.h"
24 #include "test/cctest/compiler/value-helper.h" 24 #include "test/cctest/compiler/value-helper.h"
25 25
26 using namespace v8::internal; 26 using namespace v8::internal;
27 using namespace v8::internal::compiler; 27 using namespace v8::internal::compiler;
28 28
29 template <typename ReturnType> 29 template <typename ReturnType>
30 class ChangesLoweringTester : public GraphBuilderTester<ReturnType> { 30 class ChangesLoweringTester : public GraphBuilderTester<ReturnType> {
31 public: 31 public:
32 explicit ChangesLoweringTester(MachineType p0 = kMachNone) 32 explicit ChangesLoweringTester(MachineType p0 = kMachNone)
33 : GraphBuilderTester<ReturnType>(p0), 33 : GraphBuilderTester<ReturnType>(p0),
34 typer(this->zone()),
35 javascript(this->zone()), 34 javascript(this->zone()),
36 jsgraph(this->graph(), this->common(), &javascript, &typer, 35 jsgraph(this->graph(), this->common(), &javascript, this->machine()),
37 this->machine()),
38 function(Handle<JSFunction>::null()) {} 36 function(Handle<JSFunction>::null()) {}
39 37
40 Typer typer;
41 JSOperatorBuilder javascript; 38 JSOperatorBuilder javascript;
42 JSGraph jsgraph; 39 JSGraph jsgraph;
43 Handle<JSFunction> function; 40 Handle<JSFunction> function;
44 41
45 Node* start() { return this->graph()->start(); } 42 Node* start() { return this->graph()->start(); }
46 43
47 template <typename T> 44 template <typename T>
48 T* CallWithPotentialGC() { 45 T* CallWithPotentialGC() {
49 // TODO(titzer): we wrap the code in a JSFunction here to reuse the 46 // TODO(titzer): we wrap the code in a JSFunction here to reuse the
50 // JSEntryStub; that could be done with a special prologue or other stub. 47 // JSEntryStub; that could be done with a special prologue or other stub.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 } 123 }
127 124
128 void LowerChange(Node* change) { 125 void LowerChange(Node* change) {
129 // Run the graph reducer with changes lowering on a single node. 126 // Run the graph reducer with changes lowering on a single node.
130 CompilationInfo info(this->isolate(), this->zone()); 127 CompilationInfo info(this->isolate(), this->zone());
131 Linkage linkage(&info); 128 Linkage linkage(&info);
132 ChangeLowering lowering(&jsgraph, &linkage); 129 ChangeLowering lowering(&jsgraph, &linkage);
133 GraphReducer reducer(this->graph()); 130 GraphReducer reducer(this->graph());
134 reducer.AddReducer(&lowering); 131 reducer.AddReducer(&lowering);
135 reducer.ReduceNode(change); 132 reducer.ReduceNode(change);
136 Verifier::Run(this->graph()); 133 Verifier::Run(this->graph(), Verifier::UNTYPED);
137 } 134 }
138 135
139 Factory* factory() { return this->isolate()->factory(); } 136 Factory* factory() { return this->isolate()->factory(); }
140 Heap* heap() { return this->isolate()->heap(); } 137 Heap* heap() { return this->isolate()->heap(); }
141 }; 138 };
142 139
143 140
144 TEST(RunChangeTaggedToInt32) { 141 TEST(RunChangeTaggedToInt32) {
145 // Build and lower a graph by hand. 142 // Build and lower a graph by hand.
146 ChangesLoweringTester<int32_t> t(kMachAnyTagged); 143 ChangesLoweringTester<int32_t> t(kMachAnyTagged);
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 383
387 input = *i; 384 input = *i;
388 Object* result = t.CallWithPotentialGC<Object>(); 385 Object* result = t.CallWithPotentialGC<Object>();
389 t.CheckNumber(input, result); 386 t.CheckNumber(input, result);
390 } 387 }
391 } 388 }
392 } 389 }
393 } 390 }
394 391
395 #endif // V8_TURBOFAN_BACKEND 392 #endif // V8_TURBOFAN_BACKEND
OLDNEW
« no previous file with comments | « src/types-inl.h ('k') | test/cctest/compiler/test-js-constant-cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698