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