From 64e9cbc305e71780ee347b9f64c917f32b794535 Mon Sep 17 00:00:00 2001 From: "jkummerow@chromium.org" Date: Fri, 6 Dec 2013 11:45:26 +0000 Subject: [PATCH] Fix compilation with clang R=bmeurer@chromium.org Review URL: https://codereview.chromium.org/106863002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18267 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/arm/codegen-arm.cc | 2 ++ src/arm/stub-cache-arm.cc | 9 ++---- src/assembler.cc | 2 ++ src/builtins.cc | 4 +-- src/cached-powers.cc | 3 ++ src/date.cc | 1 - src/heap-snapshot-generator.cc | 5 ++++ src/ia32/full-codegen-ia32.cc | 4 ++- src/ia32/stub-cache-ia32.cc | 5 ++-- src/scanner-character-streams.cc | 2 +- src/x64/full-codegen-x64.cc | 4 ++- src/x64/stub-cache-x64.cc | 9 ++---- test/cctest/test-api.cc | 11 ++++---- test/cctest/test-cpu-profiler.cc | 4 --- test/cctest/test-debug.cc | 59 ---------------------------------------- 15 files changed, 35 insertions(+), 89 deletions(-) diff --git a/src/arm/codegen-arm.cc b/src/arm/codegen-arm.cc index 97bf622..255e1f3 100644 --- a/src/arm/codegen-arm.cc +++ b/src/arm/codegen-arm.cc @@ -833,8 +833,10 @@ void MathExpGenerator::EmitMathExp(MacroAssembler* masm, #undef __ +#ifdef DEBUG // add(r0, pc, Operand(-8)) static const uint32_t kCodeAgePatchFirstInstruction = 0xe24f0008; +#endif static byte* GetNoCodeAgeSequence(uint32_t* length) { // The sequence of instructions that is patched out for aging code is the diff --git a/src/arm/stub-cache-arm.cc b/src/arm/stub-cache-arm.cc index 2fc80fb..9d1418b 100644 --- a/src/arm/stub-cache-arm.cc +++ b/src/arm/stub-cache-arm.cc @@ -927,12 +927,10 @@ class CallInterceptorCompiler BASE_EMBEDDED { public: CallInterceptorCompiler(CallStubCompiler* stub_compiler, const ParameterCount& arguments, - Register name, - ExtraICState extra_ic_state) + Register name) : stub_compiler_(stub_compiler), arguments_(arguments), - name_(name), - extra_ic_state_(extra_ic_state) {} + name_(name) {} void Compile(MacroAssembler* masm, Handle object, @@ -1107,7 +1105,6 @@ class CallInterceptorCompiler BASE_EMBEDDED { CallStubCompiler* stub_compiler_; const ParameterCount& arguments_; Register name_; - ExtraICState extra_ic_state_; }; @@ -2466,7 +2463,7 @@ Handle CallStubCompiler::CompileCallInterceptor(Handle object, // Get the receiver from the stack. __ ldr(r1, MemOperand(sp, argc * kPointerSize)); - CallInterceptorCompiler compiler(this, arguments(), r2, extra_state()); + CallInterceptorCompiler compiler(this, arguments(), r2); compiler.Compile(masm(), object, holder, name, &lookup, r1, r3, r4, r0, &miss); diff --git a/src/assembler.cc b/src/assembler.cc index c8d16ae..b77e92d 100644 --- a/src/assembler.cc +++ b/src/assembler.cc @@ -306,7 +306,9 @@ int Label::pos() const { // dropped, and last non-zero chunk tagged with 1.) +#ifdef DEBUG const int kMaxStandardNonCompactModes = 14; +#endif const int kTagBits = 2; const int kTagMask = (1 << kTagBits) - 1; diff --git a/src/builtins.cc b/src/builtins.cc index f9c2708..b27f29a 100644 --- a/src/builtins.cc +++ b/src/builtins.cc @@ -153,8 +153,8 @@ BUILTIN_LIST_C(DEF_ARG_TYPE) #endif -static inline bool CalledAsConstructor(Isolate* isolate) { #ifdef DEBUG +static inline bool CalledAsConstructor(Isolate* isolate) { // Calculate the result using a full stack frame iterator and check // that the state of the stack is as we assume it to be in the // code below. @@ -163,7 +163,6 @@ static inline bool CalledAsConstructor(Isolate* isolate) { it.Advance(); StackFrame* frame = it.frame(); bool reference_result = frame->is_construct(); -#endif Address fp = Isolate::c_entry_fp(isolate->thread_local_top()); // Because we know fp points to an exit frame we can use the relevant // part of ExitFrame::ComputeCallerState directly. @@ -180,6 +179,7 @@ static inline bool CalledAsConstructor(Isolate* isolate) { ASSERT_EQ(result, reference_result); return result; } +#endif // ---------------------------------------------------------------------------- diff --git a/src/cached-powers.cc b/src/cached-powers.cc index fbfaf26..9e2919b 100644 --- a/src/cached-powers.cc +++ b/src/cached-powers.cc @@ -133,7 +133,10 @@ static const CachedPower kCachedPowers[] = { {V8_2PART_UINT64_C(0xaf87023b, 9bf0ee6b), 1066, 340}, }; +#ifdef DEBUG static const int kCachedPowersLength = ARRAY_SIZE(kCachedPowers); +#endif + static const int kCachedPowersOffset = 348; // -1 * the first decimal_exponent. static const double kD_1_LOG2_10 = 0.30102999566398114; // 1 / lg(10) // Difference between the decimal exponents in the table above. diff --git a/src/date.cc b/src/date.cc index a377451..4afd8dc 100644 --- a/src/date.cc +++ b/src/date.cc @@ -36,7 +36,6 @@ namespace v8 { namespace internal { -static const int kDays4Years[] = {0, 365, 2 * 365, 3 * 365 + 1}; static const int kDaysIn4Years = 4 * 365 + 1; static const int kDaysIn100Years = 25 * kDaysIn4Years - 1; static const int kDaysIn400Years = 4 * kDaysIn100Years + 1; diff --git a/src/heap-snapshot-generator.cc b/src/heap-snapshot-generator.cc index 84e819d..010552d 100644 --- a/src/heap-snapshot-generator.cc +++ b/src/heap-snapshot-generator.cc @@ -202,6 +202,7 @@ template <> struct SnapshotSizeConstants<8> { } // namespace + HeapSnapshot::HeapSnapshot(HeapProfiler* profiler, const char* title, unsigned uid) @@ -218,6 +219,10 @@ HeapSnapshot::HeapSnapshot(HeapProfiler* profiler, STATIC_CHECK( sizeof(HeapEntry) == SnapshotSizeConstants::kExpectedHeapEntrySize); + USE(SnapshotSizeConstants<4>::kExpectedHeapGraphEdgeSize); + USE(SnapshotSizeConstants<4>::kExpectedHeapEntrySize); + USE(SnapshotSizeConstants<8>::kExpectedHeapGraphEdgeSize); + USE(SnapshotSizeConstants<8>::kExpectedHeapEntrySize); for (int i = 0; i < VisitorSynchronization::kNumberOfSyncTags; ++i) { gc_subroot_indexes_[i] = HeapEntry::kNoEntry; } diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc index 8b1ecb0..3c92afa 100644 --- a/src/ia32/full-codegen-ia32.cc +++ b/src/ia32/full-codegen-ia32.cc @@ -4833,9 +4833,11 @@ FullCodeGenerator::NestedStatement* FullCodeGenerator::TryFinally::Exit( static const byte kJnsInstruction = 0x79; static const byte kJnsOffset = 0x11; -static const byte kCallInstruction = 0xe8; static const byte kNopByteOne = 0x66; static const byte kNopByteTwo = 0x90; +#ifdef DEBUG +static const byte kCallInstruction = 0xe8; +#endif void BackEdgeTable::PatchAt(Code* unoptimized_code, diff --git a/src/ia32/stub-cache-ia32.cc b/src/ia32/stub-cache-ia32.cc index f4f3b2b..88923c3 100644 --- a/src/ia32/stub-cache-ia32.cc +++ b/src/ia32/stub-cache-ia32.cc @@ -647,8 +647,7 @@ class CallInterceptorCompiler BASE_EMBEDDED { public: CallInterceptorCompiler(CallStubCompiler* stub_compiler, const ParameterCount& arguments, - Register name, - ExtraICState extra_state) + Register name) : stub_compiler_(stub_compiler), arguments_(arguments), name_(name) {} @@ -2589,7 +2588,7 @@ Handle CallStubCompiler::CompileCallInterceptor(Handle object, // Get the receiver from the stack. __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); - CallInterceptorCompiler compiler(this, arguments(), ecx, extra_state()); + CallInterceptorCompiler compiler(this, arguments(), ecx); compiler.Compile(masm(), object, holder, name, &lookup, edx, ebx, edi, eax, &miss); diff --git a/src/scanner-character-streams.cc b/src/scanner-character-streams.cc index fb50345..cbef3f9 100644 --- a/src/scanner-character-streams.cc +++ b/src/scanner-character-streams.cc @@ -213,11 +213,11 @@ unsigned Utf8ToUtf16CharacterStream::FillBuffer(unsigned char_position, static const byte kUtf8MultiByteMask = 0xC0; -static const byte kUtf8MultiByteCharStart = 0xC0; static const byte kUtf8MultiByteCharFollower = 0x80; #ifdef DEBUG +static const byte kUtf8MultiByteCharStart = 0xC0; static bool IsUtf8MultiCharacterStart(byte first_byte) { return (first_byte & kUtf8MultiByteMask) == kUtf8MultiByteCharStart; } diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc index bff29b7..473f548 100644 --- a/src/x64/full-codegen-x64.cc +++ b/src/x64/full-codegen-x64.cc @@ -4826,9 +4826,11 @@ FullCodeGenerator::NestedStatement* FullCodeGenerator::TryFinally::Exit( static const byte kJnsInstruction = 0x79; static const byte kJnsOffset = 0x1d; -static const byte kCallInstruction = 0xe8; static const byte kNopByteOne = 0x66; static const byte kNopByteTwo = 0x90; +#ifdef DEBUG +static const byte kCallInstruction = 0xe8; +#endif void BackEdgeTable::PatchAt(Code* unoptimized_code, diff --git a/src/x64/stub-cache-x64.cc b/src/x64/stub-cache-x64.cc index 9bf6e9f..9cfcf46 100644 --- a/src/x64/stub-cache-x64.cc +++ b/src/x64/stub-cache-x64.cc @@ -639,12 +639,10 @@ class CallInterceptorCompiler BASE_EMBEDDED { public: CallInterceptorCompiler(CallStubCompiler* stub_compiler, const ParameterCount& arguments, - Register name, - ExtraICState extra_ic_state) + Register name) : stub_compiler_(stub_compiler), arguments_(arguments), - name_(name), - extra_ic_state_(extra_ic_state) {} + name_(name) {} void Compile(MacroAssembler* masm, Handle object, @@ -820,7 +818,6 @@ class CallInterceptorCompiler BASE_EMBEDDED { CallStubCompiler* stub_compiler_; const ParameterCount& arguments_; Register name_; - ExtraICState extra_ic_state_; }; @@ -2497,7 +2494,7 @@ Handle CallStubCompiler::CompileCallInterceptor(Handle object, StackArgumentsAccessor args(rsp, arguments()); __ movq(rdx, args.GetReceiverOperand()); - CallInterceptorCompiler compiler(this, arguments(), rcx, extra_state()); + CallInterceptorCompiler compiler(this, arguments(), rcx); compiler.Compile(masm(), object, holder, name, &lookup, rdx, rbx, rdi, rax, &miss); diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc index 819f42d..81104e6 100644 --- a/test/cctest/test-api.cc +++ b/test/cctest/test-api.cc @@ -6454,9 +6454,12 @@ TEST(UndetectableOptimized) { template static void USE(T) { } -// This test is not intended to be run, just type checked. -static inline void PersistentHandles(v8::Isolate* isolate) { - USE(PersistentHandles); +// The point of this test is type checking. We run it only so compilers +// don't complain about an unused function. +TEST(PersistentHandles) { + LocalContext env; + v8::Isolate* isolate = CcTest::isolate(); + v8::HandleScope scope(isolate); Local str = v8_str("foo"); v8::Persistent p_str(isolate, str); p_str.Reset(); @@ -18088,8 +18091,6 @@ THREADED_TEST(AddToJSFunctionResultCache) { } -static const int k0CacheSize = 16; - THREADED_TEST(FillJSFunctionResultCache) { i::FLAG_allow_natives_syntax = true; LocalContext context; diff --git a/test/cctest/test-cpu-profiler.cc b/test/cctest/test-cpu-profiler.cc index 9627277..9204dc4 100644 --- a/test/cctest/test-cpu-profiler.cc +++ b/test/cctest/test-cpu-profiler.cc @@ -59,10 +59,6 @@ TEST(StartStop) { } -static inline i::Address ToAddress(int n) { - return reinterpret_cast(n); -} - static void EnqueueTickSampleEvent(ProfilerEventsProcessor* proc, i::Address frame1, i::Address frame2 = NULL, diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc index 8c6f418..3272e9c 100644 --- a/test/cctest/test-debug.cc +++ b/test/cctest/test-debug.cc @@ -70,65 +70,6 @@ using ::v8::internal::StrLength; // Size of temp buffer for formatting small strings. #define SMALL_STRING_BUFFER_SIZE 80 -// --- A d d i t i o n a l C h e c k H e l p e r s - - -// Helper function used by the CHECK_EQ function when given Address -// arguments. Should not be called directly. -static inline void CheckEqualsHelper(const char* file, int line, - const char* expected_source, - ::v8::internal::Address expected, - const char* value_source, - ::v8::internal::Address value) { - if (expected != value) { - V8_Fatal(file, line, "CHECK_EQ(%s, %s) failed\n# " - "Expected: %i\n# Found: %i", - expected_source, value_source, expected, value); - } -} - - -// Helper function used by the CHECK_NE function when given Address -// arguments. Should not be called directly. -static inline void CheckNonEqualsHelper(const char* file, int line, - const char* unexpected_source, - ::v8::internal::Address unexpected, - const char* value_source, - ::v8::internal::Address value) { - if (unexpected == value) { - V8_Fatal(file, line, "CHECK_NE(%s, %s) failed\n# Value: %i", - unexpected_source, value_source, value); - } -} - - -// Helper function used by the CHECK function when given code -// arguments. Should not be called directly. -static inline void CheckEqualsHelper(const char* file, int line, - const char* expected_source, - const Code* expected, - const char* value_source, - const Code* value) { - if (expected != value) { - V8_Fatal(file, line, "CHECK_EQ(%s, %s) failed\n# " - "Expected: %p\n# Found: %p", - expected_source, value_source, expected, value); - } -} - - -static inline void CheckNonEqualsHelper(const char* file, int line, - const char* expected_source, - const Code* expected, - const char* value_source, - const Code* value) { - if (expected == value) { - V8_Fatal(file, line, "CHECK_NE(%s, %s) failed\n# Value: %p", - expected_source, value_source, value); - } -} - - // --- H e l p e r C l a s s e s -- 2.7.4