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

Commit

Permalink
Merge branch 'v0.4'
Browse files Browse the repository at this point in the history
Conflicts:
	src/node_version.h
	test/simple/test-buffer.js
  • Loading branch information
ry committed Apr 4, 2011
2 parents 7ee8c56 + dcc2dd5 commit bfa9db9
Show file tree
Hide file tree
Showing 66 changed files with 1,133 additions and 156 deletions.
4 changes: 4 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,7 @@ Konstantin Käfer <github@kkaefer.com>
Richard Rodger <richard@ricebridge.com>
Andreas Reich <andreas@reich.name>
Dean McNamee <dean@gmail.com>
Trevor Burnham <trevor@databraid.com>
Zachary Scott <zachary.s.scott@gmail.com>
Arnout Kazemier <info@3rd-Eden.com>

38 changes: 37 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,40 @@
2011.03.18, Version 0.4.3 (stable)
2011.04.01, Version 0.4.5 (stable)

* Fix listener leak in stream.pipe() (Mikeal Rogers)

* Retain buffers in fs.read/write() GH-814 (Jorge Chamorro Bieling)

* TLS performance improvements

* SlowBuffer.prototype.slice bug GH-843

* process.stderr.write should return true

* Immediate pause/resume race condition GH-535 (isaacs)

* Set default host header properly GH-721 (isaacs)

* Upgrade V8 to 3.1.8.8


2011.03.26, Version 0.4.4 (stable), 25122b986a90ba0982697b7abcb0158c302a1019

* CryptoStream.end shouldn't throw if not writable GH-820

* Drop out if connection destroyed before connect() GH-819

* expose https.Agent

* Correctly setsid in tty.open GH-815

* Bug fix for failed buffer construction

* Added support for removing .once listeners (GH-806)

* Upgrade V8 to 3.1.8.5


2011.03.18, Version 0.4.3 (stable), c095ce1a1b41ca015758a713283bf1f0bd41e4c4

* Don't decrease server connection counter again if destroy() is called more
than once GH-431 (Andreas Reich, Anders Conbere)
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ website_files = \
build/doc/sh_vim-dark.css \
build/doc/logo.png \
build/doc/sponsored.png \
build/doc/favicon.ico \
build/doc/pipe.css

doc: build/default/node $(apidoc_dirs) $(website_files) $(apiassets) $(apidocs)
Expand Down
40 changes: 38 additions & 2 deletions deps/v8/src/arm/code-stubs-arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions deps/v8/src/arm/code-stubs-arm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions deps/v8/src/arm/deoptimizer-arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ int Deoptimizer::patch_size() {
}


void Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(Handle<Code> code) {
// Nothing to do. No new relocation information is written for lazy
// deoptimization on ARM.
}


void Deoptimizer::DeoptimizeFunction(JSFunction* function) {
AssertNoAllocation no_allocation;
Expand Down
1 change: 1 addition & 0 deletions deps/v8/src/arm/lithium-codegen-arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ void LCodeGen::FinishCode(Handle<Code> code) {
code->set_stack_slots(StackSlotCount());
code->set_safepoint_table_offset(safepoints_.GetCodeOffset());
PopulateDeoptimizationData(code);
Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(code);
}


Expand Down
1 change: 1 addition & 0 deletions deps/v8/src/assembler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ const int kPCJumpTag = (1 << kExtraTagBits) - 1;

const int kSmallPCDeltaBits = kBitsPerByte - kTagBits;
const int kSmallPCDeltaMask = (1 << kSmallPCDeltaBits) - 1;
const int RelocInfo::kMaxSmallPCDelta = kSmallPCDeltaMask;

const int kVariableLengthPCJumpTopTag = 1;
const int kChunkBits = 7;
Expand Down
3 changes: 3 additions & 0 deletions deps/v8/src/assembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ class RelocInfo BASE_EMBEDDED {
// The maximum size for a call instruction including pc-jump.
static const int kMaxCallSize = 6;

// The maximum pc delta that will use the short encoding.
static const int kMaxSmallPCDelta;

enum Mode {
// Please note the order is important (see IsCodeTarget, IsGCRelocMode).
CONSTRUCT_CALL, // code target that is a call to a JavaScript constructor.
Expand Down
7 changes: 7 additions & 0 deletions deps/v8/src/deoptimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ class Deoptimizer : public Malloced {
int fp_to_sp_delta);
static Deoptimizer* Grab();

// Makes sure that there is enough room in the relocation
// information of a code object to perform lazy deoptimization
// patching. If there is not enough room a new relocation
// information object is allocated and comments are added until it
// is big enough.
static void EnsureRelocSpaceForLazyDeoptimization(Handle<Code> code);

// Deoptimize the function now. Its current optimized code will never be run
// again and any activations of the optimized code will get deoptimized when
// execution returns.
Expand Down
1 change: 1 addition & 0 deletions deps/v8/src/heap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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") \
Expand Down
9 changes: 7 additions & 2 deletions deps/v8/src/hydrogen-instructions.h
Original file line number Diff line number Diff line change
Expand Up @@ -1423,8 +1423,9 @@ class HJSArrayLength: public HUnaryOperation {
// object. It is guaranteed to be 32 bit integer, but it can be
// represented as either a smi or heap number.
set_representation(Representation::Tagged());
SetFlag(kDependsOnArrayLengths);
SetFlag(kUseGVN);
SetFlag(kDependsOnArrayLengths);
SetFlag(kDependsOnMaps);
}

virtual Representation RequiredInputRepresentation(int index) const {
Expand All @@ -1442,8 +1443,8 @@ class HFixedArrayLength: public HUnaryOperation {
public:
explicit HFixedArrayLength(HValue* value) : HUnaryOperation(value) {
set_representation(Representation::Tagged());
SetFlag(kDependsOnArrayLengths);
SetFlag(kUseGVN);
SetFlag(kDependsOnArrayLengths);
}

virtual Representation RequiredInputRepresentation(int index) const {
Expand Down Expand Up @@ -2268,6 +2269,7 @@ class HCompareJSObjectEq: public HBinaryOperation {
: HBinaryOperation(left, right) {
set_representation(Representation::Tagged());
SetFlag(kUseGVN);
SetFlag(kDependsOnMaps);
}

virtual bool EmitAtUses() const {
Expand Down Expand Up @@ -2943,6 +2945,7 @@ class HLoadNamedField: public HUnaryOperation {
offset_(offset) {
set_representation(Representation::Tagged());
SetFlag(kUseGVN);
SetFlag(kDependsOnMaps);
if (is_in_object) {
SetFlag(kDependsOnInobjectFields);
} else {
Expand Down Expand Up @@ -3269,6 +3272,7 @@ class HStringCharCodeAt: public HBinaryOperation {
: HBinaryOperation(string, index) {
set_representation(Representation::Integer32());
SetFlag(kUseGVN);
SetFlag(kDependsOnMaps);
}

virtual Representation RequiredInputRepresentation(int index) const {
Expand Down Expand Up @@ -3296,6 +3300,7 @@ class HStringLength: public HUnaryOperation {
explicit HStringLength(HValue* string) : HUnaryOperation(string) {
set_representation(Representation::Tagged());
SetFlag(kUseGVN);
SetFlag(kDependsOnMaps);
}

virtual Representation RequiredInputRepresentation(int index) const {
Expand Down
37 changes: 36 additions & 1 deletion deps/v8/src/ia32/code-stubs-ia32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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_) {
Expand Down
1 change: 1 addition & 0 deletions deps/v8/src/ia32/code-stubs-ia32.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
74 changes: 74 additions & 0 deletions deps/v8/src/ia32/deoptimizer-ia32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,80 @@ static void ZapCodeRange(Address start, Address end) {
}


void Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(Handle<Code> code) {
HandleScope scope;

// Compute the size of relocation information needed for the code
// patching in Deoptimizer::DeoptimizeFunction.
int min_reloc_size = 0;
Address prev_reloc_address = code->instruction_start();
Address code_start_address = code->instruction_start();
SafepointTable table(*code);
for (unsigned i = 0; i < table.length(); ++i) {
Address curr_reloc_address = code_start_address + table.GetPcOffset(i);
ASSERT_GE(curr_reloc_address, prev_reloc_address);
SafepointEntry safepoint_entry = table.GetEntry(i);
int deoptimization_index = safepoint_entry.deoptimization_index();
if (deoptimization_index != Safepoint::kNoDeoptimizationIndex) {
// The gap code is needed to get to the state expected at the
// bailout and we need to skip the call opcode to get to the
// address that needs reloc.
curr_reloc_address += safepoint_entry.gap_code_size() + 1;
int pc_delta = curr_reloc_address - prev_reloc_address;
// We use RUNTIME_ENTRY reloc info which has a size of 2 bytes
// if encodable with small pc delta encoding and up to 6 bytes
// otherwise.
if (pc_delta <= RelocInfo::kMaxSmallPCDelta) {
min_reloc_size += 2;
} else {
min_reloc_size += 6;
}
prev_reloc_address = curr_reloc_address;
}
}

// If the relocation information is not big enough we create a new
// relocation info object that is padded with comments to make it
// big enough for lazy doptimization.
int reloc_length = code->relocation_info()->length();
if (min_reloc_size > reloc_length) {
int comment_reloc_size = RelocInfo::kMinRelocCommentSize;
// Padding needed.
int min_padding = min_reloc_size - reloc_length;
// Number of comments needed to take up at least that much space.
int additional_comments =
(min_padding + comment_reloc_size - 1) / comment_reloc_size;
// Actual padding size.
int padding = additional_comments * comment_reloc_size;
// Allocate new relocation info and copy old relocation to the end
// of the new relocation info array because relocation info is
// written and read backwards.
Handle<ByteArray> new_reloc =
Factory::NewByteArray(reloc_length + padding, TENURED);
memcpy(new_reloc->GetDataStartAddress() + padding,
code->relocation_info()->GetDataStartAddress(),
reloc_length);
// Create a relocation writer to write the comments in the padding
// space. Use position 0 for everything to ensure short encoding.
RelocInfoWriter reloc_info_writer(
new_reloc->GetDataStartAddress() + padding, 0);
intptr_t comment_string
= reinterpret_cast<intptr_t>(RelocInfo::kFillerCommentString);
RelocInfo rinfo(0, RelocInfo::COMMENT, comment_string);
for (int i = 0; i < additional_comments; ++i) {
#ifdef DEBUG
byte* pos_before = reloc_info_writer.pos();
#endif
reloc_info_writer.Write(&rinfo);
ASSERT(RelocInfo::kMinRelocCommentSize ==
pos_before - reloc_info_writer.pos());
}
// Replace relocation information on the code object.
code->set_relocation_info(*new_reloc);
}
}


void Deoptimizer::DeoptimizeFunction(JSFunction* function) {
AssertNoAllocation no_allocation;

Expand Down
Loading

0 comments on commit bfa9db9

Please sign in to comment.