Remove some unused fields from class CompilationInfo.

Review URL: http://codereview.chromium.org/3533007

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5557 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
kmillikin@chromium.org 2010-09-29 17:38:37 +00:00
parent 3567207741
commit 4d04e9d5d4
5 changed files with 15 additions and 46 deletions

View File

@ -42,15 +42,11 @@ namespace internal {
class CompilationInfo BASE_EMBEDDED {
public:
// Lazy compilation of a JSFunction.
CompilationInfo(Handle<JSFunction> closure,
int loop_nesting,
Handle<Object> receiver)
CompilationInfo(Handle<JSFunction> closure, int loop_nesting)
: closure_(closure),
function_(NULL),
is_eval_(false),
loop_nesting_(loop_nesting),
receiver_(receiver) {
Initialize();
loop_nesting_(loop_nesting) {
ASSERT(!closure_.is_null() &&
shared_info_.is_null() &&
script_.is_null());
@ -62,7 +58,6 @@ class CompilationInfo BASE_EMBEDDED {
function_(NULL),
is_eval_(false),
loop_nesting_(0) {
Initialize();
ASSERT(closure_.is_null() &&
!shared_info_.is_null() &&
script_.is_null());
@ -74,7 +69,6 @@ class CompilationInfo BASE_EMBEDDED {
function_(literal),
is_eval_(is_eval),
loop_nesting_(0) {
Initialize();
ASSERT(closure_.is_null() &&
shared_info_.is_null() &&
!script_.is_null());
@ -112,11 +106,6 @@ class CompilationInfo BASE_EMBEDDED {
// Simple accessors.
bool is_eval() { return is_eval_; }
int loop_nesting() { return loop_nesting_; }
bool has_receiver() { return !receiver_.is_null(); }
Handle<Object> receiver() { return receiver_; }
bool has_this_properties() { return has_this_properties_; }
void set_has_this_properties(bool flag) { has_this_properties_ = flag; }
bool has_global_object() {
return !closure().is_null() && (closure()->context()->global() != NULL);
@ -126,18 +115,10 @@ class CompilationInfo BASE_EMBEDDED {
return has_global_object() ? closure()->context()->global() : NULL;
}
bool has_globals() { return has_globals_; }
void set_has_globals(bool flag) { has_globals_ = flag; }
// Derived accessors.
Scope* scope() { return function()->scope(); }
private:
void Initialize() {
has_this_properties_ = false;
has_globals_ = false;
}
Handle<JSFunction> closure_;
Handle<SharedFunctionInfo> shared_info_;
Handle<Script> script_;
@ -147,11 +128,6 @@ class CompilationInfo BASE_EMBEDDED {
bool is_eval_;
int loop_nesting_;
Handle<Object> receiver_;
bool has_this_properties_;
bool has_globals_;
DISALLOW_COPY_AND_ASSIGN(CompilationInfo);
};

View File

@ -785,14 +785,13 @@ bool CompileLazyShared(Handle<SharedFunctionInfo> shared,
bool CompileLazy(Handle<JSFunction> function,
Handle<Object> receiver,
ClearExceptionFlag flag) {
if (function->shared()->is_compiled()) {
function->set_code(function->shared()->code());
function->shared()->set_code_age(0);
return true;
} else {
CompilationInfo info(function, 0, receiver);
CompilationInfo info(function, 0);
bool result = CompileLazyHelper(&info, flag);
PROFILE(FunctionCreateEvent(*function));
return result;
@ -801,14 +800,13 @@ bool CompileLazy(Handle<JSFunction> function,
bool CompileLazyInLoop(Handle<JSFunction> function,
Handle<Object> receiver,
ClearExceptionFlag flag) {
if (function->shared()->is_compiled()) {
function->set_code(function->shared()->code());
function->shared()->set_code_age(0);
return true;
} else {
CompilationInfo info(function, 1, receiver);
CompilationInfo info(function, 1);
bool result = CompileLazyHelper(&info, flag);
PROFILE(FunctionCreateEvent(*function));
return result;

View File

@ -345,13 +345,9 @@ bool EnsureCompiled(Handle<SharedFunctionInfo> shared,
bool CompileLazyShared(Handle<SharedFunctionInfo> shared,
ClearExceptionFlag flag);
bool CompileLazy(Handle<JSFunction> function,
Handle<Object> receiver,
ClearExceptionFlag flag);
bool CompileLazy(Handle<JSFunction> function, ClearExceptionFlag flag);
bool CompileLazyInLoop(Handle<JSFunction> function,
Handle<Object> receiver,
ClearExceptionFlag flag);
bool CompileLazyInLoop(Handle<JSFunction> function, ClearExceptionFlag flag);
class NoHandleAllocation BASE_EMBEDDED {
public:

View File

@ -1541,18 +1541,17 @@ void KeyedStoreIC::UpdateCaches(LookupResult* lookup,
// Static IC stub generators.
//
static Object* CompileFunction(Object* result,
Handle<Object> object,
InLoopFlag in_loop) {
static JSFunction* CompileFunction(JSFunction* function,
InLoopFlag in_loop) {
// Compile now with optimization.
HandleScope scope;
Handle<JSFunction> function = Handle<JSFunction>(JSFunction::cast(result));
Handle<JSFunction> function_handle(function);
if (in_loop == IN_LOOP) {
CompileLazyInLoop(function, object, CLEAR_EXCEPTION);
CompileLazyInLoop(function_handle, CLEAR_EXCEPTION);
} else {
CompileLazy(function, object, CLEAR_EXCEPTION);
CompileLazy(function_handle, CLEAR_EXCEPTION);
}
return *function;
return *function_handle;
}
@ -1575,7 +1574,7 @@ Object* CallIC_Miss(Arguments args) {
if (!result->IsJSFunction() || JSFunction::cast(result)->is_compiled()) {
return result;
}
return CompileFunction(result, args.at<Object>(0), ic.target()->ic_in_loop());
return CompileFunction(JSFunction::cast(result), ic.target()->ic_in_loop());
}
@ -1591,7 +1590,7 @@ Object* KeyedCallIC_Miss(Arguments args) {
if (!result->IsJSFunction() || JSFunction::cast(result)->is_compiled()) {
return result;
}
return CompileFunction(result, args.at<Object>(0), ic.target()->ic_in_loop());
return CompileFunction(JSFunction::cast(result), ic.target()->ic_in_loop());
}

View File

@ -6374,7 +6374,7 @@ static Object* Runtime_LazyCompile(Arguments args) {
// this means that things called through constructors are never known to
// be in loops. We compile them as if they are in loops here just in case.
ASSERT(!function->is_compiled());
if (!CompileLazyInLoop(function, Handle<Object>::null(), KEEP_EXCEPTION)) {
if (!CompileLazyInLoop(function, KEEP_EXCEPTION)) {
return Failure::Exception();
}