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 { |
| 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 |
1113 class Runtime : public AllStatic { | 1134 class Runtime : public AllStatic { |
1114 public: | 1135 public: |
1115 enum FunctionId { | 1136 enum FunctionId { |
1116 #define F(name, nargs, ressize) k##name, | 1137 #define F(name, nargs, ressize) k##name, |
1117 #define I(name, nargs, ressize) kInline##name, | 1138 #define I(name, nargs, ressize) kInline##name, |
1118 FOR_EACH_INTRINSIC(F) | 1139 FOR_EACH_INTRINSIC(F) |
1119 FOR_EACH_INTRINSIC(I) | 1140 FOR_EACH_INTRINSIC(I) |
1120 #undef I | 1141 #undef I |
1121 #undef F | 1142 #undef F |
1122 kNumFunctions, | 1143 kNumFunctions, |
(...skipping 28 matching lines...) Expand all Loading... |
1151 | 1172 |
1152 // Get the intrinsic function with the given name, which must be internalized. | 1173 // Get the intrinsic function with the given name, which must be internalized. |
1153 static const Function* FunctionForName(Handle<String> name); | 1174 static const Function* FunctionForName(Handle<String> name); |
1154 | 1175 |
1155 // Get the intrinsic function with the given FunctionId. | 1176 // Get the intrinsic function with the given FunctionId. |
1156 static const Function* FunctionForId(FunctionId id); | 1177 static const Function* FunctionForId(FunctionId id); |
1157 | 1178 |
1158 // Get the intrinsic function with the given function entry address. | 1179 // Get the intrinsic function with the given function entry address. |
1159 static const Function* FunctionForEntry(Address ref); | 1180 static const Function* FunctionForEntry(Address ref); |
1160 | 1181 |
1161 // Get the runtime intrinsic function table. | |
1162 static const Function* RuntimeFunctionTable(Isolate* isolate); | |
1163 | |
1164 MUST_USE_RESULT static MaybeHandle<Object> DeleteObjectProperty( | 1182 MUST_USE_RESULT static MaybeHandle<Object> DeleteObjectProperty( |
1165 Isolate* isolate, Handle<JSReceiver> receiver, Handle<Object> key, | 1183 Isolate* isolate, Handle<JSReceiver> receiver, Handle<Object> key, |
1166 LanguageMode language_mode); | 1184 LanguageMode language_mode); |
1167 | 1185 |
1168 MUST_USE_RESULT static MaybeHandle<Object> SetObjectProperty( | 1186 MUST_USE_RESULT static MaybeHandle<Object> SetObjectProperty( |
1169 Isolate* isolate, Handle<Object> object, Handle<Object> key, | 1187 Isolate* isolate, Handle<Object> object, Handle<Object> key, |
1170 Handle<Object> value, LanguageMode language_mode); | 1188 Handle<Object> value, LanguageMode language_mode); |
1171 | 1189 |
1172 MUST_USE_RESULT static MaybeHandle<Object> GetObjectProperty( | 1190 MUST_USE_RESULT static MaybeHandle<Object> GetObjectProperty( |
1173 Isolate* isolate, Handle<Object> object, Handle<Object> key, | 1191 Isolate* isolate, Handle<Object> object, Handle<Object> key, |
(...skipping 30 matching lines...) Expand all Loading... |
1204 // into C++ code. Collect these in a newly allocated array of handles | 1222 // into C++ code. Collect these in a newly allocated array of handles |
1205 // (possibly prefixed by a number of empty handles). | 1223 // (possibly prefixed by a number of empty handles). |
1206 // TODO(mstarzinger): Temporary workaround until this is only used by the | 1224 // TODO(mstarzinger): Temporary workaround until this is only used by the |
1207 // %_Arguments and %_ArgumentsLength intrinsics. Make this function local to | 1225 // %_Arguments and %_ArgumentsLength intrinsics. Make this function local to |
1208 // runtime-scopes.cc then. | 1226 // runtime-scopes.cc then. |
1209 static base::SmartArrayPointer<Handle<Object>> GetCallerArguments( | 1227 static base::SmartArrayPointer<Handle<Object>> GetCallerArguments( |
1210 Isolate* isolate, int prefix_argc, int* total_argc); | 1228 Isolate* isolate, int prefix_argc, int* total_argc); |
1211 }; | 1229 }; |
1212 | 1230 |
1213 | 1231 |
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 | |
1246 std::ostream& operator<<(std::ostream&, Runtime::FunctionId); | 1232 std::ostream& operator<<(std::ostream&, Runtime::FunctionId); |
1247 | 1233 |
1248 //--------------------------------------------------------------------------- | 1234 //--------------------------------------------------------------------------- |
1249 // Constants used by interface to runtime functions. | 1235 // Constants used by interface to runtime functions. |
1250 | 1236 |
1251 class AllocateDoubleAlignFlag : public BitField<bool, 0, 1> {}; | 1237 class AllocateDoubleAlignFlag : public BitField<bool, 0, 1> {}; |
1252 class AllocateTargetSpace : public BitField<AllocationSpace, 1, 3> {}; | 1238 class AllocateTargetSpace : public BitField<AllocationSpace, 1, 3> {}; |
1253 | 1239 |
1254 class DeclareGlobalsEvalFlag : public BitField<bool, 0, 1> {}; | 1240 class DeclareGlobalsEvalFlag : public BitField<bool, 0, 1> {}; |
1255 class DeclareGlobalsNativeFlag : public BitField<bool, 1, 1> {}; | 1241 class DeclareGlobalsNativeFlag : public BitField<bool, 1, 1> {}; |
1256 STATIC_ASSERT(LANGUAGE_END == 3); | 1242 STATIC_ASSERT(LANGUAGE_END == 3); |
1257 class DeclareGlobalsLanguageMode : public BitField<LanguageMode, 2, 2> {}; | 1243 class DeclareGlobalsLanguageMode : public BitField<LanguageMode, 2, 2> {}; |
1258 | 1244 |
1259 } // namespace internal | 1245 } // namespace internal |
1260 } // namespace v8 | 1246 } // namespace v8 |
1261 | 1247 |
1262 #endif // V8_RUNTIME_RUNTIME_H_ | 1248 #endif // V8_RUNTIME_RUNTIME_H_ |
OLD | NEW |