#include "compiler.h"
#include "oprofile-agent.h"
#include "scopes.h"
+#include "scopeinfo.h"
#include "global-handles.h"
#include "debug.h"
#include "memory.h"
this->SetSmiValueField(kParamNumOffset_, param_num);
this->SetSmiValueField(kParentIndexOffset_, parent_index);
}
- void SetFunctionCode(Handle<Code> function_code) {
- Handle<JSValue> wrapper = WrapInJSValue(*function_code);
- this->SetField(kCodeOffset_, wrapper);
+ void SetFunctionCode(Handle<Code> function_code,
+ Handle<Object> code_scope_info) {
+ Handle<JSValue> code_wrapper = WrapInJSValue(*function_code);
+ this->SetField(kCodeOffset_, code_wrapper);
+
+ Handle<JSValue> scope_wrapper = WrapInJSValue(*code_scope_info);
+ this->SetField(kCodeScopeInfoOffset_, scope_wrapper);
}
- void SetScopeInfo(Handle<Object> scope_info_array) {
- this->SetField(kScopeInfoOffset_, scope_info_array);
+ void SetOuterScopeInfo(Handle<Object> scope_info_array) {
+ this->SetField(kOuterScopeInfoOffset_, scope_info_array);
}
void SetSharedFunctionInfo(Handle<SharedFunctionInfo> info) {
Handle<JSValue> info_holder = WrapInJSValue(*info);
JSValue::cast(this->GetField(kCodeOffset_))));
return Handle<Code>::cast(raw_result);
}
+ Handle<Object> GetCodeScopeInfo() {
+ Handle<Object> raw_result = UnwrapJSValue(Handle<JSValue>(
+ JSValue::cast(this->GetField(kCodeScopeInfoOffset_))));
+ return raw_result;
+ }
int GetStartPosition() {
return this->GetSmiValueField(kStartPositionOffset_);
}
static const int kEndPositionOffset_ = 2;
static const int kParamNumOffset_ = 3;
static const int kCodeOffset_ = 4;
- static const int kScopeInfoOffset_ = 5;
- static const int kParentIndexOffset_ = 6;
- static const int kSharedFunctionInfoOffset_ = 7;
- static const int kSize_ = 8;
+ static const int kCodeScopeInfoOffset_ = 5;
+ static const int kOuterScopeInfoOffset_ = 6;
+ static const int kParentIndexOffset_ = 7;
+ static const int kSharedFunctionInfoOffset_ = 8;
+ static const int kSize_ = 9;
friend class JSArrayBasedStruct<FunctionInfoWrapper>;
};
void FunctionCode(Handle<Code> function_code) {
FunctionInfoWrapper info =
FunctionInfoWrapper::cast(result_->GetElement(current_parent_index_));
- info.SetFunctionCode(function_code);
+ info.SetFunctionCode(function_code, Handle<Object>(Heap::null_value()));
}
// Saves full information about a function: its code, its scope info
}
FunctionInfoWrapper info =
FunctionInfoWrapper::cast(result_->GetElement(current_parent_index_));
- info.SetFunctionCode(Handle<Code>(shared->code()));
+ info.SetFunctionCode(Handle<Code>(shared->code()),
+ Handle<Object>(shared->scope_info()));
info.SetSharedFunctionInfo(shared);
Handle<Object> scope_info_list(SerializeFunctionScope(scope));
- info.SetScopeInfo(scope_info_list);
+ info.SetOuterScopeInfo(scope_info_list);
}
Handle<JSArray> GetResult() {
if (IsJSFunctionCode(shared_info->code())) {
ReplaceCodeObject(shared_info->code(),
*(compile_info_wrapper.GetFunctionCode()));
+ Handle<Object> code_scope_info = compile_info_wrapper.GetCodeScopeInfo();
+ if (code_scope_info->IsFixedArray()) {
+ shared_info->set_scope_info(SerializedScopeInfo::cast(*code_scope_info));
+ }
}
if (shared_info->debug_info()->IsDebugInfo()) {