fix -Wunused-but-set-variable for gcc-4.6 on x64

* src/third_party/valgrind/valgrind.h: Update from upstream valgrind
  r11899, so as to get around some unused value warnings.  Also adds
  support for darwin.

  This version of valgrind.h differs from the original in that all
  instances of "unsigned long long int" have been replaced with
  "uint64_t", as the former is not allowed in ISO C++ 89.

  See https://bugs.kde.org/show_bug.cgi?id=211926 for the upstream bug
  report.

* src/x64/cpu-x64.cc:
* src/builtins.cc:
* src/conversions-inl.h:
* src/debug.cc:
* src/frames.cc:
* src/full-codegen.cc:
* src/jsregexp.cc:
* src/objects.cc:
* src/parser.cc:
* src/platform-linux.cc:
* src/x64/code-stubs-x64.cc:
* src/x64/deoptimizer-x64.cc:
* src/x64/full-codegen-x64.cc:
* src/x64/lithium-codegen-x64.cc:
* src/x64/regexp-macro-assembler-x64.cc:
* src/x64/stub-cache-x64.cc: Remove a number of assigned but
  unreferenced variables.

* SConstruct (CCTEST_EXTRA_FLAGS): Punt on -Wunused-but-set-variable for
  the test suite.

BUG=1291
TEST=A build and tools/test.py passes.

Review URL: http://codereview.chromium.org/7400023

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8688 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
whesse@chromium.org 2011-07-20 08:09:58 +00:00
parent e372a2ddeb
commit 47e03a0000
16 changed files with 26 additions and 39 deletions

View File

@ -398,7 +398,8 @@ CCTEST_EXTRA_FLAGS = {
'gcc': {
'all': {
'LIBPATH': [abspath('.')],
'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'],
'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS',
'-Wno-unused-but-set-variable'],
'CXXFLAGS': ['-fno-rtti', '-fno-exceptions'],
'LINKFLAGS': ['$CCFLAGS'],
},

View File

@ -1202,10 +1202,10 @@ MUST_USE_RESULT static MaybeObject* HandleApiCallAsFunctionOrConstructor(
ASSERT(!CalledAsConstructor(isolate));
Heap* heap = isolate->heap();
Handle<Object> receiver = args.at<Object>(0);
Handle<Object> receiver = args.receiver();
// Get the object called.
JSObject* obj = JSObject::cast(*args.receiver());
JSObject* obj = JSObject::cast(*receiver);
// Get the invocation callback from the function descriptor that was
// used to create the called object.

View File

@ -454,7 +454,6 @@ static double InternalStringToDouble(UnicodeCache* unicode_cache,
int significant_digits = 0;
int insignificant_digits = 0;
bool nonzero_digit_dropped = false;
bool fractional_part = false;
bool negative = false;
@ -557,10 +556,8 @@ static double InternalStringToDouble(UnicodeCache* unicode_cache,
}
}
// We don't emit a '.', but adjust the exponent instead.
fractional_part = true;
// There is a fractional part.
// There is a fractional part. We don't emit a '.', but adjust the exponent
// instead.
while (*current >= '0' && *current <= '9') {
if (significant_digits < kMaxSignificantDigits) {
ASSERT(buffer_pos < kBufferSize);

View File

@ -772,9 +772,9 @@ bool Debug::CompileDebuggerScript(int index) {
bool caught_exception = false;
Handle<JSFunction> function =
factory->NewFunctionFromSharedFunctionInfo(function_info, context);
Handle<Object> result =
Execution::TryCall(function, Handle<Object>(context->global()),
0, NULL, &caught_exception);
Execution::TryCall(function, Handle<Object>(context->global()),
0, NULL, &caught_exception);
// Check for caught exceptions.
if (caught_exception) {
@ -1886,8 +1886,7 @@ void Debug::ClearMirrorCache() {
*function_name));
ASSERT(fun->IsJSFunction());
bool caught_exception;
Handle<Object> js_object = Execution::TryCall(
Handle<JSFunction>::cast(fun),
Execution::TryCall(Handle<JSFunction>::cast(fun),
Handle<JSObject>(Debug::debug_context()->global()),
0, NULL, &caught_exception);
}
@ -2252,8 +2251,7 @@ void Debugger::OnAfterCompile(Handle<Script> script,
bool caught_exception = false;
const int argc = 1;
Object** argv[argc] = { reinterpret_cast<Object**>(wrapper.location()) };
Handle<Object> result = Execution::TryCall(
Handle<JSFunction>::cast(update_script_break_points),
Execution::TryCall(Handle<JSFunction>::cast(update_script_break_points),
Isolate::Current()->js_builtins_object(), argc, argv,
&caught_exception);
if (caught_exception) {
@ -2930,7 +2928,7 @@ v8::Handle<v8::Context> MessageImpl::GetEventContext() const {
v8::Handle<v8::Context> context = GetDebugEventContext(isolate);
// Isolate::context() may be NULL when "script collected" event occures.
ASSERT(!context.IsEmpty() || event_ == v8::ScriptCollected);
return GetDebugEventContext(isolate);
return context;
}

View File

@ -371,7 +371,6 @@ Code* StackFrame::GetSafepointData(Isolate* isolate,
unsigned* stack_slots) {
PcToCodeCache::PcToCodeCacheEntry* entry =
isolate->pc_to_code_cache()->GetCacheEntry(pc);
SafepointEntry cached_safepoint_entry = entry->safepoint_entry;
if (!entry->safepoint_entry.is_valid()) {
entry->safepoint_entry = entry->code->GetSafepointEntry(pc);
ASSERT(entry->safepoint_entry.is_valid());

View File

@ -686,7 +686,6 @@ FullCodeGenerator::InlineFunctionGenerator
void FullCodeGenerator::EmitInlineRuntimeCall(CallRuntime* node) {
ZoneList<Expression*>* args = node->arguments();
Handle<String> name = node->name();
const Runtime::Function* function = node->function();
ASSERT(function != NULL);
ASSERT(function->intrinsic_type == Runtime::INLINE);

View File

@ -1,4 +1,4 @@
// Copyright 2006-2009 the V8 project authors. All rights reserved.
// Copyright 2006-2009, 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@ -1958,13 +1958,10 @@ void TextNode::GetQuickCheckDetails(QuickCheckDetails* details,
ASSERT(characters_filled_in < details->characters());
int characters = details->characters();
int char_mask;
int char_shift;
if (compiler->ascii()) {
char_mask = String::kMaxAsciiCharCode;
char_shift = 8;
} else {
char_mask = String::kMaxUC16CharCode;
char_shift = 16;
}
for (int k = 0; k < elms_->length(); k++) {
TextElement elm = elms_->at(k);
@ -4888,7 +4885,6 @@ void TextNode::CalculateOffsets() {
cp_offset += elm.data.u_atom->data().length();
} else {
cp_offset++;
Vector<const uc16> quarks = elm.data.u_atom->data();
}
}
}
@ -5327,8 +5323,6 @@ RegExpEngine::CompilationResult RegExpEngine::Compile(RegExpCompileData* data,
return CompilationResult(error_message);
}
NodeInfo info = *node->info();
// Create the correct assembler for the architecture.
#ifndef V8_INTERPRETED_REGEXP
// Native regexp implementation.

View File

@ -2245,8 +2245,7 @@ MUST_USE_RESULT MaybeObject* JSProxy::SetPropertyWithHandler(
receiver.location(), name.location(), value.location()
};
bool has_exception;
Handle<Object> result =
Execution::Call(trap, handler, ARRAY_SIZE(args), args, &has_exception);
Execution::Call(trap, handler, ARRAY_SIZE(args), args, &has_exception);
if (has_exception) return Failure::Exception();
return *value;

View File

@ -719,7 +719,6 @@ FunctionLiteral* Parser::ParseLazy(CompilationInfo* info,
{
// Parse the function literal.
Handle<String> no_name = isolate()->factory()->empty_symbol();
Scope* scope = NewScope(top_scope_, Scope::GLOBAL_SCOPE, inside_with());
if (!info->closure().is_null()) {
scope = Scope::DeserializeScopeChain(info, scope);
@ -3443,7 +3442,6 @@ Expression* Parser::ParseObjectLiteral(bool* ok) {
ObjectLiteralPropertyChecker checker(this, top_scope_->is_strict_mode());
Expect(Token::LBRACE, CHECK_OK);
Scanner::Location loc = scanner().location();
while (peek() != Token::RBRACE) {
if (fni_ != NULL) fni_->Enter();

View File

@ -734,6 +734,7 @@ class LinuxMutex : public Mutex {
ASSERT(result == 0);
result = pthread_mutex_init(&mutex_, &attrs);
ASSERT(result == 0);
USE(result);
}
virtual ~LinuxMutex() { pthread_mutex_destroy(&mutex_); }

View File

@ -2529,6 +2529,7 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
#else
// Already there in AMD64 calling convention.
ASSERT(arg1.is(rdi));
USE(arg1);
#endif
// Locate the code entry and call it.

View File

@ -128,7 +128,9 @@ void Deoptimizer::DeoptimizeFunction(JSFunction* function) {
Address instruction_start = function->code()->instruction_start();
Address jump_table_address =
instruction_start + function->code()->safepoint_table_offset();
#ifdef DEBUG
Address previous_pc = instruction_start;
#endif
SafepointTableDeoptimiztionEntryIterator deoptimizations(function->code());
Address entry_pc = NULL;
@ -157,12 +159,16 @@ void Deoptimizer::DeoptimizeFunction(JSFunction* function) {
CodePatcher patcher(call_address, Assembler::kCallInstructionLength);
patcher.masm()->Call(GetDeoptimizationEntry(deoptimization_index, LAZY),
RelocInfo::NONE);
#ifdef DEBUG
previous_pc = call_end_address;
#endif
} else {
// Not room enough for a long Call instruction. Write a short call
// instruction to a long jump placed elsewhere in the code.
#ifdef DEBUG
Address short_call_end_address =
call_address + MacroAssembler::kShortCallInstructionLength;
#endif
ASSERT(next_pc >= short_call_end_address);
// Write jump in jump-table.
@ -177,7 +183,9 @@ void Deoptimizer::DeoptimizeFunction(JSFunction* function) {
CodePatcher call_patcher(call_address,
MacroAssembler::kShortCallInstructionLength);
call_patcher.masm()->call(jump_table_address);
#ifdef DEBUG
previous_pc = short_call_end_address;
#endif
}
// Continue with next deoptimization entry.

View File

@ -4060,10 +4060,8 @@ void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) {
default: {
VisitForAccumulatorValue(expr->right());
Condition cc = no_condition;
bool strict = false;
switch (op) {
case Token::EQ_STRICT:
strict = true;
// Fall through.
case Token::EQ:
cc = equal;

View File

@ -1883,7 +1883,6 @@ void LCodeGen::DoDeferredLInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr,
__ push(ToRegister(instr->InputAt(0)));
__ Push(instr->function());
Register temp = ToRegister(instr->TempAt(0));
static const int kAdditionalDelta = 10;
int delta =
masm_->SizeOfCodeGeneratedSince(map_check) + kAdditionalDelta;

View File

@ -661,7 +661,6 @@ bool RegExpMacroAssemblerX64::CheckSpecialCharacterClass(uc16 type,
}
__ movq(rbx, ExternalReference::re_word_character_map());
ASSERT_EQ(0, word_character_map[0]); // Character '\0' is not a word char.
ExternalReference word_map = ExternalReference::re_word_character_map();
__ testb(Operand(rbx, current_character(), times_1, 0),
current_character());
BranchOrBacktrack(zero, on_no_match);
@ -676,7 +675,6 @@ bool RegExpMacroAssemblerX64::CheckSpecialCharacterClass(uc16 type,
}
__ movq(rbx, ExternalReference::re_word_character_map());
ASSERT_EQ(0, word_character_map[0]); // Character '\0' is not a word char.
ExternalReference word_map = ExternalReference::re_word_character_map();
__ testb(Operand(rbx, current_character(), times_1, 0),
current_character());
BranchOrBacktrack(not_zero, on_no_match);

View File

@ -1089,9 +1089,8 @@ void StubCompiler::GenerateLoadConstant(JSObject* object,
__ JumpIfSmi(receiver, miss);
// Check that the maps haven't changed.
Register reg =
CheckPrototypes(object, receiver, holder,
scratch1, scratch2, scratch3, name, miss);
CheckPrototypes(object, receiver, holder,
scratch1, scratch2, scratch3, name, miss);
// Return the constant value.
__ Move(rax, Handle<Object>(value));
@ -3746,8 +3745,6 @@ void KeyedStoreStubCompiler::GenerateStoreFastDoubleElement(
__ bind(&is_nan);
// Convert all NaNs to the same canonical NaN value when they are stored in
// the double array.
ExternalReference canonical_nan_reference =
ExternalReference::address_of_canonical_non_hole_nan();
__ Set(kScratchRegister, BitCast<uint64_t>(
FixedDoubleArray::canonical_not_the_hole_nan_as_double()));
__ movq(xmm0, kScratchRegister);