Commit 0de87ac8 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

Remove duplicate code for searching SharedFunctionInfo.

R=mvstanton@chromium.org

Review URL: https://codereview.chromium.org/762123002

Cr-Commit-Position: refs/heads/master@{#25561}
parent 297935b3
...@@ -164,6 +164,8 @@ bool FunctionLiteral::uses_super_constructor_call() const { ...@@ -164,6 +164,8 @@ bool FunctionLiteral::uses_super_constructor_call() const {
} }
// Helper to find an existing shared function info in the baseline code for the
// given function literal. Used to canonicalize SharedFunctionInfo objects.
void FunctionLiteral::InitializeSharedInfo( void FunctionLiteral::InitializeSharedInfo(
Handle<Code> unoptimized_code) { Handle<Code> unoptimized_code) {
for (RelocIterator it(*unoptimized_code); !it.done(); it.next()) { for (RelocIterator it(*unoptimized_code); !it.done(); it.next()) {
......
...@@ -148,26 +148,6 @@ static LhsKind DetermineLhsKind(Expression* expr) { ...@@ -148,26 +148,6 @@ static LhsKind DetermineLhsKind(Expression* expr) {
} }
// Helper to find an existing shared function info in the baseline code for the
// given function literal. Used to canonicalize SharedFunctionInfo objects.
static Handle<SharedFunctionInfo> SearchSharedFunctionInfo(
Code* unoptimized_code, FunctionLiteral* expr) {
int start_position = expr->start_position();
for (RelocIterator it(unoptimized_code); !it.done(); it.next()) {
RelocInfo* rinfo = it.rinfo();
if (rinfo->rmode() != RelocInfo::EMBEDDED_OBJECT) continue;
Object* obj = rinfo->target_object();
if (obj->IsSharedFunctionInfo()) {
SharedFunctionInfo* shared = SharedFunctionInfo::cast(obj);
if (shared->start_position() == start_position) {
return Handle<SharedFunctionInfo>(shared);
}
}
}
return Handle<SharedFunctionInfo>();
}
StructuredGraphBuilder::Environment* AstGraphBuilder::CopyEnvironment( StructuredGraphBuilder::Environment* AstGraphBuilder::CopyEnvironment(
StructuredGraphBuilder::Environment* env) { StructuredGraphBuilder::Environment* env) {
return new (zone()) Environment(*reinterpret_cast<Environment*>(env)); return new (zone()) Environment(*reinterpret_cast<Environment*>(env));
...@@ -835,8 +815,8 @@ void AstGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) { ...@@ -835,8 +815,8 @@ void AstGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) {
// Build a new shared function info if we cannot find one in the baseline // Build a new shared function info if we cannot find one in the baseline
// code. We also have a stack overflow if the recursive compilation did. // code. We also have a stack overflow if the recursive compilation did.
Handle<SharedFunctionInfo> shared_info = expr->InitializeSharedInfo(handle(info()->shared_info()->code()));
SearchSharedFunctionInfo(info()->shared_info()->code(), expr); Handle<SharedFunctionInfo> shared_info = expr->shared_info();
if (shared_info.is_null()) { if (shared_info.is_null()) {
shared_info = Compiler::BuildFunctionInfo(expr, info()->script(), info()); shared_info = Compiler::BuildFunctionInfo(expr, info()->script(), info());
CHECK(!shared_info.is_null()); // TODO(mstarzinger): Set stack overflow? CHECK(!shared_info.is_null()); // TODO(mstarzinger): Set 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