Reviewers: Michael Starzinger,

Message:
Please take a look.

Description:
Replace SharedFunctionInfo::EnsureCompiled with JSFunction::CompileLazy where
possible.

After we get rid of all SharedFunctionInfo::EnsureCompiled calls, it will be
possible to remove the HasTrivialOuterContext() condition in
Scope::AllowsLazyCompilation.

[email protected]

Please review this at https://chromiumcodereview.appspot.com/10542002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/bootstrapper.cc
  M src/runtime.cc


Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index a20f87b122cda6954667cb88e20d1c40a5e7e51a..5c98a5c77dff86993ee2cbc5910f1510d43a8e51 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -2094,11 +2094,9 @@ bool Genesis::InstallJSBuiltins(Handle<JSBuiltinsObject> builtins) {
     builtins->set_javascript_builtin(id, *function);
     Handle<SharedFunctionInfo> shared
         = Handle<SharedFunctionInfo>(function->shared());
-    if (!SharedFunctionInfo::EnsureCompiled(shared, CLEAR_EXCEPTION)) {
+    if (!JSFunction::CompileLazy(function, CLEAR_EXCEPTION)) {
       return false;
     }
-    // Set the code object on the function object.
-    function->ReplaceCode(function->shared()->code());
     builtins->set_javascript_builtin_code(id, shared->code());
   }
   return true;
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index c8ad03057c47a55f1658ecc024867c09d52865ce..7a97e4ea7aff111f3688719beb027be987649a7b 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -2182,7 +2182,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetCode) {
     Handle<JSFunction> fun = Handle<JSFunction>::cast(code);
     Handle<SharedFunctionInfo> shared(fun->shared());

-    if (!SharedFunctionInfo::EnsureCompiled(shared, KEEP_EXCEPTION)) {
+    if (!JSFunction::CompileLazy(fun, KEEP_EXCEPTION)) {
       return Failure::Exception();
     }
     // Since we don't store the source for this we should never
@@ -12504,7 +12504,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugDisassembleFunction) {
   // Get the function and make sure it is compiled.
   CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0);
   Handle<SharedFunctionInfo> shared(func->shared());
-  if (!SharedFunctionInfo::EnsureCompiled(shared, KEEP_EXCEPTION)) {
+  if (!JSFunction::CompileLazy(func, KEEP_EXCEPTION)) {
     return Failure::Exception();
   }
   func->code()->PrintLn();
@@ -12520,7 +12520,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugDisassembleConstructor) {
   // Get the function and make sure it is compiled.
   CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0);
   Handle<SharedFunctionInfo> shared(func->shared());
-  if (!SharedFunctionInfo::EnsureCompiled(shared, KEEP_EXCEPTION)) {
+  if (!JSFunction::CompileLazy(func, KEEP_EXCEPTION)) {
     return Failure::Exception();
   }
   shared->construct_stub()->PrintLn();


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to