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

Issue 6119009: Wrap external pointers more carefully. (Closed)

Created:
9 years, 11 months ago by antonm
Modified:
9 years, 4 months ago
Reviewers:
Lasse Reichstein
CC:
v8-dev
Visibility:
Public.

Description

Wrap external pointers more carefully. On 32-bit platforms any pointer with 0 as LSB can be wrapped into Smi. However, on 64-bit platforms it's currently not the case as x64 Smis must have 0s in lower 32 bit word. Even worse, macroassembler Move instruction will try to fetch integer value from Smi and will shift by 32 bits to the right rendering stored pointer incorrect. BUG=v8:1037 Committed: http://code.google.com/p/v8/source/detail?r=6301

Patch Set 1 #

Total comments: 3

Patch Set 2 : Next round #

Total comments: 8

Patch Set 3 : Addressing Lasse's comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+137 lines, -24 lines) Patch
M include/v8.h View 1 2 5 chunks +33 lines, -7 lines 0 comments Download
M src/api.cc View 1 4 chunks +35 lines, -17 lines 0 comments Download
M test/cctest/test-api.cc View 1 2 1 chunk +69 lines, -0 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
antonm
Lasse, may you have a look?
9 years, 11 months ago (2011-01-12 16:40:03 UTC) #1
Lasse Reichstein
We need to distinguish between actual smis and smi-tagged values. You can have smi-tagged values ...
9 years, 11 months ago (2011-01-13 08:35:18 UTC) #2
antonm
Lasse, may you have another look?
9 years, 11 months ago (2011-01-13 12:44:55 UTC) #3
Lasse Reichstein
LGTM http://codereview.chromium.org/6119009/diff/6001/include/v8.h File include/v8.h (right): http://codereview.chromium.org/6119009/diff/6001/include/v8.h#newcode3356 include/v8.h:3356: template <size_t ptr_size> struct SmiTraits; I think I ...
9 years, 11 months ago (2011-01-13 12:57:57 UTC) #4
antonm
9 years, 11 months ago (2011-01-13 15:49:15 UTC) #5
Thanks a lot for review, Lasse.  Submitting.

http://codereview.chromium.org/6119009/diff/6001/include/v8.h
File include/v8.h (right):

http://codereview.chromium.org/6119009/diff/6001/include/v8.h#newcode3356
include/v8.h:3356: template <size_t ptr_size> struct SmiTraits;
On 2011/01/13 12:57:57, Lasse Reichstein wrote:
> I think I would prefer "SmiTagging", but it's better than SmiConstants.

Done.

http://codereview.chromium.org/6119009/diff/6001/include/v8.h#newcode3386
include/v8.h:3386: // alignment.  Currently we require 8 bytes alignment (which
On 2011/01/13 12:57:57, Lasse Reichstein wrote:
> Drop "better" alignment (the text should be stand-alone, so it should not be
> implicitly relative to the 32-bit case).
> Just say something like "To maximize the range of pointers that can be encoded
> in the available 32 bit, we require them to be 8-byte aligned".

Done.

http://codereview.chromium.org/6119009/diff/6001/include/v8.h#newcode3393
include/v8.h:3393: intptr_t(0xffffffff) << kPointerAlignment;
On 2011/01/13 12:57:57, Lasse Reichstein wrote:
> Shouldn't this be inverted to mask the bits that must be zero?

Thanks a lot, of course it should.

http://codereview.chromium.org/6119009/diff/6001/test/cctest/test-api.cc
File test/cctest/test-api.cc (right):

http://codereview.chromium.org/6119009/diff/6001/test/cctest/test-api.cc#newc...
test/cctest/test-api.cc:829: *value = 42;
On 2011/01/13 12:57:57, Lasse Reichstein wrote:
> Try storing both values that can and can't be stored as smis.

Done.

Powered by Google App Engine
This is Rietveld 408576698