Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(510)

Side by Side Diff: src/compiler/js-builtin-reducer.cc

Issue 2523223003: Merged: Squashed multiple commits. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/js-builtin-reducer.h ('k') | src/compiler/js-generic-lowering.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 927 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 if (HasInstanceTypeWitness(receiver, effect, JS_DATE_TYPE)) { 938 if (HasInstanceTypeWitness(receiver, effect, JS_DATE_TYPE)) {
939 Node* value = effect = graph()->NewNode( 939 Node* value = effect = graph()->NewNode(
940 simplified()->LoadField(AccessBuilder::ForJSDateValue()), receiver, 940 simplified()->LoadField(AccessBuilder::ForJSDateValue()), receiver,
941 effect, control); 941 effect, control);
942 ReplaceWithValue(node, value, effect, control); 942 ReplaceWithValue(node, value, effect, control);
943 return Replace(value); 943 return Replace(value);
944 } 944 }
945 return NoChange(); 945 return NoChange();
946 } 946 }
947 947
948 // ES6 section 19.2.3.6 Function.prototype [ @@hasInstance ] ( V )
949 Reduction JSBuiltinReducer::ReduceFunctionHasInstance(Node* node) {
950 Node* receiver = NodeProperties::GetValueInput(node, 1);
951 Node* object = (node->op()->ValueInputCount() >= 3)
952 ? NodeProperties::GetValueInput(node, 2)
953 : jsgraph()->UndefinedConstant();
954 Node* context = NodeProperties::GetContextInput(node);
955 Node* frame_state = NodeProperties::GetFrameStateInput(node);
956 Node* effect = NodeProperties::GetEffectInput(node);
957 Node* control = NodeProperties::GetControlInput(node);
958
959 // TODO(turbofan): If JSOrdinaryToInstance raises an exception, the
960 // stack trace doesn't contain the @@hasInstance call; we have the
961 // corresponding bug in the baseline case. Some massaging of the frame
962 // state would be necessary here.
963
964 // Morph this {node} into a JSOrdinaryHasInstance node.
965 node->ReplaceInput(0, receiver);
966 node->ReplaceInput(1, object);
967 node->ReplaceInput(2, context);
968 node->ReplaceInput(3, frame_state);
969 node->ReplaceInput(4, effect);
970 node->ReplaceInput(5, control);
971 node->TrimInputCount(6);
972 NodeProperties::ChangeOp(node, javascript()->OrdinaryHasInstance());
973 return Changed(node);
974 }
975
948 // ES6 section 18.2.2 isFinite ( number ) 976 // ES6 section 18.2.2 isFinite ( number )
949 Reduction JSBuiltinReducer::ReduceGlobalIsFinite(Node* node) { 977 Reduction JSBuiltinReducer::ReduceGlobalIsFinite(Node* node) {
950 JSCallReduction r(node); 978 JSCallReduction r(node);
951 if (r.InputsMatchOne(Type::PlainPrimitive())) { 979 if (r.InputsMatchOne(Type::PlainPrimitive())) {
952 // isFinite(a:plain-primitive) -> NumberEqual(a', a') 980 // isFinite(a:plain-primitive) -> NumberEqual(a', a')
953 // where a' = NumberSubtract(ToNumber(a), ToNumber(a)) 981 // where a' = NumberSubtract(ToNumber(a), ToNumber(a))
954 Node* input = ToNumber(r.GetJSCallInput(0)); 982 Node* input = ToNumber(r.GetJSCallInput(0));
955 Node* diff = graph()->NewNode(simplified()->NumberSubtract(), input, input); 983 Node* diff = graph()->NewNode(simplified()->NumberSubtract(), input, input);
956 Node* value = graph()->NewNode(simplified()->NumberEqual(), diff, diff); 984 Node* value = graph()->NewNode(simplified()->NumberEqual(), diff, diff);
957 return Replace(value); 985 return Replace(value);
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after
1813 case kArrayValues: 1841 case kArrayValues:
1814 return ReduceArrayIterator(node, IterationKind::kValues); 1842 return ReduceArrayIterator(node, IterationKind::kValues);
1815 case kArrayIteratorNext: 1843 case kArrayIteratorNext:
1816 return ReduceArrayIteratorNext(node); 1844 return ReduceArrayIteratorNext(node);
1817 case kArrayPop: 1845 case kArrayPop:
1818 return ReduceArrayPop(node); 1846 return ReduceArrayPop(node);
1819 case kArrayPush: 1847 case kArrayPush:
1820 return ReduceArrayPush(node); 1848 return ReduceArrayPush(node);
1821 case kDateGetTime: 1849 case kDateGetTime:
1822 return ReduceDateGetTime(node); 1850 return ReduceDateGetTime(node);
1851 case kFunctionHasInstance:
1852 return ReduceFunctionHasInstance(node);
1853 break;
1823 case kGlobalIsFinite: 1854 case kGlobalIsFinite:
1824 reduction = ReduceGlobalIsFinite(node); 1855 reduction = ReduceGlobalIsFinite(node);
1825 break; 1856 break;
1826 case kGlobalIsNaN: 1857 case kGlobalIsNaN:
1827 reduction = ReduceGlobalIsNaN(node); 1858 reduction = ReduceGlobalIsNaN(node);
1828 break; 1859 break;
1829 case kMathAbs: 1860 case kMathAbs:
1830 reduction = ReduceMathAbs(node); 1861 reduction = ReduceMathAbs(node);
1831 break; 1862 break;
1832 case kMathAcos: 1863 case kMathAcos:
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
2016 return jsgraph()->simplified(); 2047 return jsgraph()->simplified();
2017 } 2048 }
2018 2049
2019 JSOperatorBuilder* JSBuiltinReducer::javascript() const { 2050 JSOperatorBuilder* JSBuiltinReducer::javascript() const {
2020 return jsgraph()->javascript(); 2051 return jsgraph()->javascript();
2021 } 2052 }
2022 2053
2023 } // namespace compiler 2054 } // namespace compiler
2024 } // namespace internal 2055 } // namespace internal
2025 } // namespace v8 2056 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-builtin-reducer.h ('k') | src/compiler/js-generic-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698