| 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/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 7729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7740 } | 7740 } |
| 7741 | 7741 |
| 7742 | 7742 |
| 7743 RawTokenStream* TokenStream::New(intptr_t len) { | 7743 RawTokenStream* TokenStream::New(intptr_t len) { |
| 7744 if (len < 0 || len > kMaxElements) { | 7744 if (len < 0 || len > kMaxElements) { |
| 7745 // This should be caught before we reach here. | 7745 // This should be caught before we reach here. |
| 7746 FATAL1("Fatal error in TokenStream::New: invalid len %" Pd "\n", len); | 7746 FATAL1("Fatal error in TokenStream::New: invalid len %" Pd "\n", len); |
| 7747 } | 7747 } |
| 7748 uint8_t* data = reinterpret_cast<uint8_t*>(::malloc(len)); | 7748 uint8_t* data = reinterpret_cast<uint8_t*>(::malloc(len)); |
| 7749 ASSERT(data != NULL); | 7749 ASSERT(data != NULL); |
| 7750 Isolate* isolate = Isolate::Current(); |
| 7750 const ExternalTypedData& stream = ExternalTypedData::Handle( | 7751 const ExternalTypedData& stream = ExternalTypedData::Handle( |
| 7752 isolate, |
| 7751 ExternalTypedData::New(kExternalTypedDataUint8ArrayCid, | 7753 ExternalTypedData::New(kExternalTypedDataUint8ArrayCid, |
| 7752 data, len, Heap::kOld)); | 7754 data, len, Heap::kOld)); |
| 7753 stream.AddFinalizer(data, DataFinalizer); | 7755 stream.AddFinalizer(data, DataFinalizer); |
| 7754 const TokenStream& result = TokenStream::Handle(TokenStream::New()); | 7756 const TokenStream& result = TokenStream::Handle(isolate, TokenStream::New()); |
| 7755 result.SetStream(stream); | 7757 result.SetStream(stream); |
| 7756 return result.raw(); | 7758 return result.raw(); |
| 7757 } | 7759 } |
| 7758 | 7760 |
| 7759 | 7761 |
| 7760 // CompressedTokenMap maps String and LiteralToken keys to Smi values. | 7762 // CompressedTokenMap maps String and LiteralToken keys to Smi values. |
| 7761 // It also supports lookup by Scanner::TokenDescriptor. | 7763 // It also supports lookup by Scanner::TokenDescriptor. |
| 7762 class CompressedTokenTraits { | 7764 class CompressedTokenTraits { |
| 7763 public: | 7765 public: |
| 7764 static bool IsMatch(const Scanner::TokenDescriptor& descriptor, | 7766 static bool IsMatch(const Scanner::TokenDescriptor& descriptor, |
| (...skipping 11808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19573 return tag_label.ToCString(); | 19575 return tag_label.ToCString(); |
| 19574 } | 19576 } |
| 19575 | 19577 |
| 19576 | 19578 |
| 19577 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 19579 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 19578 Instance::PrintJSONImpl(stream, ref); | 19580 Instance::PrintJSONImpl(stream, ref); |
| 19579 } | 19581 } |
| 19580 | 19582 |
| 19581 | 19583 |
| 19582 } // namespace dart | 19584 } // namespace dart |
| OLD | NEW |