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

Issue 1349643002: [builtins] Also simplify the Symbol constructor. (Closed)

Created:
5 years, 3 months ago by Benedikt Meurer
Modified:
5 years, 3 months ago
CC:
v8-reviews_googlegroups.com
Base URL:
https://chromium.googlesource.com/v8/v8.git@StringConstructor
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

[builtins] Also simplify the Symbol constructor. No need to rely on the %_IsConstructCall magic here, we can just implement the Symbol constructor in C++ altogether (it was just a stupid wrapper around %CreateSymbol anyway). R=mstarzinger@chromium.org Committed: https://crrev.com/04087a7e45648a41b791e335ca852e53676f11f8 Cr-Commit-Position: refs/heads/master@{#30762}

Patch Set 1 #

Patch Set 2 : Fix off-by-1 in DCHECK. #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+33 lines, -16 lines) Patch
M src/bootstrapper.cc View 1 chunk +5 lines, -1 line 0 comments Download
M src/builtins.h View 1 chunk +3 lines, -0 lines 0 comments Download
M src/builtins.cc View 1 2 chunks +25 lines, -5 lines 2 comments Download
M src/symbol.js View 2 chunks +0 lines, -10 lines 0 comments Download

Depends on Patchset:

Messages

Total messages: 13 (4 generated)
Benedikt Meurer
5 years, 3 months ago (2015-09-16 09:56:17 UTC) #1
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1349643002/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1349643002/1
5 years, 3 months ago (2015-09-16 10:15:45 UTC) #3
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: v8_linux64_avx2_rel on tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux64_avx2_rel/builds/4390) v8_linux_arm_rel on ...
5 years, 3 months ago (2015-09-16 10:26:30 UTC) #5
Michael Starzinger
LGTM.
5 years, 3 months ago (2015-09-16 11:33:04 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1349643002/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1349643002/20001
5 years, 3 months ago (2015-09-16 11:33:38 UTC) #8
commit-bot: I haz the power
Committed patchset #2 (id:20001)
5 years, 3 months ago (2015-09-16 11:35:18 UTC) #9
commit-bot: I haz the power
Patchset 2 (id:??) landed as https://crrev.com/04087a7e45648a41b791e335ca852e53676f11f8 Cr-Commit-Position: refs/heads/master@{#30762}
5 years, 3 months ago (2015-09-16 11:35:42 UTC) #10
adamk
https://codereview.chromium.org/1349643002/diff/20001/src/builtins.cc File src/builtins.cc (right): https://codereview.chromium.org/1349643002/diff/20001/src/builtins.cc#newcode1475 src/builtins.cc:1475: ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, description, I'd like to understand why this approach ...
5 years, 3 months ago (2015-09-16 19:33:31 UTC) #12
Benedikt Meurer
5 years, 3 months ago (2015-09-17 02:58:10 UTC) #13
Message was sent while issue was closed.
https://codereview.chromium.org/1349643002/diff/20001/src/builtins.cc
File src/builtins.cc (right):

https://codereview.chromium.org/1349643002/diff/20001/src/builtins.cc#newcode...
src/builtins.cc:1475: ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, description,
On 2015/09/16 19:33:31, adamk wrote:
> I'd like to understand why this approach is better than the previous version.
> Here the call stack is:
> 
> JS -> C++ -> JS
> 
> instead of the old
> 
> JS -> JS
> 
> I thought I'd understood that part of the point of these cleanups was to
reduce
> the hops between JS and C++, but that seems to be increased by this change.
> 
> If the main point of this change is to get rid of %_IsConstructCall(), you
could
> replace it with new.target instead, which in ES6 exposes the IsConstruct-ness
of
> a [[Call]] to author script.

The main point of these cleanups is to make it correct, and as you guessed,
%_IsConstructCall is buggy (in the case of TCO), and unfortunately the same
applies to new.target (currently). But in case of the Symbol constructor it was
never

 JS -> JS 

but always

 JS -> (JS ->) C++ -> JS

because it always ended up with a call to %CreateSymbol, and it was also using
the obsolete ToString implementation, which is why it wouldn't do the callback
from C++ to JS previously. So fixing all of that was easiest by just writing
everything in C++, and that's what we agreed on as baseline implementation. If
that ever becomes a bottleneck we can turn it into a native builtin.

Powered by Google App Engine
This is Rietveld 408576698