Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Side by Side Diff: runtime/vm/object.cc

Issue 1427863002: Token stream iterator improvement (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 8550 matching lines...) Expand 10 before | Expand all | Expand 10 after
8561 JSONArray members(&jsobj, "members"); 8561 JSONArray members(&jsobj, "members");
8562 } 8562 }
8563 8563
8564 8564
8565 TokenStream::Iterator::Iterator(const TokenStream& tokens, 8565 TokenStream::Iterator::Iterator(const TokenStream& tokens,
8566 intptr_t token_pos, 8566 intptr_t token_pos,
8567 Iterator::StreamType stream_type) 8567 Iterator::StreamType stream_type)
8568 : tokens_(TokenStream::Handle(tokens.raw())), 8568 : tokens_(TokenStream::Handle(tokens.raw())),
8569 data_(ExternalTypedData::Handle(tokens.GetStream())), 8569 data_(ExternalTypedData::Handle(tokens.GetStream())),
8570 stream_(reinterpret_cast<uint8_t*>(data_.DataAddr(0)), data_.Length()), 8570 stream_(reinterpret_cast<uint8_t*>(data_.DataAddr(0)), data_.Length()),
8571 token_objects_(GrowableObjectArray::Handle(tokens.TokenObjects())), 8571 token_objects_(Array::Handle(
8572 GrowableObjectArray::Handle(tokens.TokenObjects()).data())),
8572 obj_(Object::Handle()), 8573 obj_(Object::Handle()),
8573 cur_token_pos_(token_pos), 8574 cur_token_pos_(token_pos),
8574 cur_token_kind_(Token::kILLEGAL), 8575 cur_token_kind_(Token::kILLEGAL),
8575 cur_token_obj_index_(-1), 8576 cur_token_obj_index_(-1),
8576 stream_type_(stream_type) { 8577 stream_type_(stream_type) {
8577 SetCurrentPosition(token_pos); 8578 SetCurrentPosition(token_pos);
8578 } 8579 }
8579 8580
8580 8581
8581 void TokenStream::Iterator::SetStream(const TokenStream& tokens, 8582 void TokenStream::Iterator::SetStream(const TokenStream& tokens,
8582 intptr_t token_pos) { 8583 intptr_t token_pos) {
8583 tokens_ = tokens.raw(); 8584 tokens_ = tokens.raw();
8584 data_ = tokens.GetStream(); 8585 data_ = tokens.GetStream();
8585 stream_.SetStream(reinterpret_cast<uint8_t*>(data_.DataAddr(0)), 8586 stream_.SetStream(reinterpret_cast<uint8_t*>(data_.DataAddr(0)),
8586 data_.Length()); 8587 data_.Length());
8587 token_objects_ = tokens.TokenObjects(); 8588 token_objects_ = GrowableObjectArray::Handle(tokens.TokenObjects()).data();
8588 obj_ = Object::null(); 8589 obj_ = Object::null();
8589 cur_token_pos_ = token_pos; 8590 cur_token_pos_ = token_pos;
8590 cur_token_kind_ = Token::kILLEGAL; 8591 cur_token_kind_ = Token::kILLEGAL;
8591 cur_token_obj_index_ = -1; 8592 cur_token_obj_index_ = -1;
8592 SetCurrentPosition(token_pos); 8593 SetCurrentPosition(token_pos);
8593 } 8594 }
8594 8595
8595 8596
8596 bool TokenStream::Iterator::IsValid() const { 8597 bool TokenStream::Iterator::IsValid() const {
8597 return !tokens_.IsNull(); 8598 return !tokens_.IsNull();
(...skipping 13330 matching lines...) Expand 10 before | Expand all | Expand 10 after
21928 return tag_label.ToCString(); 21929 return tag_label.ToCString();
21929 } 21930 }
21930 21931
21931 21932
21932 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 21933 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
21933 Instance::PrintJSONImpl(stream, ref); 21934 Instance::PrintJSONImpl(stream, ref);
21934 } 21935 }
21935 21936
21936 21937
21937 } // namespace dart 21938 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698