OLD | NEW |
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 Loading... |
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()) return GetIsolate()->factory()->undefined_value(); |
7620 if (!HasSourceCode()) return isolate->heap()->undefined_value(); | 7620 Handle<String> source(String::cast(Script::cast(script())->source())); |
7621 HandleScope scope(isolate); | 7621 return SubString(source, start_position(), end_position()); |
7622 Object* source = Script::cast(script())->source(); | |
7623 return *SubString(Handle<String>(String::cast(source), isolate), | |
7624 start_position(), end_position()); | |
7625 } | 7622 } |
7626 | 7623 |
7627 | 7624 |
7628 int SharedFunctionInfo::SourceSize() { | 7625 int SharedFunctionInfo::SourceSize() { |
7629 return end_position() - start_position(); | 7626 return end_position() - start_position(); |
7630 } | 7627 } |
7631 | 7628 |
7632 | 7629 |
7633 int SharedFunctionInfo::CalculateInstanceSize() { | 7630 int SharedFunctionInfo::CalculateInstanceSize() { |
7634 int instance_size = | 7631 int instance_size = |
(...skipping 5398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13033 if (break_point_objects()->IsUndefined()) return 0; | 13030 if (break_point_objects()->IsUndefined()) return 0; |
13034 // Single break point. | 13031 // Single break point. |
13035 if (!break_point_objects()->IsFixedArray()) return 1; | 13032 if (!break_point_objects()->IsFixedArray()) return 1; |
13036 // Multiple break points. | 13033 // Multiple break points. |
13037 return FixedArray::cast(break_point_objects())->length(); | 13034 return FixedArray::cast(break_point_objects())->length(); |
13038 } | 13035 } |
13039 #endif // ENABLE_DEBUGGER_SUPPORT | 13036 #endif // ENABLE_DEBUGGER_SUPPORT |
13040 | 13037 |
13041 | 13038 |
13042 } } // namespace v8::internal | 13039 } } // namespace v8::internal |
OLD | NEW |