OLD | NEW |
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 | 6 |
7 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
8 #include "src/compiler/node-properties-inl.h" | 8 #include "src/compiler/node-properties-inl.h" |
9 #include "src/compiler/typer.h" | 9 #include "src/compiler/typer.h" |
10 #include "src/types.h" | 10 #include "src/types.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 public JSGraph { | 29 public JSGraph { |
30 public: | 30 public: |
31 JSConstantCacheTester() | 31 JSConstantCacheTester() |
32 : JSCacheTesterHelper(main_zone()), | 32 : JSCacheTesterHelper(main_zone()), |
33 JSGraph(&main_graph_, &main_common_, &main_typer_) {} | 33 JSGraph(&main_graph_, &main_common_, &main_typer_) {} |
34 | 34 |
35 Type* upper(Node* node) { return NodeProperties::GetBounds(node).upper; } | 35 Type* upper(Node* node) { return NodeProperties::GetBounds(node).upper; } |
36 | 36 |
37 Handle<Object> handle(Node* node) { | 37 Handle<Object> handle(Node* node) { |
38 CHECK_EQ(IrOpcode::kHeapConstant, node->opcode()); | 38 CHECK_EQ(IrOpcode::kHeapConstant, node->opcode()); |
39 return ValueOf<Handle<Object> >(node->op()); | 39 return OpParameter<Unique<Object> >(node).handle(); |
40 } | 40 } |
41 | 41 |
42 Factory* factory() { return main_isolate()->factory(); } | 42 Factory* factory() { return main_isolate()->factory(); } |
43 }; | 43 }; |
44 | 44 |
45 | 45 |
46 TEST(ZeroConstant1) { | 46 TEST(ZeroConstant1) { |
47 JSConstantCacheTester T; | 47 JSConstantCacheTester T; |
48 | 48 |
49 Node* zero = T.ZeroConstant(); | 49 Node* zero = T.ZeroConstant(); |
(...skipping 30 matching lines...) Expand all Loading... |
80 Type* t = T.upper(minus_zero); | 80 Type* t = T.upper(minus_zero); |
81 | 81 |
82 CHECK(t->Is(Type::Number())); | 82 CHECK(t->Is(Type::Number())); |
83 CHECK(t->Is(Type::MinusZero())); | 83 CHECK(t->Is(Type::MinusZero())); |
84 CHECK(!t->Is(Type::Integral32())); | 84 CHECK(!t->Is(Type::Integral32())); |
85 CHECK(!t->Is(Type::Signed32())); | 85 CHECK(!t->Is(Type::Signed32())); |
86 CHECK(!t->Is(Type::Unsigned32())); | 86 CHECK(!t->Is(Type::Unsigned32())); |
87 CHECK(!t->Is(Type::SignedSmall())); | 87 CHECK(!t->Is(Type::SignedSmall())); |
88 CHECK(!t->Is(Type::UnsignedSmall())); | 88 CHECK(!t->Is(Type::UnsignedSmall())); |
89 | 89 |
90 double zero_value = ValueOf<double>(zero->op()); | 90 double zero_value = OpParameter<double>(zero); |
91 double minus_zero_value = ValueOf<double>(minus_zero->op()); | 91 double minus_zero_value = OpParameter<double>(minus_zero); |
92 | 92 |
93 CHECK_EQ(0.0, zero_value); | 93 CHECK_EQ(0.0, zero_value); |
94 CHECK_NE(-0.0, zero_value); | 94 CHECK_NE(-0.0, zero_value); |
95 CHECK_EQ(-0.0, minus_zero_value); | 95 CHECK_EQ(-0.0, minus_zero_value); |
96 CHECK_NE(0.0, minus_zero_value); | 96 CHECK_NE(0.0, minus_zero_value); |
97 } | 97 } |
98 | 98 |
99 | 99 |
100 TEST(ZeroConstant2) { | 100 TEST(ZeroConstant2) { |
101 JSConstantCacheTester T; | 101 JSConstantCacheTester T; |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 CHECK(T.upper(T.NullConstant())->Is(Type::Null())); | 275 CHECK(T.upper(T.NullConstant())->Is(Type::Null())); |
276 CHECK(T.upper(T.ZeroConstant())->Is(Type::Number())); | 276 CHECK(T.upper(T.ZeroConstant())->Is(Type::Number())); |
277 CHECK(T.upper(T.OneConstant())->Is(Type::Number())); | 277 CHECK(T.upper(T.OneConstant())->Is(Type::Number())); |
278 CHECK(T.upper(T.NaNConstant())->Is(Type::NaN())); | 278 CHECK(T.upper(T.NaNConstant())->Is(Type::NaN())); |
279 } | 279 } |
280 | 280 |
281 | 281 |
282 TEST(ExternalReferences) { | 282 TEST(ExternalReferences) { |
283 // TODO(titzer): test canonicalization of external references. | 283 // TODO(titzer): test canonicalization of external references. |
284 } | 284 } |
OLD | NEW |