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

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

Issue 2155633002: [builtins] remove redundant builtins lists. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: attempt to fix gc mole Created 4 years, 5 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/builtins/arm64/builtins-arm64.cc ('k') | src/builtins/builtins.cc » ('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 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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 #define BUILTIN_LIST_ALL(V) BUILTIN_LIST(V, V, V, V, V, V, V) 385 #define BUILTIN_LIST_ALL(V) BUILTIN_LIST(V, V, V, V, V, V, V)
386 386
387 #define BUILTIN_LIST_C(V) \ 387 #define BUILTIN_LIST_C(V) \
388 BUILTIN_LIST(V, V, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \ 388 BUILTIN_LIST(V, V, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \
389 IGNORE_BUILTIN, IGNORE_BUILTIN) 389 IGNORE_BUILTIN, IGNORE_BUILTIN)
390 390
391 #define BUILTIN_LIST_A(V) \ 391 #define BUILTIN_LIST_A(V) \
392 BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \ 392 BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \
393 V, V, V) 393 V, V, V)
394 394
395 #define BUILTIN_LIST_TFS(V) \
396 BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, V, \
397 IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN)
398
399 #define BUILTIN_LIST_DBG(V) \ 395 #define BUILTIN_LIST_DBG(V) \
400 BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \ 396 BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \
401 IGNORE_BUILTIN, IGNORE_BUILTIN, V) 397 IGNORE_BUILTIN, IGNORE_BUILTIN, V)
402 398
403 // Forward declarations. 399 // Forward declarations.
404 class CodeStubAssembler; 400 class CodeStubAssembler;
405 class BuiltinFunctionTable;
406 class ObjectVisitor; 401 class ObjectVisitor;
407 402
408 class Builtins { 403 class Builtins {
409 public: 404 public:
410 ~Builtins(); 405 ~Builtins();
411 406
412 // Generate all builtin code objects. Should be called once during 407 // Generate all builtin code objects. Should be called once during
413 // isolate initialization. 408 // isolate initialization.
414 void SetUp(Isolate* isolate, bool create_heap_objects); 409 void SetUp(Isolate* isolate, bool create_heap_objects);
415 void TearDown(); 410 void TearDown();
416 411
417 // Garbage collection support. 412 // Garbage collection support.
418 void IterateBuiltins(ObjectVisitor* v); 413 void IterateBuiltins(ObjectVisitor* v);
419 414
420 // Disassembler support. 415 // Disassembler support.
421 const char* Lookup(byte* pc); 416 const char* Lookup(byte* pc);
422 417
423 enum Name { 418 enum Name {
424 #define DEF_ENUM(name, ...) k##name, 419 #define DEF_ENUM(Name, ...) k##Name,
425 BUILTIN_LIST_ALL(DEF_ENUM) 420 BUILTIN_LIST_ALL(DEF_ENUM)
426 #undef DEF_ENUM 421 #undef DEF_ENUM
427 builtin_count 422 builtin_count
428 }; 423 };
429 424
430 enum CFunctionId { 425 #define DECLARE_BUILTIN_ACCESSOR(Name, ...) Handle<Code> Name();
431 #define DEF_ENUM(name) c_##name,
432 BUILTIN_LIST_C(DEF_ENUM)
433 #undef DEF_ENUM
434 cfunction_count
435 };
436
437 #define DECLARE_BUILTIN_ACCESSOR(name, ...) Handle<Code> name();
438 BUILTIN_LIST_ALL(DECLARE_BUILTIN_ACCESSOR) 426 BUILTIN_LIST_ALL(DECLARE_BUILTIN_ACCESSOR)
439 #undef DECLARE_BUILTIN_ACCESSOR 427 #undef DECLARE_BUILTIN_ACCESSOR
440 428
441 // Convenience wrappers. 429 // Convenience wrappers.
442 Handle<Code> CallFunction( 430 Handle<Code> CallFunction(
443 ConvertReceiverMode = ConvertReceiverMode::kAny, 431 ConvertReceiverMode = ConvertReceiverMode::kAny,
444 TailCallMode tail_call_mode = TailCallMode::kDisallow); 432 TailCallMode tail_call_mode = TailCallMode::kDisallow);
445 Handle<Code> Call(ConvertReceiverMode = ConvertReceiverMode::kAny, 433 Handle<Code> Call(ConvertReceiverMode = ConvertReceiverMode::kAny,
446 TailCallMode tail_call_mode = TailCallMode::kDisallow); 434 TailCallMode tail_call_mode = TailCallMode::kDisallow);
447 Handle<Code> CallBoundFunction(TailCallMode tail_call_mode); 435 Handle<Code> CallBoundFunction(TailCallMode tail_call_mode);
448 Handle<Code> NonPrimitiveToPrimitive( 436 Handle<Code> NonPrimitiveToPrimitive(
449 ToPrimitiveHint hint = ToPrimitiveHint::kDefault); 437 ToPrimitiveHint hint = ToPrimitiveHint::kDefault);
450 Handle<Code> OrdinaryToPrimitive(OrdinaryToPrimitiveHint hint); 438 Handle<Code> OrdinaryToPrimitive(OrdinaryToPrimitiveHint hint);
451 Handle<Code> InterpreterPushArgsAndCall( 439 Handle<Code> InterpreterPushArgsAndCall(
452 TailCallMode tail_call_mode, 440 TailCallMode tail_call_mode,
453 CallableType function_type = CallableType::kAny); 441 CallableType function_type = CallableType::kAny);
454 442
455 Code* builtin(Name name) { 443 Code* builtin(Name name) {
456 // Code::cast cannot be used here since we access builtins 444 // Code::cast cannot be used here since we access builtins
457 // during the marking phase of mark sweep. See IC::Clear. 445 // during the marking phase of mark sweep. See IC::Clear.
458 return reinterpret_cast<Code*>(builtins_[name]); 446 return reinterpret_cast<Code*>(builtins_[name]);
459 } 447 }
460 448
461 Address builtin_address(Name name) { 449 Address builtin_address(Name name) {
462 return reinterpret_cast<Address>(&builtins_[name]); 450 return reinterpret_cast<Address>(&builtins_[name]);
463 } 451 }
464 452
465 static Address c_function_address(CFunctionId id) { return c_functions_[id]; } 453 const char* name(int index);
466
467 const char* name(int index) {
468 DCHECK(index >= 0);
469 DCHECK(index < builtin_count);
470 return names_[index];
471 }
472 454
473 bool is_initialized() const { return initialized_; } 455 bool is_initialized() const { return initialized_; }
474 456
475 MUST_USE_RESULT static MaybeHandle<Object> InvokeApiFunction( 457 MUST_USE_RESULT static MaybeHandle<Object> InvokeApiFunction(
476 Isolate* isolate, Handle<HeapObject> function, Handle<Object> receiver, 458 Isolate* isolate, Handle<HeapObject> function, Handle<Object> receiver,
477 int argc, Handle<Object> args[]); 459 int argc, Handle<Object> args[]);
478 460
479 enum ExitFrameType { EXIT, BUILTIN_EXIT }; 461 enum ExitFrameType { EXIT, BUILTIN_EXIT };
480 462
463 static void Generate_Adaptor(MacroAssembler* masm, Address builtin_address,
464 ExitFrameType exit_frame_type);
465
481 private: 466 private:
482 Builtins(); 467 Builtins();
483 468
484 // The external C++ functions called from the code.
485 static Address const c_functions_[cfunction_count];
486
487 // Note: These are always Code objects, but to conform with
488 // IterateBuiltins() above which assumes Object**'s for the callback
489 // function f, we use an Object* array here.
490 Object* builtins_[builtin_count];
491 const char* names_[builtin_count];
492
493 static void Generate_Adaptor(MacroAssembler* masm, CFunctionId id,
494 ExitFrameType exit_frame_type);
495 static void Generate_AllocateInNewSpace(MacroAssembler* masm); 469 static void Generate_AllocateInNewSpace(MacroAssembler* masm);
496 static void Generate_AllocateInOldSpace(MacroAssembler* masm); 470 static void Generate_AllocateInOldSpace(MacroAssembler* masm);
497 static void Generate_ConstructedNonConstructable(MacroAssembler* masm); 471 static void Generate_ConstructedNonConstructable(MacroAssembler* masm);
498 static void Generate_InstantiateAsmJs(MacroAssembler* masm); 472 static void Generate_InstantiateAsmJs(MacroAssembler* masm);
499 static void Generate_CompileLazy(MacroAssembler* masm); 473 static void Generate_CompileLazy(MacroAssembler* masm);
500 static void Generate_CompileBaseline(MacroAssembler* masm); 474 static void Generate_CompileBaseline(MacroAssembler* masm);
501 static void Generate_InOptimizationQueue(MacroAssembler* masm); 475 static void Generate_InOptimizationQueue(MacroAssembler* masm);
502 static void Generate_CompileOptimized(MacroAssembler* masm); 476 static void Generate_CompileOptimized(MacroAssembler* masm);
503 static void Generate_CompileOptimizedConcurrent(MacroAssembler* masm); 477 static void Generate_CompileOptimizedConcurrent(MacroAssembler* masm);
504 static void Generate_JSConstructStubGeneric(MacroAssembler* masm); 478 static void Generate_JSConstructStubGeneric(MacroAssembler* masm);
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 CODE_AGE_LIST(DECLARE_CODE_AGE_BUILTIN_GENERATOR) 790 CODE_AGE_LIST(DECLARE_CODE_AGE_BUILTIN_GENERATOR)
817 #undef DECLARE_CODE_AGE_BUILTIN_GENERATOR 791 #undef DECLARE_CODE_AGE_BUILTIN_GENERATOR
818 792
819 static void Generate_MarkCodeAsToBeExecutedOnce(MacroAssembler* masm); 793 static void Generate_MarkCodeAsToBeExecutedOnce(MacroAssembler* masm);
820 static void Generate_MarkCodeAsExecutedOnce(MacroAssembler* masm); 794 static void Generate_MarkCodeAsExecutedOnce(MacroAssembler* masm);
821 static void Generate_MarkCodeAsExecutedTwice(MacroAssembler* masm); 795 static void Generate_MarkCodeAsExecutedTwice(MacroAssembler* masm);
822 796
823 static void Generate_AtomicsLoad(CodeStubAssembler* assembler); 797 static void Generate_AtomicsLoad(CodeStubAssembler* assembler);
824 static void Generate_AtomicsStore(CodeStubAssembler* assembler); 798 static void Generate_AtomicsStore(CodeStubAssembler* assembler);
825 799
826 static void InitBuiltinFunctionTable(); 800 // Note: These are always Code objects, but to conform with
827 801 // IterateBuiltins() above which assumes Object**'s for the callback
802 // function f, we use an Object* array here.
803 Object* builtins_[builtin_count];
828 bool initialized_; 804 bool initialized_;
829 805
830 friend class BuiltinFunctionTable;
831 friend class Isolate; 806 friend class Isolate;
832 807
833 DISALLOW_COPY_AND_ASSIGN(Builtins); 808 DISALLOW_COPY_AND_ASSIGN(Builtins);
834 }; 809 };
835 810
836 } // namespace internal 811 } // namespace internal
837 } // namespace v8 812 } // namespace v8
838 813
839 #endif // V8_BUILTINS_BUILTINS_H_ 814 #endif // V8_BUILTINS_BUILTINS_H_
OLDNEW
« no previous file with comments | « src/builtins/arm64/builtins-arm64.cc ('k') | src/builtins/builtins.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698