Message from discussion
Share optimized code for closures. (issue 10103035)
Received: by 10.101.46.13 with SMTP id y13mr748192anj.22.1339672104836;
Thu, 14 Jun 2012 04:08:24 -0700 (PDT)
X-BeenThere: v8-dev@googlegroups.com
Received: by 10.236.173.229 with SMTP id v65ls557692yhl.0.gmail; Thu, 14 Jun
2012 04:08:24 -0700 (PDT)
Received: by 10.101.133.36 with SMTP id k36mr745715ann.25.1339672104101;
Thu, 14 Jun 2012 04:08:24 -0700 (PDT)
Received: by 10.101.133.36 with SMTP id k36mr745714ann.25.1339672104082;
Thu, 14 Jun 2012 04:08:24 -0700 (PDT)
Return-Path: <3J8bZTxUJAJ4AFPMKGSKAMBCPCTGCU-FPEK8GJ....@m3kw2wvrgufz5godrsrytgd7.apphosting.bounces.google.com>
Received: from mail-gh0-f199.google.com (mail-gh0-f199.google.com [209.85.160.199])
by gmr-mx.google.com with ESMTPS id p72si3844162yhh.1.2012.06.14.04.08.24
(version=TLSv1/SSLv3 cipher=OTHER);
Thu, 14 Jun 2012 04:08:24 -0700 (PDT)
Received-SPF: pass (google.com: domain of 3J8bZTxUJAJ4AFPMKGSKAMBCPCTGCU-FPEK8GJ....@m3kw2wvrgufz5godrsrytgd7.apphosting.bounces.google.com designates 209.85.160.199 as permitted sender) client-ip=209.85.160.199;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of 3J8bZTxUJAJ4AFPMKGSKAMBCPCTGCU-FPEK8GJ....@m3kw2wvrgufz5godrsrytgd7.apphosting.bounces.google.com designates 209.85.160.199 as permitted sender) smtp.mail=3J8bZTxUJAJ4AFPMKGSKAMBCPCTGCU-FPEK8GJ....@m3kw2wvrgufz5godrsrytgd7.apphosting.bounces.google.com; dkim=pass header...@chromium.org
Received: by mail-gh0-f199.google.com with SMTP id r1so2407819ghr.6
for <v8-dev@googlegroups.com>; Thu, 14 Jun 2012 04:08:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=chromium.org; s=google;
h=mime-version:reply-to:x-google-appengine-app-id:message-id:date
:subject:from:to:cc:content-type;
bh=4ItaQN6cv59F9CGChyT/sQDnZfhnOgSXeh8LnSBOfgk=;
b=niNw0FmD0mOImO4VxFwScm+MGi/FAvxy9RjrCXSfj7g1CdMWQsL75/Em6W0rmGa8ME
d18ne9keqJ0OcpbCAW7bvJBRakjWgutY+JMUg1I4WzKIxlJTvJTO/dros2qOSDaj0rCm
BuH3t5VndbNoqvd9Ft0y85776bIf0k21LfG4g=
MIME-Version: 1.0
Received: by 10.52.75.161 with SMTP id d1mr744697vdw.2.1339672103931; Thu, 14
Jun 2012 04:08:23 -0700 (PDT)
Reply-To: fschnei...@chromium.org, mstarzin...@chromium.org,
v8-dev@googlegroups.com
Message-ID: <bcaec50161b1ded2e704c26cb...@google.com>
Date: Thu, 14 Jun 2012 11:08:23 +0000
Subject: Re: Share optimized code for closures. (issue 10103035)
From: fschnei...@chromium.org
To: mstarzin...@chromium.org
Cc: v8-dev@googlegroups.com
Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes
http://codereview.chromium.org/10103035/diff/23027/src/compiler.cc
File src/compiler.cc (right):
http://codereview.chromium.org/10103035/diff/23027/src/compiler.cc#newcode603
src/compiler.cc:603: static void
AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared,
On 2012/05/23 11:16:29, Michael Starzinger wrote:
> Can we move this into the the SharedFunctionInfo class so that it is
coupled
> with the corresponding search method?
Done.
http://codereview.chromium.org/10103035/diff/23027/src/compiler.cc#newcode609
src/compiler.cc:609: const int kEntryLength = 3;
On 2012/05/23 11:16:29, Michael Starzinger wrote:
> Moving these constants into SharedFunctionInfo and reusing them in the
search
> method seems reasonable as well.
Done.
http://codereview.chromium.org/10103035/diff/23027/src/compiler.cc#newcode626
src/compiler.cc:626: for (int i = 0; i < old_length; i += kEntryLength)
{
On 2012/05/23 11:16:29, Michael Starzinger wrote:
> Can we use FixedArray::CopyTo or even a handlified version of
> FixedArray::CopySize or a similar method to do the copying?
Done.
http://codereview.chromium.org/10103035/diff/23027/src/factory.cc
File src/factory.cc (right):
http://codereview.chromium.org/10103035/diff/23027/src/factory.cc#newcode561
src/factory.cc:561: FixedArray::cast(code_map->get(index + 1));
On 2012/05/23 11:16:29, Michael Starzinger wrote:
> It would be nice to have constants for these offsets (i.e. -1, 0 and
+1) in
> SharedFunctionInfo.
Agree. Though I'd have the constants relative to the entry start so that
it does not get confusing: 0 = context, 1 = code, 2 = literals
SearchOptimizedCodeMap would have to accordingly return the entry start
instead of the Code*
http://codereview.chromium.org/10103035/diff/23027/src/factory.cc#newcode562
src/factory.cc:562: ASSERT(cached_literals != NULL);
On 2012/05/23 11:16:29, Michael Starzinger wrote:
> Better add an ASSERT that the global context stored in the cached
literals array
> still matches.
Done.
http://codereview.chromium.org/10103035/diff/23027/src/ia32/code-stubs-ia32.cc
File src/ia32/code-stubs-ia32.cc (right):
http://codereview.chromium.org/10103035/diff/23027/src/ia32/code-stubs-ia32.cc#newcode130
src/ia32/code-stubs-ia32.cc:130: const int kEntryLength = 3;
On 2012/05/23 11:16:29, Michael Starzinger wrote:
> Again, having this constant in SharedFunctionInfo seems safer.
Done.
http://codereview.chromium.org/10103035/diff/23027/src/ia32/code-stubs-ia32.cc#newcode7146
src/ia32/code-stubs-ia32.cc:7146: { ecx, edx, ebx, EMIT_REMEMBERED_SET},
On 2012/05/23 11:16:29, Michael Starzinger wrote:
> Use the REG macro as well.
Done.
http://codereview.chromium.org/10103035/diff/23027/src/ia32/deoptimizer-ia32.cc
File src/ia32/deoptimizer-ia32.cc (right):
http://codereview.chromium.org/10103035/diff/23027/src/ia32/deoptimizer-ia32.cc#newcode122
src/ia32/deoptimizer-ia32.cc:122:
function->shared()->set_optimized_code_map(Smi::FromInt(0));
On 2012/05/23 11:16:29, Michael Starzinger wrote:
> I think it would make sense to have shared->ClearOptimizedCodeMap() as
a helper.
Done.
http://codereview.chromium.org/10103035/diff/23027/src/mark-compact.cc
File src/mark-compact.cc (right):
http://codereview.chromium.org/10103035/diff/23027/src/mark-compact.cc#newcode1305
src/mark-compact.cc:1305:
reinterpret_cast<SharedFunctionInfo*>(object)->BeforeVisitingPointers();
On 2012/05/23 11:16:29, Michael Starzinger wrote:
> We should be able to use SharedFunctionInfo::cast() with the new GC.
Done.
http://codereview.chromium.org/10103035/diff/23027/src/objects.h
File src/objects.h (right):
http://codereview.chromium.org/10103035/diff/23027/src/objects.h#newcode5164
src/objects.h:5164: // i - 1 is the context, position i the code, and i
+ 1 the literals array.
On 2012/05/23 11:16:29, Michael Starzinger wrote:
> Can we add a comment about what happens when no entry is found?
Done.
http://codereview.chromium.org/10103035/diff/23027/src/objects.h#newcode5274
src/objects.h:5274: // Invoked before pointers in SharedFunctionInfo are
being marked.
On 2012/05/23 11:16:29, Michael Starzinger wrote:
> It would be nice to also have a short comment what this method does on
top of
> when it is being called.
Done.
http://codereview.chromium.org/10103035/diff/23027/src/runtime.cc
File src/runtime.cc (right):
http://codereview.chromium.org/10103035/diff/23027/src/runtime.cc#newcode8255
src/runtime.cc:8255:
function->shared()->set_optimized_code_map(Smi::FromInt(0));
On 2012/05/23 11:16:29, Michael Starzinger wrote:
> It seems we can hoist that out of the condition.
Done.
http://codereview.chromium.org/10103035/