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

Side by Side Diff: src/hydrogen.cc

Issue 1329293003: [runtime] Sanitize %NewClosure runtime entries. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Ports Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « src/full-codegen/x87/full-codegen-x87.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/hydrogen.h" 5 #include "src/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 5455 matching lines...) Expand 10 before | Expand all | Expand 10 after
5466 5466
5467 5467
5468 void HOptimizedGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) { 5468 void HOptimizedGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) {
5469 DCHECK(!HasStackOverflow()); 5469 DCHECK(!HasStackOverflow());
5470 DCHECK(current_block() != NULL); 5470 DCHECK(current_block() != NULL);
5471 DCHECK(current_block()->HasPredecessor()); 5471 DCHECK(current_block()->HasPredecessor());
5472 Handle<SharedFunctionInfo> shared_info = Compiler::GetSharedFunctionInfo( 5472 Handle<SharedFunctionInfo> shared_info = Compiler::GetSharedFunctionInfo(
5473 expr, current_info()->script(), top_info()); 5473 expr, current_info()->script(), top_info());
5474 // We also have a stack overflow if the recursive compilation did. 5474 // We also have a stack overflow if the recursive compilation did.
5475 if (HasStackOverflow()) return; 5475 if (HasStackOverflow()) return;
5476 HFunctionLiteral* instr = 5476 // Use the fast case closure allocation code that allocates in new
5477 New<HFunctionLiteral>(shared_info, expr->pretenure()); 5477 // space for nested functions that don't need literals cloning.
5478 HConstant* shared_info_value = Add<HConstant>(shared_info);
5479 HInstruction* instr;
5480 if (!expr->pretenure() && shared_info->num_literals() == 0) {
5481 FastNewClosureStub stub(isolate(), shared_info->language_mode(),
5482 shared_info->kind());
5483 FastNewClosureDescriptor descriptor(isolate());
5484 HValue* values[] = {context(), shared_info_value};
5485 HConstant* stub_value = Add<HConstant>(stub.GetCode());
5486 instr = New<HCallWithDescriptor>(stub_value, 0, descriptor,
5487 Vector<HValue*>(values, arraysize(values)),
5488 NORMAL_CALL);
5489 } else {
5490 Add<HPushArguments>(shared_info_value);
5491 Runtime::FunctionId function_id =
5492 expr->pretenure() ? Runtime::kNewClosure_Tenured : Runtime::kNewClosure;
5493 instr = New<HCallRuntime>(Runtime::FunctionForId(function_id), 1);
5494 }
5478 return ast_context()->ReturnInstruction(instr, expr->id()); 5495 return ast_context()->ReturnInstruction(instr, expr->id());
5479 } 5496 }
5480 5497
5481 5498
5482 void HOptimizedGraphBuilder::VisitClassLiteral(ClassLiteral* lit) { 5499 void HOptimizedGraphBuilder::VisitClassLiteral(ClassLiteral* lit) {
5483 DCHECK(!HasStackOverflow()); 5500 DCHECK(!HasStackOverflow());
5484 DCHECK(current_block() != NULL); 5501 DCHECK(current_block() != NULL);
5485 DCHECK(current_block()->HasPredecessor()); 5502 DCHECK(current_block()->HasPredecessor());
5486 return Bailout(kClassLiteral); 5503 return Bailout(kClassLiteral);
5487 } 5504 }
(...skipping 8008 matching lines...) Expand 10 before | Expand all | Expand 10 after
13496 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13513 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13497 } 13514 }
13498 13515
13499 #ifdef DEBUG 13516 #ifdef DEBUG
13500 graph_->Verify(false); // No full verify. 13517 graph_->Verify(false); // No full verify.
13501 #endif 13518 #endif
13502 } 13519 }
13503 13520
13504 } // namespace internal 13521 } // namespace internal
13505 } // namespace v8 13522 } // namespace v8
OLDNEW
« no previous file with comments | « src/full-codegen/x87/full-codegen-x87.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698