OLD | NEW |
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/builtins/builtins-definitions.h" | 9 #include "src/builtins/builtins-definitions.h" |
10 #include "src/globals.h" | 10 #include "src/globals.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 class ObjectVisitor; | 21 class ObjectVisitor; |
22 enum class InterpreterPushArgsMode : unsigned; | 22 enum class InterpreterPushArgsMode : unsigned; |
23 namespace compiler { | 23 namespace compiler { |
24 class CodeAssemblerState; | 24 class CodeAssemblerState; |
25 } | 25 } |
26 | 26 |
27 class Builtins { | 27 class Builtins { |
28 public: | 28 public: |
29 ~Builtins(); | 29 ~Builtins(); |
30 | 30 |
| 31 // Generate all builtin code objects. Should be called once during |
| 32 // isolate initialization. |
| 33 void SetUp(Isolate* isolate, bool create_heap_objects); |
31 void TearDown(); | 34 void TearDown(); |
32 | 35 |
33 // Garbage collection support. | 36 // Garbage collection support. |
34 void IterateBuiltins(ObjectVisitor* v); | 37 void IterateBuiltins(ObjectVisitor* v); |
35 | 38 |
36 // Disassembler support. | 39 // Disassembler support. |
37 const char* Lookup(byte* pc); | 40 const char* Lookup(byte* pc); |
38 | 41 |
39 enum Name : int32_t { | 42 enum Name : int32_t { |
40 #define DEF_ENUM(Name, ...) k##Name, | 43 #define DEF_ENUM(Name, ...) k##Name, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 enum ExitFrameType { EXIT, BUILTIN_EXIT }; | 100 enum ExitFrameType { EXIT, BUILTIN_EXIT }; |
98 | 101 |
99 static void Generate_Adaptor(MacroAssembler* masm, Address builtin_address, | 102 static void Generate_Adaptor(MacroAssembler* masm, Address builtin_address, |
100 ExitFrameType exit_frame_type); | 103 ExitFrameType exit_frame_type); |
101 | 104 |
102 static bool AllowDynamicFunction(Isolate* isolate, Handle<JSFunction> target, | 105 static bool AllowDynamicFunction(Isolate* isolate, Handle<JSFunction> target, |
103 Handle<JSObject> target_global_proxy); | 106 Handle<JSObject> target_global_proxy); |
104 | 107 |
105 private: | 108 private: |
106 Builtins(); | 109 Builtins(); |
107 // Used by SetupIsolateDelegate. | |
108 void MarkInitialized() { | |
109 DCHECK(!initialized_); | |
110 initialized_ = true; | |
111 } | |
112 | 110 |
113 static void Generate_CallFunction(MacroAssembler* masm, | 111 static void Generate_CallFunction(MacroAssembler* masm, |
114 ConvertReceiverMode mode, | 112 ConvertReceiverMode mode, |
115 TailCallMode tail_call_mode); | 113 TailCallMode tail_call_mode); |
116 | 114 |
117 static void Generate_CallBoundFunctionImpl(MacroAssembler* masm, | 115 static void Generate_CallBoundFunctionImpl(MacroAssembler* masm, |
118 TailCallMode tail_call_mode); | 116 TailCallMode tail_call_mode); |
119 | 117 |
120 static void Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode, | 118 static void Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode, |
121 TailCallMode tail_call_mode); | 119 TailCallMode tail_call_mode); |
(...skipping 18 matching lines...) Expand all Loading... |
140 #undef DECLARE_ASM | 138 #undef DECLARE_ASM |
141 #undef DECLARE_TF | 139 #undef DECLARE_TF |
142 | 140 |
143 // Note: These are always Code objects, but to conform with | 141 // Note: These are always Code objects, but to conform with |
144 // IterateBuiltins() above which assumes Object**'s for the callback | 142 // IterateBuiltins() above which assumes Object**'s for the callback |
145 // function f, we use an Object* array here. | 143 // function f, we use an Object* array here. |
146 Object* builtins_[builtin_count]; | 144 Object* builtins_[builtin_count]; |
147 bool initialized_; | 145 bool initialized_; |
148 | 146 |
149 friend class Isolate; | 147 friend class Isolate; |
150 friend class SetupIsolateDelegate; | |
151 | 148 |
152 DISALLOW_COPY_AND_ASSIGN(Builtins); | 149 DISALLOW_COPY_AND_ASSIGN(Builtins); |
153 }; | 150 }; |
154 | 151 |
155 } // namespace internal | 152 } // namespace internal |
156 } // namespace v8 | 153 } // namespace v8 |
157 | 154 |
158 #endif // V8_BUILTINS_BUILTINS_H_ | 155 #endif // V8_BUILTINS_BUILTINS_H_ |
OLD | NEW |