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

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

Issue 64273012: Address comment from vm-based keyword symbols CL (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
« no previous file with comments | « no previous file | 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/symbols.h" 5 #include "vm/symbols.h"
6 6
7 #include "vm/handles.h" 7 #include "vm/handles.h"
8 #include "vm/handles_impl.h" 8 #include "vm/handles_impl.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 const char* Symbols::Name(SymbolId symbol) { 44 const char* Symbols::Name(SymbolId symbol) {
45 ASSERT((symbol > kIllegal) && (symbol < kNullCharId)); 45 ASSERT((symbol > kIllegal) && (symbol < kNullCharId));
46 return names[symbol]; 46 return names[symbol];
47 } 47 }
48 48
49 49
50 const String& Symbols::Keyword(Token::Kind keyword) { 50 const String& Symbols::Keyword(Token::Kind keyword) {
51 const int kw_index = keyword - Token::kFirstKeyword; 51 const int kw_index = keyword - Token::kFirstKeyword;
52 ASSERT((0 <= kw_index) && (kw_index < Token::numKeywords)); 52 ASSERT((0 <= kw_index) && (kw_index < Token::numKeywords));
53 ASSERT(Token::kABSTRACT == Token::kFirstKeyword); 53 // First keyword symbol is in symbol_handles_[kKwTableStart + 1].
54 const intptr_t keyword_id = Symbols::kABSTRACTId + kw_index; 54 const intptr_t keyword_id = Symbols::kKwTableStart + 1 + kw_index;
55 ASSERT(symbol_handles_[keyword_id] != NULL); 55 ASSERT(symbol_handles_[keyword_id] != NULL);
56 return *symbol_handles_[keyword_id]; 56 return *symbol_handles_[keyword_id];
57 } 57 }
58 58
59 59
60 void Symbols::InitOnce(Isolate* isolate) { 60 void Symbols::InitOnce(Isolate* isolate) {
61 // Should only be run by the vm isolate. 61 // Should only be run by the vm isolate.
62 ASSERT(isolate == Dart::vm_isolate()); 62 ASSERT(isolate == Dart::vm_isolate());
63 63
64 if (FLAG_dump_symbol_stats) { 64 if (FLAG_dump_symbol_stats) {
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 RawObject* Symbols::GetVMSymbol(intptr_t object_id) { 473 RawObject* Symbols::GetVMSymbol(intptr_t object_id) {
474 ASSERT(IsVMSymbolId(object_id)); 474 ASSERT(IsVMSymbolId(object_id));
475 intptr_t i = (object_id - kMaxPredefinedObjectIds); 475 intptr_t i = (object_id - kMaxPredefinedObjectIds);
476 if ((i > kIllegal) && (i < Symbols::kMaxPredefinedId)) { 476 if ((i > kIllegal) && (i < Symbols::kMaxPredefinedId)) {
477 return symbol_handles_[i]->raw(); 477 return symbol_handles_[i]->raw();
478 } 478 }
479 return Object::null(); 479 return Object::null();
480 } 480 }
481 481
482 } // namespace dart 482 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698