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 |
1191 class RuntimeState { | 1211 class RuntimeState { |
1192 public: | 1212 public: |
1193 unibrow::Mapping<unibrow::ToUppercase, 128>* to_upper_mapping() { | 1213 unibrow::Mapping<unibrow::ToUppercase, 128>* to_upper_mapping() { |
1194 return &to_upper_mapping_; | 1214 return &to_upper_mapping_; |
1195 } | 1215 } |
1196 unibrow::Mapping<unibrow::ToLowercase, 128>* to_lower_mapping() { | 1216 unibrow::Mapping<unibrow::ToLowercase, 128>* to_lower_mapping() { |
1197 return &to_lower_mapping_; | 1217 return &to_lower_mapping_; |
1198 } | 1218 } |
1199 | 1219 |
1200 Runtime::Function* redirected_intrinsic_functions() { | 1220 Runtime::Function* redirected_intrinsic_functions() { |
1201 return redirected_intrinsic_functions_.get(); | 1221 return redirected_intrinsic_functions_.get(); |
1202 } | 1222 } |
1203 | 1223 |
1204 void set_redirected_intrinsic_functions( | 1224 void set_redirected_intrinsic_functions( |
1205 Runtime::Function* redirected_intrinsic_functions) { | 1225 Runtime::Function* redirected_intrinsic_functions) { |
1206 redirected_intrinsic_functions_.Reset(redirected_intrinsic_functions); | 1226 redirected_intrinsic_functions_.Reset(redirected_intrinsic_functions); |
1207 } | 1227 } |
1208 | 1228 |
| 1229 RuntimeCallStats* runtime_call_stats() { return &runtime_call_stats_; } |
| 1230 |
1209 private: | 1231 private: |
1210 RuntimeState() {} | 1232 RuntimeState() {} |
1211 unibrow::Mapping<unibrow::ToUppercase, 128> to_upper_mapping_; | 1233 unibrow::Mapping<unibrow::ToUppercase, 128> to_upper_mapping_; |
1212 unibrow::Mapping<unibrow::ToLowercase, 128> to_lower_mapping_; | 1234 unibrow::Mapping<unibrow::ToLowercase, 128> to_lower_mapping_; |
1213 | 1235 |
| 1236 RuntimeCallStats runtime_call_stats_; |
1214 | 1237 |
1215 base::SmartArrayPointer<Runtime::Function> redirected_intrinsic_functions_; | 1238 base::SmartArrayPointer<Runtime::Function> redirected_intrinsic_functions_; |
1216 | 1239 |
1217 friend class Isolate; | 1240 friend class Isolate; |
1218 friend class Runtime; | 1241 friend class Runtime; |
1219 | 1242 |
1220 DISALLOW_COPY_AND_ASSIGN(RuntimeState); | 1243 DISALLOW_COPY_AND_ASSIGN(RuntimeState); |
1221 }; | 1244 }; |
1222 | 1245 |
1223 | 1246 |
1224 std::ostream& operator<<(std::ostream&, Runtime::FunctionId); | 1247 std::ostream& operator<<(std::ostream&, Runtime::FunctionId); |
1225 | 1248 |
1226 //--------------------------------------------------------------------------- | 1249 //--------------------------------------------------------------------------- |
1227 // Constants used by interface to runtime functions. | 1250 // Constants used by interface to runtime functions. |
1228 | 1251 |
1229 class AllocateDoubleAlignFlag : public BitField<bool, 0, 1> {}; | 1252 class AllocateDoubleAlignFlag : public BitField<bool, 0, 1> {}; |
1230 class AllocateTargetSpace : public BitField<AllocationSpace, 1, 3> {}; | 1253 class AllocateTargetSpace : public BitField<AllocationSpace, 1, 3> {}; |
1231 | 1254 |
1232 class DeclareGlobalsEvalFlag : public BitField<bool, 0, 1> {}; | 1255 class DeclareGlobalsEvalFlag : public BitField<bool, 0, 1> {}; |
1233 class DeclareGlobalsNativeFlag : public BitField<bool, 1, 1> {}; | 1256 class DeclareGlobalsNativeFlag : public BitField<bool, 1, 1> {}; |
1234 STATIC_ASSERT(LANGUAGE_END == 3); | 1257 STATIC_ASSERT(LANGUAGE_END == 3); |
1235 class DeclareGlobalsLanguageMode : public BitField<LanguageMode, 2, 2> {}; | 1258 class DeclareGlobalsLanguageMode : public BitField<LanguageMode, 2, 2> {}; |
1236 | 1259 |
1237 } // namespace internal | 1260 } // namespace internal |
1238 } // namespace v8 | 1261 } // namespace v8 |
1239 | 1262 |
1240 #endif // V8_RUNTIME_RUNTIME_H_ | 1263 #endif // V8_RUNTIME_RUNTIME_H_ |
OLD | NEW |