[runtime] Move AtomicIsLockFree out of Runtime class.
R=binji@chromium.org Review URL: https://codereview.chromium.org/1327743004 Cr-Commit-Position: refs/heads/master@{#30663}
This commit is contained in:
parent
422b0fa72d
commit
a14d2dfaa5
@ -19,6 +19,26 @@ namespace internal {
|
||||
|
||||
namespace {
|
||||
|
||||
// Assume that 32-bit architectures don't have 64-bit atomic ops.
|
||||
// TODO(binji): can we do better here?
|
||||
#if V8_TARGET_ARCH_64_BIT && V8_HOST_ARCH_64_BIT
|
||||
|
||||
#define ATOMICS_REQUIRE_LOCK_64_BIT 0
|
||||
|
||||
inline bool AtomicIsLockFree(uint32_t size) {
|
||||
return size == 1 || size == 2 || size == 4 || size == 8;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define ATOMICS_REQUIRE_LOCK_64_BIT 1
|
||||
|
||||
inline bool AtomicIsLockFree(uint32_t size) {
|
||||
return size == 1 || size == 2 || size == 4;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if V8_CC_GNU
|
||||
|
||||
template <typename T>
|
||||
@ -826,9 +846,7 @@ RUNTIME_FUNCTION(Runtime_AtomicsIsLockFree) {
|
||||
DCHECK(args.length() == 1);
|
||||
CONVERT_NUMBER_ARG_HANDLE_CHECKED(size, 0);
|
||||
uint32_t usize = NumberToUint32(*size);
|
||||
|
||||
return Runtime::AtomicIsLockFree(usize) ? isolate->heap()->true_value()
|
||||
: isolate->heap()->false_value();
|
||||
return isolate->heap()->ToBoolean(AtomicIsLockFree(usize));
|
||||
}
|
||||
}
|
||||
} // namespace v8::internal
|
||||
|
@ -1215,8 +1215,6 @@ class Runtime : public AllStatic {
|
||||
// runtime-scopes.cc then.
|
||||
static base::SmartArrayPointer<Handle<Object>> GetCallerArguments(
|
||||
Isolate* isolate, int prefix_argc, int* total_argc);
|
||||
|
||||
static bool AtomicIsLockFree(uint32_t size);
|
||||
};
|
||||
|
||||
|
||||
@ -1233,29 +1231,6 @@ class DeclareGlobalsNativeFlag : public BitField<bool, 1, 1> {};
|
||||
STATIC_ASSERT(LANGUAGE_END == 3);
|
||||
class DeclareGlobalsLanguageMode : public BitField<LanguageMode, 2, 2> {};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Inline functions
|
||||
|
||||
// Assume that 32-bit architectures don't have 64-bit atomic ops.
|
||||
// TODO(binji): can we do better here?
|
||||
#if V8_TARGET_ARCH_64_BIT && V8_HOST_ARCH_64_BIT
|
||||
|
||||
#define ATOMICS_REQUIRE_LOCK_64_BIT 0
|
||||
|
||||
inline bool Runtime::AtomicIsLockFree(uint32_t size) {
|
||||
return size == 1 || size == 2 || size == 4 || size == 8;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define ATOMICS_REQUIRE_LOCK_64_BIT 1
|
||||
|
||||
inline bool Runtime::AtomicIsLockFree(uint32_t size) {
|
||||
return size == 1 || size == 2 || size == 4;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user