Index: src/compiler.cc |
=================================================================== |
--- src/compiler.cc (revision 5039) |
+++ src/compiler.cc (working copy) |
@@ -40,6 +40,7 @@ |
#include "oprofile-agent.h" |
#include "rewriter.h" |
#include "scopes.h" |
+#include "scopeinfo.h" |
namespace v8 { |
namespace internal { |
@@ -156,7 +157,12 @@ |
#ifdef ENABLE_DEBUGGER_SUPPORT |
Handle<Code> MakeCodeForLiveEdit(CompilationInfo* info) { |
Handle<Context> context = Handle<Context>::null(); |
- return MakeCode(context, info); |
+ Handle<Code> code = MakeCode(context, info); |
+ if (!info->shared_info().is_null()) { |
+ info->shared_info()->set_scope_info( |
+ *ScopeInfo<>::CreateHeapObject(info->scope())); |
+ } |
+ return code; |
} |
#endif |
@@ -252,9 +258,11 @@ |
// Allocate function. |
Handle<SharedFunctionInfo> result = |
- Factory::NewSharedFunctionInfo(lit->name(), |
- lit->materialized_literal_count(), |
- code); |
+ Factory::NewSharedFunctionInfo( |
+ lit->name(), |
+ lit->materialized_literal_count(), |
+ code, |
+ ScopeInfo<>::CreateHeapObject(info.scope())); |
ASSERT_EQ(RelocInfo::kNoPosition, lit->function_token_position()); |
Compiler::SetFunctionInfo(result, lit, true, script); |
@@ -445,8 +453,9 @@ |
info->script(), |
code); |
- // Update the shared function info with the compiled code. |
+ // Update the shared function info with the compiled code and the scope info. |
shared->set_code(*code); |
+ shared->set_scope_info(*ScopeInfo<>::CreateHeapObject(info->scope())); |
// Set the expected number of properties for instances. |
SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count()); |
@@ -481,6 +490,8 @@ |
bool allow_lazy = literal->AllowsLazyCompilation() && |
!LiveEditFunctionTracker::IsActive(); |
+ Handle<Object> scope_info(ScopeInfo<>::EmptyHeapObject()); |
+ |
// Generate code |
Handle<Code> code; |
if (FLAG_lazy && allow_lazy) { |
@@ -562,13 +573,15 @@ |
literal->start_position(), |
script, |
code); |
+ scope_info = ScopeInfo<>::CreateHeapObject(info.scope()); |
} |
// Create a shared function info object. |
Handle<SharedFunctionInfo> result = |
Factory::NewSharedFunctionInfo(literal->name(), |
literal->materialized_literal_count(), |
- code); |
+ code, |
+ scope_info); |
SetFunctionInfo(result, literal, false, script); |
// Set the expected number of properties for instances and return |