| 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/code-factory.h" | 5 #include "src/code-factory.h" |
| 6 #include "src/code-stubs.h" | 6 #include "src/code-stubs.h" |
| 7 #include "src/compiler/common-operator.h" | 7 #include "src/compiler/common-operator.h" |
| 8 #include "src/compiler/graph-inl.h" | 8 #include "src/compiler/graph-inl.h" |
| 9 #include "src/compiler/js-generic-lowering.h" | 9 #include "src/compiler/js-generic-lowering.h" |
| 10 #include "src/compiler/machine-operator.h" | 10 #include "src/compiler/machine-operator.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // Remove the frame state from inputs. | 163 // Remove the frame state from inputs. |
| 164 node->RemoveInput(NodeProperties::FirstFrameStateIndex(node)); | 164 node->RemoveInput(NodeProperties::FirstFrameStateIndex(node)); |
| 165 } | 165 } |
| 166 | 166 |
| 167 ReplaceWithRuntimeCall(node, Runtime::kBooleanize); | 167 ReplaceWithRuntimeCall(node, Runtime::kBooleanize); |
| 168 } | 168 } |
| 169 | 169 |
| 170 | 170 |
| 171 void JSGenericLowering::ReplaceWithStubCall(Node* node, Callable callable, | 171 void JSGenericLowering::ReplaceWithStubCall(Node* node, Callable callable, |
| 172 CallDescriptor::Flags flags) { | 172 CallDescriptor::Flags flags) { |
| 173 Operator::Properties properties = node->op()->properties(); |
| 173 CallDescriptor* desc = linkage()->GetStubCallDescriptor( | 174 CallDescriptor* desc = linkage()->GetStubCallDescriptor( |
| 174 callable.descriptor(), 0, flags | FlagsForNode(node)); | 175 callable.descriptor(), 0, flags | FlagsForNode(node), properties); |
| 175 Node* stub_code = jsgraph()->HeapConstant(callable.code()); | 176 Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
| 176 PatchInsertInput(node, 0, stub_code); | 177 PatchInsertInput(node, 0, stub_code); |
| 177 PatchOperator(node, common()->Call(desc)); | 178 PatchOperator(node, common()->Call(desc)); |
| 178 } | 179 } |
| 179 | 180 |
| 180 | 181 |
| 181 void JSGenericLowering::ReplaceWithBuiltinCall(Node* node, | 182 void JSGenericLowering::ReplaceWithBuiltinCall(Node* node, |
| 182 Builtins::JavaScript id, | 183 Builtins::JavaScript id, |
| 183 int nargs) { | 184 int nargs) { |
| 185 Operator::Properties properties = node->op()->properties(); |
| 184 Callable callable = | 186 Callable callable = |
| 185 CodeFactory::CallFunction(isolate(), nargs - 1, NO_CALL_FUNCTION_FLAGS); | 187 CodeFactory::CallFunction(isolate(), nargs - 1, NO_CALL_FUNCTION_FLAGS); |
| 186 CallDescriptor* desc = linkage()->GetStubCallDescriptor( | 188 CallDescriptor* desc = linkage()->GetStubCallDescriptor( |
| 187 callable.descriptor(), nargs, FlagsForNode(node)); | 189 callable.descriptor(), nargs, FlagsForNode(node), properties); |
| 188 // TODO(mstarzinger): Accessing the builtins object this way prevents sharing | 190 // TODO(mstarzinger): Accessing the builtins object this way prevents sharing |
| 189 // of code across native contexts. Fix this by loading from given context. | 191 // of code across native contexts. Fix this by loading from given context. |
| 190 Handle<JSFunction> function( | 192 Handle<JSFunction> function( |
| 191 JSFunction::cast(info()->context()->builtins()->javascript_builtin(id))); | 193 JSFunction::cast(info()->context()->builtins()->javascript_builtin(id))); |
| 192 Node* stub_code = jsgraph()->HeapConstant(callable.code()); | 194 Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
| 193 Node* function_node = jsgraph()->HeapConstant(function); | 195 Node* function_node = jsgraph()->HeapConstant(function); |
| 194 PatchInsertInput(node, 0, stub_code); | 196 PatchInsertInput(node, 0, stub_code); |
| 195 PatchInsertInput(node, 1, function_node); | 197 PatchInsertInput(node, 1, function_node); |
| 196 PatchOperator(node, common()->Call(desc)); | 198 PatchOperator(node, common()->Call(desc)); |
| 197 } | 199 } |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 | 419 |
| 418 | 420 |
| 419 void JSGenericLowering::LowerJSCallRuntime(Node* node) { | 421 void JSGenericLowering::LowerJSCallRuntime(Node* node) { |
| 420 const CallRuntimeParameters& p = CallRuntimeParametersOf(node->op()); | 422 const CallRuntimeParameters& p = CallRuntimeParametersOf(node->op()); |
| 421 ReplaceWithRuntimeCall(node, p.id(), static_cast<int>(p.arity())); | 423 ReplaceWithRuntimeCall(node, p.id(), static_cast<int>(p.arity())); |
| 422 } | 424 } |
| 423 | 425 |
| 424 } // namespace compiler | 426 } // namespace compiler |
| 425 } // namespace internal | 427 } // namespace internal |
| 426 } // namespace v8 | 428 } // namespace v8 |
| OLD | NEW |