| Index: src/ast.cc
|
| diff --git a/src/ast.cc b/src/ast.cc
|
| index 00d01001240acac63c91356ffe00fdda5a96fe3f..bd0c516e753a191f31d145c28ace81ec00439284 100644
|
| --- a/src/ast.cc
|
| +++ b/src/ast.cc
|
| @@ -238,6 +238,25 @@
|
| if (expr == nullptr || !expr->IsFunctionLiteral()) return false;
|
| DCHECK_NOT_NULL(expr->AsFunctionLiteral()->scope());
|
| return expr->AsFunctionLiteral()->scope()->NeedsHomeObject();
|
| +}
|
| +
|
| +
|
| +// 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(
|
| + Handle<Code> unoptimized_code) {
|
| + 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()) {
|
| + shared_info_ = Handle<SharedFunctionInfo>(shared);
|
| + break;
|
| + }
|
| + }
|
| + }
|
| }
|
|
|
|
|
|
|