OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 9716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9727 | 9727 |
9728 bool SharedFunctionInfo::HasSourceCode() { | 9728 bool SharedFunctionInfo::HasSourceCode() { |
9729 return !script()->IsUndefined() && | 9729 return !script()->IsUndefined() && |
9730 !reinterpret_cast<Script*>(script())->source()->IsUndefined(); | 9730 !reinterpret_cast<Script*>(script())->source()->IsUndefined(); |
9731 } | 9731 } |
9732 | 9732 |
9733 | 9733 |
9734 Handle<Object> SharedFunctionInfo::GetSourceCode() { | 9734 Handle<Object> SharedFunctionInfo::GetSourceCode() { |
9735 if (!HasSourceCode()) return GetIsolate()->factory()->undefined_value(); | 9735 if (!HasSourceCode()) return GetIsolate()->factory()->undefined_value(); |
9736 Handle<String> source(String::cast(Script::cast(script())->source())); | 9736 Handle<String> source(String::cast(Script::cast(script())->source())); |
9737 return SubString(source, start_position(), end_position()); | 9737 return GetIsolate()->factory()->NewSubString( |
| 9738 source, start_position(), end_position()); |
9738 } | 9739 } |
9739 | 9740 |
9740 | 9741 |
9741 int SharedFunctionInfo::SourceSize() { | 9742 int SharedFunctionInfo::SourceSize() { |
9742 return end_position() - start_position(); | 9743 return end_position() - start_position(); |
9743 } | 9744 } |
9744 | 9745 |
9745 | 9746 |
9746 int SharedFunctionInfo::CalculateInstanceSize() { | 9747 int SharedFunctionInfo::CalculateInstanceSize() { |
9747 int instance_size = | 9748 int instance_size = |
(...skipping 6357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16105 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16106 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16106 static const char* error_messages_[] = { | 16107 static const char* error_messages_[] = { |
16107 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16108 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16108 }; | 16109 }; |
16109 #undef ERROR_MESSAGES_TEXTS | 16110 #undef ERROR_MESSAGES_TEXTS |
16110 return error_messages_[reason]; | 16111 return error_messages_[reason]; |
16111 } | 16112 } |
16112 | 16113 |
16113 | 16114 |
16114 } } // namespace v8::internal | 16115 } } // namespace v8::internal |
OLD | NEW |