Navigation Menu

Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Upgrade V8 to 3.5.8
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Aug 26, 2011
1 parent 8af0abd commit 028908a
Show file tree
Hide file tree
Showing 44 changed files with 731 additions and 402 deletions.
11 changes: 11 additions & 0 deletions deps/v8/ChangeLog
@@ -1,3 +1,14 @@
2011-08-24: Version 3.5.8

Added V8EXPORT attributes for v8::Array::CheckCast and
v8::Number::CheckCast.

Made a slight API change enabling opting out from null termination
in String::Write*().

Fixed arm build for gcc-4.6.


2011-08-22: Version 3.5.7

Make scanner handle invalid unicode escapes in identifiers correctly.
Expand Down
Empty file modified deps/v8/include/v8-debug.h 100755 → 100644
Empty file.
21 changes: 11 additions & 10 deletions deps/v8/include/v8.h
Expand Up @@ -1039,29 +1039,30 @@ class String : public Primitive {
* \param length The number of characters to copy from the string. For
* WriteUtf8 the number of bytes in the buffer.
* \param nchars_ref The number of characters written, can be NULL.
* \param hints Various hints that might affect performance of this or
* \param options Various options that might affect performance of this or
* subsequent operations.
* \return The number of characters copied to the buffer excluding the null
* terminator. For WriteUtf8: The number of bytes copied to the buffer
* including the null terminator.
* including the null terminator (if written).
*/
enum WriteHints {
NO_HINTS = 0,
HINT_MANY_WRITES_EXPECTED = 1
enum WriteOptions {
NO_OPTIONS = 0,
HINT_MANY_WRITES_EXPECTED = 1,
NO_NULL_TERMINATION = 2
};

V8EXPORT int Write(uint16_t* buffer,
int start = 0,
int length = -1,
WriteHints hints = NO_HINTS) const; // UTF-16
int options = NO_OPTIONS) const; // UTF-16
V8EXPORT int WriteAscii(char* buffer,
int start = 0,
int length = -1,
WriteHints hints = NO_HINTS) const; // ASCII
int options = NO_OPTIONS) const; // ASCII
V8EXPORT int WriteUtf8(char* buffer,
int length = -1,
int* nchars_ref = NULL,
WriteHints hints = NO_HINTS) const; // UTF-8
int options = NO_OPTIONS) const; // UTF-8

/**
* A zero length string.
Expand Down Expand Up @@ -1335,7 +1336,7 @@ class Number : public Primitive {
static inline Number* Cast(v8::Value* obj);
private:
V8EXPORT Number();
static void CheckCast(v8::Value* obj);
V8EXPORT static void CheckCast(v8::Value* obj);
};


Expand Down Expand Up @@ -1709,7 +1710,7 @@ class Array : public Object {
static inline Array* Cast(Value* obj);
private:
V8EXPORT Array();
static void CheckCast(Value* obj);
V8EXPORT static void CheckCast(Value* obj);
};


Expand Down
Empty file modified deps/v8/src/SConscript 100755 → 100644
Empty file.
22 changes: 12 additions & 10 deletions deps/v8/src/api.cc
Expand Up @@ -3621,15 +3621,15 @@ int String::Utf8Length() const {
int String::WriteUtf8(char* buffer,
int capacity,
int* nchars_ref,
WriteHints hints) const {
int options) const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::String::WriteUtf8()")) return 0;
LOG_API(isolate, "String::WriteUtf8");
ENTER_V8(isolate);
i::StringInputBuffer& write_input_buffer = *isolate->write_input_buffer();
i::Handle<i::String> str = Utils::OpenHandle(this);
isolate->string_tracker()->RecordWrite(str);
if (hints & HINT_MANY_WRITES_EXPECTED) {
if (options & HINT_MANY_WRITES_EXPECTED) {
// Flatten the string for efficiency. This applies whether we are
// using StringInputBuffer or Get(i) to access the characters.
str->TryFlatten();
Expand Down Expand Up @@ -3669,7 +3669,8 @@ int String::WriteUtf8(char* buffer,
}
}
if (nchars_ref != NULL) *nchars_ref = nchars;
if (i == len && (capacity == -1 || pos < capacity))
if (!(options & NO_NULL_TERMINATION) &&
(i == len && (capacity == -1 || pos < capacity)))
buffer[pos++] = '\0';
return pos;
}
Expand All @@ -3678,7 +3679,7 @@ int String::WriteUtf8(char* buffer,
int String::WriteAscii(char* buffer,
int start,
int length,
WriteHints hints) const {
int options) const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::String::WriteAscii()")) return 0;
LOG_API(isolate, "String::WriteAscii");
Expand All @@ -3687,7 +3688,7 @@ int String::WriteAscii(char* buffer,
ASSERT(start >= 0 && length >= -1);
i::Handle<i::String> str = Utils::OpenHandle(this);
isolate->string_tracker()->RecordWrite(str);
if (hints & HINT_MANY_WRITES_EXPECTED) {
if (options & HINT_MANY_WRITES_EXPECTED) {
// Flatten the string for efficiency. This applies whether we are
// using StringInputBuffer or Get(i) to access the characters.
str->TryFlatten();
Expand All @@ -3703,7 +3704,7 @@ int String::WriteAscii(char* buffer,
if (c == '\0') c = ' ';
buffer[i] = c;
}
if (length == -1 || i < length)
if (!(options & NO_NULL_TERMINATION) && (length == -1 || i < length))
buffer[i] = '\0';
return i;
}
Expand All @@ -3712,15 +3713,15 @@ int String::WriteAscii(char* buffer,
int String::Write(uint16_t* buffer,
int start,
int length,
WriteHints hints) const {
int options) const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
if (IsDeadCheck(isolate, "v8::String::Write()")) return 0;
LOG_API(isolate, "String::Write");
ENTER_V8(isolate);
ASSERT(start >= 0 && length >= -1);
i::Handle<i::String> str = Utils::OpenHandle(this);
isolate->string_tracker()->RecordWrite(str);
if (hints & HINT_MANY_WRITES_EXPECTED) {
if (options & HINT_MANY_WRITES_EXPECTED) {
// Flatten the string for efficiency. This applies whether we are
// using StringInputBuffer or Get(i) to access the characters.
str->TryFlatten();
Expand All @@ -3730,7 +3731,8 @@ int String::Write(uint16_t* buffer,
end = str->length();
if (end < 0) return 0;
i::String::WriteToFlat(*str, buffer, start, end);
if (length == -1 || end - start < length) {
if (!(options & NO_NULL_TERMINATION) &&
(length == -1 || end - start < length)) {
buffer[end - start] = '\0';
}
return end - start;
Expand Down Expand Up @@ -4118,7 +4120,7 @@ bool Context::InContext() {

v8::Local<v8::Context> Context::GetEntered() {
i::Isolate* isolate = i::Isolate::Current();
if (IsDeadCheck(isolate, "v8::Context::GetEntered()")) {
if (!EnsureInitializedForIsolate(isolate, "v8::Context::GetEntered()")) {
return Local<Context>();
}
i::Handle<i::Object> last =
Expand Down
3 changes: 3 additions & 0 deletions deps/v8/src/arm/assembler-arm.h
Expand Up @@ -377,6 +377,9 @@ class Operand BASE_EMBEDDED {
// immediate
INLINE(explicit Operand(int32_t immediate,
RelocInfo::Mode rmode = RelocInfo::NONE));
INLINE(static Operand Zero()) {
return Operand(static_cast<int32_t>(0));
}
INLINE(explicit Operand(const ExternalReference& f));
explicit Operand(Handle<Object> handle);
INLINE(explicit Operand(Smi* value));
Expand Down
32 changes: 15 additions & 17 deletions deps/v8/src/arm/code-stubs-arm.cc
Expand Up @@ -549,15 +549,15 @@ void FloatingPointHelper::ConvertIntToDouble(MacroAssembler* masm,
// | s | exp | mantissa |

// Check for zero.
__ cmp(int_scratch, Operand(0));
__ cmp(int_scratch, Operand::Zero());
__ mov(dst2, int_scratch);
__ mov(dst1, int_scratch);
__ b(eq, &done);

// Preload the sign of the value.
__ and_(dst2, int_scratch, Operand(HeapNumber::kSignMask), SetCC);
// Get the absolute value of the object (as an unsigned integer).
__ rsb(int_scratch, int_scratch, Operand(0), SetCC, mi);
__ rsb(int_scratch, int_scratch, Operand::Zero(), SetCC, mi);

// Get mantisssa[51:20].

Expand Down Expand Up @@ -589,7 +589,7 @@ void FloatingPointHelper::ConvertIntToDouble(MacroAssembler* masm,
__ mov(scratch2, Operand(int_scratch, LSL, scratch2));
__ orr(dst2, dst2, scratch2);
// Set dst1 to 0.
__ mov(dst1, Operand(0));
__ mov(dst1, Operand::Zero());
}
__ bind(&done);
}
Expand Down Expand Up @@ -657,7 +657,7 @@ void FloatingPointHelper::LoadNumberAsInt32Double(MacroAssembler* masm,
// Check for 0 and -0.
__ bic(scratch1, dst1, Operand(HeapNumber::kSignMask));
__ orr(scratch1, scratch1, Operand(dst2));
__ cmp(scratch1, Operand(0));
__ cmp(scratch1, Operand::Zero());
__ b(eq, &done);

// Check that the value can be exactly represented by a 32-bit integer.
Expand Down Expand Up @@ -730,7 +730,7 @@ void FloatingPointHelper::LoadNumberAsInt32(MacroAssembler* masm,
// Check for 0 and -0.
__ bic(dst, scratch1, Operand(HeapNumber::kSignMask));
__ orr(dst, scratch2, Operand(dst));
__ cmp(dst, Operand(0));
__ cmp(dst, Operand::Zero());
__ b(eq, &done);

DoubleIs32BitInteger(masm, scratch1, scratch2, dst, scratch3, not_int32);
Expand All @@ -747,7 +747,7 @@ void FloatingPointHelper::LoadNumberAsInt32(MacroAssembler* masm,
// Set the sign.
__ ldr(scratch1, FieldMemOperand(object, HeapNumber::kExponentOffset));
__ tst(scratch1, Operand(HeapNumber::kSignMask));
__ rsb(dst, dst, Operand(0), LeaveCC, mi);
__ rsb(dst, dst, Operand::Zero(), LeaveCC, mi);
}

__ bind(&done);
Expand Down Expand Up @@ -2424,7 +2424,6 @@ void BinaryOpStub::GenerateSmiCode(
Register left = r1;
Register right = r0;
Register scratch1 = r7;
Register scratch2 = r9;

// Perform combined smi check on both operands.
__ orr(scratch1, left, Operand(right));
Expand Down Expand Up @@ -2618,7 +2617,7 @@ void BinaryOpStub::GenerateInt32Stub(MacroAssembler* masm) {
__ b(mi, &return_heap_number);
// Check for minus zero. Return heap number for minus zero.
Label not_zero;
__ cmp(scratch1, Operand(0));
__ cmp(scratch1, Operand::Zero());
__ b(ne, &not_zero);
__ vmov(scratch2, d5.high());
__ tst(scratch2, Operand(HeapNumber::kSignMask));
Expand Down Expand Up @@ -3110,7 +3109,6 @@ void TranscendentalCacheStub::Generate(MacroAssembler* masm) {

Label no_update;
Label skip_cache;
const Register heap_number_map = r5;

// Call C function to calculate the result and update the cache.
// Register r0 holds precalculated cache entry address; preserve
Expand Down Expand Up @@ -3581,7 +3579,7 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
ExternalReference js_entry_sp(Isolate::k_js_entry_sp_address, isolate);
__ mov(r5, Operand(ExternalReference(js_entry_sp)));
__ ldr(r6, MemOperand(r5));
__ cmp(r6, Operand(0));
__ cmp(r6, Operand::Zero());
__ b(ne, &non_outermost_js);
__ str(fp, MemOperand(r5));
__ mov(ip, Operand(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME)));
Expand Down Expand Up @@ -3656,7 +3654,7 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
__ pop(r5);
__ cmp(r5, Operand(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME)));
__ b(ne, &non_outermost_js_2);
__ mov(r6, Operand(0));
__ mov(r6, Operand::Zero());
__ mov(r5, Operand(ExternalReference(js_entry_sp)));
__ str(r6, MemOperand(r5));
__ bind(&non_outermost_js_2);
Expand Down Expand Up @@ -3857,7 +3855,7 @@ void InstanceofStub::Generate(MacroAssembler* masm) {
__ Push(r0, r1);
__ InvokeBuiltin(Builtins::INSTANCE_OF, CALL_FUNCTION);
__ LeaveInternalFrame();
__ cmp(r0, Operand(0));
__ cmp(r0, Operand::Zero());
__ LoadRoot(r0, Heap::kTrueValueRootIndex, eq);
__ LoadRoot(r0, Heap::kFalseValueRootIndex, ne);
__ Ret(HasArgsInRegisters() ? 0 : 2);
Expand Down Expand Up @@ -3991,7 +3989,7 @@ void ArgumentsAccessStub::GenerateNewNonStrictFast(MacroAssembler* masm) {
FixedArray::kHeaderSize + 2 * kPointerSize;
// If there are no mapped parameters, we do not need the parameter_map.
__ cmp(r1, Operand(Smi::FromInt(0)));
__ mov(r9, Operand(0), LeaveCC, eq);
__ mov(r9, Operand::Zero(), LeaveCC, eq);
__ mov(r9, Operand(r1, LSL, 1), LeaveCC, ne);
__ add(r9, r9, Operand(kParameterMapHeaderSize), LeaveCC, ne);

Expand All @@ -4015,7 +4013,7 @@ void ArgumentsAccessStub::GenerateNewNonStrictFast(MacroAssembler* masm) {

__ ldr(r4, MemOperand(r8, Context::SlotOffset(Context::GLOBAL_INDEX)));
__ ldr(r4, FieldMemOperand(r4, GlobalObject::kGlobalContextOffset));
__ cmp(r1, Operand(0));
__ cmp(r1, Operand::Zero());
__ ldr(r4, MemOperand(r4, kNormalOffset), eq);
__ ldr(r4, MemOperand(r4, kAliasedOffset), ne);

Expand Down Expand Up @@ -5697,7 +5695,7 @@ void StringCompareStub::GenerateAsciiCharsCompareLoop(
Operand(SeqAsciiString::kHeaderSize - kHeapObjectTag));
__ add(left, left, Operand(scratch1));
__ add(right, right, Operand(scratch1));
__ rsb(length, length, Operand(0));
__ rsb(length, length, Operand::Zero());
Register index = length; // index = -length;

// Compare loop.
Expand Down Expand Up @@ -6555,7 +6553,7 @@ void StringDictionaryLookupStub::Generate(MacroAssembler* masm) {
// treated as a lookup success. For positive lookup probing failure
// should be treated as lookup failure.
if (mode_ == POSITIVE_LOOKUP) {
__ mov(result, Operand(0));
__ mov(result, Operand::Zero());
__ Ret();
}

Expand All @@ -6564,7 +6562,7 @@ void StringDictionaryLookupStub::Generate(MacroAssembler* masm) {
__ Ret();

__ bind(&not_in_dictionary);
__ mov(result, Operand(0));
__ mov(result, Operand::Zero());
__ Ret();
}

Expand Down
3 changes: 0 additions & 3 deletions deps/v8/src/arm/full-codegen-arm.cc
Expand Up @@ -4129,11 +4129,8 @@ void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) {
default: {
VisitForAccumulatorValue(expr->right());
Condition cond = eq;
bool strict = false;
switch (op) {
case Token::EQ_STRICT:
strict = true;
// Fall through
case Token::EQ:
cond = eq;
__ pop(r1);
Expand Down
1 change: 0 additions & 1 deletion deps/v8/src/arm/lithium-arm.cc
Expand Up @@ -1399,7 +1399,6 @@ LInstruction* LChunkBuilder::DoPower(HPower* instr) {

LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) {
Token::Value op = instr->token();
Representation r = instr->GetInputRepresentation();
ASSERT(instr->left()->representation().IsTagged());
ASSERT(instr->right()->representation().IsTagged());
bool reversed = (op == Token::GT || op == Token::LTE);
Expand Down
3 changes: 0 additions & 3 deletions deps/v8/src/arm/lithium-codegen-arm.cc
Expand Up @@ -1804,7 +1804,6 @@ Condition LCodeGen::EmitIsObject(Register input,
void LCodeGen::DoIsObjectAndBranch(LIsObjectAndBranch* instr) {
Register reg = ToRegister(instr->InputAt(0));
Register temp1 = ToRegister(instr->TempAt(0));
Register temp2 = scratch0();

int true_block = chunk_->LookupDestination(instr->true_block_id());
int false_block = chunk_->LookupDestination(instr->false_block_id());
Expand Down Expand Up @@ -2759,7 +2758,6 @@ void LCodeGen::DoOuterContext(LOuterContext* instr) {


void LCodeGen::DoGlobalObject(LGlobalObject* instr) {
Register context = ToRegister(instr->context());
Register result = ToRegister(instr->result());
__ ldr(result, ContextOperand(cp, Context::GLOBAL_INDEX));
}
Expand Down Expand Up @@ -3965,7 +3963,6 @@ void LCodeGen::DoDoubleToI(LDoubleToI* instr) {
Register scratch1 = scratch0();
Register scratch2 = ToRegister(instr->TempAt(0));
DwVfpRegister double_input = ToDoubleRegister(instr->InputAt(0));
DwVfpRegister double_scratch = double_scratch0();
SwVfpRegister single_scratch = double_scratch0().low();

Label done;
Expand Down
4 changes: 1 addition & 3 deletions deps/v8/src/arm/lithium-gap-resolver-arm.cc
Expand Up @@ -254,7 +254,6 @@ void LGapResolver::EmitMove(int index) {
} else {
ASSERT(destination->IsStackSlot());
ASSERT(!in_cycle_); // Constant moves happen after all cycles are gone.
MemOperand destination_operand = cgen_->ToMemOperand(destination);
__ mov(kSavedValueRegister, source_operand);
__ str(kSavedValueRegister, cgen_->ToMemOperand(destination));
}
Expand All @@ -265,8 +264,7 @@ void LGapResolver::EmitMove(int index) {
__ vmov(cgen_->ToDoubleRegister(destination), source_register);
} else {
ASSERT(destination->IsDoubleStackSlot());
MemOperand destination_operand = cgen_->ToMemOperand(destination);
__ vstr(source_register, destination_operand);
__ vstr(source_register, cgen_->ToMemOperand(destination));
}

} else if (source->IsDoubleStackSlot()) {
Expand Down
5 changes: 2 additions & 3 deletions deps/v8/src/arm/stub-cache-arm.cc
Expand Up @@ -1183,9 +1183,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.
__ mov(r0, Operand(Handle<Object>(value)));
Expand Down

0 comments on commit 028908a

Please sign in to comment.