Skip to content

Commit bfa9db9

Browse files
committed
Merge branch 'v0.4'
Conflicts: src/node_version.h test/simple/test-buffer.js
2 parents 7ee8c56 + dcc2dd5 commit bfa9db9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1133
-156
lines changed

AUTHORS

+4
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,7 @@ Konstantin Käfer <[email protected]>
164164
Richard Rodger <[email protected]>
165165
Andreas Reich <[email protected]>
166166
Dean McNamee <[email protected]>
167+
Trevor Burnham <[email protected]>
168+
Zachary Scott <[email protected]>
169+
Arnout Kazemier <[email protected]>
170+

ChangeLog

+37-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,40 @@
1-
2011.03.18, Version 0.4.3 (stable)
1+
2011.04.01, Version 0.4.5 (stable)
2+
3+
* Fix listener leak in stream.pipe() (Mikeal Rogers)
4+
5+
* Retain buffers in fs.read/write() GH-814 (Jorge Chamorro Bieling)
6+
7+
* TLS performance improvements
8+
9+
* SlowBuffer.prototype.slice bug GH-843
10+
11+
* process.stderr.write should return true
12+
13+
* Immediate pause/resume race condition GH-535 (isaacs)
14+
15+
* Set default host header properly GH-721 (isaacs)
16+
17+
* Upgrade V8 to 3.1.8.8
18+
19+
20+
2011.03.26, Version 0.4.4 (stable), 25122b986a90ba0982697b7abcb0158c302a1019
21+
22+
* CryptoStream.end shouldn't throw if not writable GH-820
23+
24+
* Drop out if connection destroyed before connect() GH-819
25+
26+
* expose https.Agent
27+
28+
* Correctly setsid in tty.open GH-815
29+
30+
* Bug fix for failed buffer construction
31+
32+
* Added support for removing .once listeners (GH-806)
33+
34+
* Upgrade V8 to 3.1.8.5
35+
36+
37+
2011.03.18, Version 0.4.3 (stable), c095ce1a1b41ca015758a713283bf1f0bd41e4c4
238

339
* Don't decrease server connection counter again if destroy() is called more
440
than once GH-431 (Andreas Reich, Anders Conbere)

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ website_files = \
7070
build/doc/sh_vim-dark.css \
7171
build/doc/logo.png \
7272
build/doc/sponsored.png \
73+
build/doc/favicon.ico \
7374
build/doc/pipe.css
7475

7576
doc: build/default/node $(apidoc_dirs) $(website_files) $(apiassets) $(apidocs)

deps/v8/src/arm/code-stubs-arm.cc

+38-2
Original file line numberDiff line numberDiff line change
@@ -2856,6 +2856,9 @@ void TypeRecordingBinaryOpStub::Generate(MacroAssembler* masm) {
28562856
case TRBinaryOpIC::HEAP_NUMBER:
28572857
GenerateHeapNumberStub(masm);
28582858
break;
2859+
case TRBinaryOpIC::ODDBALL:
2860+
GenerateOddballStub(masm);
2861+
break;
28592862
case TRBinaryOpIC::STRING:
28602863
GenerateStringStub(masm);
28612864
break;
@@ -3572,10 +3575,43 @@ void TypeRecordingBinaryOpStub::GenerateInt32Stub(MacroAssembler* masm) {
35723575
}
35733576

35743577

3578+
void TypeRecordingBinaryOpStub::GenerateOddballStub(MacroAssembler* masm) {
3579+
Label call_runtime;
3580+
3581+
if (op_ == Token::ADD) {
3582+
// Handle string addition here, because it is the only operation
3583+
// that does not do a ToNumber conversion on the operands.
3584+
GenerateAddStrings(masm);
3585+
}
3586+
3587+
// Convert oddball arguments to numbers.
3588+
Label check, done;
3589+
__ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
3590+
__ cmp(r1, ip);
3591+
__ b(ne, &check);
3592+
if (Token::IsBitOp(op_)) {
3593+
__ mov(r1, Operand(Smi::FromInt(0)));
3594+
} else {
3595+
__ LoadRoot(r1, Heap::kNanValueRootIndex);
3596+
}
3597+
__ jmp(&done);
3598+
__ bind(&check);
3599+
__ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
3600+
__ cmp(r0, ip);
3601+
__ b(ne, &done);
3602+
if (Token::IsBitOp(op_)) {
3603+
__ mov(r0, Operand(Smi::FromInt(0)));
3604+
} else {
3605+
__ LoadRoot(r0, Heap::kNanValueRootIndex);
3606+
}
3607+
__ bind(&done);
3608+
3609+
GenerateHeapNumberStub(masm);
3610+
}
3611+
3612+
35753613
void TypeRecordingBinaryOpStub::GenerateHeapNumberStub(MacroAssembler* masm) {
35763614
Label not_numbers, call_runtime;
3577-
ASSERT(operands_type_ == TRBinaryOpIC::HEAP_NUMBER);
3578-
35793615
GenerateFPOperation(masm, false, &not_numbers, &call_runtime);
35803616

35813617
__ bind(&not_numbers);

deps/v8/src/arm/code-stubs-arm.h

+1
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ class TypeRecordingBinaryOpStub: public CodeStub {
302302
void GenerateSmiStub(MacroAssembler* masm);
303303
void GenerateInt32Stub(MacroAssembler* masm);
304304
void GenerateHeapNumberStub(MacroAssembler* masm);
305+
void GenerateOddballStub(MacroAssembler* masm);
305306
void GenerateStringStub(MacroAssembler* masm);
306307
void GenerateGenericStub(MacroAssembler* masm);
307308
void GenerateAddStrings(MacroAssembler* masm);

deps/v8/src/arm/deoptimizer-arm.cc

+5
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ int Deoptimizer::patch_size() {
4444
}
4545

4646

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

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

deps/v8/src/arm/lithium-codegen-arm.cc

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ void LCodeGen::FinishCode(Handle<Code> code) {
7575
code->set_stack_slots(StackSlotCount());
7676
code->set_safepoint_table_offset(safepoints_.GetCodeOffset());
7777
PopulateDeoptimizationData(code);
78+
Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(code);
7879
}
7980

8081

deps/v8/src/assembler.cc

+1
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ const int kPCJumpTag = (1 << kExtraTagBits) - 1;
139139

140140
const int kSmallPCDeltaBits = kBitsPerByte - kTagBits;
141141
const int kSmallPCDeltaMask = (1 << kSmallPCDeltaBits) - 1;
142+
const int RelocInfo::kMaxSmallPCDelta = kSmallPCDeltaMask;
142143

143144
const int kVariableLengthPCJumpTopTag = 1;
144145
const int kChunkBits = 7;

deps/v8/src/assembler.h

+3
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ class RelocInfo BASE_EMBEDDED {
192192
// The maximum size for a call instruction including pc-jump.
193193
static const int kMaxCallSize = 6;
194194

195+
// The maximum pc delta that will use the short encoding.
196+
static const int kMaxSmallPCDelta;
197+
195198
enum Mode {
196199
// Please note the order is important (see IsCodeTarget, IsGCRelocMode).
197200
CONSTRUCT_CALL, // code target that is a call to a JavaScript constructor.

deps/v8/src/deoptimizer.h

+7
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,13 @@ class Deoptimizer : public Malloced {
110110
int fp_to_sp_delta);
111111
static Deoptimizer* Grab();
112112

113+
// Makes sure that there is enough room in the relocation
114+
// information of a code object to perform lazy deoptimization
115+
// patching. If there is not enough room a new relocation
116+
// information object is allocated and comments are added until it
117+
// is big enough.
118+
static void EnsureRelocSpaceForLazyDeoptimization(Handle<Code> code);
119+
113120
// Deoptimize the function now. Its current optimized code will never be run
114121
// again and any activations of the optimized code will get deoptimized when
115122
// execution returns.

deps/v8/src/heap.h

+1
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ namespace internal {
163163
V(name_symbol, "name") \
164164
V(number_symbol, "number") \
165165
V(Number_symbol, "Number") \
166+
V(nan_symbol, "NaN") \
166167
V(RegExp_symbol, "RegExp") \
167168
V(source_symbol, "source") \
168169
V(global_symbol, "global") \

deps/v8/src/hydrogen-instructions.h

+7-2
Original file line numberDiff line numberDiff line change
@@ -1423,8 +1423,9 @@ class HJSArrayLength: public HUnaryOperation {
14231423
// object. It is guaranteed to be 32 bit integer, but it can be
14241424
// represented as either a smi or heap number.
14251425
set_representation(Representation::Tagged());
1426-
SetFlag(kDependsOnArrayLengths);
14271426
SetFlag(kUseGVN);
1427+
SetFlag(kDependsOnArrayLengths);
1428+
SetFlag(kDependsOnMaps);
14281429
}
14291430

14301431
virtual Representation RequiredInputRepresentation(int index) const {
@@ -1442,8 +1443,8 @@ class HFixedArrayLength: public HUnaryOperation {
14421443
public:
14431444
explicit HFixedArrayLength(HValue* value) : HUnaryOperation(value) {
14441445
set_representation(Representation::Tagged());
1445-
SetFlag(kDependsOnArrayLengths);
14461446
SetFlag(kUseGVN);
1447+
SetFlag(kDependsOnArrayLengths);
14471448
}
14481449

14491450
virtual Representation RequiredInputRepresentation(int index) const {
@@ -2268,6 +2269,7 @@ class HCompareJSObjectEq: public HBinaryOperation {
22682269
: HBinaryOperation(left, right) {
22692270
set_representation(Representation::Tagged());
22702271
SetFlag(kUseGVN);
2272+
SetFlag(kDependsOnMaps);
22712273
}
22722274

22732275
virtual bool EmitAtUses() const {
@@ -2943,6 +2945,7 @@ class HLoadNamedField: public HUnaryOperation {
29432945
offset_(offset) {
29442946
set_representation(Representation::Tagged());
29452947
SetFlag(kUseGVN);
2948+
SetFlag(kDependsOnMaps);
29462949
if (is_in_object) {
29472950
SetFlag(kDependsOnInobjectFields);
29482951
} else {
@@ -3269,6 +3272,7 @@ class HStringCharCodeAt: public HBinaryOperation {
32693272
: HBinaryOperation(string, index) {
32703273
set_representation(Representation::Integer32());
32713274
SetFlag(kUseGVN);
3275+
SetFlag(kDependsOnMaps);
32723276
}
32733277

32743278
virtual Representation RequiredInputRepresentation(int index) const {
@@ -3296,6 +3300,7 @@ class HStringLength: public HUnaryOperation {
32963300
explicit HStringLength(HValue* string) : HUnaryOperation(string) {
32973301
set_representation(Representation::Tagged());
32983302
SetFlag(kUseGVN);
3303+
SetFlag(kDependsOnMaps);
32993304
}
33003305

33013306
virtual Representation RequiredInputRepresentation(int index) const {

deps/v8/src/ia32/code-stubs-ia32.cc

+36-1
Original file line numberDiff line numberDiff line change
@@ -1342,6 +1342,9 @@ void TypeRecordingBinaryOpStub::Generate(MacroAssembler* masm) {
13421342
case TRBinaryOpIC::HEAP_NUMBER:
13431343
GenerateHeapNumberStub(masm);
13441344
break;
1345+
case TRBinaryOpIC::ODDBALL:
1346+
GenerateOddballStub(masm);
1347+
break;
13451348
case TRBinaryOpIC::STRING:
13461349
GenerateStringStub(masm);
13471350
break;
@@ -2006,9 +2009,41 @@ void TypeRecordingBinaryOpStub::GenerateInt32Stub(MacroAssembler* masm) {
20062009
}
20072010

20082011

2012+
void TypeRecordingBinaryOpStub::GenerateOddballStub(MacroAssembler* masm) {
2013+
Label call_runtime;
2014+
2015+
if (op_ == Token::ADD) {
2016+
// Handle string addition here, because it is the only operation
2017+
// that does not do a ToNumber conversion on the operands.
2018+
GenerateAddStrings(masm);
2019+
}
2020+
2021+
// Convert odd ball arguments to numbers.
2022+
NearLabel check, done;
2023+
__ cmp(edx, Factory::undefined_value());
2024+
__ j(not_equal, &check);
2025+
if (Token::IsBitOp(op_)) {
2026+
__ xor_(edx, Operand(edx));
2027+
} else {
2028+
__ mov(edx, Immediate(Factory::nan_value()));
2029+
}
2030+
__ jmp(&done);
2031+
__ bind(&check);
2032+
__ cmp(eax, Factory::undefined_value());
2033+
__ j(not_equal, &done);
2034+
if (Token::IsBitOp(op_)) {
2035+
__ xor_(eax, Operand(eax));
2036+
} else {
2037+
__ mov(eax, Immediate(Factory::nan_value()));
2038+
}
2039+
__ bind(&done);
2040+
2041+
GenerateHeapNumberStub(masm);
2042+
}
2043+
2044+
20092045
void TypeRecordingBinaryOpStub::GenerateHeapNumberStub(MacroAssembler* masm) {
20102046
Label call_runtime;
2011-
ASSERT(operands_type_ == TRBinaryOpIC::HEAP_NUMBER);
20122047

20132048
// Floating point case.
20142049
switch (op_) {

deps/v8/src/ia32/code-stubs-ia32.h

+1
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ class TypeRecordingBinaryOpStub: public CodeStub {
306306
void GenerateSmiStub(MacroAssembler* masm);
307307
void GenerateInt32Stub(MacroAssembler* masm);
308308
void GenerateHeapNumberStub(MacroAssembler* masm);
309+
void GenerateOddballStub(MacroAssembler* masm);
309310
void GenerateStringStub(MacroAssembler* masm);
310311
void GenerateGenericStub(MacroAssembler* masm);
311312
void GenerateAddStrings(MacroAssembler* masm);

deps/v8/src/ia32/deoptimizer-ia32.cc

+74
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,80 @@ static void ZapCodeRange(Address start, Address end) {
5555
}
5656

5757

58+
void Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(Handle<Code> code) {
59+
HandleScope scope;
60+
61+
// Compute the size of relocation information needed for the code
62+
// patching in Deoptimizer::DeoptimizeFunction.
63+
int min_reloc_size = 0;
64+
Address prev_reloc_address = code->instruction_start();
65+
Address code_start_address = code->instruction_start();
66+
SafepointTable table(*code);
67+
for (unsigned i = 0; i < table.length(); ++i) {
68+
Address curr_reloc_address = code_start_address + table.GetPcOffset(i);
69+
ASSERT_GE(curr_reloc_address, prev_reloc_address);
70+
SafepointEntry safepoint_entry = table.GetEntry(i);
71+
int deoptimization_index = safepoint_entry.deoptimization_index();
72+
if (deoptimization_index != Safepoint::kNoDeoptimizationIndex) {
73+
// The gap code is needed to get to the state expected at the
74+
// bailout and we need to skip the call opcode to get to the
75+
// address that needs reloc.
76+
curr_reloc_address += safepoint_entry.gap_code_size() + 1;
77+
int pc_delta = curr_reloc_address - prev_reloc_address;
78+
// We use RUNTIME_ENTRY reloc info which has a size of 2 bytes
79+
// if encodable with small pc delta encoding and up to 6 bytes
80+
// otherwise.
81+
if (pc_delta <= RelocInfo::kMaxSmallPCDelta) {
82+
min_reloc_size += 2;
83+
} else {
84+
min_reloc_size += 6;
85+
}
86+
prev_reloc_address = curr_reloc_address;
87+
}
88+
}
89+
90+
// If the relocation information is not big enough we create a new
91+
// relocation info object that is padded with comments to make it
92+
// big enough for lazy doptimization.
93+
int reloc_length = code->relocation_info()->length();
94+
if (min_reloc_size > reloc_length) {
95+
int comment_reloc_size = RelocInfo::kMinRelocCommentSize;
96+
// Padding needed.
97+
int min_padding = min_reloc_size - reloc_length;
98+
// Number of comments needed to take up at least that much space.
99+
int additional_comments =
100+
(min_padding + comment_reloc_size - 1) / comment_reloc_size;
101+
// Actual padding size.
102+
int padding = additional_comments * comment_reloc_size;
103+
// Allocate new relocation info and copy old relocation to the end
104+
// of the new relocation info array because relocation info is
105+
// written and read backwards.
106+
Handle<ByteArray> new_reloc =
107+
Factory::NewByteArray(reloc_length + padding, TENURED);
108+
memcpy(new_reloc->GetDataStartAddress() + padding,
109+
code->relocation_info()->GetDataStartAddress(),
110+
reloc_length);
111+
// Create a relocation writer to write the comments in the padding
112+
// space. Use position 0 for everything to ensure short encoding.
113+
RelocInfoWriter reloc_info_writer(
114+
new_reloc->GetDataStartAddress() + padding, 0);
115+
intptr_t comment_string
116+
= reinterpret_cast<intptr_t>(RelocInfo::kFillerCommentString);
117+
RelocInfo rinfo(0, RelocInfo::COMMENT, comment_string);
118+
for (int i = 0; i < additional_comments; ++i) {
119+
#ifdef DEBUG
120+
byte* pos_before = reloc_info_writer.pos();
121+
#endif
122+
reloc_info_writer.Write(&rinfo);
123+
ASSERT(RelocInfo::kMinRelocCommentSize ==
124+
pos_before - reloc_info_writer.pos());
125+
}
126+
// Replace relocation information on the code object.
127+
code->set_relocation_info(*new_reloc);
128+
}
129+
}
130+
131+
58132
void Deoptimizer::DeoptimizeFunction(JSFunction* function) {
59133
AssertNoAllocation no_allocation;
60134

0 commit comments

Comments
 (0)