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

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: Fix typo 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 };
Toon Verwaest 2016/08/19 11:58:15 Here I'd write the names out so we don't need to g
580
581 struct Descriptor {
582 Descriptor() {}
583 Descriptor(Name id, Kind kind, Address entry, Object* code,
584 const char* debug_name)
585 : id(id),
586 kind(kind),
587 entry(entry),
588 code(code),
589 debug_name(debug_name) {}
590
591 Name id;
592 Kind kind;
593
594 // For CPP and API functions, this is the C++ entry point.
595 Address entry;
596
597 // Note: These are always Code objects, but to conform with
598 // IterateBuiltins(), we use an Object* here.
599 Object* code;
Toon Verwaest 2016/08/19 11:58:15 You should be able to just make this a Code*, whic
600
601 const char* debug_name;
Toon Verwaest 2016/08/19 11:58:15 #ifdef DEBUG?
602 };
603
579 // Convenience wrappers. 604 // Convenience wrappers.
580 Handle<Code> CallFunction( 605 Handle<Code> CallFunction(
581 ConvertReceiverMode = ConvertReceiverMode::kAny, 606 ConvertReceiverMode = ConvertReceiverMode::kAny,
582 TailCallMode tail_call_mode = TailCallMode::kDisallow); 607 TailCallMode tail_call_mode = TailCallMode::kDisallow);
583 Handle<Code> Call(ConvertReceiverMode = ConvertReceiverMode::kAny, 608 Handle<Code> Call(ConvertReceiverMode = ConvertReceiverMode::kAny,
584 TailCallMode tail_call_mode = TailCallMode::kDisallow); 609 TailCallMode tail_call_mode = TailCallMode::kDisallow);
585 Handle<Code> CallBoundFunction(TailCallMode tail_call_mode); 610 Handle<Code> CallBoundFunction(TailCallMode tail_call_mode);
586 Handle<Code> NonPrimitiveToPrimitive( 611 Handle<Code> NonPrimitiveToPrimitive(
587 ToPrimitiveHint hint = ToPrimitiveHint::kDefault); 612 ToPrimitiveHint hint = ToPrimitiveHint::kDefault);
588 Handle<Code> OrdinaryToPrimitive(OrdinaryToPrimitiveHint hint); 613 Handle<Code> OrdinaryToPrimitive(OrdinaryToPrimitiveHint hint);
589 Handle<Code> InterpreterPushArgsAndCall( 614 Handle<Code> InterpreterPushArgsAndCall(
590 TailCallMode tail_call_mode, 615 TailCallMode tail_call_mode,
591 CallableType function_type = CallableType::kAny); 616 CallableType function_type = CallableType::kAny);
592 617
593 Code* builtin(Name name) { 618 Code* builtin(Name name) {
594 // Code::cast cannot be used here since we access builtins 619 // Code::cast cannot be used here since we access builtins
595 // during the marking phase of mark sweep. See IC::Clear. 620 // during the marking phase of mark sweep. See IC::Clear.
Toon Verwaest 2016/08/19 11:58:15 Then you don't need to reinterpret_cast here.
596 return reinterpret_cast<Code*>(builtins_[name]); 621 return reinterpret_cast<Code*>(builtins_[name].code);
597 } 622 }
598 623
599 Address builtin_address(Name name) { 624 Address builtin_address(Name name) {
600 return reinterpret_cast<Address>(&builtins_[name]); 625 return reinterpret_cast<Address>(&builtins_[name].code);
601 } 626 }
602 627
603 const char* name(int index); 628 const char* name(int index);
604 629
605 bool is_initialized() const { return initialized_; } 630 bool is_initialized() const { return initialized_; }
606 631
607 MUST_USE_RESULT static MaybeHandle<Object> InvokeApiFunction( 632 MUST_USE_RESULT static MaybeHandle<Object> InvokeApiFunction(
608 Isolate* isolate, bool is_construct, Handle<HeapObject> function, 633 Isolate* isolate, bool is_construct, Handle<HeapObject> function,
609 Handle<Object> receiver, int argc, Handle<Object> args[], 634 Handle<Object> receiver, int argc, Handle<Object> args[],
610 Handle<HeapObject> new_target); 635 Handle<HeapObject> new_target);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 static void Generate_##Name(MacroAssembler* masm); 669 static void Generate_##Name(MacroAssembler* masm);
645 #define DECLARE_TF(Name, ...) \ 670 #define DECLARE_TF(Name, ...) \
646 static void Generate_##Name(CodeStubAssembler* csasm); 671 static void Generate_##Name(CodeStubAssembler* csasm);
647 672
648 BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, DECLARE_TF, DECLARE_TF, 673 BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, DECLARE_TF, DECLARE_TF,
649 DECLARE_ASM, DECLARE_ASM, DECLARE_ASM) 674 DECLARE_ASM, DECLARE_ASM, DECLARE_ASM)
650 675
651 #undef DECLARE_ASM 676 #undef DECLARE_ASM
652 #undef DECLARE_TF 677 #undef DECLARE_TF
653 678
654 // Note: These are always Code objects, but to conform with 679 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_; 680 bool initialized_;
659 681
660 friend class Isolate; 682 friend class Isolate;
661 683
662 DISALLOW_COPY_AND_ASSIGN(Builtins); 684 DISALLOW_COPY_AND_ASSIGN(Builtins);
663 }; 685 };
664 686
665 } // namespace internal 687 } // namespace internal
666 } // namespace v8 688 } // namespace v8
667 689
668 #endif // V8_BUILTINS_BUILTINS_H_ 690 #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