OLD | NEW |
---|---|
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 6841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6852 ASSERT(obj->HasFastProperties()); | 6852 ASSERT(obj->HasFastProperties()); |
6853 | 6853 |
6854 return obj; | 6854 return obj; |
6855 } | 6855 } |
6856 | 6856 |
6857 | 6857 |
6858 // Init line_ends array with code positions of line ends inside script source | 6858 // Init line_ends array with code positions of line ends inside script source |
6859 void Script::InitLineEnds() { | 6859 void Script::InitLineEnds() { |
6860 if (!line_ends()->IsUndefined()) return; | 6860 if (!line_ends()->IsUndefined()) return; |
6861 | 6861 |
6862 if (source()->IsUndefined()) { | |
6863 set_line_ends(*(Factory::NewArrayLiteral(0))); | |
Søren Thygesen Gjesse
2009/02/24 13:23:52
Please use NewJSArray.
Mikhail Naganov
2009/02/24 13:41:01
Um, but 'NewArrayLiteral' uses NewJSArrayWithEleme
| |
6864 ASSERT(line_ends()->IsJSArray()); | |
6865 return; | |
6866 } | |
6867 | |
6862 Handle<String> src(String::cast(source())); | 6868 Handle<String> src(String::cast(source())); |
6863 const int src_len = src->length(); | 6869 const int src_len = src->length(); |
6864 Handle<String> new_line = Factory::NewStringFromAscii(CStrVector("\n")); | 6870 Handle<String> new_line = Factory::NewStringFromAscii(CStrVector("\n")); |
6865 | 6871 |
6866 // Pass 1: Identify line count | 6872 // Pass 1: Identify line count |
6867 int line_count = 0; | 6873 int line_count = 0; |
6868 int position = 0; | 6874 int position = 0; |
6869 while (position != -1 && position < src_len) { | 6875 while (position != -1 && position < src_len) { |
6870 position = Runtime::StringMatch(src, new_line, position); | 6876 position = Runtime::StringMatch(src, new_line, position); |
6871 if (position != -1) { | 6877 if (position != -1) { |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7157 // No break point. | 7163 // No break point. |
7158 if (break_point_objects()->IsUndefined()) return 0; | 7164 if (break_point_objects()->IsUndefined()) return 0; |
7159 // Single beak point. | 7165 // Single beak point. |
7160 if (!break_point_objects()->IsFixedArray()) return 1; | 7166 if (!break_point_objects()->IsFixedArray()) return 1; |
7161 // Multiple break points. | 7167 // Multiple break points. |
7162 return FixedArray::cast(break_point_objects())->length(); | 7168 return FixedArray::cast(break_point_objects())->length(); |
7163 } | 7169 } |
7164 | 7170 |
7165 | 7171 |
7166 } } // namespace v8::internal | 7172 } } // namespace v8::internal |
OLD | NEW |