Fix a few clang warnings (which -Werror treats as errors)

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9141 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 4a36886a
...@@ -45,14 +45,14 @@ namespace internal { ...@@ -45,14 +45,14 @@ namespace internal {
const int kMaxSignificantDigits = 772; const int kMaxSignificantDigits = 772;
static bool isDigit(int x, int radix) { static inline bool isDigit(int x, int radix) {
return (x >= '0' && x <= '9' && x < '0' + radix) return (x >= '0' && x <= '9' && x < '0' + radix)
|| (radix > 10 && x >= 'a' && x < 'a' + radix - 10) || (radix > 10 && x >= 'a' && x < 'a' + radix - 10)
|| (radix > 10 && x >= 'A' && x < 'A' + radix - 10); || (radix > 10 && x >= 'A' && x < 'A' + radix - 10);
} }
static double SignedZero(bool negative) { static inline double SignedZero(bool negative) {
return negative ? -0.0 : 0.0; return negative ? -0.0 : 0.0;
} }
......
...@@ -3175,7 +3175,6 @@ void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) { ...@@ -3175,7 +3175,6 @@ void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) {
void LCodeGen::DoStoreKeyedFastDoubleElement( void LCodeGen::DoStoreKeyedFastDoubleElement(
LStoreKeyedFastDoubleElement* instr) { LStoreKeyedFastDoubleElement* instr) {
XMMRegister value = ToDoubleRegister(instr->value()); XMMRegister value = ToDoubleRegister(instr->value());
Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg;
Label have_value; Label have_value;
__ ucomisd(value, value); __ ucomisd(value, value);
......
...@@ -2661,7 +2661,8 @@ int TextNode::GreedyLoopTextLength() { ...@@ -2661,7 +2661,8 @@ int TextNode::GreedyLoopTextLength() {
// this alternative and back to this choice node. If there are variable // this alternative and back to this choice node. If there are variable
// length nodes or other complications in the way then return a sentinel // length nodes or other complications in the way then return a sentinel
// value indicating that a greedy loop cannot be constructed. // value indicating that a greedy loop cannot be constructed.
int ChoiceNode::GreedyLoopTextLength(GuardedAlternative* alternative) { int ChoiceNode::GreedyLoopTextLengthForAlternative(
GuardedAlternative* alternative) {
int length = 0; int length = 0;
RegExpNode* node = alternative->node(); RegExpNode* node = alternative->node();
// Later we will generate code for all these text nodes using recursion // Later we will generate code for all these text nodes using recursion
...@@ -2700,7 +2701,8 @@ void LoopChoiceNode::AddContinueAlternative(GuardedAlternative alt) { ...@@ -2700,7 +2701,8 @@ void LoopChoiceNode::AddContinueAlternative(GuardedAlternative alt) {
void LoopChoiceNode::Emit(RegExpCompiler* compiler, Trace* trace) { void LoopChoiceNode::Emit(RegExpCompiler* compiler, Trace* trace) {
RegExpMacroAssembler* macro_assembler = compiler->macro_assembler(); RegExpMacroAssembler* macro_assembler = compiler->macro_assembler();
if (trace->stop_node() == this) { if (trace->stop_node() == this) {
int text_length = GreedyLoopTextLength(&(alternatives_->at(0))); int text_length =
GreedyLoopTextLengthForAlternative(&(alternatives_->at(0)));
ASSERT(text_length != kNodeIsTooComplexForGreedyLoops); ASSERT(text_length != kNodeIsTooComplexForGreedyLoops);
// Update the counter-based backtracking info on the stack. This is an // Update the counter-based backtracking info on the stack. This is an
// optimization for greedy loops (see below). // optimization for greedy loops (see below).
...@@ -2893,7 +2895,7 @@ void ChoiceNode::Emit(RegExpCompiler* compiler, Trace* trace) { ...@@ -2893,7 +2895,7 @@ void ChoiceNode::Emit(RegExpCompiler* compiler, Trace* trace) {
Trace* current_trace = trace; Trace* current_trace = trace;
int text_length = GreedyLoopTextLength(&(alternatives_->at(0))); int text_length = GreedyLoopTextLengthForAlternative(&(alternatives_->at(0)));
bool greedy_loop = false; bool greedy_loop = false;
Label greedy_loop_label; Label greedy_loop_label;
Trace counter_backtrack_trace; Trace counter_backtrack_trace;
......
...@@ -1071,7 +1071,7 @@ class ChoiceNode: public RegExpNode { ...@@ -1071,7 +1071,7 @@ class ChoiceNode: public RegExpNode {
virtual bool try_to_emit_quick_check_for_alternative(int i) { return true; } virtual bool try_to_emit_quick_check_for_alternative(int i) { return true; }
protected: protected:
int GreedyLoopTextLength(GuardedAlternative* alternative); int GreedyLoopTextLengthForAlternative(GuardedAlternative* alternative);
ZoneList<GuardedAlternative>* alternatives_; ZoneList<GuardedAlternative>* alternatives_;
private: private:
......
...@@ -4226,7 +4226,7 @@ template <typename T> static void USE(T) { } ...@@ -4226,7 +4226,7 @@ template <typename T> static void USE(T) { }
// This test is not intended to be run, just type checked. // This test is not intended to be run, just type checked.
static void PersistentHandles() { static inline void PersistentHandles() {
USE(PersistentHandles); USE(PersistentHandles);
Local<String> str = v8_str("foo"); Local<String> str = v8_str("foo");
v8::Persistent<String> p_str = v8::Persistent<String>::New(str); v8::Persistent<String> p_str = v8::Persistent<String>::New(str);
...@@ -11793,14 +11793,21 @@ THREADED_TEST(PixelArray) { ...@@ -11793,14 +11793,21 @@ THREADED_TEST(PixelArray) {
CHECK_EQ(28, result->Int32Value()); CHECK_EQ(28, result->Int32Value());
i::Handle<i::Smi> value(i::Smi::FromInt(2)); i::Handle<i::Smi> value(i::Smi::FromInt(2));
i::SetElement(jsobj, 1, value, i::kNonStrictMode); i::Handle<i::Object> no_failure;
no_failure = i::SetElement(jsobj, 1, value, i::kNonStrictMode);
ASSERT(!no_failure.is_null());
i::USE(no_failure);
CHECK_EQ(2, i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value()); CHECK_EQ(2, i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value());
*value.location() = i::Smi::FromInt(256); *value.location() = i::Smi::FromInt(256);
i::SetElement(jsobj, 1, value, i::kNonStrictMode); no_failure = i::SetElement(jsobj, 1, value, i::kNonStrictMode);
ASSERT(!no_failure.is_null());
i::USE(no_failure);
CHECK_EQ(255, CHECK_EQ(255,
i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value()); i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value());
*value.location() = i::Smi::FromInt(-1); *value.location() = i::Smi::FromInt(-1);
i::SetElement(jsobj, 1, value, i::kNonStrictMode); no_failure = i::SetElement(jsobj, 1, value, i::kNonStrictMode);
ASSERT(!no_failure.is_null());
i::USE(no_failure);
CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value()); CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value());
result = CompileRun("for (var i = 0; i < 8; i++) {" result = CompileRun("for (var i = 0; i < 8; i++) {"
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdlib.h> #include <stdlib.h>
#include <wchar.h> // wint_t #include <wchar.h>
#include "v8.h" #include "v8.h"
...@@ -75,7 +75,7 @@ v8::Handle<v8::Value> PrintExtension::Print(const v8::Arguments& args) { ...@@ -75,7 +75,7 @@ v8::Handle<v8::Value> PrintExtension::Print(const v8::Arguments& args) {
uint16_t* string = NewArray<uint16_t>(length + 1); uint16_t* string = NewArray<uint16_t>(length + 1);
string_obj->Write(string); string_obj->Write(string);
for (int j = 0; j < length; j++) for (int j = 0; j < length; j++)
printf("%lc", static_cast<wint_t>(string[j])); printf("%lc", static_cast<wchar_t>(string[j]));
DeleteArray(string); DeleteArray(string);
} }
printf("\n"); printf("\n");
......
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