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/compiler/js-builtin-reducer.h" | 5 #include "src/compiler/js-builtin-reducer.h" |
6 #include "src/compiler/js-graph.h" | 6 #include "src/compiler/js-graph.h" |
7 #include "src/compiler/node-properties.h" | 7 #include "src/compiler/node-properties.h" |
8 #include "src/compiler/simplified-operator.h" | 8 #include "src/compiler/simplified-operator.h" |
9 #include "src/compiler/typer.h" | 9 #include "src/compiler/typer.h" |
10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 protected: | 26 protected: |
27 Reduction Reduce(Node* node, MachineOperatorBuilder::Flags flags = | 27 Reduction Reduce(Node* node, MachineOperatorBuilder::Flags flags = |
28 MachineOperatorBuilder::Flag::kNoFlags) { | 28 MachineOperatorBuilder::Flag::kNoFlags) { |
29 MachineOperatorBuilder machine(zone(), MachineType::PointerRepresentation(), | 29 MachineOperatorBuilder machine(zone(), MachineType::PointerRepresentation(), |
30 flags); | 30 flags); |
31 SimplifiedOperatorBuilder simplified(zone()); | 31 SimplifiedOperatorBuilder simplified(zone()); |
32 JSGraph jsgraph(isolate(), graph(), common(), javascript(), &simplified, | 32 JSGraph jsgraph(isolate(), graph(), common(), javascript(), &simplified, |
33 &machine); | 33 &machine); |
34 // TODO(titzer): mock the GraphReducer here for better unit testing. | 34 // TODO(titzer): mock the GraphReducer here for better unit testing. |
35 GraphReducer graph_reducer(zone(), graph()); | 35 GraphReducer graph_reducer(zone(), graph()); |
| 36 |
36 JSBuiltinReducer reducer(&graph_reducer, &jsgraph, | 37 JSBuiltinReducer reducer(&graph_reducer, &jsgraph, |
37 JSBuiltinReducer::kNoFlags, nullptr); | 38 JSBuiltinReducer::kNoFlags, nullptr, |
| 39 native_context()); |
38 return reducer.Reduce(node); | 40 return reducer.Reduce(node); |
39 } | 41 } |
40 | 42 |
41 Node* GlobalFunction(const char* name) { | 43 Node* GlobalFunction(const char* name) { |
42 Handle<JSFunction> f = Handle<JSFunction>::cast( | 44 Handle<JSFunction> f = Handle<JSFunction>::cast( |
43 Object::GetProperty( | 45 Object::GetProperty( |
44 isolate()->global_object(), | 46 isolate()->global_object(), |
45 isolate()->factory()->NewStringFromAsciiChecked(name)) | 47 isolate()->factory()->NewStringFromAsciiChecked(name)) |
46 .ToHandleChecked()); | 48 .ToHandleChecked()); |
47 return HeapConstant(f); | 49 return HeapConstant(f); |
(...skipping 1529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1577 Reduction r = Reduce(call); | 1579 Reduction r = Reduce(call); |
1578 | 1580 |
1579 ASSERT_TRUE(r.Changed()); | 1581 ASSERT_TRUE(r.Changed()); |
1580 EXPECT_THAT(r.replacement(), | 1582 EXPECT_THAT(r.replacement(), |
1581 IsStringFromCharCode(IsPlainPrimitiveToNumber(p0))); | 1583 IsStringFromCharCode(IsPlainPrimitiveToNumber(p0))); |
1582 } | 1584 } |
1583 | 1585 |
1584 } // namespace compiler | 1586 } // namespace compiler |
1585 } // namespace internal | 1587 } // namespace internal |
1586 } // namespace v8 | 1588 } // namespace v8 |
OLD | NEW |