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

Issue 9669054: Fox issue 2108: throw illegal argument exception for RegExp natives. Continue throwin NPE where exp… (Closed)

Created:
8 years, 9 months ago by srdjan
Modified:
8 years, 9 months ago
Reviewers:
siva
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Visibility:
Public.

Description

Fox issue 2108: throw illegal argument exception for RegExp natives. Continue throwin NPE where expected. Committed: https://code.google.com/p/dart/source/detail?r=5343

Patch Set 1 #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+9 lines, -8 lines) Patch
M runtime/lib/regexp.cc View 2 chunks +9 lines, -8 lines 4 comments Download

Messages

Total messages: 3 (0 generated)
srdjan
8 years, 9 months ago (2012-03-12 17:22:26 UTC) #1
siva
LGTM https://chromiumcodereview.appspot.com/9669054/diff/1/runtime/lib/regexp.cc File runtime/lib/regexp.cc (right): https://chromiumcodereview.appspot.com/9669054/diff/1/runtime/lib/regexp.cc#newcode26 runtime/lib/regexp.cc:26: CheckAndThrowExceptionIfNull(arg1); Not sure how many times this comes ...
8 years, 9 months ago (2012-03-12 18:49:00 UTC) #2
srdjan
8 years, 9 months ago (2012-03-12 19:01:13 UTC) #3
https://chromiumcodereview.appspot.com/9669054/diff/1/runtime/lib/regexp.cc
File runtime/lib/regexp.cc (right):

https://chromiumcodereview.appspot.com/9669054/diff/1/runtime/lib/regexp.cc#n...
runtime/lib/regexp.cc:26: CheckAndThrowExceptionIfNull(arg1);
On 2012/03/12 18:49:01, asiva wrote:
> Not sure how many times this comes up where we have to check for Null and
proper
> type. If there are too many of these we could have a
GET_NONNULL_NATIVE_ARGUMENT
> macro.

JSSyntaxRegExp are the only place where an illegal argument may throw a NPE.
Maybe we remove this special behavior at some point.

https://chromiumcodereview.appspot.com/9669054/diff/1/runtime/lib/regexp.cc#n...
runtime/lib/regexp.cc:27: GET_NATIVE_ARGUMENT(String, pattern,
arguments->At(1));
On 2012/03/12 18:49:01, asiva wrote:
> Another unrelated question, the macro GET_NATIVE_ARGUMENT
> calls CheckedHandle(arg);
> if arg is not an instance it results in a FATAL(...).
> 
> Should we consider throwing an exception there instead of a FATAL?

Generated code can never pass a non-Instance object. We could make it quicker by
eliminating CheckedHandle and check that the argument is instance in debug mode
only.

Powered by Google App Engine
This is Rietveld 408576698