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/js-generic-lowering.h" | 8 #include "src/compiler/js-generic-lowering.h" |
9 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
10 #include "src/compiler/machine-operator.h" | 10 #include "src/compiler/machine-operator.h" |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
499 node->InsertInput(zone(), 0, jsgraph()->HeapConstant(p.shared_info())); | 499 node->InsertInput(zone(), 0, jsgraph()->HeapConstant(p.shared_info())); |
500 ReplaceWithRuntimeCall(node, (p.pretenure() == TENURED) | 500 ReplaceWithRuntimeCall(node, (p.pretenure() == TENURED) |
501 ? Runtime::kNewClosure_Tenured | 501 ? Runtime::kNewClosure_Tenured |
502 : Runtime::kNewClosure); | 502 : Runtime::kNewClosure); |
503 } | 503 } |
504 | 504 |
505 | 505 |
506 void JSGenericLowering::LowerJSCreateLiteralArray(Node* node) { | 506 void JSGenericLowering::LowerJSCreateLiteralArray(Node* node) { |
507 CreateLiteralParameters const& p = CreateLiteralParametersOf(node->op()); | 507 CreateLiteralParameters const& p = CreateLiteralParametersOf(node->op()); |
508 node->InsertInput(zone(), 1, jsgraph()->SmiConstant(p.index())); | 508 node->InsertInput(zone(), 1, jsgraph()->SmiConstant(p.index())); |
509 node->InsertInput(zone(), 2, jsgraph()->HeapConstant(p.constants())); | 509 node->InsertInput(zone(), 2, jsgraph()->HeapConstant(p.constant())); |
510 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.flags())); | 510 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.flags())); |
511 ReplaceWithRuntimeCall(node, Runtime::kCreateArrayLiteral); | 511 ReplaceWithRuntimeCall(node, Runtime::kCreateArrayLiteral); |
512 } | 512 } |
513 | 513 |
514 | 514 |
515 void JSGenericLowering::LowerJSCreateLiteralObject(Node* node) { | 515 void JSGenericLowering::LowerJSCreateLiteralObject(Node* node) { |
516 CreateLiteralParameters const& p = CreateLiteralParametersOf(node->op()); | 516 CreateLiteralParameters const& p = CreateLiteralParametersOf(node->op()); |
517 node->InsertInput(zone(), 1, jsgraph()->SmiConstant(p.index())); | 517 node->InsertInput(zone(), 1, jsgraph()->SmiConstant(p.index())); |
518 node->InsertInput(zone(), 2, jsgraph()->HeapConstant(p.constants())); | 518 node->InsertInput(zone(), 2, jsgraph()->HeapConstant(p.constant())); |
519 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.flags())); | 519 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.flags())); |
520 ReplaceWithRuntimeCall(node, Runtime::kCreateObjectLiteral); | 520 ReplaceWithRuntimeCall(node, Runtime::kCreateObjectLiteral); |
521 } | 521 } |
522 | 522 |
523 | 523 |
524 void JSGenericLowering::LowerJSCreateLiteralRegExp(Node* node) { | |
525 CreateLiteralParameters const& p = CreateLiteralParametersOf(node->op()); | |
526 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | |
527 Callable callable = CodeFactory::FastCloneRegExp(isolate()); | |
528 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | |
529 isolate(), graph()->zone(), callable.descriptor(), 0, flags); | |
530 const Operator* new_op = common()->Call(desc); | |
531 Node* stub_code = jsgraph()->HeapConstant(callable.code()); | |
Michael Starzinger
2015/11/25 14:49:15
Is it possible to use JSGenericLowering::ReplaceWi
| |
532 Node* literal_index = jsgraph()->SmiConstant(p.index()); | |
533 Node* literal_flags = jsgraph()->SmiConstant(p.flags()); | |
534 Node* pattern = jsgraph()->HeapConstant(p.constant()); | |
535 node->InsertInput(graph()->zone(), 0, stub_code); | |
536 node->InsertInput(graph()->zone(), 2, literal_index); | |
537 node->InsertInput(graph()->zone(), 3, pattern); | |
538 node->InsertInput(graph()->zone(), 4, literal_flags); | |
539 NodeProperties::ChangeOp(node, new_op); | |
540 } | |
541 | |
542 | |
524 void JSGenericLowering::LowerJSCreateCatchContext(Node* node) { | 543 void JSGenericLowering::LowerJSCreateCatchContext(Node* node) { |
525 Handle<String> name = OpParameter<Handle<String>>(node); | 544 Handle<String> name = OpParameter<Handle<String>>(node); |
526 node->InsertInput(zone(), 0, jsgraph()->HeapConstant(name)); | 545 node->InsertInput(zone(), 0, jsgraph()->HeapConstant(name)); |
527 ReplaceWithRuntimeCall(node, Runtime::kPushCatchContext); | 546 ReplaceWithRuntimeCall(node, Runtime::kPushCatchContext); |
528 } | 547 } |
529 | 548 |
530 | 549 |
531 void JSGenericLowering::LowerJSCreateBlockContext(Node* node) { | 550 void JSGenericLowering::LowerJSCreateBlockContext(Node* node) { |
532 Handle<ScopeInfo> scope_info = OpParameter<Handle<ScopeInfo>>(node); | 551 Handle<ScopeInfo> scope_info = OpParameter<Handle<ScopeInfo>>(node); |
533 node->InsertInput(zone(), 0, jsgraph()->HeapConstant(scope_info)); | 552 node->InsertInput(zone(), 0, jsgraph()->HeapConstant(scope_info)); |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
875 } | 894 } |
876 | 895 |
877 | 896 |
878 MachineOperatorBuilder* JSGenericLowering::machine() const { | 897 MachineOperatorBuilder* JSGenericLowering::machine() const { |
879 return jsgraph()->machine(); | 898 return jsgraph()->machine(); |
880 } | 899 } |
881 | 900 |
882 } // namespace compiler | 901 } // namespace compiler |
883 } // namespace internal | 902 } // namespace internal |
884 } // namespace v8 | 903 } // namespace v8 |
OLD | NEW |