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

Side by Side 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 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/crankshaft/hydrogen.h" 5 #include "src/crankshaft/hydrogen.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/allocation-site-scopes.h" 9 #include "src/allocation-site-scopes.h"
10 #include "src/ast-numbering.h" 10 #include "src/ast-numbering.h"
(...skipping 5756 matching lines...) Expand 10 before | Expand all | Expand 10 after
5767 DCHECK(current_block()->HasPredecessor()); 5767 DCHECK(current_block()->HasPredecessor());
5768 HConstant* instr = New<HConstant>(expr->value()); 5768 HConstant* instr = New<HConstant>(expr->value());
5769 return ast_context()->ReturnInstruction(instr, expr->id()); 5769 return ast_context()->ReturnInstruction(instr, expr->id());
5770 } 5770 }
5771 5771
5772 5772
5773 void HOptimizedGraphBuilder::VisitRegExpLiteral(RegExpLiteral* expr) { 5773 void HOptimizedGraphBuilder::VisitRegExpLiteral(RegExpLiteral* expr) {
5774 DCHECK(!HasStackOverflow()); 5774 DCHECK(!HasStackOverflow());
5775 DCHECK(current_block() != NULL); 5775 DCHECK(current_block() != NULL);
5776 DCHECK(current_block()->HasPredecessor()); 5776 DCHECK(current_block()->HasPredecessor());
5777 Handle<JSFunction> closure = function_state()->compilation_info()->closure(); 5777 Callable callable = CodeFactory::FastCloneRegExp(isolate());
5778 Handle<LiteralsArray> literals(closure->literals()); 5778 HValue* values[] = {
5779 HRegExpLiteral* instr = New<HRegExpLiteral>(literals, 5779 context(), AddThisFunction(), Add<HConstant>(expr->literal_index()),
5780 expr->pattern(), 5780 Add<HConstant>(expr->pattern()), Add<HConstant>(expr->flags())};
5781 expr->flags(), 5781 HConstant* stub_value = Add<HConstant>(callable.code());
5782 expr->literal_index()); 5782 HInstruction* instr = New<HCallWithDescriptor>(
5783 stub_value, 0, callable.descriptor(),
5784 Vector<HValue*>(values, arraysize(values)), NORMAL_CALL);
5783 return ast_context()->ReturnInstruction(instr, expr->id()); 5785 return ast_context()->ReturnInstruction(instr, expr->id());
5784 } 5786 }
5785 5787
5786 5788
5787 static bool CanInlinePropertyAccess(Handle<Map> map) { 5789 static bool CanInlinePropertyAccess(Handle<Map> map) {
5788 if (map->instance_type() == HEAP_NUMBER_TYPE) return true; 5790 if (map->instance_type() == HEAP_NUMBER_TYPE) return true;
5789 if (map->instance_type() < FIRST_NONSTRING_TYPE) return true; 5791 if (map->instance_type() < FIRST_NONSTRING_TYPE) return true;
5790 return map->IsJSObjectMap() && !map->is_dictionary_map() && 5792 return map->IsJSObjectMap() && !map->is_dictionary_map() &&
5791 !map->has_named_interceptor() && 5793 !map->has_named_interceptor() &&
5792 // TODO(verwaest): Whitelist contexts to which we have access. 5794 // TODO(verwaest): Whitelist contexts to which we have access.
(...skipping 7842 matching lines...) Expand 10 before | Expand all | Expand 10 after
13635 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13637 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13636 } 13638 }
13637 13639
13638 #ifdef DEBUG 13640 #ifdef DEBUG
13639 graph_->Verify(false); // No full verify. 13641 graph_->Verify(false); // No full verify.
13640 #endif 13642 #endif
13641 } 13643 }
13642 13644
13643 } // namespace internal 13645 } // namespace internal
13644 } // namespace v8 13646 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698