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 | 6 |
7 #include "src/compilation-dependencies.h" | 7 #include "src/compilation-dependencies.h" |
8 #include "src/compiler/access-builder.h" | 8 #include "src/compiler/access-builder.h" |
9 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
943 } | 943 } |
944 break; | 944 break; |
945 } | 945 } |
946 } | 946 } |
947 dominator = NodeProperties::GetEffectInput(dominator); | 947 dominator = NodeProperties::GetEffectInput(dominator); |
948 } | 948 } |
949 } | 949 } |
950 | 950 |
951 } // namespace | 951 } // namespace |
952 | 952 |
| 953 // ES6 section 20.3.3.1 Date.now ( ) |
| 954 Reduction JSBuiltinReducer::ReduceDateNow(Node* node) { |
| 955 NodeProperties::RemoveValueInputs(node); |
| 956 NodeProperties::ChangeOp( |
| 957 node, javascript()->CallRuntime(Runtime::kDateCurrentTime)); |
| 958 return Changed(node); |
| 959 } |
| 960 |
953 // ES6 section 20.3.4.10 Date.prototype.getTime ( ) | 961 // ES6 section 20.3.4.10 Date.prototype.getTime ( ) |
954 Reduction JSBuiltinReducer::ReduceDateGetTime(Node* node) { | 962 Reduction JSBuiltinReducer::ReduceDateGetTime(Node* node) { |
955 Node* receiver = NodeProperties::GetValueInput(node, 1); | 963 Node* receiver = NodeProperties::GetValueInput(node, 1); |
956 Node* effect = NodeProperties::GetEffectInput(node); | 964 Node* effect = NodeProperties::GetEffectInput(node); |
957 Node* control = NodeProperties::GetControlInput(node); | 965 Node* control = NodeProperties::GetControlInput(node); |
958 if (HasInstanceTypeWitness(receiver, effect, JS_DATE_TYPE)) { | 966 if (HasInstanceTypeWitness(receiver, effect, JS_DATE_TYPE)) { |
959 Node* value = effect = graph()->NewNode( | 967 Node* value = effect = graph()->NewNode( |
960 simplified()->LoadField(AccessBuilder::ForJSDateValue()), receiver, | 968 simplified()->LoadField(AccessBuilder::ForJSDateValue()), receiver, |
961 effect, control); | 969 effect, control); |
962 ReplaceWithValue(node, value, effect, control); | 970 ReplaceWithValue(node, value, effect, control); |
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1851 case kArrayKeys: | 1859 case kArrayKeys: |
1852 return ReduceArrayIterator(node, IterationKind::kKeys); | 1860 return ReduceArrayIterator(node, IterationKind::kKeys); |
1853 case kArrayValues: | 1861 case kArrayValues: |
1854 return ReduceArrayIterator(node, IterationKind::kValues); | 1862 return ReduceArrayIterator(node, IterationKind::kValues); |
1855 case kArrayIteratorNext: | 1863 case kArrayIteratorNext: |
1856 return ReduceArrayIteratorNext(node); | 1864 return ReduceArrayIteratorNext(node); |
1857 case kArrayPop: | 1865 case kArrayPop: |
1858 return ReduceArrayPop(node); | 1866 return ReduceArrayPop(node); |
1859 case kArrayPush: | 1867 case kArrayPush: |
1860 return ReduceArrayPush(node); | 1868 return ReduceArrayPush(node); |
| 1869 case kDateNow: |
| 1870 return ReduceDateNow(node); |
1861 case kDateGetTime: | 1871 case kDateGetTime: |
1862 return ReduceDateGetTime(node); | 1872 return ReduceDateGetTime(node); |
1863 case kGlobalIsFinite: | 1873 case kGlobalIsFinite: |
1864 reduction = ReduceGlobalIsFinite(node); | 1874 reduction = ReduceGlobalIsFinite(node); |
1865 break; | 1875 break; |
1866 case kGlobalIsNaN: | 1876 case kGlobalIsNaN: |
1867 reduction = ReduceGlobalIsNaN(node); | 1877 reduction = ReduceGlobalIsNaN(node); |
1868 break; | 1878 break; |
1869 case kMathAbs: | 1879 case kMathAbs: |
1870 reduction = ReduceMathAbs(node); | 1880 reduction = ReduceMathAbs(node); |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2056 return jsgraph()->simplified(); | 2066 return jsgraph()->simplified(); |
2057 } | 2067 } |
2058 | 2068 |
2059 JSOperatorBuilder* JSBuiltinReducer::javascript() const { | 2069 JSOperatorBuilder* JSBuiltinReducer::javascript() const { |
2060 return jsgraph()->javascript(); | 2070 return jsgraph()->javascript(); |
2061 } | 2071 } |
2062 | 2072 |
2063 } // namespace compiler | 2073 } // namespace compiler |
2064 } // namespace internal | 2074 } // namespace internal |
2065 } // namespace v8 | 2075 } // namespace v8 |
OLD | NEW |