Commit 8036c41f authored by Adam Klein's avatar Adam Klein Committed by Commit Bot

[binary size] Move PendingCompilationErrorHandler implementation out-of-line

These functions should only be called in case of a parse error, so speed
of calling them should not be a concern.

In local testing, this saves ~16k of binary size on a release mode build.

Bug: v8:7090
Change-Id: I433df81c2a5811ed922885dbab3ce003427f3d1c
Reviewed-on: https://chromium-review.googlesource.com/780693Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
Commit-Queue: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49551}
parent a8df8f38
......@@ -804,10 +804,10 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
}
// Reporting errors.
V8_INLINE void ReportMessageAt(Scanner::Location source_location,
MessageTemplate::Template message,
const char* arg = nullptr,
ParseErrorType error_type = kSyntaxError) {
void ReportMessageAt(Scanner::Location source_location,
MessageTemplate::Template message,
const char* arg = nullptr,
ParseErrorType error_type = kSyntaxError) {
if (stack_overflow()) {
// Suppress the error message (syntax error or such) in the presence of a
// stack overflow. The isolate allows only one pending exception at at
......@@ -820,10 +820,10 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
arg, error_type);
}
V8_INLINE void ReportMessageAt(Scanner::Location source_location,
MessageTemplate::Template message,
const AstRawString* arg,
ParseErrorType error_type = kSyntaxError) {
void ReportMessageAt(Scanner::Location source_location,
MessageTemplate::Template message,
const AstRawString* arg,
ParseErrorType error_type = kSyntaxError) {
if (stack_overflow()) {
// Suppress the error message (syntax error or such) in the presence of a
// stack overflow. The isolate allows only one pending exception at at
......
......@@ -1428,10 +1428,10 @@ class PreParser : public ParserBase<PreParser> {
}
// Reporting errors.
V8_INLINE void ReportMessageAt(Scanner::Location source_location,
MessageTemplate::Template message,
const char* arg = nullptr,
ParseErrorType error_type = kSyntaxError) {
void ReportMessageAt(Scanner::Location source_location,
MessageTemplate::Template message,
const char* arg = nullptr,
ParseErrorType error_type = kSyntaxError) {
pending_error_handler()->ReportMessageAt(source_location.beg_pos,
source_location.end_pos, message,
arg, error_type);
......
......@@ -30,6 +30,35 @@ MessageLocation PendingCompilationErrorHandler::MessageDetails::GetLocation(
return MessageLocation(script, start_position_, end_position_);
}
void PendingCompilationErrorHandler::ReportMessageAt(
int start_position, int end_position, MessageTemplate::Template message,
const char* arg, ParseErrorType error_type) {
if (has_pending_error_) return;
has_pending_error_ = true;
error_details_ =
MessageDetails(start_position, end_position, message, nullptr, arg);
error_type_ = error_type;
}
void PendingCompilationErrorHandler::ReportMessageAt(
int start_position, int end_position, MessageTemplate::Template message,
const AstRawString* arg, ParseErrorType error_type) {
if (has_pending_error_) return;
has_pending_error_ = true;
error_details_ =
MessageDetails(start_position, end_position, message, arg, nullptr);
error_type_ = error_type;
}
void PendingCompilationErrorHandler::ReportWarningAt(
int start_position, int end_position, MessageTemplate::Template message,
const char* arg) {
warning_messages_.emplace_front(
MessageDetails(start_position, end_position, message, nullptr, arg));
}
void PendingCompilationErrorHandler::ReportWarnings(Isolate* isolate,
Handle<Script> script) {
DCHECK(!has_pending_error());
......
......@@ -32,33 +32,16 @@ class PendingCompilationErrorHandler {
void ReportMessageAt(int start_position, int end_position,
MessageTemplate::Template message,
const char* arg = nullptr,
ParseErrorType error_type = kSyntaxError) {
if (has_pending_error_) return;
has_pending_error_ = true;
error_details_ =
MessageDetails(start_position, end_position, message, nullptr, arg);
error_type_ = error_type;
}
ParseErrorType error_type = kSyntaxError);
void ReportMessageAt(int start_position, int end_position,
MessageTemplate::Template message,
const AstRawString* arg,
ParseErrorType error_type = kSyntaxError) {
if (has_pending_error_) return;
has_pending_error_ = true;
error_details_ =
MessageDetails(start_position, end_position, message, arg, nullptr);
error_type_ = error_type;
}
ParseErrorType error_type = kSyntaxError);
void ReportWarningAt(int start_position, int end_position,
MessageTemplate::Template message,
const char* arg = nullptr) {
warning_messages_.emplace_front(
MessageDetails(start_position, end_position, message, nullptr, arg));
}
const char* arg = nullptr);
bool stack_overflow() const { return stack_overflow_; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment