Commit a14d2dfa authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[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}
parent 422b0fa7
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment