OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 preamble_[PreparseDataConstants::kSizeOffset] = 0; | 81 preamble_[PreparseDataConstants::kSizeOffset] = 0; |
82 ASSERT_EQ(6, PreparseDataConstants::kHeaderSize); | 82 ASSERT_EQ(6, PreparseDataConstants::kHeaderSize); |
83 #ifdef DEBUG | 83 #ifdef DEBUG |
84 prev_start_ = -1; | 84 prev_start_ = -1; |
85 #endif | 85 #endif |
86 should_log_symbols_ = true; | 86 should_log_symbols_ = true; |
87 } | 87 } |
88 | 88 |
89 | 89 |
90 void CompleteParserRecorder::LogMessage(int start_pos, | 90 void CompleteParserRecorder::LogMessage(int start_pos, |
91 int end_pos, | 91 int end_pos, |
92 const char* message, | 92 const char* message, |
93 const char* arg_opt) { | 93 const char* arg_opt, |
| 94 bool is_reference_error) { |
94 if (has_error()) return; | 95 if (has_error()) return; |
95 preamble_[PreparseDataConstants::kHasErrorOffset] = true; | 96 preamble_[PreparseDataConstants::kHasErrorOffset] = true; |
96 function_store_.Reset(); | 97 function_store_.Reset(); |
97 STATIC_ASSERT(PreparseDataConstants::kMessageStartPos == 0); | 98 STATIC_ASSERT(PreparseDataConstants::kMessageStartPos == 0); |
98 function_store_.Add(start_pos); | 99 function_store_.Add(start_pos); |
99 STATIC_ASSERT(PreparseDataConstants::kMessageEndPos == 1); | 100 STATIC_ASSERT(PreparseDataConstants::kMessageEndPos == 1); |
100 function_store_.Add(end_pos); | 101 function_store_.Add(end_pos); |
101 STATIC_ASSERT(PreparseDataConstants::kMessageArgCountPos == 2); | 102 STATIC_ASSERT(PreparseDataConstants::kMessageArgCountPos == 2); |
102 function_store_.Add((arg_opt == NULL) ? 0 : 1); | 103 function_store_.Add((arg_opt == NULL) ? 0 : 1); |
103 STATIC_ASSERT(PreparseDataConstants::kMessageTextPos == 3); | 104 STATIC_ASSERT(PreparseDataConstants::kIsReferenceErrorPos == 3); |
| 105 function_store_.Add(is_reference_error ? 1 : 0); |
| 106 STATIC_ASSERT(PreparseDataConstants::kMessageTextPos == 4); |
104 WriteString(CStrVector(message)); | 107 WriteString(CStrVector(message)); |
105 if (arg_opt != NULL) WriteString(CStrVector(arg_opt)); | 108 if (arg_opt != NULL) WriteString(CStrVector(arg_opt)); |
106 should_log_symbols_ = false; | 109 should_log_symbols_ = false; |
107 } | 110 } |
108 | 111 |
109 | 112 |
110 void CompleteParserRecorder::WriteString(Vector<const char> str) { | 113 void CompleteParserRecorder::WriteString(Vector<const char> str) { |
111 function_store_.Add(str.length()); | 114 function_store_.Add(str.length()); |
112 for (int i = 0; i < str.length(); i++) { | 115 for (int i = 0; i < str.length(); i++) { |
113 function_store_.Add(str[i]); | 116 function_store_.Add(str[i]); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 number &= mask; | 200 number &= mask; |
198 mask >>= 7; | 201 mask >>= 7; |
199 i -= 7; | 202 i -= 7; |
200 } | 203 } |
201 ASSERT(number < (1 << 7)); | 204 ASSERT(number < (1 << 7)); |
202 symbol_store_.Add(static_cast<byte>(number)); | 205 symbol_store_.Add(static_cast<byte>(number)); |
203 } | 206 } |
204 | 207 |
205 | 208 |
206 } } // namespace v8::internal. | 209 } } // namespace v8::internal. |
OLD | NEW |