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.constant())); | 509 node->InsertInput(zone(), 2, jsgraph()->HeapConstant(p.constants())); |
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.constant())); | 518 node->InsertInput(zone(), 2, jsgraph()->HeapConstant(p.constants())); |
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 Node* literal_index = jsgraph()->SmiConstant(p.index()); | |
529 Node* literal_flags = jsgraph()->SmiConstant(p.flags()); | |
530 Node* pattern = jsgraph()->HeapConstant(p.constant()); | |
531 node->InsertInput(graph()->zone(), 1, literal_index); | |
532 node->InsertInput(graph()->zone(), 2, pattern); | |
533 node->InsertInput(graph()->zone(), 3, literal_flags); | |
534 ReplaceWithStubCall(node, callable, flags); | |
535 } | |
536 | |
537 | |
538 void JSGenericLowering::LowerJSCreateCatchContext(Node* node) { | 524 void JSGenericLowering::LowerJSCreateCatchContext(Node* node) { |
539 Handle<String> name = OpParameter<Handle<String>>(node); | 525 Handle<String> name = OpParameter<Handle<String>>(node); |
540 node->InsertInput(zone(), 0, jsgraph()->HeapConstant(name)); | 526 node->InsertInput(zone(), 0, jsgraph()->HeapConstant(name)); |
541 ReplaceWithRuntimeCall(node, Runtime::kPushCatchContext); | 527 ReplaceWithRuntimeCall(node, Runtime::kPushCatchContext); |
542 } | 528 } |
543 | 529 |
544 | 530 |
545 void JSGenericLowering::LowerJSCreateBlockContext(Node* node) { | 531 void JSGenericLowering::LowerJSCreateBlockContext(Node* node) { |
546 Handle<ScopeInfo> scope_info = OpParameter<Handle<ScopeInfo>>(node); | 532 Handle<ScopeInfo> scope_info = OpParameter<Handle<ScopeInfo>>(node); |
547 node->InsertInput(zone(), 0, jsgraph()->HeapConstant(scope_info)); | 533 node->InsertInput(zone(), 0, jsgraph()->HeapConstant(scope_info)); |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 } | 875 } |
890 | 876 |
891 | 877 |
892 MachineOperatorBuilder* JSGenericLowering::machine() const { | 878 MachineOperatorBuilder* JSGenericLowering::machine() const { |
893 return jsgraph()->machine(); | 879 return jsgraph()->machine(); |
894 } | 880 } |
895 | 881 |
896 } // namespace compiler | 882 } // namespace compiler |
897 } // namespace internal | 883 } // namespace internal |
898 } // namespace v8 | 884 } // namespace v8 |
OLD | NEW |