OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_RUNTIME_RUNTIME_H_ | 5 #ifndef V8_RUNTIME_RUNTIME_H_ |
6 #define V8_RUNTIME_RUNTIME_H_ | 6 #define V8_RUNTIME_RUNTIME_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/objects.h" | 9 #include "src/objects.h" |
10 #include "src/unicode.h" | 10 #include "src/unicode.h" |
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1103 | 1103 |
1104 #define F(name, nargs, ressize) \ | 1104 #define F(name, nargs, ressize) \ |
1105 Object* Runtime_##name(int args_length, Object** args_object, \ | 1105 Object* Runtime_##name(int args_length, Object** args_object, \ |
1106 Isolate* isolate); | 1106 Isolate* isolate); |
1107 FOR_EACH_INTRINSIC_RETURN_OBJECT(F) | 1107 FOR_EACH_INTRINSIC_RETURN_OBJECT(F) |
1108 #undef F | 1108 #undef F |
1109 | 1109 |
1110 //--------------------------------------------------------------------------- | 1110 //--------------------------------------------------------------------------- |
1111 // Runtime provides access to all C++ runtime functions. | 1111 // Runtime provides access to all C++ runtime functions. |
1112 | 1112 |
1113 class RuntimeState { | |
Michael Starzinger
2015/10/01 17:45:17
Thanks for moving this down, this "gap" between th
rmcilroy
2015/10/01 20:44:25
Ack :)
| |
1114 public: | |
1115 unibrow::Mapping<unibrow::ToUppercase, 128>* to_upper_mapping() { | |
1116 return &to_upper_mapping_; | |
1117 } | |
1118 unibrow::Mapping<unibrow::ToLowercase, 128>* to_lower_mapping() { | |
1119 return &to_lower_mapping_; | |
1120 } | |
1121 | |
1122 private: | |
1123 RuntimeState() {} | |
1124 unibrow::Mapping<unibrow::ToUppercase, 128> to_upper_mapping_; | |
1125 unibrow::Mapping<unibrow::ToLowercase, 128> to_lower_mapping_; | |
1126 | |
1127 friend class Isolate; | |
1128 friend class Runtime; | |
1129 | |
1130 DISALLOW_COPY_AND_ASSIGN(RuntimeState); | |
1131 }; | |
1132 | |
1133 | |
1134 class Runtime : public AllStatic { | 1113 class Runtime : public AllStatic { |
1135 public: | 1114 public: |
1136 enum FunctionId { | 1115 enum FunctionId { |
1137 #define F(name, nargs, ressize) k##name, | 1116 #define F(name, nargs, ressize) k##name, |
1138 #define I(name, nargs, ressize) kInline##name, | 1117 #define I(name, nargs, ressize) kInline##name, |
1139 FOR_EACH_INTRINSIC(F) | 1118 FOR_EACH_INTRINSIC(F) |
1140 FOR_EACH_INTRINSIC(I) | 1119 FOR_EACH_INTRINSIC(I) |
1141 #undef I | 1120 #undef I |
1142 #undef F | 1121 #undef F |
1143 kNumFunctions, | 1122 kNumFunctions, |
(...skipping 28 matching lines...) Expand all Loading... | |
1172 | 1151 |
1173 // Get the intrinsic function with the given name, which must be internalized. | 1152 // Get the intrinsic function with the given name, which must be internalized. |
1174 static const Function* FunctionForName(Handle<String> name); | 1153 static const Function* FunctionForName(Handle<String> name); |
1175 | 1154 |
1176 // Get the intrinsic function with the given FunctionId. | 1155 // Get the intrinsic function with the given FunctionId. |
1177 static const Function* FunctionForId(FunctionId id); | 1156 static const Function* FunctionForId(FunctionId id); |
1178 | 1157 |
1179 // Get the intrinsic function with the given function entry address. | 1158 // Get the intrinsic function with the given function entry address. |
1180 static const Function* FunctionForEntry(Address ref); | 1159 static const Function* FunctionForEntry(Address ref); |
1181 | 1160 |
1161 // Get the runtime intrinsic function table. | |
1162 static const Function* RuntimeFunctionTable(Isolate* isolate); | |
1163 | |
1182 MUST_USE_RESULT static MaybeHandle<Object> DeleteObjectProperty( | 1164 MUST_USE_RESULT static MaybeHandle<Object> DeleteObjectProperty( |
1183 Isolate* isolate, Handle<JSReceiver> receiver, Handle<Object> key, | 1165 Isolate* isolate, Handle<JSReceiver> receiver, Handle<Object> key, |
1184 LanguageMode language_mode); | 1166 LanguageMode language_mode); |
1185 | 1167 |
1186 MUST_USE_RESULT static MaybeHandle<Object> SetObjectProperty( | 1168 MUST_USE_RESULT static MaybeHandle<Object> SetObjectProperty( |
1187 Isolate* isolate, Handle<Object> object, Handle<Object> key, | 1169 Isolate* isolate, Handle<Object> object, Handle<Object> key, |
1188 Handle<Object> value, LanguageMode language_mode); | 1170 Handle<Object> value, LanguageMode language_mode); |
1189 | 1171 |
1190 MUST_USE_RESULT static MaybeHandle<Object> GetObjectProperty( | 1172 MUST_USE_RESULT static MaybeHandle<Object> GetObjectProperty( |
1191 Isolate* isolate, Handle<Object> object, Handle<Object> key, | 1173 Isolate* isolate, Handle<Object> object, Handle<Object> key, |
(...skipping 30 matching lines...) Expand all Loading... | |
1222 // into C++ code. Collect these in a newly allocated array of handles | 1204 // into C++ code. Collect these in a newly allocated array of handles |
1223 // (possibly prefixed by a number of empty handles). | 1205 // (possibly prefixed by a number of empty handles). |
1224 // TODO(mstarzinger): Temporary workaround until this is only used by the | 1206 // TODO(mstarzinger): Temporary workaround until this is only used by the |
1225 // %_Arguments and %_ArgumentsLength intrinsics. Make this function local to | 1207 // %_Arguments and %_ArgumentsLength intrinsics. Make this function local to |
1226 // runtime-scopes.cc then. | 1208 // runtime-scopes.cc then. |
1227 static base::SmartArrayPointer<Handle<Object>> GetCallerArguments( | 1209 static base::SmartArrayPointer<Handle<Object>> GetCallerArguments( |
1228 Isolate* isolate, int prefix_argc, int* total_argc); | 1210 Isolate* isolate, int prefix_argc, int* total_argc); |
1229 }; | 1211 }; |
1230 | 1212 |
1231 | 1213 |
1214 class RuntimeState { | |
1215 public: | |
1216 unibrow::Mapping<unibrow::ToUppercase, 128>* to_upper_mapping() { | |
1217 return &to_upper_mapping_; | |
1218 } | |
1219 unibrow::Mapping<unibrow::ToLowercase, 128>* to_lower_mapping() { | |
1220 return &to_lower_mapping_; | |
1221 } | |
1222 | |
1223 Runtime::Function* redirected_intrinsic_functions() { | |
1224 return redirected_intrinsic_functions_.get(); | |
1225 } | |
1226 | |
1227 void set_redirected_intrinsic_functions( | |
1228 Runtime::Function* redirected_intrinsic_functions) { | |
1229 redirected_intrinsic_functions_.Reset(redirected_intrinsic_functions); | |
1230 } | |
1231 | |
1232 private: | |
1233 RuntimeState() {} | |
1234 unibrow::Mapping<unibrow::ToUppercase, 128> to_upper_mapping_; | |
1235 unibrow::Mapping<unibrow::ToLowercase, 128> to_lower_mapping_; | |
1236 | |
1237 base::SmartArrayPointer<Runtime::Function> redirected_intrinsic_functions_; | |
1238 | |
1239 friend class Isolate; | |
1240 friend class Runtime; | |
1241 | |
1242 DISALLOW_COPY_AND_ASSIGN(RuntimeState); | |
1243 }; | |
1244 | |
1245 | |
1232 std::ostream& operator<<(std::ostream&, Runtime::FunctionId); | 1246 std::ostream& operator<<(std::ostream&, Runtime::FunctionId); |
1233 | 1247 |
1234 //--------------------------------------------------------------------------- | 1248 //--------------------------------------------------------------------------- |
1235 // Constants used by interface to runtime functions. | 1249 // Constants used by interface to runtime functions. |
1236 | 1250 |
1237 class AllocateDoubleAlignFlag : public BitField<bool, 0, 1> {}; | 1251 class AllocateDoubleAlignFlag : public BitField<bool, 0, 1> {}; |
1238 class AllocateTargetSpace : public BitField<AllocationSpace, 1, 3> {}; | 1252 class AllocateTargetSpace : public BitField<AllocationSpace, 1, 3> {}; |
1239 | 1253 |
1240 class DeclareGlobalsEvalFlag : public BitField<bool, 0, 1> {}; | 1254 class DeclareGlobalsEvalFlag : public BitField<bool, 0, 1> {}; |
1241 class DeclareGlobalsNativeFlag : public BitField<bool, 1, 1> {}; | 1255 class DeclareGlobalsNativeFlag : public BitField<bool, 1, 1> {}; |
1242 STATIC_ASSERT(LANGUAGE_END == 3); | 1256 STATIC_ASSERT(LANGUAGE_END == 3); |
1243 class DeclareGlobalsLanguageMode : public BitField<LanguageMode, 2, 2> {}; | 1257 class DeclareGlobalsLanguageMode : public BitField<LanguageMode, 2, 2> {}; |
1244 | 1258 |
1245 } // namespace internal | 1259 } // namespace internal |
1246 } // namespace v8 | 1260 } // namespace v8 |
1247 | 1261 |
1248 #endif // V8_RUNTIME_RUNTIME_H_ | 1262 #endif // V8_RUNTIME_RUNTIME_H_ |
OLD | NEW |