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

Side by Side Diff: test/cctest/test-representation.cc

Issue 66193004: Reland 17588: Add signed/unsigned 8-bit and 16-bit Representations to Crankshaft (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Latest version Created 7 years, 1 month 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 | « test/cctest/test-macro-assembler-x64.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
(Empty)
1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28 #include "cctest.h"
29 #include "types.h"
30 #include "property-details.h"
31
32 using namespace v8::internal;
33
34
35 void TestPairPositive(Representation more_general,
36 Representation less_general) {
37 CHECK(more_general.is_more_general_than(less_general));
38 }
39
40
41 void TestPairNegative(Representation more_general,
42 Representation less_general) {
43 CHECK(!more_general.is_more_general_than(less_general));
44 }
45
46
47 TEST(RepresentationMoreGeneralThan) {
48 TestPairNegative(Representation::None(), Representation::None());
49 TestPairPositive(Representation::Integer8(), Representation::None());
50 TestPairPositive(Representation::UInteger8(), Representation::None());
51 TestPairPositive(Representation::Integer16(), Representation::None());
52 TestPairPositive(Representation::UInteger16(), Representation::None());
53 TestPairPositive(Representation::Smi(), Representation::None());
54 TestPairPositive(Representation::Integer32(), Representation::None());
55 TestPairPositive(Representation::HeapObject(), Representation::None());
56 TestPairPositive(Representation::Double(), Representation::None());
57 TestPairPositive(Representation::Tagged(), Representation::None());
58
59 TestPairNegative(Representation::None(), Representation::Integer8());
60 TestPairNegative(Representation::Integer8(), Representation::Integer8());
61 TestPairNegative(Representation::UInteger8(), Representation::Integer8());
62 TestPairPositive(Representation::Integer16(), Representation::Integer8());
63 TestPairPositive(Representation::UInteger16(), Representation::Integer8());
64 TestPairPositive(Representation::Smi(), Representation::Integer8());
65 TestPairPositive(Representation::Integer32(), Representation::Integer8());
66 TestPairNegative(Representation::HeapObject(), Representation::Integer8());
67 TestPairPositive(Representation::Double(), Representation::Integer8());
68 TestPairPositive(Representation::Tagged(), Representation::Integer8());
69
70 TestPairNegative(Representation::None(), Representation::UInteger8());
71 TestPairNegative(Representation::Integer8(), Representation::UInteger8());
72 TestPairNegative(Representation::UInteger8(), Representation::UInteger8());
73 TestPairPositive(Representation::Integer16(), Representation::UInteger8());
74 TestPairPositive(Representation::UInteger16(), Representation::UInteger8());
75 TestPairPositive(Representation::Smi(), Representation::UInteger8());
76 TestPairPositive(Representation::Integer32(), Representation::UInteger8());
77 TestPairNegative(Representation::HeapObject(), Representation::UInteger8());
78 TestPairPositive(Representation::Double(), Representation::UInteger8());
79 TestPairPositive(Representation::Tagged(), Representation::UInteger8());
80
81 TestPairNegative(Representation::None(), Representation::Integer16());
82 TestPairNegative(Representation::Integer8(), Representation::Integer16());
83 TestPairNegative(Representation::UInteger8(), Representation::Integer16());
84 TestPairNegative(Representation::Integer16(), Representation::Integer16());
85 TestPairNegative(Representation::UInteger16(), Representation::Integer16());
86 TestPairPositive(Representation::Smi(), Representation::Integer16());
87 TestPairPositive(Representation::Integer32(), Representation::Integer16());
88 TestPairNegative(Representation::HeapObject(), Representation::Integer16());
89 TestPairPositive(Representation::Double(), Representation::Integer16());
90 TestPairPositive(Representation::Tagged(), Representation::Integer16());
91
92 TestPairNegative(Representation::None(), Representation::UInteger16());
93 TestPairNegative(Representation::Integer8(), Representation::UInteger16());
94 TestPairNegative(Representation::UInteger8(), Representation::UInteger16());
95 TestPairNegative(Representation::Integer16(), Representation::UInteger16());
96 TestPairNegative(Representation::UInteger16(), Representation::UInteger16());
97 TestPairPositive(Representation::Smi(), Representation::UInteger16());
98 TestPairPositive(Representation::Integer32(), Representation::UInteger16());
99 TestPairNegative(Representation::HeapObject(), Representation::UInteger16());
100 TestPairPositive(Representation::Double(), Representation::UInteger16());
101 TestPairPositive(Representation::Tagged(), Representation::UInteger16());
102
103 TestPairNegative(Representation::None(), Representation::Smi());
104 TestPairNegative(Representation::Integer8(), Representation::Smi());
105 TestPairNegative(Representation::UInteger8(), Representation::Smi());
106 TestPairNegative(Representation::Integer16(), Representation::Smi());
107 TestPairNegative(Representation::UInteger16(), Representation::Smi());
108 TestPairNegative(Representation::Smi(), Representation::Smi());
109 TestPairPositive(Representation::Integer32(), Representation::Smi());
110 TestPairNegative(Representation::HeapObject(), Representation::Smi());
111 TestPairPositive(Representation::Double(), Representation::Smi());
112 TestPairPositive(Representation::Tagged(), Representation::Smi());
113
114 TestPairNegative(Representation::None(), Representation::Integer32());
115 TestPairNegative(Representation::Integer8(), Representation::Integer32());
116 TestPairNegative(Representation::UInteger8(), Representation::Integer32());
117 TestPairNegative(Representation::Integer16(), Representation::Integer32());
118 TestPairNegative(Representation::UInteger16(), Representation::Integer32());
119 TestPairNegative(Representation::Smi(), Representation::Integer32());
120 TestPairNegative(Representation::Integer32(), Representation::Integer32());
121 TestPairNegative(Representation::HeapObject(), Representation::Integer32());
122 TestPairPositive(Representation::Double(), Representation::Integer32());
123 TestPairPositive(Representation::Tagged(), Representation::Integer32());
124 }
OLDNEW
« no previous file with comments | « test/cctest/test-macro-assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698