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

Side by Side Diff: src/builtins/builtins.h

Issue 2246333003: Store information about builtins in descriptors (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rename to Builtins::Descriptor Created 4 years, 4 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 | « no previous file | src/builtins/builtins.cc » ('j') | src/builtins/builtins.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 #ifndef V8_BUILTINS_BUILTINS_H_ 5 #ifndef V8_BUILTINS_BUILTINS_H_
6 #define V8_BUILTINS_BUILTINS_H_ 6 #define V8_BUILTINS_BUILTINS_H_
7 7
8 #include "src/base/flags.h" 8 #include "src/base/flags.h"
9 #include "src/handles.h" 9 #include "src/handles.h"
10 10
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 // Garbage collection support. 562 // Garbage collection support.
563 void IterateBuiltins(ObjectVisitor* v); 563 void IterateBuiltins(ObjectVisitor* v);
564 564
565 // Disassembler support. 565 // Disassembler support.
566 const char* Lookup(byte* pc); 566 const char* Lookup(byte* pc);
567 567
568 enum Name { 568 enum Name {
569 #define DEF_ENUM(Name, ...) k##Name, 569 #define DEF_ENUM(Name, ...) k##Name,
570 BUILTIN_LIST_ALL(DEF_ENUM) 570 BUILTIN_LIST_ALL(DEF_ENUM)
571 #undef DEF_ENUM 571 #undef DEF_ENUM
572 builtin_count 572 BUILTIN_COUNT
573 }; 573 };
574 574
575 #define DECLARE_BUILTIN_ACCESSOR(Name, ...) Handle<Code> Name(); 575 #define DECLARE_BUILTIN_ACCESSOR(Name, ...) Handle<Code> Name();
576 BUILTIN_LIST_ALL(DECLARE_BUILTIN_ACCESSOR) 576 BUILTIN_LIST_ALL(DECLARE_BUILTIN_ACCESSOR)
577 #undef DECLARE_BUILTIN_ACCESSOR 577 #undef DECLARE_BUILTIN_ACCESSOR
578 578
579 enum Kind { CPP, API, TFJ, TFS, ASM, ASH, DBG };
580
581 struct Descriptor {
582 Name id;
583 Kind kind;
584
585 // For CPP and API functions, this is the C++ entry point.
586 Address entry;
587
588 // Note: These are always Code objects, but to conform with
589 // IterateBuiltins(), we use an Object* here.
590 Object* code;
591
592 const char* debug_name;
593 };
594
579 // Convenience wrappers. 595 // Convenience wrappers.
580 Handle<Code> CallFunction( 596 Handle<Code> CallFunction(
581 ConvertReceiverMode = ConvertReceiverMode::kAny, 597 ConvertReceiverMode = ConvertReceiverMode::kAny,
582 TailCallMode tail_call_mode = TailCallMode::kDisallow); 598 TailCallMode tail_call_mode = TailCallMode::kDisallow);
583 Handle<Code> Call(ConvertReceiverMode = ConvertReceiverMode::kAny, 599 Handle<Code> Call(ConvertReceiverMode = ConvertReceiverMode::kAny,
584 TailCallMode tail_call_mode = TailCallMode::kDisallow); 600 TailCallMode tail_call_mode = TailCallMode::kDisallow);
585 Handle<Code> CallBoundFunction(TailCallMode tail_call_mode); 601 Handle<Code> CallBoundFunction(TailCallMode tail_call_mode);
586 Handle<Code> NonPrimitiveToPrimitive( 602 Handle<Code> NonPrimitiveToPrimitive(
587 ToPrimitiveHint hint = ToPrimitiveHint::kDefault); 603 ToPrimitiveHint hint = ToPrimitiveHint::kDefault);
588 Handle<Code> OrdinaryToPrimitive(OrdinaryToPrimitiveHint hint); 604 Handle<Code> OrdinaryToPrimitive(OrdinaryToPrimitiveHint hint);
589 Handle<Code> InterpreterPushArgsAndCall( 605 Handle<Code> InterpreterPushArgsAndCall(
590 TailCallMode tail_call_mode, 606 TailCallMode tail_call_mode,
591 CallableType function_type = CallableType::kAny); 607 CallableType function_type = CallableType::kAny);
592 608
593 Code* builtin(Name name) { 609 Code* builtin(Name name) {
594 // Code::cast cannot be used here since we access builtins 610 // Code::cast cannot be used here since we access builtins
595 // during the marking phase of mark sweep. See IC::Clear. 611 // during the marking phase of mark sweep. See IC::Clear.
596 return reinterpret_cast<Code*>(builtins_[name]); 612 return reinterpret_cast<Code*>(builtins_[name].code);
597 } 613 }
598 614
599 Address builtin_address(Name name) { 615 Address builtin_address(Name name) {
600 return reinterpret_cast<Address>(&builtins_[name]); 616 return reinterpret_cast<Address>(&builtins_[name].code);
601 } 617 }
602 618
603 const char* name(int index); 619 const char* name(int index);
604 620
605 bool is_initialized() const { return initialized_; } 621 bool is_initialized() const { return initialized_; }
606 622
607 MUST_USE_RESULT static MaybeHandle<Object> InvokeApiFunction( 623 MUST_USE_RESULT static MaybeHandle<Object> InvokeApiFunction(
608 Isolate* isolate, bool is_construct, Handle<HeapObject> function, 624 Isolate* isolate, bool is_construct, Handle<HeapObject> function,
609 Handle<Object> receiver, int argc, Handle<Object> args[], 625 Handle<Object> receiver, int argc, Handle<Object> args[],
610 Handle<HeapObject> new_target); 626 Handle<HeapObject> new_target);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 static void Generate_##Name(MacroAssembler* masm); 660 static void Generate_##Name(MacroAssembler* masm);
645 #define DECLARE_TF(Name, ...) \ 661 #define DECLARE_TF(Name, ...) \
646 static void Generate_##Name(CodeStubAssembler* csasm); 662 static void Generate_##Name(CodeStubAssembler* csasm);
647 663
648 BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, DECLARE_TF, DECLARE_TF, 664 BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, DECLARE_TF, DECLARE_TF,
649 DECLARE_ASM, DECLARE_ASM, DECLARE_ASM) 665 DECLARE_ASM, DECLARE_ASM, DECLARE_ASM)
650 666
651 #undef DECLARE_ASM 667 #undef DECLARE_ASM
652 #undef DECLARE_TF 668 #undef DECLARE_TF
653 669
654 // Note: These are always Code objects, but to conform with 670 Descriptor builtins_[BUILTIN_COUNT];
655 // IterateBuiltins() above which assumes Object**'s for the callback
656 // function f, we use an Object* array here.
657 Object* builtins_[builtin_count];
658 bool initialized_; 671 bool initialized_;
659 672
660 friend class Isolate; 673 friend class Isolate;
661 674
662 DISALLOW_COPY_AND_ASSIGN(Builtins); 675 DISALLOW_COPY_AND_ASSIGN(Builtins);
663 }; 676 };
664 677
665 } // namespace internal 678 } // namespace internal
666 } // namespace v8 679 } // namespace v8
667 680
668 #endif // V8_BUILTINS_BUILTINS_H_ 681 #endif // V8_BUILTINS_BUILTINS_H_
OLDNEW
« no previous file with comments | « no previous file | src/builtins/builtins.cc » ('j') | src/builtins/builtins.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698