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

Side by Side Diff: src/compiler/code-assembler.cc

Issue 2753793002: [builtins] Separate Array.prototype.* CSA builtins into two parts (Closed)
Patch Set: Remove stray changes Created 3 years, 9 months 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/code-factory.cc ('k') | src/interface-descriptors.h » ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/code-assembler.h" 5 #include "src/compiler/code-assembler.h"
6 6
7 #include <ostream> 7 #include <ostream>
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/compiler/graph.h" 10 #include "src/compiler/graph.h"
(...skipping 13 matching lines...) Expand all
24 #include "src/zone/zone.h" 24 #include "src/zone/zone.h"
25 25
26 #define REPEAT_1_TO_2(V, T) V(T) V(T, T) 26 #define REPEAT_1_TO_2(V, T) V(T) V(T, T)
27 #define REPEAT_1_TO_3(V, T) REPEAT_1_TO_2(V, T) V(T, T, T) 27 #define REPEAT_1_TO_3(V, T) REPEAT_1_TO_2(V, T) V(T, T, T)
28 #define REPEAT_1_TO_4(V, T) REPEAT_1_TO_3(V, T) V(T, T, T, T) 28 #define REPEAT_1_TO_4(V, T) REPEAT_1_TO_3(V, T) V(T, T, T, T)
29 #define REPEAT_1_TO_5(V, T) REPEAT_1_TO_4(V, T) V(T, T, T, T, T) 29 #define REPEAT_1_TO_5(V, T) REPEAT_1_TO_4(V, T) V(T, T, T, T, T)
30 #define REPEAT_1_TO_6(V, T) REPEAT_1_TO_5(V, T) V(T, T, T, T, T, T) 30 #define REPEAT_1_TO_6(V, T) REPEAT_1_TO_5(V, T) V(T, T, T, T, T, T)
31 #define REPEAT_1_TO_7(V, T) REPEAT_1_TO_6(V, T) V(T, T, T, T, T, T, T) 31 #define REPEAT_1_TO_7(V, T) REPEAT_1_TO_6(V, T) V(T, T, T, T, T, T, T)
32 #define REPEAT_1_TO_8(V, T) REPEAT_1_TO_7(V, T) V(T, T, T, T, T, T, T, T) 32 #define REPEAT_1_TO_8(V, T) REPEAT_1_TO_7(V, T) V(T, T, T, T, T, T, T, T)
33 #define REPEAT_1_TO_9(V, T) REPEAT_1_TO_8(V, T) V(T, T, T, T, T, T, T, T, T) 33 #define REPEAT_1_TO_9(V, T) REPEAT_1_TO_8(V, T) V(T, T, T, T, T, T, T, T, T)
34 #define REPEAT_1_TO_10(V, T) REPEAT_1_TO_9(V, T) V(T, T, T, T, T, T, T, T, T, T)
35 #define REPEAT_1_TO_11(V, T) \
36 REPEAT_1_TO_10(V, T) V(T, T, T, T, T, T, T, T, T, T, T)
34 37
35 namespace v8 { 38 namespace v8 {
36 namespace internal { 39 namespace internal {
37 namespace compiler { 40 namespace compiler {
38 41
39 CodeAssemblerState::CodeAssemblerState( 42 CodeAssemblerState::CodeAssemblerState(
40 Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor, 43 Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor,
41 Code::Flags flags, const char* name, size_t result_size) 44 Code::Flags flags, const char* name, size_t result_size)
42 : CodeAssemblerState( 45 : CodeAssemblerState(
43 isolate, zone, 46 isolate, zone,
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 Node* arity = Int32Constant(argc); 528 Node* arity = Int32Constant(argc);
526 529
527 Node* nodes[] = {centry, args..., ref, arity, context}; 530 Node* nodes[] = {centry, args..., ref, arity, context};
528 531
529 CallPrologue(); 532 CallPrologue();
530 Node* return_value = raw_assembler()->CallN(desc, arraysize(nodes), nodes); 533 Node* return_value = raw_assembler()->CallN(desc, arraysize(nodes), nodes);
531 CallEpilogue(); 534 CallEpilogue();
532 return return_value; 535 return return_value;
533 } 536 }
534 537
535 // Instantiate CallRuntime() with up to 6 arguments. 538 // Instantiate CallRuntime() for argument counts used by CSA-generated code
536 #define INSTANTIATE(...) \ 539 #define INSTANTIATE(...) \
537 template V8_EXPORT_PRIVATE Node* CodeAssembler::CallRuntime( \ 540 template V8_EXPORT_PRIVATE Node* CodeAssembler::CallRuntime( \
538 Runtime::FunctionId, __VA_ARGS__); 541 Runtime::FunctionId, __VA_ARGS__);
539 REPEAT_1_TO_7(INSTANTIATE, Node*) 542 REPEAT_1_TO_7(INSTANTIATE, Node*)
540 #undef INSTANTIATE 543 #undef INSTANTIATE
541 544
542 template <class... TArgs> 545 template <class... TArgs>
543 Node* CodeAssembler::TailCallRuntime(Runtime::FunctionId function, 546 Node* CodeAssembler::TailCallRuntime(Runtime::FunctionId function,
544 Node* context, TArgs... args) { 547 Node* context, TArgs... args) {
545 int argc = static_cast<int>(sizeof...(args)); 548 int argc = static_cast<int>(sizeof...(args));
546 CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor( 549 CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor(
547 zone(), function, argc, Operator::kNoProperties, 550 zone(), function, argc, Operator::kNoProperties,
548 CallDescriptor::kSupportsTailCalls); 551 CallDescriptor::kSupportsTailCalls);
549 int return_count = static_cast<int>(desc->ReturnCount()); 552 int return_count = static_cast<int>(desc->ReturnCount());
550 553
551 Node* centry = 554 Node* centry =
552 HeapConstant(CodeFactory::RuntimeCEntry(isolate(), return_count)); 555 HeapConstant(CodeFactory::RuntimeCEntry(isolate(), return_count));
553 Node* ref = ExternalConstant(ExternalReference(function, isolate())); 556 Node* ref = ExternalConstant(ExternalReference(function, isolate()));
554 Node* arity = Int32Constant(argc); 557 Node* arity = Int32Constant(argc);
555 558
556 Node* nodes[] = {centry, args..., ref, arity, context}; 559 Node* nodes[] = {centry, args..., ref, arity, context};
557 560
558 return raw_assembler()->TailCallN(desc, arraysize(nodes), nodes); 561 return raw_assembler()->TailCallN(desc, arraysize(nodes), nodes);
559 } 562 }
560 563
561 // Instantiate TailCallRuntime() with up to 6 arguments. 564 // Instantiate TailCallRuntime() for argument counts used by CSA-generated code
562 #define INSTANTIATE(...) \ 565 #define INSTANTIATE(...) \
563 template V8_EXPORT_PRIVATE Node* CodeAssembler::TailCallRuntime( \ 566 template V8_EXPORT_PRIVATE Node* CodeAssembler::TailCallRuntime( \
564 Runtime::FunctionId, __VA_ARGS__); 567 Runtime::FunctionId, __VA_ARGS__);
565 REPEAT_1_TO_7(INSTANTIATE, Node*) 568 REPEAT_1_TO_7(INSTANTIATE, Node*)
566 #undef INSTANTIATE 569 #undef INSTANTIATE
567 570
568 template <class... TArgs> 571 template <class... TArgs>
569 Node* CodeAssembler::CallStubR(const CallInterfaceDescriptor& descriptor, 572 Node* CodeAssembler::CallStubR(const CallInterfaceDescriptor& descriptor,
570 size_t result_size, Node* target, Node* context, 573 size_t result_size, Node* target, Node* context,
571 TArgs... args) { 574 TArgs... args) {
572 Node* nodes[] = {target, args..., context}; 575 Node* nodes[] = {target, args..., context};
573 return CallStubN(descriptor, result_size, arraysize(nodes), nodes); 576 return CallStubN(descriptor, result_size, arraysize(nodes), nodes);
574 } 577 }
575 578
576 // Instantiate CallStubR() with up to 6 arguments. 579 // Instantiate CallStubR() for argument counts used by CSA-generated code.
577 #define INSTANTIATE(...) \ 580 #define INSTANTIATE(...) \
578 template V8_EXPORT_PRIVATE Node* CodeAssembler::CallStubR( \ 581 template V8_EXPORT_PRIVATE Node* CodeAssembler::CallStubR( \
579 const CallInterfaceDescriptor& descriptor, size_t, Node*, __VA_ARGS__); 582 const CallInterfaceDescriptor& descriptor, size_t, Node*, __VA_ARGS__);
580 REPEAT_1_TO_7(INSTANTIATE, Node*) 583 REPEAT_1_TO_7(INSTANTIATE, Node*)
581 #undef INSTANTIATE 584 #undef INSTANTIATE
582 585
583 Node* CodeAssembler::CallStubN(const CallInterfaceDescriptor& descriptor, 586 Node* CodeAssembler::CallStubN(const CallInterfaceDescriptor& descriptor,
584 size_t result_size, int input_count, 587 size_t result_size, int input_count,
585 Node* const* inputs) { 588 Node* const* inputs) {
586 // 2 is for target and context. 589 // 2 is for target and context.
(...skipping 18 matching lines...) Expand all
605 Node* CodeAssembler::TailCallStub(const CallInterfaceDescriptor& descriptor, 608 Node* CodeAssembler::TailCallStub(const CallInterfaceDescriptor& descriptor,
606 Node* target, Node* context, TArgs... args) { 609 Node* target, Node* context, TArgs... args) {
607 DCHECK_EQ(descriptor.GetParameterCount(), sizeof...(args)); 610 DCHECK_EQ(descriptor.GetParameterCount(), sizeof...(args));
608 size_t result_size = 1; 611 size_t result_size = 1;
609 CallDescriptor* desc = Linkage::GetStubCallDescriptor( 612 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
610 isolate(), zone(), descriptor, descriptor.GetStackParameterCount(), 613 isolate(), zone(), descriptor, descriptor.GetStackParameterCount(),
611 CallDescriptor::kSupportsTailCalls, Operator::kNoProperties, 614 CallDescriptor::kSupportsTailCalls, Operator::kNoProperties,
612 MachineType::AnyTagged(), result_size); 615 MachineType::AnyTagged(), result_size);
613 616
614 Node* nodes[] = {target, args..., context}; 617 Node* nodes[] = {target, args..., context};
615 618 CHECK_EQ(descriptor.GetParameterCount() + 2, arraysize(nodes));
616 return raw_assembler()->TailCallN(desc, arraysize(nodes), nodes); 619 return raw_assembler()->TailCallN(desc, arraysize(nodes), nodes);
617 } 620 }
618 621
619 // Instantiate TailCallStub() with up to 6 arguments. 622 // Instantiate TailCallStub() for argument counts used by CSA-generated code
620 #define INSTANTIATE(...) \ 623 #define INSTANTIATE(...) \
621 template V8_EXPORT_PRIVATE Node* CodeAssembler::TailCallStub( \ 624 template V8_EXPORT_PRIVATE Node* CodeAssembler::TailCallStub( \
622 const CallInterfaceDescriptor& descriptor, Node*, __VA_ARGS__); 625 const CallInterfaceDescriptor& descriptor, Node*, __VA_ARGS__);
623 REPEAT_1_TO_7(INSTANTIATE, Node*) 626 REPEAT_1_TO_11(INSTANTIATE, Node*)
624 #undef INSTANTIATE 627 #undef INSTANTIATE
625 628
626 template <class... TArgs> 629 template <class... TArgs>
627 Node* CodeAssembler::TailCallBytecodeDispatch( 630 Node* CodeAssembler::TailCallBytecodeDispatch(
628 const CallInterfaceDescriptor& descriptor, Node* target, TArgs... args) { 631 const CallInterfaceDescriptor& descriptor, Node* target, TArgs... args) {
629 DCHECK_EQ(descriptor.GetParameterCount(), sizeof...(args)); 632 DCHECK_EQ(descriptor.GetParameterCount(), sizeof...(args));
630 CallDescriptor* desc = Linkage::GetBytecodeDispatchCallDescriptor( 633 CallDescriptor* desc = Linkage::GetBytecodeDispatchCallDescriptor(
631 isolate(), zone(), descriptor, descriptor.GetStackParameterCount()); 634 isolate(), zone(), descriptor, descriptor.GetStackParameterCount());
632 635
633 Node* nodes[] = {target, args...}; 636 Node* nodes[] = {target, args...};
637 CHECK_EQ(descriptor.GetParameterCount() + 1, arraysize(nodes));
634 return raw_assembler()->TailCallN(desc, arraysize(nodes), nodes); 638 return raw_assembler()->TailCallN(desc, arraysize(nodes), nodes);
635 } 639 }
636 640
637 // Instantiate TailCallBytecodeDispatch() with 4 arguments. 641 // Instantiate TailCallBytecodeDispatch() for argument counts used by
642 // CSA-generated code
638 template V8_EXPORT_PRIVATE Node* CodeAssembler::TailCallBytecodeDispatch( 643 template V8_EXPORT_PRIVATE Node* CodeAssembler::TailCallBytecodeDispatch(
639 const CallInterfaceDescriptor& descriptor, Node* target, Node*, Node*, 644 const CallInterfaceDescriptor& descriptor, Node* target, Node*, Node*,
640 Node*, Node*); 645 Node*, Node*);
641 646
642 Node* CodeAssembler::CallCFunctionN(Signature<MachineType>* signature, 647 Node* CodeAssembler::CallCFunctionN(Signature<MachineType>* signature,
643 int input_count, Node* const* inputs) { 648 int input_count, Node* const* inputs) {
644 CallDescriptor* desc = Linkage::GetSimplifiedCDescriptor(zone(), signature); 649 CallDescriptor* desc = Linkage::GetSimplifiedCDescriptor(zone(), signature);
645 return raw_assembler()->CallN(desc, input_count, inputs); 650 return raw_assembler()->CallN(desc, input_count, inputs);
646 } 651 }
647 652
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 } 875 }
871 } 876 }
872 } 877 }
873 878
874 bound_ = true; 879 bound_ = true;
875 } 880 }
876 881
877 } // namespace compiler 882 } // namespace compiler
878 } // namespace internal 883 } // namespace internal
879 } // namespace v8 884 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-factory.cc ('k') | src/interface-descriptors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698