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

Unified Diff: src/parser.cc

Issue 1210533003: Use C runtime functions for ThrowNewXXError desugarings. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/parser.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index 61385929bc5962d2955d32788a117ce2cc88670a..c87dffca8f4d9336de62a7810e30c83e2a4c59ab 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -645,36 +645,34 @@ Expression* ParserTraits::BuildUnaryExpression(Expression* expression,
Expression* ParserTraits::NewThrowReferenceError(
MessageTemplate::Template message, int pos) {
- return NewThrowError(
- parser_->ast_value_factory()->make_reference_error_string(), message,
- parser_->ast_value_factory()->empty_string(), pos);
+ return NewThrowError(Runtime::kNewReferenceError, message,
+ parser_->ast_value_factory()->empty_string(), pos);
}
Expression* ParserTraits::NewThrowSyntaxError(MessageTemplate::Template message,
const AstRawString* arg,
int pos) {
- return NewThrowError(parser_->ast_value_factory()->make_syntax_error_string(),
- message, arg, pos);
+ return NewThrowError(Runtime::kNewSyntaxError, message, arg, pos);
}
Expression* ParserTraits::NewThrowTypeError(MessageTemplate::Template message,
const AstRawString* arg, int pos) {
- return NewThrowError(parser_->ast_value_factory()->make_type_error_string(),
- message, arg, pos);
+ return NewThrowError(Runtime::kNewTypeError, message, arg, pos);
}
-Expression* ParserTraits::NewThrowError(const AstRawString* constructor,
+Expression* ParserTraits::NewThrowError(Runtime::FunctionId id,
MessageTemplate::Template message,
const AstRawString* arg, int pos) {
Zone* zone = parser_->zone();
ZoneList<Expression*>* args = new (zone) ZoneList<Expression*>(2, zone);
args->Add(parser_->factory()->NewSmiLiteral(message, pos), zone);
args->Add(parser_->factory()->NewStringLiteral(arg, pos), zone);
- CallRuntime* call_constructor =
- parser_->factory()->NewCallRuntime(constructor, NULL, args, pos);
+ CallRuntime* call_constructor = parser_->factory()->NewCallRuntime(
+ parser_->ast_value_factory()->empty_string(), Runtime::FunctionForId(id),
+ args, pos);
return parser_->factory()->NewThrow(call_constructor, pos);
}
« no previous file with comments | « src/parser.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698