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

Side by Side Diff: vm/object.cc

Issue 10808111: Move more symbols to the vm isolate. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 4 months 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 | « vm/code_generator.cc ('k') | vm/parser.h » ('j') | vm/symbols.h » ('J')
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 "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/bootstrap.h" 10 #include "vm/bootstrap.h"
(...skipping 5002 matching lines...) Expand 10 before | Expand all | Expand 10 after
5013 if (FLAG_compiler_stats) { 5013 if (FLAG_compiler_stats) {
5014 CompilerStats::src_length += src.Length(); 5014 CompilerStats::src_length += src.Length();
5015 } 5015 }
5016 } 5016 }
5017 5017
5018 5018
5019 void Script::GetTokenLocation(intptr_t token_pos, 5019 void Script::GetTokenLocation(intptr_t token_pos,
5020 intptr_t* line, 5020 intptr_t* line,
5021 intptr_t* column) const { 5021 intptr_t* column) const {
5022 const String& src = String::Handle(Source()); 5022 const String& src = String::Handle(Source());
5023 const String& dummy_key = String::Handle(String::New("")); 5023 const String& dummy_key = String::Handle(Symbols::Empty());
5024 const TokenStream& tkns = TokenStream::Handle(tokens()); 5024 const TokenStream& tkns = TokenStream::Handle(tokens());
5025 intptr_t src_pos = tkns.ComputeSourcePosition(token_pos); 5025 intptr_t src_pos = tkns.ComputeSourcePosition(token_pos);
5026 Scanner scanner(src, dummy_key); 5026 Scanner scanner(src, dummy_key);
5027 scanner.ScanTo(src_pos); 5027 scanner.ScanTo(src_pos);
5028 *line = scanner.CurrentPosition().line; 5028 *line = scanner.CurrentPosition().line;
5029 *column = scanner.CurrentPosition().column; 5029 *column = scanner.CurrentPosition().column;
5030 } 5030 }
5031 5031
5032 5032
5033 void Script::TokenRangeAtLine(intptr_t line_number, 5033 void Script::TokenRangeAtLine(intptr_t line_number,
5034 intptr_t* first_token_index, 5034 intptr_t* first_token_index,
5035 intptr_t* last_token_index) const { 5035 intptr_t* last_token_index) const {
5036 intptr_t first_src_pos; 5036 intptr_t first_src_pos;
5037 intptr_t last_src_pos; 5037 intptr_t last_src_pos;
5038 const String& src = String::Handle(Source()); 5038 const String& src = String::Handle(Source());
5039 const String& dummy_key = String::Handle(String::New("")); 5039 const String& dummy_key = String::Handle(Symbols::Empty());
5040 const TokenStream& tkns = TokenStream::Handle(tokens()); 5040 const TokenStream& tkns = TokenStream::Handle(tokens());
5041 Scanner scanner(src, dummy_key); 5041 Scanner scanner(src, dummy_key);
5042 scanner.TokenRangeAtLine(line_number, &first_src_pos, &last_src_pos); 5042 scanner.TokenRangeAtLine(line_number, &first_src_pos, &last_src_pos);
5043 *first_token_index = tkns.ComputeTokenPosition(first_src_pos); 5043 *first_token_index = tkns.ComputeTokenPosition(first_src_pos);
5044 *last_token_index = tkns.ComputeTokenPosition(last_src_pos); 5044 *last_token_index = tkns.ComputeTokenPosition(last_src_pos);
5045 } 5045 }
5046 5046
5047 5047
5048 RawString* Script::GetLine(intptr_t line_number) const { 5048 RawString* Script::GetLine(intptr_t line_number) const {
5049 const String& src = String::Handle(Source()); 5049 const String& src = String::Handle(Source());
(...skipping 10 matching lines...) Expand all
5060 current_line++; 5060 current_line++;
5061 } else if (src.CharAt(ix) == '\r') { 5061 } else if (src.CharAt(ix) == '\r') {
5062 if ((ix + 1 != src.Length()) && (src.CharAt(ix + 1) != '\n')) { 5062 if ((ix + 1 != src.Length()) && (src.CharAt(ix + 1) != '\n')) {
5063 current_line++; 5063 current_line++;
5064 } 5064 }
5065 } else { 5065 } else {
5066 last_char = ix; 5066 last_char = ix;
5067 } 5067 }
5068 } 5068 }
5069 // Guarantee that returned string is never NULL. 5069 // Guarantee that returned string is never NULL.
5070 String& line = String::Handle(Symbols::New("")); 5070 String& line = String::Handle(Symbols::Empty());
5071 if (line_start >= 0) { 5071 if (line_start >= 0) {
5072 line = String::SubString(src, line_start, last_char - line_start + 1); 5072 line = String::SubString(src, line_start, last_char - line_start + 1);
5073 } 5073 }
5074 return line.raw(); 5074 return line.raw();
5075 } 5075 }
5076 5076
5077 5077
5078 RawString* Script::GetSnippet(intptr_t from_line, 5078 RawString* Script::GetSnippet(intptr_t from_line,
5079 intptr_t from_column, 5079 intptr_t from_column,
5080 intptr_t to_line, 5080 intptr_t to_line,
(...skipping 5689 matching lines...) Expand 10 before | Expand all | Expand 10 after
10770 const String& str = String::Handle(pattern()); 10770 const String& str = String::Handle(pattern());
10771 const char* format = "JSRegExp: pattern=%s flags=%s"; 10771 const char* format = "JSRegExp: pattern=%s flags=%s";
10772 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 10772 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
10773 char* chars = reinterpret_cast<char*>( 10773 char* chars = reinterpret_cast<char*>(
10774 Isolate::Current()->current_zone()->Allocate(len + 1)); 10774 Isolate::Current()->current_zone()->Allocate(len + 1));
10775 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 10775 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
10776 return chars; 10776 return chars;
10777 } 10777 }
10778 10778
10779 } // namespace dart 10779 } // namespace dart
OLDNEW
« no previous file with comments | « vm/code_generator.cc ('k') | vm/parser.h » ('j') | vm/symbols.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698