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