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

Unified Diff: src/crankshaft/hydrogen.cc

Issue 1475823003: [runtime] First step to sanitize regexp literal creation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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
Index: src/crankshaft/hydrogen.cc
diff --git a/src/crankshaft/hydrogen.cc b/src/crankshaft/hydrogen.cc
index 1e9b0bdb9432c2ac6f20fa3d191d458caf5e3b8a..7e8c99e93df9df9a6746889629f58cdb4f603176 100644
--- a/src/crankshaft/hydrogen.cc
+++ b/src/crankshaft/hydrogen.cc
@@ -5774,12 +5774,14 @@ void HOptimizedGraphBuilder::VisitRegExpLiteral(RegExpLiteral* expr) {
DCHECK(!HasStackOverflow());
DCHECK(current_block() != NULL);
DCHECK(current_block()->HasPredecessor());
- Handle<JSFunction> closure = function_state()->compilation_info()->closure();
- Handle<LiteralsArray> literals(closure->literals());
- HRegExpLiteral* instr = New<HRegExpLiteral>(literals,
- expr->pattern(),
- expr->flags(),
- expr->literal_index());
+ Callable callable = CodeFactory::FastCloneRegExp(isolate());
+ HValue* values[] = {
+ context(), AddThisFunction(), Add<HConstant>(expr->literal_index()),
+ Add<HConstant>(expr->pattern()), Add<HConstant>(expr->flags())};
+ HConstant* stub_value = Add<HConstant>(callable.code());
+ HInstruction* instr = New<HCallWithDescriptor>(
+ stub_value, 0, callable.descriptor(),
+ Vector<HValue*>(values, arraysize(values)), NORMAL_CALL);
return ast_context()->ReturnInstruction(instr, expr->id());
}

Powered by Google App Engine
This is Rietveld 408576698