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 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 Handle<Object>); | 1208 Handle<Object>); |
1209 | 1209 |
1210 // Find the arguments of the JavaScript function invocation that called | 1210 // Find the arguments of the JavaScript function invocation that called |
1211 // into C++ code. Collect these in a newly allocated array of handles | 1211 // into C++ code. Collect these in a newly allocated array of handles |
1212 // (possibly prefixed by a number of empty handles). | 1212 // (possibly prefixed by a number of empty handles). |
1213 // TODO(mstarzinger): Temporary workaround until this is only used by the | 1213 // TODO(mstarzinger): Temporary workaround until this is only used by the |
1214 // %_Arguments and %_ArgumentsLength intrinsics. Make this function local to | 1214 // %_Arguments and %_ArgumentsLength intrinsics. Make this function local to |
1215 // runtime-scopes.cc then. | 1215 // runtime-scopes.cc then. |
1216 static base::SmartArrayPointer<Handle<Object>> GetCallerArguments( | 1216 static base::SmartArrayPointer<Handle<Object>> GetCallerArguments( |
1217 Isolate* isolate, int prefix_argc, int* total_argc); | 1217 Isolate* isolate, int prefix_argc, int* total_argc); |
1218 | |
1219 static bool AtomicIsLockFree(uint32_t size); | |
1220 }; | 1218 }; |
1221 | 1219 |
1222 | 1220 |
1223 std::ostream& operator<<(std::ostream&, Runtime::FunctionId); | 1221 std::ostream& operator<<(std::ostream&, Runtime::FunctionId); |
1224 | 1222 |
1225 //--------------------------------------------------------------------------- | 1223 //--------------------------------------------------------------------------- |
1226 // Constants used by interface to runtime functions. | 1224 // Constants used by interface to runtime functions. |
1227 | 1225 |
1228 class AllocateDoubleAlignFlag : public BitField<bool, 0, 1> {}; | 1226 class AllocateDoubleAlignFlag : public BitField<bool, 0, 1> {}; |
1229 class AllocateTargetSpace : public BitField<AllocationSpace, 1, 3> {}; | 1227 class AllocateTargetSpace : public BitField<AllocationSpace, 1, 3> {}; |
1230 | 1228 |
1231 class DeclareGlobalsEvalFlag : public BitField<bool, 0, 1> {}; | 1229 class DeclareGlobalsEvalFlag : public BitField<bool, 0, 1> {}; |
1232 class DeclareGlobalsNativeFlag : public BitField<bool, 1, 1> {}; | 1230 class DeclareGlobalsNativeFlag : public BitField<bool, 1, 1> {}; |
1233 STATIC_ASSERT(LANGUAGE_END == 3); | 1231 STATIC_ASSERT(LANGUAGE_END == 3); |
1234 class DeclareGlobalsLanguageMode : public BitField<LanguageMode, 2, 2> {}; | 1232 class DeclareGlobalsLanguageMode : public BitField<LanguageMode, 2, 2> {}; |
1235 | 1233 |
1236 //--------------------------------------------------------------------------- | |
1237 // Inline functions | |
1238 | |
1239 // Assume that 32-bit architectures don't have 64-bit atomic ops. | |
1240 // TODO(binji): can we do better here? | |
1241 #if V8_TARGET_ARCH_64_BIT && V8_HOST_ARCH_64_BIT | |
1242 | |
1243 #define ATOMICS_REQUIRE_LOCK_64_BIT 0 | |
1244 | |
1245 inline bool Runtime::AtomicIsLockFree(uint32_t size) { | |
1246 return size == 1 || size == 2 || size == 4 || size == 8; | |
1247 } | |
1248 | |
1249 #else | |
1250 | |
1251 #define ATOMICS_REQUIRE_LOCK_64_BIT 1 | |
1252 | |
1253 inline bool Runtime::AtomicIsLockFree(uint32_t size) { | |
1254 return size == 1 || size == 2 || size == 4; | |
1255 } | |
1256 | |
1257 #endif | |
1258 | |
1259 } // namespace internal | 1234 } // namespace internal |
1260 } // namespace v8 | 1235 } // namespace v8 |
1261 | 1236 |
1262 #endif // V8_RUNTIME_RUNTIME_H_ | 1237 #endif // V8_RUNTIME_RUNTIME_H_ |
OLD | NEW |