Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: src/runtime.cc

Issue 9374013: Handlify GetSourceCode-related functions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Use an easier way to get a handlified undefined. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1983 matching lines...) Expand 10 before | Expand all | Expand 10 after
1994 1994
1995 CONVERT_CHECKED(JSFunction, fun, args[0]); 1995 CONVERT_CHECKED(JSFunction, fun, args[0]);
1996 Handle<Object> script = Handle<Object>(fun->shared()->script(), isolate); 1996 Handle<Object> script = Handle<Object>(fun->shared()->script(), isolate);
1997 if (!script->IsScript()) return isolate->heap()->undefined_value(); 1997 if (!script->IsScript()) return isolate->heap()->undefined_value();
1998 1998
1999 return *GetScriptWrapper(Handle<Script>::cast(script)); 1999 return *GetScriptWrapper(Handle<Script>::cast(script));
2000 } 2000 }
2001 2001
2002 2002
2003 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetSourceCode) { 2003 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetSourceCode) {
2004 NoHandleAllocation ha; 2004 HandleScope scope(isolate);
2005 ASSERT(args.length() == 1); 2005 ASSERT(args.length() == 1);
2006 2006
2007 CONVERT_CHECKED(JSFunction, f, args[0]); 2007 CONVERT_ARG_CHECKED(JSFunction, f, 0);
2008 return f->shared()->GetSourceCode(); 2008 Handle<SharedFunctionInfo> shared(f->shared());
2009 return *shared->GetSourceCode();
2009 } 2010 }
2010 2011
2011 2012
2012 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetScriptSourcePosition) { 2013 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetScriptSourcePosition) {
2013 NoHandleAllocation ha; 2014 NoHandleAllocation ha;
2014 ASSERT(args.length() == 1); 2015 ASSERT(args.length() == 1);
2015 2016
2016 CONVERT_CHECKED(JSFunction, fun, args[0]); 2017 CONVERT_CHECKED(JSFunction, fun, args[0]);
2017 int pos = fun->shared()->start_position(); 2018 int pos = fun->shared()->start_position();
2018 return Smi::FromInt(pos); 2019 return Smi::FromInt(pos);
(...skipping 11635 matching lines...) Expand 10 before | Expand all | Expand 10 after
13654 // Handle last resort GC and make sure to allow future allocations 13655 // Handle last resort GC and make sure to allow future allocations
13655 // to grow the heap without causing GCs (if possible). 13656 // to grow the heap without causing GCs (if possible).
13656 isolate->counters()->gc_last_resort_from_js()->Increment(); 13657 isolate->counters()->gc_last_resort_from_js()->Increment();
13657 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13658 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13658 "Runtime::PerformGC"); 13659 "Runtime::PerformGC");
13659 } 13660 }
13660 } 13661 }
13661 13662
13662 13663
13663 } } // namespace v8::internal 13664 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698