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());
function_(NULL),
is_eval_(false),
loop_nesting_(0) {
- Initialize();
ASSERT(closure_.is_null() &&
!shared_info_.is_null() &&
script_.is_null());
function_(literal),
is_eval_(is_eval),
loop_nesting_(0) {
- Initialize();
ASSERT(closure_.is_null() &&
shared_info_.is_null() &&
!script_.is_null());
// 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);
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_;
bool is_eval_;
int loop_nesting_;
- Handle<Object> receiver_;
-
- bool has_this_properties_;
- bool has_globals_;
-
DISALLOW_COPY_AND_ASSIGN(CompilationInfo);
};
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;
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;
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:
// 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;
}
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());
}
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());
}
// 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();
}