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

Side by Side Diff: src/objects.cc

Issue 9374013: Handlify GetSourceCode-related functions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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.h ('k') | src/runtime.cc » ('j') | 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 7597 matching lines...) Expand 10 before | Expand all | Expand 10 after
7608 return String::cast(n); 7608 return String::cast(n);
7609 } 7609 }
7610 7610
7611 7611
7612 bool SharedFunctionInfo::HasSourceCode() { 7612 bool SharedFunctionInfo::HasSourceCode() {
7613 return !script()->IsUndefined() && 7613 return !script()->IsUndefined() &&
7614 !reinterpret_cast<Script*>(script())->source()->IsUndefined(); 7614 !reinterpret_cast<Script*>(script())->source()->IsUndefined();
7615 } 7615 }
7616 7616
7617 7617
7618 Object* SharedFunctionInfo::GetSourceCode() { 7618 Handle<Object> SharedFunctionInfo::GetSourceCode() {
7619 Isolate* isolate = GetIsolate(); 7619 if (!HasSourceCode()) {
7620 if (!HasSourceCode()) return isolate->heap()->undefined_value(); 7620 return Handle<Object>(GetIsolate()->heap()->undefined_value());
Kevin Millikin (Chromium) 2012/02/09 08:01:51 You should write this as return GetIsolate()->fac
Sven Panne 2012/02/09 08:17:48 Good point. Done.
7621 HandleScope scope(isolate); 7621 }
7622 Object* source = Script::cast(script())->source(); 7622 Handle<String> source(String::cast(Script::cast(script())->source()));
7623 return *SubString(Handle<String>(String::cast(source), isolate), 7623 return SubString(source, start_position(), end_position());
7624 start_position(), end_position());
7625 } 7624 }
7626 7625
7627 7626
7628 int SharedFunctionInfo::SourceSize() { 7627 int SharedFunctionInfo::SourceSize() {
7629 return end_position() - start_position(); 7628 return end_position() - start_position();
7630 } 7629 }
7631 7630
7632 7631
7633 int SharedFunctionInfo::CalculateInstanceSize() { 7632 int SharedFunctionInfo::CalculateInstanceSize() {
7634 int instance_size = 7633 int instance_size =
(...skipping 5398 matching lines...) Expand 10 before | Expand all | Expand 10 after
13033 if (break_point_objects()->IsUndefined()) return 0; 13032 if (break_point_objects()->IsUndefined()) return 0;
13034 // Single break point. 13033 // Single break point.
13035 if (!break_point_objects()->IsFixedArray()) return 1; 13034 if (!break_point_objects()->IsFixedArray()) return 1;
13036 // Multiple break points. 13035 // Multiple break points.
13037 return FixedArray::cast(break_point_objects())->length(); 13036 return FixedArray::cast(break_point_objects())->length();
13038 } 13037 }
13039 #endif // ENABLE_DEBUGGER_SUPPORT 13038 #endif // ENABLE_DEBUGGER_SUPPORT
13040 13039
13041 13040
13042 } } // namespace v8::internal 13041 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698