From: mstarzinger Date: Wed, 9 Sep 2015 17:13:20 +0000 (-0700) Subject: [runtime] Move AtomicIsLockFree out of Runtime class. X-Git-Tag: upstream/4.7.83~377 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a14d2dfaa5aa68cea3231f2ceb7bc05ff86ac09e;p=platform%2Fupstream%2Fv8.git [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} --- diff --git a/src/runtime/runtime-atomics.cc b/src/runtime/runtime-atomics.cc index 9b9fa0b..bdb7ae7 100644 --- a/src/runtime/runtime-atomics.cc +++ b/src/runtime/runtime-atomics.cc @@ -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 @@ -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 diff --git a/src/runtime/runtime.h b/src/runtime/runtime.h index aff18f6..4495562 100644 --- a/src/runtime/runtime.h +++ b/src/runtime/runtime.h @@ -1215,8 +1215,6 @@ class Runtime : public AllStatic { // runtime-scopes.cc then. static base::SmartArrayPointer> GetCallerArguments( Isolate* isolate, int prefix_argc, int* total_argc); - - static bool AtomicIsLockFree(uint32_t size); }; @@ -1233,29 +1231,6 @@ class DeclareGlobalsNativeFlag : public BitField {}; STATIC_ASSERT(LANGUAGE_END == 3); class DeclareGlobalsLanguageMode : public BitField {}; -//--------------------------------------------------------------------------- -// 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