Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(393)

Issue 196139: X64: Convert smis to holding 32 bits of payload. (Closed)

Created:
11 years, 3 months ago by Lasse Reichstein
Modified:
9 years, 6 months ago
CC:
v8-dev
Visibility:
Public.

Description

X64: Convert smis to holding 32 bits of payload.

Patch Set 1 #

Total comments: 28

Patch Set 2 : Fixed bugs. Still too slow. #

Patch Set 3 : Fix lint. Fix bug in ic table probing. #

Patch Set 4 : Weeded out more bugs and missing optimizations. #

Patch Set 5 : Fixed last-minute change that broke 31-bit smis #

Total comments: 2

Patch Set 6 : Slight optimization on smi-shifts (fewer shifts) #

Total comments: 88

Patch Set 7 : Addressed review comments. Forwarded to head. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+3730 lines, -666 lines) Patch
M SConstruct View 5 2 chunks +2 lines, -2 lines 0 comments Download
M include/v8.h View 1 2 3 4 5 6 2 chunks +23 lines, -3 lines 0 comments Download
M src/api.cc View 1 2 3 4 5 6 2 chunks +2 lines, -2 lines 0 comments Download
M src/execution.cc View 1 2 3 1 chunk +5 lines, -2 lines 0 comments Download
M src/heap.cc View 2 3 4 5 6 1 chunk +2 lines, -2 lines 0 comments Download
M src/macros.py View 1 chunk +1 line, -3 lines 0 comments Download
M src/objects.h View 1 2 3 4 5 6 5 chunks +10 lines, -9 lines 0 comments Download
M src/objects-inl.h View 1 2 3 4 5 6 3 chunks +10 lines, -15 lines 0 comments Download
M src/runtime.cc View 2 3 4 5 6 4 chunks +7 lines, -7 lines 0 comments Download
M src/serialize.cc View 2 3 4 5 6 2 chunks +16 lines, -4 lines 0 comments Download
M src/top.cc View 2 3 1 chunk +1 line, -0 lines 0 comments Download
M src/utils.h View 1 2 3 4 5 1 chunk +2 lines, -1 line 0 comments Download
M src/v8.cc View 1 2 3 4 5 6 1 chunk +5 lines, -2 lines 0 comments Download
M src/x64/assembler-x64.h View 1 2 3 4 5 6 6 chunks +36 lines, -3 lines 0 comments Download
M src/x64/assembler-x64.cc View 1 2 3 4 5 6 11 chunks +50 lines, -21 lines 0 comments Download
M src/x64/assembler-x64-inl.h View 1 2 3 4 5 6 1 chunk +0 lines, -5 lines 0 comments Download
M src/x64/builtins-x64.cc View 1 2 3 10 chunks +18 lines, -28 lines 0 comments Download
M src/x64/codegen-x64.cc View 1 2 3 4 5 6 54 chunks +107 lines, -109 lines 0 comments Download
M src/x64/ic-x64.cc View 1 2 3 4 5 6 6 chunks +25 lines, -17 lines 0 comments Download
M src/x64/macro-assembler-x64.h View 1 2 3 4 8 chunks +50 lines, -37 lines 0 comments Download
M src/x64/macro-assembler-x64.cc View 1 2 3 4 5 6 56 chunks +1118 lines, -285 lines 0 comments Download
M src/x64/stub-cache-x64.cc View 3 1 chunk +9 lines, -4 lines 0 comments Download
M src/x64/virtual-frame-x64.h View 1 chunk +1 line, -0 lines 0 comments Download
M src/x64/virtual-frame-x64.cc View 1 2 3 4 5 6 4 chunks +11 lines, -3 lines 0 comments Download
M test/cctest/SConscript View 2 3 1 chunk +3 lines, -1 line 0 comments Download
M test/cctest/test-api.cc View 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M test/cctest/test-heap.cc View 1 2 3 4 5 6 2 chunks +9 lines, -4 lines 0 comments Download
A test/cctest/test-macro-assembler-x64.cc View 2 3 4 5 6 1 chunk +2096 lines, -0 lines 0 comments Download
M test/mjsunit/for-in.js View 2 chunks +22 lines, -22 lines 0 comments Download
M test/mjsunit/regress/regress-1199401.js View 1 chunk +46 lines, -32 lines 0 comments Download
M test/mjsunit/smi-negative-zero.js View 1 chunk +42 lines, -42 lines 0 comments Download

Messages

Total messages: 11 (0 generated)
William Hesse
Mainly formatting issues. http://codereview.chromium.org/196139/diff/1/7 File src/objects.h (right): http://codereview.chromium.org/196139/diff/1/7#newcode908 Line 908: static inline bool IsValid(intptr_t value); ...
11 years, 3 months ago (2009-09-21 13:31:36 UTC) #1
Lasse Reichstein
Now works. Benchmarks are still running. Last chance to compare to previous upload before I ...
11 years, 2 months ago (2009-09-30 08:56:17 UTC) #2
Lasse Reichstein
Ready for re-review. The 31-bit smis are currently slightly broken, but the 32-bit ones work ...
11 years, 2 months ago (2009-10-02 09:58:22 UTC) #3
William Hesse
Reviewed up through builtins-x64.cc. http://codereview.chromium.org/196139/diff/10001/11009 File src/runtime.cc (right): http://codereview.chromium.org/196139/diff/10001/11009#newcode3243 Line 3243: // We don't allow ...
11 years, 2 months ago (2009-10-02 12:57:41 UTC) #4
Lasse Reichstein
Erik, could you take a look at the 64-bit Smi operations in macroassembler-x64.cc too, with ...
11 years, 2 months ago (2009-10-05 05:24:29 UTC) #5
Erik Corry
LGTM, though my brain did boil over when I got to the 31 bit versions ...
11 years, 2 months ago (2009-10-06 19:44:57 UTC) #6
Søren Thygesen Gjesse
Drive by style related comments. http://codereview.chromium.org/196139/diff/13001/9021 File src/x64/macro-assembler-x64.cc (right): http://codereview.chromium.org/196139/diff/13001/9021#newcode123 Line 123: class RecordWriteStub: public ...
11 years, 2 months ago (2009-10-06 21:25:36 UTC) #7
William Hesse
Some more comments, I am still reviewing. http://codereview.chromium.org/196139/diff/13001/9019 File src/x64/codegen-x64.cc (right): http://codereview.chromium.org/196139/diff/13001/9019#newcode799 Line 799: __ ...
11 years, 2 months ago (2009-10-07 11:45:02 UTC) #8
William Hesse
Still not done - here are more comments. It might be good to separate out ...
11 years, 2 months ago (2009-10-07 14:38:34 UTC) #9
William Hesse
LGTM! http://codereview.chromium.org/196139/diff/13001/9028 File test/cctest/test-heap.cc (right): http://codereview.chromium.org/196139/diff/13001/9028#newcode148 Line 148: Two consecutive blank lines inside a function ...
11 years, 2 months ago (2009-10-08 10:11:34 UTC) #10
Lasse Reichstein
11 years, 2 months ago (2009-10-08 11:02:06 UTC) #11
http://codereview.chromium.org/196139/diff/13001/9019
File src/x64/codegen-x64.cc (right):

http://codereview.chromium.org/196139/diff/13001/9019#newcode799
Line 799: __ bind(&loop);
It would, but it's a multi-micro-op instruction with a fairly large latency on
modern chips.
(The AMD64 optimization guide simply writes that you shouldn 't use loop.)

http://codereview.chromium.org/196139/diff/13001/9019#newcode4952
Line 4952: __ SmiCompare(left_side.reg(), Smi::cast(*right_side.handle()));
They could, and possibly should, but the SmiCompare functions were the final
result of a number of attempts of doing the 32-bit smis. They grew out of the
other changes.

http://codereview.chromium.org/196139/diff/13001/9019#newcode5005
Line 5005: __ SmiTest(answer.reg());  // Both zero and sign flag right.
Done.

http://codereview.chromium.org/196139/diff/13001/9019#newcode5313
Line 5313: Smi::FromInt(int_value),
Good point. Fixed.

http://codereview.chromium.org/196139/diff/13001/9019#newcode5335
Line 5335: Smi::FromInt(int_value),
Fixed.

http://codereview.chromium.org/196139/diff/13001/9019#newcode6489
Line 6489: __ cmovq(below, rax, rdx);  // -1 if negative.
Agree. I'll revert it for now, and look at it again later.

http://codereview.chromium.org/196139/diff/13001/9019#newcode7565
Line 7565: __ JumpIfNotValidSmiValue(rax, &non_smi_result);
We are supporting both.
The test does go away, for 32-bit smis, this is handled by the opcodes, so the
call doesn't actually add any code.

http://codereview.chromium.org/196139/diff/13001/9021
File src/x64/macro-assembler-x64.cc (left):

http://codereview.chromium.org/196139/diff/13001/9021#oldcode2185
Line 2185: 
Generally one line of whitespace before the namespace end.

http://codereview.chromium.org/196139/diff/13001/9021
File src/x64/macro-assembler-x64.cc (right):

http://codereview.chromium.org/196139/diff/13001/9021#newcode30
Line 30: #include "bootstrapper.h"
Will do.

http://codereview.chromium.org/196139/diff/13001/9021#newcode44
Line 44: allow_stub_calls_(true), code_object_(Heap::undefined_value()) {
Fixed.

http://codereview.chromium.org/196139/diff/13001/9021#newcode123
Line 123: class RecordWriteStub: public CodeStub {
Ack. Something (likely a combination of me and one of my IDEs) did a
reformatting of this file at some time. 
I can see I haven't weeded out all its mistakes yet.

http://codereview.chromium.org/196139/diff/13001/9021#newcode138
Line 138: PrintF(
Fixed.

http://codereview.chromium.org/196139/diff/13001/9021#newcode144
Line 144: // Minor key encoding in 12 bits of three registers (object, address
and
I think we do, but perhaps we should measure it, just to be sure. It does seem
like something that can be called with dynamically allocaated registers.

http://codereview.chromium.org/196139/diff/13001/9021#newcode146
Line 146: class ScratchBits: public BitField<uint32_t, 0, 4> {
Actually, I don't. Fixed.

http://codereview.chromium.org/196139/diff/13001/9021#newcode160
Line 160: | AddressBits::encode(addr_.code())
Fixed.

http://codereview.chromium.org/196139/diff/13001/9021#newcode202
Line 202: movq(kScratchRegister, ExternalReference::new_space_start());
Sadly only by using the Cmp macro ... which does exaxtly the same as this
sequence.

http://codereview.chromium.org/196139/diff/13001/9021#newcode249
Line 249: Check(cc, msg);
Ack. Reformatting issues. I'll try to get them all fixed back this time.

http://codereview.chromium.org/196139/diff/13001/9021#newcode262
Line 262: void MacroAssembler::NegativeZeroTest(Register result, Register op,
Fixed.

http://codereview.chromium.org/196139/diff/13001/9021#newcode397
Line 397: int builtins_offset = JSBuiltinsObject::kJSBuiltinsOffset + (id
Reverted.

http://codereview.chromium.org/196139/diff/13001/9021#newcode398
Line 398: * kPointerSize);
Fixed.

http://codereview.chromium.org/196139/diff/13001/9021#newcode435
Line 435: #if V8_LONG_SMI
Fixed.

http://codereview.chromium.org/196139/diff/13001/9021#newcode676
Line 676: or_(dst, src2);
Indeed it could. Well spotted.

http://codereview.chromium.org/196139/diff/13001/9021#newcode699
Line 699: or_(kScratchRegister, src2);
That too.

http://codereview.chromium.org/196139/diff/13001/9021#newcode721
Line 721: testl(tmp, Immediate(kSmiTagMask));
Method rewritten.

http://codereview.chromium.org/196139/diff/13001/9021#newcode726
Line 726: cmovq(overflow, dst, kScratchRegister);
I'll defer to his experience then.
The function can be greatly simplified in that case too.
Fixed.

http://codereview.chromium.org/196139/diff/13001/9021#newcode773
Line 773: if (constant->value() == 0) {
We should. Done.

http://codereview.chromium.org/196139/diff/13001/9021#newcode784
Line 784: // Notice: This works even for Smi::kMinValue.
Comment removed.

http://codereview.chromium.org/196139/diff/13001/9021#newcode848
Line 848: SmiToInteger32(rax, src1);
I did this originally, but using idivq was *significantly* slower than shifting
everything down, using idivl, and shifing it back up.

http://codereview.chromium.org/196139/diff/13001/9021#newcode1221
Line 1221: #else  // 31 BIT SMI OPERATIONS.
DONE!

http://codereview.chromium.org/196139/diff/13001/9021#newcode1222
Line 1222: 
It probably could, but in the long (and not even that long) run, I expect the
31-bit code to be going away entirely. We don't want to maintain both versions.

http://codereview.chromium.org/196139/diff/13001/9021#newcode1367
Line 1367: cmpl(src, Immediate(0x80000000u));
Yes. It was caught by the added test-macro-assembler-x64 file.

http://codereview.chromium.org/196139/diff/13001/9021#newcode1952
Line 1952: #endif
Done

http://codereview.chromium.org/196139/diff/13001/9021#newcode2257
Line 2257: << Map::kHasNonInstancePrototype));
Fixed.

http://codereview.chromium.org/196139/diff/13001/9021#newcode2454
Line 2454: == SharedFunctionInfo::kDontAdaptArgumentsSentinel) {
Yes, I'll fix them all back.

http://codereview.chromium.org/196139/diff/13001/9021#newcode2544
Line 2544: SharedFunctionInfo::kFormalParameterCountOffset));
Fixed.

http://codereview.chromium.org/196139/diff/13001/9021#newcode3014
Line 3014: : address_(address),
It does. Fixed.

http://codereview.chromium.org/196139/diff/13001/9028
File test/cctest/test-heap.cc (right):

http://codereview.chromium.org/196139/diff/13001/9028#newcode148
Line 148: 
Fixed.

http://codereview.chromium.org/196139/diff/13001/9029
File test/cctest/test-macro-assembler-x64.cc (right):

http://codereview.chromium.org/196139/diff/13001/9029#newcode87
Line 87: 
I actually only ever use F0, so it should work.
I'll remove the other typedefs.

http://codereview.chromium.org/196139/diff/13001/9029#newcode1077
Line 1077: bool overflow = (x == Smi::kMinValue) && (y < 0);  // Safe approx.
used.
Done.

http://codereview.chromium.org/196139/diff/13001/9029#newcode1081
Line 1081: bool fraction = !division_by_zero && !overflow && ((x % y) != 0);
On 2009/10/08 10:11:34, William Hesse wrote:
> Drop one set ().

Done.

http://codereview.chromium.org/196139/diff/13001/9030
File test/mjsunit/for-in.js (right):

http://codereview.chromium.org/196139/diff/13001/9030#newcode33
Line 33: 
I don't think it's worth a separate change. 
It was just added to aid in debugging the current changes, and its both safe and
helpful to leave in.

Powered by Google App Engine
This is Rietveld 408576698