From f5d9c1bef84e1b3ae44f8f30895db11b4e2bb09f Mon Sep 17 00:00:00 2001 From: "keuchel@chromium.org" Date: Wed, 30 Nov 2011 18:04:12 +0000 Subject: [PATCH] Fix build with GCC 4.7, which fails with "narrowing conversion of 'id' from 'int' to 'unsigned int' inside { } is ill-formed in C++11" Contributed by burnus@net-b.de Review URL: http://codereview.chromium.org/8724003 Patch from Tobias Burnus . git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10101 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/full-codegen.cc | 7 ++++--- src/full-codegen.h | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/full-codegen.cc b/src/full-codegen.cc index 960700b..04086d4 100644 --- a/src/full-codegen.cc +++ b/src/full-codegen.cc @@ -362,7 +362,7 @@ void FullCodeGenerator::RecordJSReturnSite(Call* call) { } -void FullCodeGenerator::PrepareForBailoutForId(int id, State state) { +void FullCodeGenerator::PrepareForBailoutForId(unsigned id, State state) { // There's no need to prepare this code for bailouts from already optimized // code or code that can't be optimized. if (!FLAG_deopt || !info_->HasDeoptimizationSupport()) return; @@ -383,10 +383,11 @@ void FullCodeGenerator::PrepareForBailoutForId(int id, State state) { } -void FullCodeGenerator::RecordStackCheck(int ast_id) { +void FullCodeGenerator::RecordStackCheck(unsigned ast_id) { // The pc offset does not need to be encoded and packed together with a // state. - BailoutEntry entry = { ast_id, masm_->pc_offset() }; + ASSERT(masm_->pc_offset() > 0); + BailoutEntry entry = { ast_id, static_cast(masm_->pc_offset()) }; stack_checks_.Add(entry); } diff --git a/src/full-codegen.h b/src/full-codegen.h index e8915fc..fbb6979 100644 --- a/src/full-codegen.h +++ b/src/full-codegen.h @@ -390,7 +390,7 @@ class FullCodeGenerator: public AstVisitor { // Bailout support. void PrepareForBailout(Expression* node, State state); - void PrepareForBailoutForId(int id, State state); + void PrepareForBailoutForId(unsigned id, State state); // Record a call's return site offset, used to rebuild the frame if the // called function was inlined at the site. @@ -417,7 +417,7 @@ class FullCodeGenerator: public AstVisitor { // a loop. void EmitStackCheck(IterationStatement* stmt); // Record the OSR AST id corresponding to a stack check in the code. - void RecordStackCheck(int osr_ast_id); + void RecordStackCheck(unsigned osr_ast_id); // Emit a table of stack check ids and pcs into the code stream. Return // the offset of the start of the table. unsigned EmitStackCheckTable(); -- 2.7.4