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/base/platform/time.h" | 9 #include "src/base/platform/time.h" |
10 #include "src/objects.h" | 10 #include "src/objects.h" |
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1181 // Used in runtime.cc and hydrogen's VisitArrayLiteral. | 1181 // Used in runtime.cc and hydrogen's VisitArrayLiteral. |
1182 MUST_USE_RESULT static MaybeHandle<Object> CreateArrayLiteralBoilerplate( | 1182 MUST_USE_RESULT static MaybeHandle<Object> CreateArrayLiteralBoilerplate( |
1183 Isolate* isolate, Handle<LiteralsArray> literals, | 1183 Isolate* isolate, Handle<LiteralsArray> literals, |
1184 Handle<FixedArray> elements, bool is_strong); | 1184 Handle<FixedArray> elements, bool is_strong); |
1185 | 1185 |
1186 static MaybeHandle<JSArray> GetInternalProperties(Isolate* isolate, | 1186 static MaybeHandle<JSArray> GetInternalProperties(Isolate* isolate, |
1187 Handle<Object>); | 1187 Handle<Object>); |
1188 }; | 1188 }; |
1189 | 1189 |
1190 | 1190 |
1191 struct RuntimeCallStats { | |
1192 #define CALL_RUNTIME_COUNTER(name, nargs, ressize) \ | |
1193 uint32_t Count_Runtime_##name; \ | |
1194 base::TimeDelta Time_Runtime_##name; | |
1195 FOR_EACH_INTRINSIC(CALL_RUNTIME_COUNTER) | |
1196 #undef CALL_RUNTIME_COUNTER | |
1197 | |
1198 // Dummy counter for the unexpected stub miss. | |
1199 uint32_t Count_UnexpectedStubMiss; | |
1200 base::TimeDelta Time_UnexpectedStubMiss; | |
1201 | |
1202 bool in_runtime_call = false; | |
1203 | |
1204 void Reset(); | |
1205 void Print(std::ostream& os); | |
1206 | |
1207 RuntimeCallStats() { Reset(); } | |
1208 }; | |
1209 | |
1210 | |
1211 class RuntimeState { | 1191 class RuntimeState { |
1212 public: | 1192 public: |
1213 unibrow::Mapping<unibrow::ToUppercase, 128>* to_upper_mapping() { | 1193 unibrow::Mapping<unibrow::ToUppercase, 128>* to_upper_mapping() { |
1214 return &to_upper_mapping_; | 1194 return &to_upper_mapping_; |
1215 } | 1195 } |
1216 unibrow::Mapping<unibrow::ToLowercase, 128>* to_lower_mapping() { | 1196 unibrow::Mapping<unibrow::ToLowercase, 128>* to_lower_mapping() { |
1217 return &to_lower_mapping_; | 1197 return &to_lower_mapping_; |
1218 } | 1198 } |
1219 | 1199 |
1220 Runtime::Function* redirected_intrinsic_functions() { | 1200 Runtime::Function* redirected_intrinsic_functions() { |
1221 return redirected_intrinsic_functions_.get(); | 1201 return redirected_intrinsic_functions_.get(); |
1222 } | 1202 } |
1223 | 1203 |
1224 void set_redirected_intrinsic_functions( | 1204 void set_redirected_intrinsic_functions( |
1225 Runtime::Function* redirected_intrinsic_functions) { | 1205 Runtime::Function* redirected_intrinsic_functions) { |
1226 redirected_intrinsic_functions_.Reset(redirected_intrinsic_functions); | 1206 redirected_intrinsic_functions_.Reset(redirected_intrinsic_functions); |
1227 } | 1207 } |
1228 | 1208 |
1229 RuntimeCallStats* runtime_call_stats() { return &runtime_call_stats_; } | |
1230 | |
1231 private: | 1209 private: |
1232 RuntimeState() {} | 1210 RuntimeState() {} |
1233 unibrow::Mapping<unibrow::ToUppercase, 128> to_upper_mapping_; | 1211 unibrow::Mapping<unibrow::ToUppercase, 128> to_upper_mapping_; |
1234 unibrow::Mapping<unibrow::ToLowercase, 128> to_lower_mapping_; | 1212 unibrow::Mapping<unibrow::ToLowercase, 128> to_lower_mapping_; |
1235 | 1213 |
1236 RuntimeCallStats runtime_call_stats_; | |
1237 | 1214 |
1238 base::SmartArrayPointer<Runtime::Function> redirected_intrinsic_functions_; | 1215 base::SmartArrayPointer<Runtime::Function> redirected_intrinsic_functions_; |
1239 | 1216 |
1240 friend class Isolate; | 1217 friend class Isolate; |
1241 friend class Runtime; | 1218 friend class Runtime; |
1242 | 1219 |
1243 DISALLOW_COPY_AND_ASSIGN(RuntimeState); | 1220 DISALLOW_COPY_AND_ASSIGN(RuntimeState); |
1244 }; | 1221 }; |
1245 | 1222 |
1246 | 1223 |
1247 std::ostream& operator<<(std::ostream&, Runtime::FunctionId); | 1224 std::ostream& operator<<(std::ostream&, Runtime::FunctionId); |
1248 | 1225 |
1249 //--------------------------------------------------------------------------- | 1226 //--------------------------------------------------------------------------- |
1250 // Constants used by interface to runtime functions. | 1227 // Constants used by interface to runtime functions. |
1251 | 1228 |
1252 class AllocateDoubleAlignFlag : public BitField<bool, 0, 1> {}; | 1229 class AllocateDoubleAlignFlag : public BitField<bool, 0, 1> {}; |
1253 class AllocateTargetSpace : public BitField<AllocationSpace, 1, 3> {}; | 1230 class AllocateTargetSpace : public BitField<AllocationSpace, 1, 3> {}; |
1254 | 1231 |
1255 class DeclareGlobalsEvalFlag : public BitField<bool, 0, 1> {}; | 1232 class DeclareGlobalsEvalFlag : public BitField<bool, 0, 1> {}; |
1256 class DeclareGlobalsNativeFlag : public BitField<bool, 1, 1> {}; | 1233 class DeclareGlobalsNativeFlag : public BitField<bool, 1, 1> {}; |
1257 STATIC_ASSERT(LANGUAGE_END == 3); | 1234 STATIC_ASSERT(LANGUAGE_END == 3); |
1258 class DeclareGlobalsLanguageMode : public BitField<LanguageMode, 2, 2> {}; | 1235 class DeclareGlobalsLanguageMode : public BitField<LanguageMode, 2, 2> {}; |
1259 | 1236 |
1260 } // namespace internal | 1237 } // namespace internal |
1261 } // namespace v8 | 1238 } // namespace v8 |
1262 | 1239 |
1263 #endif // V8_RUNTIME_RUNTIME_H_ | 1240 #endif // V8_RUNTIME_RUNTIME_H_ |
OLD | NEW |