| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file | 
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a | 
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "vm/object.h" | 5 #include "vm/object.h" | 
| 6 | 6 | 
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" | 
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" | 
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" | 
| 10 #include "vm/become.h" | 10 #include "vm/become.h" | 
| (...skipping 8848 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 8859   if (kind() == RawScript::kKernelTag) { | 8859   if (kind() == RawScript::kKernelTag) { | 
| 8860     const Array& line_starts_array = Array::Handle(line_starts()); | 8860     const Array& line_starts_array = Array::Handle(line_starts()); | 
| 8861     if (line_starts_array.IsNull()) { | 8861     if (line_starts_array.IsNull()) { | 
| 8862       // Scripts in the AOT snapshot do not have a line starts array. | 8862       // Scripts in the AOT snapshot do not have a line starts array. | 
| 8863       // A well-formed line number array has a leading null. | 8863       // A well-formed line number array has a leading null. | 
| 8864       info.Add(line_separator);  // New line. | 8864       info.Add(line_separator);  // New line. | 
| 8865       return info.raw(); | 8865       return info.raw(); | 
| 8866     } | 8866     } | 
| 8867     intptr_t line_count = line_starts_array.Length(); | 8867     intptr_t line_count = line_starts_array.Length(); | 
| 8868     ASSERT(line_count > 0); | 8868     ASSERT(line_count > 0); | 
| 8869     const Array& debug_positions_array = Array::Handle(debug_positions()); |  | 
| 8870     intptr_t token_count = debug_positions_array.Length(); |  | 
| 8871     int token_index = 0; |  | 
| 8872 | 8869 | 
| 8873     for (int line_index = 0; line_index < line_count; ++line_index) { | 8870     for (int i = 0; i < line_count; i++) { | 
| 8874       value ^= line_starts_array.At(line_index); | 8871       info.Add(line_separator);  // New line. | 
| 8875       intptr_t start = value.Value(); | 8872       value = Smi::New(i + 1); | 
| 8876       // Output the rest of the tokens if we have no next line. | 8873       info.Add(value);  // Line number. | 
| 8877       intptr_t end = INTPTR_MAX; | 8874       value ^= line_starts_array.At(i); | 
| 8878       if (line_index + 1 < line_count) { | 8875       info.Add(value);  // Token position. | 
| 8879         value ^= line_starts_array.At(line_index + 1); | 8876       value = Smi::New(1); | 
| 8880         end = value.Value(); | 8877       info.Add(value);  // Column. | 
| 8881       } |  | 
| 8882       bool first = true; |  | 
| 8883       while (token_index < token_count) { |  | 
| 8884         value ^= debug_positions_array.At(token_index); |  | 
| 8885         intptr_t debug_position = value.Value(); |  | 
| 8886         if (debug_position >= end) break; |  | 
| 8887 |  | 
| 8888         if (first) { |  | 
| 8889           info.Add(line_separator);          // New line. |  | 
| 8890           value = Smi::New(line_index + 1);  // Line number. |  | 
| 8891           info.Add(value); |  | 
| 8892           first = false; |  | 
| 8893         } |  | 
| 8894 |  | 
| 8895         value ^= debug_positions_array.At(token_index); |  | 
| 8896         info.Add(value);                               // Token position. |  | 
| 8897         value = Smi::New(debug_position - start + 1);  // Column. |  | 
| 8898         info.Add(value); |  | 
| 8899         ++token_index; |  | 
| 8900       } |  | 
| 8901     } | 8878     } | 
| 8902     return info.raw(); | 8879     return info.raw(); | 
| 8903   } | 8880   } | 
| 8904 | 8881 | 
| 8905   const TokenStream& tkns = TokenStream::Handle(zone, tokens()); | 8882   const TokenStream& tkns = TokenStream::Handle(zone, tokens()); | 
| 8906   String& tokenValue = String::Handle(zone); | 8883   String& tokenValue = String::Handle(zone); | 
| 8907   ASSERT(!tkns.IsNull()); | 8884   ASSERT(!tkns.IsNull()); | 
| 8908   TokenStream::Iterator tkit(zone, tkns, TokenPosition::kMinSource, | 8885   TokenStream::Iterator tkit(zone, tkns, TokenPosition::kMinSource, | 
| 8909                              TokenStream::Iterator::kAllTokens); | 8886                              TokenStream::Iterator::kAllTokens); | 
| 8910   int current_line = -1; | 8887   int current_line = -1; | 
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 9011 | 8988 | 
| 9012 void Script::set_source(const String& value) const { | 8989 void Script::set_source(const String& value) const { | 
| 9013   StorePointer(&raw_ptr()->source_, value.raw()); | 8990   StorePointer(&raw_ptr()->source_, value.raw()); | 
| 9014 } | 8991 } | 
| 9015 | 8992 | 
| 9016 void Script::set_line_starts(const Array& value) const { | 8993 void Script::set_line_starts(const Array& value) const { | 
| 9017   StorePointer(&raw_ptr()->line_starts_, value.raw()); | 8994   StorePointer(&raw_ptr()->line_starts_, value.raw()); | 
| 9018 } | 8995 } | 
| 9019 | 8996 | 
| 9020 | 8997 | 
| 9021 void Script::set_debug_positions(const Array& value) const { |  | 
| 9022   StorePointer(&raw_ptr()->debug_positions_, value.raw()); |  | 
| 9023 } |  | 
| 9024 |  | 
| 9025 void Script::set_yield_positions(const Array& value) const { |  | 
| 9026   StorePointer(&raw_ptr()->yield_positions_, value.raw()); |  | 
| 9027 } |  | 
| 9028 |  | 
| 9029 void Script::set_kind(RawScript::Kind value) const { | 8998 void Script::set_kind(RawScript::Kind value) const { | 
| 9030   StoreNonPointer(&raw_ptr()->kind_, value); | 8999   StoreNonPointer(&raw_ptr()->kind_, value); | 
| 9031 } | 9000 } | 
| 9032 | 9001 | 
| 9033 | 9002 | 
| 9034 void Script::set_load_timestamp(int64_t value) const { | 9003 void Script::set_load_timestamp(int64_t value) const { | 
| 9035   StoreNonPointer(&raw_ptr()->load_timestamp_, value); | 9004   StoreNonPointer(&raw_ptr()->load_timestamp_, value); | 
| 9036 } | 9005 } | 
| 9037 | 9006 | 
| 9038 | 9007 | 
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 9109       } else { | 9078       } else { | 
| 9110         min = midpoint; | 9079         min = midpoint; | 
| 9111       } | 9080       } | 
| 9112     } | 9081     } | 
| 9113     *line = min + 1; | 9082     *line = min + 1; | 
| 9114     smi ^= line_starts_array.At(min); | 9083     smi ^= line_starts_array.At(min); | 
| 9115     if (column != NULL) { | 9084     if (column != NULL) { | 
| 9116       *column = offset - smi.Value() + 1; | 9085       *column = offset - smi.Value() + 1; | 
| 9117     } | 9086     } | 
| 9118     if (token_len != NULL) { | 9087     if (token_len != NULL) { | 
| 9119       // We don't explicitly save this data. |  | 
| 9120       // TODO(jensj): Load the source and attempt to find it from there. |  | 
| 9121       *token_len = 1; | 9088       *token_len = 1; | 
| 9122     } | 9089     } | 
| 9123     return; | 9090     return; | 
| 9124   } | 9091   } | 
| 9125 | 9092 | 
| 9126   const TokenStream& tkns = TokenStream::Handle(zone, tokens()); | 9093   const TokenStream& tkns = TokenStream::Handle(zone, tokens()); | 
| 9127   if (tkns.IsNull()) { | 9094   if (tkns.IsNull()) { | 
| 9128     ASSERT((Dart::vm_snapshot_kind() == Snapshot::kAppAOT)); | 9095     ASSERT((Dart::vm_snapshot_kind() == Snapshot::kAppAOT)); | 
| 9129     *line = -1; | 9096     *line = -1; | 
| 9130     if (column != NULL) { | 9097     if (column != NULL) { | 
| (...skipping 13954 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 23085   return UserTag::null(); | 23052   return UserTag::null(); | 
| 23086 } | 23053 } | 
| 23087 | 23054 | 
| 23088 | 23055 | 
| 23089 const char* UserTag::ToCString() const { | 23056 const char* UserTag::ToCString() const { | 
| 23090   const String& tag_label = String::Handle(label()); | 23057   const String& tag_label = String::Handle(label()); | 
| 23091   return tag_label.ToCString(); | 23058   return tag_label.ToCString(); | 
| 23092 } | 23059 } | 
| 23093 | 23060 | 
| 23094 }  // namespace dart | 23061 }  // namespace dart | 
| OLD | NEW | 
|---|