Revision: 10658
Author:   [email protected]
Date:     Thu Feb  9 02:46:50 2012
Log:      Handlify GetSourceCode-related functions.

Review URL: https://chromiumcodereview.appspot.com/9374013
http://code.google.com/p/v8/source/detail?r=10658

Modified:
 /branches/bleeding_edge/src/objects.cc
 /branches/bleeding_edge/src/objects.h
 /branches/bleeding_edge/src/runtime.cc

=======================================
--- /branches/bleeding_edge/src/objects.cc      Thu Feb  9 01:55:14 2012
+++ /branches/bleeding_edge/src/objects.cc      Thu Feb  9 02:46:50 2012
@@ -7616,13 +7616,10 @@
 }


-Object* SharedFunctionInfo::GetSourceCode() {
-  Isolate* isolate = GetIsolate();
-  if (!HasSourceCode()) return isolate->heap()->undefined_value();
-  HandleScope scope(isolate);
-  Object* source = Script::cast(script())->source();
-  return *SubString(Handle<String>(String::cast(source), isolate),
-                    start_position(), end_position());
+Handle<Object> SharedFunctionInfo::GetSourceCode() {
+  if (!HasSourceCode()) return GetIsolate()->factory()->undefined_value();
+  Handle<String> source(String::cast(Script::cast(script())->source()));
+  return SubString(source, start_position(), end_position());
 }


=======================================
--- /branches/bleeding_edge/src/objects.h       Thu Feb  9 02:19:46 2012
+++ /branches/bleeding_edge/src/objects.h       Thu Feb  9 02:46:50 2012
@@ -5321,7 +5321,7 @@

   // [source code]: Source code for the function.
   bool HasSourceCode();
-  Object* GetSourceCode();
+  Handle<Object> GetSourceCode();

   inline int opt_count();
   inline void set_opt_count(int opt_count);
=======================================
--- /branches/bleeding_edge/src/runtime.cc      Thu Feb  9 02:19:46 2012
+++ /branches/bleeding_edge/src/runtime.cc      Thu Feb  9 02:46:50 2012
@@ -2001,11 +2001,12 @@


 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetSourceCode) {
-  NoHandleAllocation ha;
+  HandleScope scope(isolate);
   ASSERT(args.length() == 1);

-  CONVERT_CHECKED(JSFunction, f, args[0]);
-  return f->shared()->GetSourceCode();
+  CONVERT_ARG_CHECKED(JSFunction, f, 0);
+  Handle<SharedFunctionInfo> shared(f->shared());
+  return *shared->GetSourceCode();
 }


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

Reply via email to