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

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

Issue 2293943002: [builtins] Create StringToNumber helper. (Closed)
Patch Set: Created 4 years, 3 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') | 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 23 matching lines...) Expand all
34 V(Make##C##CodeYoungAgainEvenMarking) 34 V(Make##C##CodeYoungAgainEvenMarking)
35 35
36 // CPP: Builtin in C++. Entered via BUILTIN_EXIT frame. 36 // CPP: Builtin in C++. Entered via BUILTIN_EXIT frame.
37 // Args: name 37 // Args: name
38 // API: Builtin in C++ for API callbacks. Entered via EXIT frame. 38 // API: Builtin in C++ for API callbacks. Entered via EXIT frame.
39 // Args: name 39 // Args: name
40 // TFJ: Builtin in Turbofan, with JS linkage (callable as Javascript function). 40 // TFJ: Builtin in Turbofan, with JS linkage (callable as Javascript function).
41 // Args: name, arguments count 41 // Args: name, arguments count
42 // TFS: Builtin in Turbofan, with CodeStub linkage. 42 // TFS: Builtin in Turbofan, with CodeStub linkage.
43 // Args: name, code kind, extra IC state, interface descriptor 43 // Args: name, code kind, extra IC state, interface descriptor
44 // TFS_UNARY_OP:
Benedikt Meurer 2016/08/30 17:16:49 Don't introduce a new category here. Instead just
45 // Builtin in Turbofan, with CudeStub linkage and inlinable function.
46 // Args: name, code kind, extra IC state, interface descriptor
44 // ASM: Builtin in platform-dependent assembly. 47 // ASM: Builtin in platform-dependent assembly.
45 // Args: name 48 // Args: name
46 // ASH: Handlers implemented in platform-dependent assembly. 49 // ASH: Handlers implemented in platform-dependent assembly.
47 // Args: name, code kind, extra IC state 50 // Args: name, code kind, extra IC state
48 // DBG: Builtin in platform-dependent assembly, used by the debugger. 51 // DBG: Builtin in platform-dependent assembly, used by the debugger.
49 // Args: name 52 // Args: name
50 #define BUILTIN_LIST(CPP, API, TFJ, TFS, ASM, ASH, DBG) \ 53 #define BUILTIN_LIST(CPP, API, TFJ, TFS, TFS_UNARY_OP, ASM, ASH, DBG) \
51 ASM(Abort) \ 54 ASM(Abort) \
52 /* Handlers */ \ 55 /* Handlers */ \
53 ASH(KeyedLoadIC_Megamorphic, KEYED_LOAD_IC, kNoExtraICState) \ 56 ASH(KeyedLoadIC_Megamorphic, KEYED_LOAD_IC, kNoExtraICState) \
54 ASM(KeyedLoadIC_Miss) \ 57 ASM(KeyedLoadIC_Miss) \
55 ASH(KeyedLoadIC_Slow, HANDLER, Code::KEYED_LOAD_IC) \ 58 ASH(KeyedLoadIC_Slow, HANDLER, Code::KEYED_LOAD_IC) \
56 ASH(KeyedStoreIC_Megamorphic, KEYED_STORE_IC, kNoExtraICState) \ 59 ASH(KeyedStoreIC_Megamorphic, KEYED_STORE_IC, kNoExtraICState) \
57 ASH(KeyedStoreIC_Megamorphic_Strict, KEYED_STORE_IC, \ 60 ASH(KeyedStoreIC_Megamorphic_Strict, KEYED_STORE_IC, \
58 StoreICState::kStrictModeState) \ 61 StoreICState::kStrictModeState) \
59 ASM(KeyedStoreIC_Miss) \ 62 ASM(KeyedStoreIC_Miss) \
60 ASH(KeyedStoreIC_Slow, HANDLER, Code::KEYED_STORE_IC) \ 63 ASH(KeyedStoreIC_Slow, HANDLER, Code::KEYED_STORE_IC) \
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 /* Type conversions */ \ 174 /* Type conversions */ \
172 TFS(ToBoolean, BUILTIN, kNoExtraICState, TypeConversion) \ 175 TFS(ToBoolean, BUILTIN, kNoExtraICState, TypeConversion) \
173 TFS(OrdinaryToPrimitive_Number, BUILTIN, kNoExtraICState, TypeConversion) \ 176 TFS(OrdinaryToPrimitive_Number, BUILTIN, kNoExtraICState, TypeConversion) \
174 TFS(OrdinaryToPrimitive_String, BUILTIN, kNoExtraICState, TypeConversion) \ 177 TFS(OrdinaryToPrimitive_String, BUILTIN, kNoExtraICState, TypeConversion) \
175 TFS(NonPrimitiveToPrimitive_Default, BUILTIN, kNoExtraICState, \ 178 TFS(NonPrimitiveToPrimitive_Default, BUILTIN, kNoExtraICState, \
176 TypeConversion) \ 179 TypeConversion) \
177 TFS(NonPrimitiveToPrimitive_Number, BUILTIN, kNoExtraICState, \ 180 TFS(NonPrimitiveToPrimitive_Number, BUILTIN, kNoExtraICState, \
178 TypeConversion) \ 181 TypeConversion) \
179 TFS(NonPrimitiveToPrimitive_String, BUILTIN, kNoExtraICState, \ 182 TFS(NonPrimitiveToPrimitive_String, BUILTIN, kNoExtraICState, \
180 TypeConversion) \ 183 TypeConversion) \
181 TFS(StringToNumber, BUILTIN, kNoExtraICState, TypeConversion) \ 184 TFS_UNARY_OP(StringToNumber, BUILTIN, kNoExtraICState, TypeConversion) \
182 TFS(NonNumberToNumber, BUILTIN, kNoExtraICState, TypeConversion) \ 185 TFS(NonNumberToNumber, BUILTIN, kNoExtraICState, TypeConversion) \
183 ASM(ToNumber) \ 186 ASM(ToNumber) \
184 \ 187 \
185 /* Built-in functions for Javascript */ \ 188 /* Built-in functions for Javascript */ \
186 /* Special internal builtins */ \ 189 /* Special internal builtins */ \
187 CPP(EmptyFunction) \ 190 CPP(EmptyFunction) \
188 CPP(Illegal) \ 191 CPP(Illegal) \
189 CPP(RestrictedFunctionPropertiesThrower) \ 192 CPP(RestrictedFunctionPropertiesThrower) \
190 CPP(RestrictedStrictArgumentsPropertiesThrower) \ 193 CPP(RestrictedStrictArgumentsPropertiesThrower) \
191 CPP(UnsupportedThrower) \ 194 CPP(UnsupportedThrower) \
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 CPP(TypedArrayPrototypeBuffer) \ 529 CPP(TypedArrayPrototypeBuffer) \
527 /* ES6 section 22.2.3.2 get %TypedArray%.prototype.byteLength */ \ 530 /* ES6 section 22.2.3.2 get %TypedArray%.prototype.byteLength */ \
528 TFJ(TypedArrayPrototypeByteLength, 1) \ 531 TFJ(TypedArrayPrototypeByteLength, 1) \
529 /* ES6 section 22.2.3.3 get %TypedArray%.prototype.byteOffset */ \ 532 /* ES6 section 22.2.3.3 get %TypedArray%.prototype.byteOffset */ \
530 TFJ(TypedArrayPrototypeByteOffset, 1) \ 533 TFJ(TypedArrayPrototypeByteOffset, 1) \
531 /* ES6 section 22.2.3.18 get %TypedArray%.prototype.length */ \ 534 /* ES6 section 22.2.3.18 get %TypedArray%.prototype.length */ \
532 TFJ(TypedArrayPrototypeLength, 1) 535 TFJ(TypedArrayPrototypeLength, 1)
533 536
534 #define IGNORE_BUILTIN(...) 537 #define IGNORE_BUILTIN(...)
535 538
536 #define BUILTIN_LIST_ALL(V) BUILTIN_LIST(V, V, V, V, V, V, V) 539 #define BUILTIN_LIST_ALL(V) BUILTIN_LIST(V, V, V, V, V, V, V, V)
537 540
538 #define BUILTIN_LIST_C(V) \ 541 #define BUILTIN_LIST_C(V) \
539 BUILTIN_LIST(V, V, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \ 542 BUILTIN_LIST(V, V, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \
540 IGNORE_BUILTIN, IGNORE_BUILTIN) 543 IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN)
541 544
542 #define BUILTIN_LIST_A(V) \ 545 #define BUILTIN_LIST_A(V) \
543 BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \ 546 BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \
544 V, V, V) 547 IGNORE_BUILTIN, V, V, V)
545 548
546 #define BUILTIN_LIST_DBG(V) \ 549 #define BUILTIN_LIST_DBG(V) \
547 BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \ 550 BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \
548 IGNORE_BUILTIN, IGNORE_BUILTIN, V) 551 IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, V)
549 552
550 // Forward declarations. 553 // Forward declarations.
551 class CodeStubAssembler; 554 class CodeStubAssembler;
552 class ObjectVisitor; 555 class ObjectVisitor;
553 556
557 namespace compiler {
558 class Node;
559 }
560
554 class Builtins { 561 class Builtins {
555 public: 562 public:
556 ~Builtins(); 563 ~Builtins();
557 564
558 // Generate all builtin code objects. Should be called once during 565 // Generate all builtin code objects. Should be called once during
559 // isolate initialization. 566 // isolate initialization.
560 void SetUp(Isolate* isolate, bool create_heap_objects); 567 void SetUp(Isolate* isolate, bool create_heap_objects);
561 void TearDown(); 568 void TearDown();
562 569
563 // Garbage collection support. 570 // Garbage collection support.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 static void Generate_DatePrototype_GetField(MacroAssembler* masm, 653 static void Generate_DatePrototype_GetField(MacroAssembler* masm,
647 int field_index); 654 int field_index);
648 655
649 enum class MathMaxMinKind { kMax, kMin }; 656 enum class MathMaxMinKind { kMax, kMin };
650 static void Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind); 657 static void Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind);
651 658
652 #define DECLARE_ASM(Name, ...) \ 659 #define DECLARE_ASM(Name, ...) \
653 static void Generate_##Name(MacroAssembler* masm); 660 static void Generate_##Name(MacroAssembler* masm);
654 #define DECLARE_TF(Name, ...) \ 661 #define DECLARE_TF(Name, ...) \
655 static void Generate_##Name(CodeStubAssembler* csasm); 662 static void Generate_##Name(CodeStubAssembler* csasm);
663 #define DECLARE_TF_UNARY_OP(Name, ...) \
664 static compiler::Node* GenerateImpl_##Name(CodeStubAssembler* csasm, \
665 compiler::Node* input, \
666 compiler::Node* context); \
667 static void Generate_##Name(CodeStubAssembler* csasm);
656 668
657 BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, DECLARE_TF, DECLARE_TF, 669 BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, DECLARE_TF, DECLARE_TF,
658 DECLARE_ASM, DECLARE_ASM, DECLARE_ASM) 670 DECLARE_TF_UNARY_OP, DECLARE_ASM, DECLARE_ASM, DECLARE_ASM)
659 671
660 #undef DECLARE_ASM 672 #undef DECLARE_ASM
661 #undef DECLARE_TF 673 #undef DECLARE_TF
674 #undef DECLARE_TF_UNARY_OP
662 675
663 // Note: These are always Code objects, but to conform with 676 // Note: These are always Code objects, but to conform with
664 // IterateBuiltins() above which assumes Object**'s for the callback 677 // IterateBuiltins() above which assumes Object**'s for the callback
665 // function f, we use an Object* array here. 678 // function f, we use an Object* array here.
666 Object* builtins_[builtin_count]; 679 Object* builtins_[builtin_count];
667 bool initialized_; 680 bool initialized_;
668 681
669 friend class Isolate; 682 friend class Isolate;
670 683
671 DISALLOW_COPY_AND_ASSIGN(Builtins); 684 DISALLOW_COPY_AND_ASSIGN(Builtins);
672 }; 685 };
673 686
674 } // namespace internal 687 } // namespace internal
675 } // namespace v8 688 } // namespace v8
676 689
677 #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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698