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

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

Issue 72923002: Add Dart keyword symbols to the VM isolate (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 | Annotate | Revision Log
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 6760 matching lines...) Expand 10 before | Expand all | Expand 10 after
6771 6771
6772 6772
6773 RawString* TokenStream::Iterator::MakeLiteralToken(const Object& obj) const { 6773 RawString* TokenStream::Iterator::MakeLiteralToken(const Object& obj) const {
6774 if (obj.IsString()) { 6774 if (obj.IsString()) {
6775 return reinterpret_cast<RawString*>(obj.raw()); 6775 return reinterpret_cast<RawString*>(obj.raw());
6776 } else if (obj.IsSmi()) { 6776 } else if (obj.IsSmi()) {
6777 Token::Kind kind = static_cast<Token::Kind>( 6777 Token::Kind kind = static_cast<Token::Kind>(
6778 Smi::Value(reinterpret_cast<RawSmi*>(obj.raw()))); 6778 Smi::Value(reinterpret_cast<RawSmi*>(obj.raw())));
6779 ASSERT(kind < Token::kNumTokens); 6779 ASSERT(kind < Token::kNumTokens);
6780 if (Token::IsPseudoKeyword(kind) || Token::IsKeyword(kind)) { 6780 if (Token::IsPseudoKeyword(kind) || Token::IsKeyword(kind)) {
6781 Isolate* isolate = Isolate::Current(); 6781 return Symbols::Keyword(kind).raw();
6782 ObjectStore* object_store = isolate->object_store();
6783 const Array& symbols = Array::Handle(isolate,
6784 object_store->keyword_symbols());
6785 ASSERT(!symbols.IsNull());
6786 ASSERT(symbols.At(kind - Token::kFirstKeyword) != Object::null());
6787 return String::RawCast(symbols.At(kind - Token::kFirstKeyword));
6788 } 6782 }
6789 return Symbols::New(Token::Str(kind)); 6783 return Symbols::New(Token::Str(kind));
6790 } else { 6784 } else {
6791 ASSERT(obj.IsLiteralToken()); // Must be a literal token. 6785 ASSERT(obj.IsLiteralToken()); // Must be a literal token.
6792 const LiteralToken& literal_token = LiteralToken::Cast(obj); 6786 const LiteralToken& literal_token = LiteralToken::Cast(obj);
6793 return literal_token.literal(); 6787 return literal_token.literal();
6794 } 6788 }
6795 } 6789 }
6796 6790
6797 6791
(...skipping 8991 matching lines...) Expand 10 before | Expand all | Expand 10 after
15789 return "_MirrorReference"; 15783 return "_MirrorReference";
15790 } 15784 }
15791 15785
15792 15786
15793 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 15787 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
15794 JSONObject jsobj(stream); 15788 JSONObject jsobj(stream);
15795 } 15789 }
15796 15790
15797 15791
15798 } // namespace dart 15792 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart.cc ('k') | runtime/vm/object_store.h » ('j') | runtime/vm/object_store.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698