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

Issue 18097004: Support fast noSuchMethod dispatch for any number of arguments. (Closed)

Created:
7 years, 5 months ago by Florian Schneider
Modified:
7 years, 5 months ago
Reviewers:
srdjan, Ivan Posva
CC:
reviews_dartlang.org, vm-dev_dartlang.org, ahe
Visibility:
Public.

Description

Support fast noSuchMethod dispatch for any number of arguments. Until now, the fast dispatch was only available with getters and zero argument methods. This CL generalizes the approach to any number of arguments. The dispatcher functions that are auto-generated by the compiler are not attached to the class anymore. Instead the dispatcher is only stored in the IC data of each call site. Each class contains a cache of dispatcher function that map (name, arguments descriptor) => dispatcher. This also fixes a bug where the VM report a wrong error message when throwing a NoSuchMethodError. BUG=https://code.google.com/p/dart/issues/detail?id=11528 BUG=https://code.google.com/p/dart/issues/detail?id=11223 TEST=tests/language/no_such_method_dispatcher_test.dart R=srdjan@google.com Committed: https://code.google.com/p/dart/source/detail?r=24876

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : added per-class cache of dispatch functions #

Patch Set 4 : reformatting #

Total comments: 8

Patch Set 5 : addressed comments #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+206 lines, -76 lines) Patch
M runtime/vm/class_finalizer.cc View 1 chunk +1 line, -2 lines 0 comments Download
M runtime/vm/code_generator.cc View 1 2 3 4 3 chunks +21 lines, -64 lines 0 comments Download
M runtime/vm/object.h View 1 2 3 chunks +10 lines, -0 lines 0 comments Download
M runtime/vm/object.cc View 1 2 3 4 3 chunks +107 lines, -0 lines 0 comments Download
M runtime/vm/parser.cc View 2 chunks +16 lines, -6 lines 0 comments Download
M runtime/vm/raw_object.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M runtime/vm/resolver.cc View 1 chunk +1 line, -1 line 0 comments Download
M runtime/vm/stack_frame_test.cc View 1 1 chunk +4 lines, -3 lines 0 comments Download
M tests/language/no_such_method_dispatcher_test.dart View 1 2 2 chunks +45 lines, -0 lines 1 comment Download

Messages

Total messages: 8 (0 generated)
Florian Schneider
7 years, 5 months ago (2013-06-27 17:49:32 UTC) #1
Florian Schneider
Added per-class cache of dispatcher function. Please review.
7 years, 5 months ago (2013-07-09 14:53:09 UTC) #2
srdjan
https://codereview.chromium.org/18097004/diff/24001/runtime/vm/code_generator.cc File runtime/vm/code_generator.cc (right): https://codereview.chromium.org/18097004/diff/24001/runtime/vm/code_generator.cc#newcode1222 runtime/vm/code_generator.cc:1222: if (ic_data.num_args_tested() == 1) { Please add comments when ...
7 years, 5 months ago (2013-07-09 15:20:27 UTC) #3
srdjan
https://codereview.chromium.org/18097004/diff/24001/runtime/vm/object.cc File runtime/vm/object.cc (right): https://codereview.chromium.org/18097004/diff/24001/runtime/vm/object.cc#newcode1782 runtime/vm/object.cc:1782: intptr_t new_len = cache.Length() == 0 ? kEntrySize : ...
7 years, 5 months ago (2013-07-09 15:35:40 UTC) #4
srdjan
LGTM
7 years, 5 months ago (2013-07-09 16:26:50 UTC) #5
Florian Schneider
https://codereview.chromium.org/18097004/diff/24001/runtime/vm/code_generator.cc File runtime/vm/code_generator.cc (right): https://codereview.chromium.org/18097004/diff/24001/runtime/vm/code_generator.cc#newcode1222 runtime/vm/code_generator.cc:1222: if (ic_data.num_args_tested() == 1) { On 2013/07/09 15:20:28, srdjan ...
7 years, 5 months ago (2013-07-10 09:05:59 UTC) #6
Florian Schneider
Committed patchset #5 manually as r24876 (presubmit successful).
7 years, 5 months ago (2013-07-10 10:10:38 UTC) #7
ahe
7 years, 5 months ago (2013-07-20 17:24:26 UTC) #8
Message was sent while issue was closed.
https://codereview.chromium.org/18097004/diff/33001/tests/language/no_such_me...
File tests/language/no_such_method_dispatcher_test.dart (right):

https://codereview.chromium.org/18097004/diff/33001/tests/language/no_such_me...
tests/language/no_such_method_dispatcher_test.dart:26:
Expect.isTrue(e.toString().indexOf("method not found") != -1);
I'm working on improving dart2js' handling of NoSuchMethod errors.

Based on feedback from Lars, the error message has been changed to for example:

  NoSuchMethodError: Cannot call "bar$0" on "5" (Object 5 has no method 'bar$0')

The latter part is the message from the JavaScript VM, and the first part
represents what we have extracted from that message.

However, this varies a lot depending on how much information the browser
provides.  For example, if we cannot identify the method name, it could just be:

  NoSuchMethodError: Browser-specific error message.

Looking at the VM implementation of NoSuchMethodError.toString, I can see that
this particular message only occur in certain situations, and this might be
important for this test.

Can you elaborate on why this test is expecting this particular message?

Powered by Google App Engine
This is Rietveld 408576698