| 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" |
| 11 #include "test/cctest/cctest.h" | 11 #include "test/cctest/cctest.h" |
| 12 #include "test/cctest/compiler/value-helper.h" | 12 #include "test/cctest/compiler/value-helper.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 JSCacheTesterHelper { | 17 class JSCacheTesterHelper { |
| 18 protected: | 18 protected: |
| 19 explicit JSCacheTesterHelper(Zone* zone) | 19 explicit JSCacheTesterHelper(Zone* zone) |
| 20 : main_graph_(zone), | 20 : main_graph_(zone), main_common_(zone), main_typer_(zone) {} |
| 21 main_common_(zone), | |
| 22 main_javascript_(zone), | |
| 23 main_typer_(zone), | |
| 24 main_machine_(zone) {} | |
| 25 Graph main_graph_; | 21 Graph main_graph_; |
| 26 CommonOperatorBuilder main_common_; | 22 CommonOperatorBuilder main_common_; |
| 27 JSOperatorBuilder main_javascript_; | |
| 28 Typer main_typer_; | 23 Typer main_typer_; |
| 29 MachineOperatorBuilder main_machine_; | |
| 30 }; | 24 }; |
| 31 | 25 |
| 32 | 26 |
| 33 class JSConstantCacheTester : public HandleAndZoneScope, | 27 class JSConstantCacheTester : public HandleAndZoneScope, |
| 34 public JSCacheTesterHelper, | 28 public JSCacheTesterHelper, |
| 35 public JSGraph { | 29 public JSGraph { |
| 36 public: | 30 public: |
| 37 JSConstantCacheTester() | 31 JSConstantCacheTester() |
| 38 : JSCacheTesterHelper(main_zone()), | 32 : JSCacheTesterHelper(main_zone()), |
| 39 JSGraph(&main_graph_, &main_common_, &main_javascript_, &main_typer_, | 33 JSGraph(&main_graph_, &main_common_, &main_typer_) {} |
| 40 &main_machine_) {} | |
| 41 | 34 |
| 42 Type* upper(Node* node) { return NodeProperties::GetBounds(node).upper; } | 35 Type* upper(Node* node) { return NodeProperties::GetBounds(node).upper; } |
| 43 | 36 |
| 44 Handle<Object> handle(Node* node) { | 37 Handle<Object> handle(Node* node) { |
| 45 CHECK_EQ(IrOpcode::kHeapConstant, node->opcode()); | 38 CHECK_EQ(IrOpcode::kHeapConstant, node->opcode()); |
| 46 return OpParameter<Unique<Object> >(node).handle(); | 39 return OpParameter<Unique<Object> >(node).handle(); |
| 47 } | 40 } |
| 48 | 41 |
| 49 Factory* factory() { return main_isolate()->factory(); } | 42 Factory* factory() { return main_isolate()->factory(); } |
| 50 }; | 43 }; |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 CHECK(T.upper(T.NullConstant())->Is(Type::Null())); | 275 CHECK(T.upper(T.NullConstant())->Is(Type::Null())); |
| 283 CHECK(T.upper(T.ZeroConstant())->Is(Type::Number())); | 276 CHECK(T.upper(T.ZeroConstant())->Is(Type::Number())); |
| 284 CHECK(T.upper(T.OneConstant())->Is(Type::Number())); | 277 CHECK(T.upper(T.OneConstant())->Is(Type::Number())); |
| 285 CHECK(T.upper(T.NaNConstant())->Is(Type::NaN())); | 278 CHECK(T.upper(T.NaNConstant())->Is(Type::NaN())); |
| 286 } | 279 } |
| 287 | 280 |
| 288 | 281 |
| 289 TEST(ExternalReferences) { | 282 TEST(ExternalReferences) { |
| 290 // TODO(titzer): test canonicalization of external references. | 283 // TODO(titzer): test canonicalization of external references. |
| 291 } | 284 } |
| OLD | NEW |