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-generic-lowering.h" | 5 #include "src/compiler/js-generic-lowering.h" |
6 | 6 |
7 #include "src/ast/ast.h" | 7 #include "src/ast/ast.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/compiler/common-operator.h" | 10 #include "src/compiler/common-operator.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 Linkage::GetRuntimeCallDescriptor(zone(), f, nargs, properties, flags); | 109 Linkage::GetRuntimeCallDescriptor(zone(), f, nargs, properties, flags); |
110 Node* ref = jsgraph()->ExternalConstant(ExternalReference(f, isolate())); | 110 Node* ref = jsgraph()->ExternalConstant(ExternalReference(f, isolate())); |
111 Node* arity = jsgraph()->Int32Constant(nargs); | 111 Node* arity = jsgraph()->Int32Constant(nargs); |
112 node->InsertInput(zone(), 0, jsgraph()->CEntryStubConstant(fun->result_size)); | 112 node->InsertInput(zone(), 0, jsgraph()->CEntryStubConstant(fun->result_size)); |
113 node->InsertInput(zone(), nargs + 1, ref); | 113 node->InsertInput(zone(), nargs + 1, ref); |
114 node->InsertInput(zone(), nargs + 2, arity); | 114 node->InsertInput(zone(), nargs + 2, arity); |
115 NodeProperties::ChangeOp(node, common()->Call(desc)); | 115 NodeProperties::ChangeOp(node, common()->Call(desc)); |
116 } | 116 } |
117 | 117 |
118 void JSGenericLowering::LowerJSStrictEqual(Node* node) { | 118 void JSGenericLowering::LowerJSStrictEqual(Node* node) { |
| 119 // The === operator doesn't need the current context. |
| 120 NodeProperties::ReplaceContextInput(node, jsgraph()->NoContextConstant()); |
119 Callable callable = CodeFactory::StrictEqual(isolate()); | 121 Callable callable = CodeFactory::StrictEqual(isolate()); |
120 node->RemoveInput(4); // control | 122 node->RemoveInput(4); // control |
121 ReplaceWithStubCall(node, callable, CallDescriptor::kNoFlags, | 123 ReplaceWithStubCall(node, callable, CallDescriptor::kNoFlags, |
122 Operator::kEliminatable); | 124 Operator::kEliminatable); |
123 } | 125 } |
124 | 126 |
125 void JSGenericLowering::LowerJSStrictNotEqual(Node* node) { | 127 void JSGenericLowering::LowerJSStrictNotEqual(Node* node) { |
| 128 // The !== operator doesn't need the current context. |
| 129 NodeProperties::ReplaceContextInput(node, jsgraph()->NoContextConstant()); |
126 Callable callable = CodeFactory::StrictNotEqual(isolate()); | 130 Callable callable = CodeFactory::StrictNotEqual(isolate()); |
127 node->RemoveInput(4); // control | 131 node->RemoveInput(4); // control |
128 ReplaceWithStubCall(node, callable, CallDescriptor::kNoFlags, | 132 ReplaceWithStubCall(node, callable, CallDescriptor::kNoFlags, |
129 Operator::kEliminatable); | 133 Operator::kEliminatable); |
130 } | 134 } |
131 | 135 |
132 void JSGenericLowering::LowerJSToBoolean(Node* node) { | 136 void JSGenericLowering::LowerJSToBoolean(Node* node) { |
| 137 // The ToBoolean conversion doesn't need the current context. |
| 138 NodeProperties::ReplaceContextInput(node, jsgraph()->NoContextConstant()); |
133 Callable callable = CodeFactory::ToBoolean(isolate()); | 139 Callable callable = CodeFactory::ToBoolean(isolate()); |
134 node->AppendInput(zone(), graph()->start()); | 140 node->AppendInput(zone(), graph()->start()); |
135 ReplaceWithStubCall(node, callable, CallDescriptor::kNoAllocate, | 141 ReplaceWithStubCall(node, callable, CallDescriptor::kNoAllocate, |
136 Operator::kEliminatable); | 142 Operator::kEliminatable); |
137 } | 143 } |
138 | 144 |
139 void JSGenericLowering::LowerJSTypeOf(Node* node) { | 145 void JSGenericLowering::LowerJSTypeOf(Node* node) { |
| 146 // The typeof operator doesn't need the current context. |
| 147 NodeProperties::ReplaceContextInput(node, jsgraph()->NoContextConstant()); |
140 Callable callable = CodeFactory::Typeof(isolate()); | 148 Callable callable = CodeFactory::Typeof(isolate()); |
141 node->AppendInput(zone(), graph()->start()); | 149 node->AppendInput(zone(), graph()->start()); |
142 ReplaceWithStubCall(node, callable, CallDescriptor::kNoAllocate, | 150 ReplaceWithStubCall(node, callable, CallDescriptor::kNoAllocate, |
143 Operator::kEliminatable); | 151 Operator::kEliminatable); |
144 } | 152 } |
145 | 153 |
146 | 154 |
147 void JSGenericLowering::LowerJSLoadProperty(Node* node) { | 155 void JSGenericLowering::LowerJSLoadProperty(Node* node) { |
148 Node* closure = NodeProperties::GetValueInput(node, 2); | 156 Node* closure = NodeProperties::GetValueInput(node, 2); |
149 Node* effect = NodeProperties::GetEffectInput(node); | 157 Node* effect = NodeProperties::GetEffectInput(node); |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 } | 690 } |
683 | 691 |
684 | 692 |
685 MachineOperatorBuilder* JSGenericLowering::machine() const { | 693 MachineOperatorBuilder* JSGenericLowering::machine() const { |
686 return jsgraph()->machine(); | 694 return jsgraph()->machine(); |
687 } | 695 } |
688 | 696 |
689 } // namespace compiler | 697 } // namespace compiler |
690 } // namespace internal | 698 } // namespace internal |
691 } // namespace v8 | 699 } // namespace v8 |
OLD | NEW |