Handlify GetSourceCode-related functions.

Review URL: https://chromiumcodereview.appspot.com/9374013

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10658 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent aa2e8421
......@@ -7616,13 +7616,10 @@ bool SharedFunctionInfo::HasSourceCode() {
}
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());
}
......
......@@ -5321,7 +5321,7 @@ class SharedFunctionInfo: public HeapObject {
// [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);
......
......@@ -2001,11 +2001,12 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetScript) {
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();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment