Permalink
Browse files

Merge branch 'v8-3.1' into v0.4

  • Loading branch information...
2 parents ed74db0 + 6631983 commit ad861e135481c8ea380f5cd28bb71041c14942be @ry ry committed Mar 31, 2011
View
1 deps/v8/SConstruct
@@ -306,7 +306,6 @@ V8_EXTRA_FLAGS = {
'gcc': {
'all': {
'WARNINGFLAGS': ['-Wall',
- '-Werror',
'-W',
'-Wno-unused-parameter',
'-Wnon-virtual-dtor']
View
40 deps/v8/src/arm/code-stubs-arm.cc
@@ -2856,6 +2856,9 @@ void TypeRecordingBinaryOpStub::Generate(MacroAssembler* masm) {
case TRBinaryOpIC::HEAP_NUMBER:
GenerateHeapNumberStub(masm);
break;
+ case TRBinaryOpIC::ODDBALL:
+ GenerateOddballStub(masm);
+ break;
case TRBinaryOpIC::STRING:
GenerateStringStub(masm);
break;
@@ -3572,10 +3575,43 @@ void TypeRecordingBinaryOpStub::GenerateInt32Stub(MacroAssembler* masm) {
}
+void TypeRecordingBinaryOpStub::GenerateOddballStub(MacroAssembler* masm) {
+ Label call_runtime;
+
+ if (op_ == Token::ADD) {
+ // Handle string addition here, because it is the only operation
+ // that does not do a ToNumber conversion on the operands.
+ GenerateAddStrings(masm);
+ }
+
+ // Convert oddball arguments to numbers.
+ Label check, done;
+ __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
+ __ cmp(r1, ip);
+ __ b(ne, &check);
+ if (Token::IsBitOp(op_)) {
+ __ mov(r1, Operand(Smi::FromInt(0)));
+ } else {
+ __ LoadRoot(r1, Heap::kNanValueRootIndex);
+ }
+ __ jmp(&done);
+ __ bind(&check);
+ __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
+ __ cmp(r0, ip);
+ __ b(ne, &done);
+ if (Token::IsBitOp(op_)) {
+ __ mov(r0, Operand(Smi::FromInt(0)));
+ } else {
+ __ LoadRoot(r0, Heap::kNanValueRootIndex);
+ }
+ __ bind(&done);
+
+ GenerateHeapNumberStub(masm);
+}
+
+
void TypeRecordingBinaryOpStub::GenerateHeapNumberStub(MacroAssembler* masm) {
Label not_numbers, call_runtime;
- ASSERT(operands_type_ == TRBinaryOpIC::HEAP_NUMBER);
-
GenerateFPOperation(masm, false, &not_numbers, &call_runtime);
__ bind(&not_numbers);
View
1 deps/v8/src/arm/code-stubs-arm.h
@@ -302,6 +302,7 @@ class TypeRecordingBinaryOpStub: public CodeStub {
void GenerateSmiStub(MacroAssembler* masm);
void GenerateInt32Stub(MacroAssembler* masm);
void GenerateHeapNumberStub(MacroAssembler* masm);
+ void GenerateOddballStub(MacroAssembler* masm);
void GenerateStringStub(MacroAssembler* masm);
void GenerateGenericStub(MacroAssembler* masm);
void GenerateAddStrings(MacroAssembler* masm);
View
1 deps/v8/src/heap.h
@@ -163,6 +163,7 @@ namespace internal {
V(name_symbol, "name") \
V(number_symbol, "number") \
V(Number_symbol, "Number") \
+ V(nan_symbol, "NaN") \
V(RegExp_symbol, "RegExp") \
V(source_symbol, "source") \
V(global_symbol, "global") \
View
37 deps/v8/src/ia32/code-stubs-ia32.cc
@@ -1342,6 +1342,9 @@ void TypeRecordingBinaryOpStub::Generate(MacroAssembler* masm) {
case TRBinaryOpIC::HEAP_NUMBER:
GenerateHeapNumberStub(masm);
break;
+ case TRBinaryOpIC::ODDBALL:
+ GenerateOddballStub(masm);
+ break;
case TRBinaryOpIC::STRING:
GenerateStringStub(masm);
break;
@@ -2006,9 +2009,41 @@ void TypeRecordingBinaryOpStub::GenerateInt32Stub(MacroAssembler* masm) {
}
+void TypeRecordingBinaryOpStub::GenerateOddballStub(MacroAssembler* masm) {
+ Label call_runtime;
+
+ if (op_ == Token::ADD) {
+ // Handle string addition here, because it is the only operation
+ // that does not do a ToNumber conversion on the operands.
+ GenerateAddStrings(masm);
+ }
+
+ // Convert odd ball arguments to numbers.
+ NearLabel check, done;
+ __ cmp(edx, Factory::undefined_value());
+ __ j(not_equal, &check);
+ if (Token::IsBitOp(op_)) {
+ __ xor_(edx, Operand(edx));
+ } else {
+ __ mov(edx, Immediate(Factory::nan_value()));
+ }
+ __ jmp(&done);
+ __ bind(&check);
+ __ cmp(eax, Factory::undefined_value());
+ __ j(not_equal, &done);
+ if (Token::IsBitOp(op_)) {
+ __ xor_(eax, Operand(eax));
+ } else {
+ __ mov(eax, Immediate(Factory::nan_value()));
+ }
+ __ bind(&done);
+
+ GenerateHeapNumberStub(masm);
+}
+
+
void TypeRecordingBinaryOpStub::GenerateHeapNumberStub(MacroAssembler* masm) {
Label call_runtime;
- ASSERT(operands_type_ == TRBinaryOpIC::HEAP_NUMBER);
// Floating point case.
switch (op_) {
View
1 deps/v8/src/ia32/code-stubs-ia32.h
@@ -306,6 +306,7 @@ class TypeRecordingBinaryOpStub: public CodeStub {
void GenerateSmiStub(MacroAssembler* masm);
void GenerateInt32Stub(MacroAssembler* masm);
void GenerateHeapNumberStub(MacroAssembler* masm);
+ void GenerateOddballStub(MacroAssembler* masm);
void GenerateStringStub(MacroAssembler* masm);
void GenerateGenericStub(MacroAssembler* masm);
void GenerateAddStrings(MacroAssembler* masm);
View
16 deps/v8/src/ic.cc
@@ -1113,6 +1113,16 @@ void LoadIC::UpdateCaches(LookupResult* lookup,
MaybeObject* KeyedLoadIC::Load(State state,
Handle<Object> object,
Handle<Object> key) {
+ // Check for values that can be converted into a symbol.
+ // TODO(1295): Remove this code.
+ HandleScope scope;
+ if (key->IsHeapNumber() &&
+ isnan(HeapNumber::cast(*key)->value())) {
+ key = Factory::nan_symbol();
+ } else if (key->IsUndefined()) {
+ key = Factory::undefined_symbol();
+ }
+
if (key->IsSymbol()) {
Handle<String> name = Handle<String>::cast(key);
@@ -2082,6 +2092,7 @@ const char* TRBinaryOpIC::GetName(TypeInfo type_info) {
case SMI: return "SMI";
case INT32: return "Int32s";
case HEAP_NUMBER: return "HeapNumbers";
+ case ODDBALL: return "Oddball";
case STRING: return "Strings";
case GENERIC: return "Generic";
default: return "Invalid";
@@ -2096,6 +2107,7 @@ TRBinaryOpIC::State TRBinaryOpIC::ToState(TypeInfo type_info) {
case SMI:
case INT32:
case HEAP_NUMBER:
+ case ODDBALL:
case STRING:
return MONOMORPHIC;
case GENERIC:
@@ -2143,6 +2155,10 @@ TRBinaryOpIC::TypeInfo TRBinaryOpIC::GetTypeInfo(Handle<Object> left,
return STRING;
}
+ // Check for oddball objects.
+ if (left->IsUndefined() && right->IsNumber()) return ODDBALL;
+ if (left->IsNumber() && right->IsUndefined()) return ODDBALL;
+
return GENERIC;
}
View
1 deps/v8/src/ic.h
@@ -576,6 +576,7 @@ class TRBinaryOpIC: public IC {
SMI,
INT32,
HEAP_NUMBER,
+ ODDBALL,
STRING, // Only used for addition operation. At least one string operand.
GENERIC
};
View
7 deps/v8/src/platform-freebsd.cc
@@ -526,6 +526,11 @@ class FreeBSDMutex : public Mutex {
return result;
}
+ virtual bool TryLock() {
+ int result = pthread_mutex_trylock(&mutex_);
+ return result == 0;
+ }
+
private:
pthread_mutex_t mutex_; // Pthread mutex for POSIX platforms.
};
@@ -604,7 +609,7 @@ static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) {
TickSample sample;
// We always sample the VM state.
- sample.state = VMState::current_state();
+ sample.state = Top::current_vm_state();
// If profiling, we extract the current pc and sp.
if (active_sampler_->IsProfiling()) {
View
2 deps/v8/src/version.cc
@@ -35,7 +35,7 @@
#define MAJOR_VERSION 3
#define MINOR_VERSION 1
#define BUILD_NUMBER 8
-#define PATCH_LEVEL 5
+#define PATCH_LEVEL 8
#define CANDIDATE_VERSION false
// Define SONAME to have the SCons build the put a specific SONAME into the
View
36 deps/v8/src/x64/code-stubs-x64.cc
@@ -1053,6 +1053,9 @@ void TypeRecordingBinaryOpStub::Generate(MacroAssembler* masm) {
case TRBinaryOpIC::HEAP_NUMBER:
GenerateHeapNumberStub(masm);
break;
+ case TRBinaryOpIC::ODDBALL:
+ GenerateOddballStub(masm);
+ break;
case TRBinaryOpIC::STRING:
GenerateStringStub(masm);
break;
@@ -1428,6 +1431,39 @@ void TypeRecordingBinaryOpStub::GenerateStringStub(MacroAssembler* masm) {
}
+void TypeRecordingBinaryOpStub::GenerateOddballStub(MacroAssembler* masm) {
+ Label call_runtime;
+
+ if (op_ == Token::ADD) {
+ // Handle string addition here, because it is the only operation
+ // that does not do a ToNumber conversion on the operands.
+ GenerateStringAddCode(masm);
+ }
+
+ // Convert oddball arguments to numbers.
+ NearLabel check, done;
+ __ CompareRoot(rdx, Heap::kUndefinedValueRootIndex);
+ __ j(not_equal, &check);
+ if (Token::IsBitOp(op_)) {
+ __ xor_(rdx, rdx);
+ } else {
+ __ LoadRoot(rdx, Heap::kNanValueRootIndex);
+ }
+ __ jmp(&done);
+ __ bind(&check);
+ __ CompareRoot(rax, Heap::kUndefinedValueRootIndex);
+ __ j(not_equal, &done);
+ if (Token::IsBitOp(op_)) {
+ __ xor_(rax, rax);
+ } else {
+ __ LoadRoot(rax, Heap::kNanValueRootIndex);
+ }
+ __ bind(&done);
+
+ GenerateHeapNumberStub(masm);
+}
+
+
void TypeRecordingBinaryOpStub::GenerateHeapNumberStub(MacroAssembler* masm) {
Label gc_required, not_number;
GenerateFloatingPointCode(masm, &gc_required, &not_number);
View
1 deps/v8/src/x64/code-stubs-x64.h
@@ -289,6 +289,7 @@ class TypeRecordingBinaryOpStub: public CodeStub {
void GenerateSmiStub(MacroAssembler* masm);
void GenerateInt32Stub(MacroAssembler* masm);
void GenerateHeapNumberStub(MacroAssembler* masm);
+ void GenerateOddballStub(MacroAssembler* masm);
void GenerateStringStub(MacroAssembler* masm);
void GenerateGenericStub(MacroAssembler* masm);

0 comments on commit ad861e1

Please sign in to comment.