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

Side by Side Diff: test/cctest/compiler/test-js-typed-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
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/v8.h" 5 #include "src/v8.h"
6 #include "test/cctest/cctest.h" 6 #include "test/cctest/cctest.h"
7 7
8 #include "src/compiler/graph-inl.h" 8 #include "src/compiler/graph-inl.h"
9 #include "src/compiler/js-typed-lowering.h" 9 #include "src/compiler/js-typed-lowering.h"
10 #include "src/compiler/node-properties-inl.h" 10 #include "src/compiler/node-properties-inl.h"
11 #include "src/compiler/opcodes.h" 11 #include "src/compiler/opcodes.h"
12 #include "src/compiler/typer.h" 12 #include "src/compiler/typer.h"
13 13
14 using namespace v8::internal; 14 using namespace v8::internal;
15 using namespace v8::internal::compiler; 15 using namespace v8::internal::compiler;
16 16
17 class JSTypedLoweringTester : public HandleAndZoneScope { 17 class JSTypedLoweringTester : public HandleAndZoneScope {
18 public: 18 public:
19 explicit JSTypedLoweringTester(int num_parameters = 0) 19 explicit JSTypedLoweringTester(int num_parameters = 0)
20 : isolate(main_isolate()), 20 : isolate(main_isolate()),
21 binop(NULL), 21 binop(NULL),
22 unop(NULL), 22 unop(NULL),
23 javascript(main_zone()), 23 javascript(main_zone()),
24 simplified(main_zone()), 24 simplified(main_zone()),
25 common(main_zone()), 25 common(main_zone()),
26 graph(main_zone()), 26 graph(main_zone()),
27 typer(main_zone()), 27 typer(&graph, MaybeHandle<Context>()),
28 context_node(NULL) { 28 context_node(NULL) {
29 typer.DecorateGraph(&graph); 29 graph.SetStart(graph.NewNode(common.Start(num_parameters)));
30 Node* s = graph.NewNode(common.Start(num_parameters)); 30 graph.SetEnd(graph.NewNode(common.End()));
31 graph.SetStart(s); 31 typer.Run();
32 } 32 }
33 33
34 Isolate* isolate; 34 Isolate* isolate;
35 const Operator* binop; 35 const Operator* binop;
36 const Operator* unop; 36 const Operator* unop;
37 JSOperatorBuilder javascript; 37 JSOperatorBuilder javascript;
38 MachineOperatorBuilder machine; 38 MachineOperatorBuilder machine;
39 SimplifiedOperatorBuilder simplified; 39 SimplifiedOperatorBuilder simplified;
40 CommonOperatorBuilder common; 40 CommonOperatorBuilder common;
41 Graph graph; 41 Graph graph;
(...skipping 25 matching lines...) Expand all
67 67
68 Node* state_node = 68 Node* state_node =
69 graph.NewNode(common.FrameState(JS_FRAME, BailoutId(0), 69 graph.NewNode(common.FrameState(JS_FRAME, BailoutId(0),
70 OutputFrameStateCombine::Ignore()), 70 OutputFrameStateCombine::Ignore()),
71 parameters, locals, stack, context, UndefinedConstant()); 71 parameters, locals, stack, context, UndefinedConstant());
72 72
73 return state_node; 73 return state_node;
74 } 74 }
75 75
76 Node* reduce(Node* node) { 76 Node* reduce(Node* node) {
77 JSGraph jsgraph(&graph, &common, &javascript, &typer, &machine); 77 JSGraph jsgraph(&graph, &common, &javascript, &machine);
78 JSTypedLowering reducer(&jsgraph); 78 JSTypedLowering reducer(&jsgraph);
79 Reduction reduction = reducer.Reduce(node); 79 Reduction reduction = reducer.Reduce(node);
80 if (reduction.Changed()) return reduction.replacement(); 80 if (reduction.Changed()) return reduction.replacement();
81 return node; 81 return node;
82 } 82 }
83 83
84 Node* start() { return graph.start(); } 84 Node* start() { return graph.start(); }
85 85
86 Node* context() { 86 Node* context() {
87 if (context_node == NULL) { 87 if (context_node == NULL) {
(...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after
1378 CHECK_EQ(p1, r->InputAt(0)); 1378 CHECK_EQ(p1, r->InputAt(0));
1379 CHECK_EQ(p0, r->InputAt(1)); 1379 CHECK_EQ(p0, r->InputAt(1));
1380 } else { 1380 } else {
1381 CHECK_EQ(p0, r->InputAt(0)); 1381 CHECK_EQ(p0, r->InputAt(0));
1382 CHECK_EQ(p1, r->InputAt(1)); 1382 CHECK_EQ(p1, r->InputAt(1));
1383 } 1383 }
1384 } 1384 }
1385 } 1385 }
1386 } 1386 }
1387 } 1387 }
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-js-context-specialization.cc ('k') | test/cctest/compiler/test-machine-operator-reducer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698