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

Side by Side Diff: src/scanner.cc

Issue 314603004: Parser: Delay internalizing strings and values. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased Created 6 years, 6 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 | « src/scanner.h ('k') | src/scopeinfo.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Features shared by parsing and pre-parsing scanners. 5 // Features shared by parsing and pre-parsing scanners.
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "src/scanner.h" 9 #include "src/scanner.h"
10 10
11 #include "include/v8stdint.h" 11 #include "include/v8stdint.h"
12 #include "src/ast-value-factory.h"
12 #include "src/char-predicates-inl.h" 13 #include "src/char-predicates-inl.h"
13 #include "src/conversions-inl.h" 14 #include "src/conversions-inl.h"
14 #include "src/list-inl.h" 15 #include "src/list-inl.h"
15 #include "src/v8.h" 16 #include "src/v8.h"
16 #include "src/parser.h" 17 #include "src/parser.h"
17 18
18 namespace v8 { 19 namespace v8 {
19 namespace internal { 20 namespace internal {
20 21
21 // ---------------------------------------------------------------------------- 22 // ----------------------------------------------------------------------------
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 Advance(); 1087 Advance();
1087 } 1088 }
1088 } 1089 }
1089 literal.Complete(); 1090 literal.Complete();
1090 1091
1091 next_.location.end_pos = source_pos() - 1; 1092 next_.location.end_pos = source_pos() - 1;
1092 return true; 1093 return true;
1093 } 1094 }
1094 1095
1095 1096
1096 Handle<String> Scanner::AllocateNextLiteralString(Isolate* isolate, 1097 const AstString* Scanner::CurrentSymbol(AstValueFactory* ast_value_factory) {
1097 PretenureFlag tenured) { 1098 if (is_literal_one_byte()) {
1098 if (is_next_literal_one_byte()) { 1099 return ast_value_factory->GetOneByteString(literal_one_byte_string());
1099 return isolate->factory()->NewStringFromOneByte(
1100 next_literal_one_byte_string(), tenured).ToHandleChecked();
1101 } else {
1102 return isolate->factory()->NewStringFromTwoByte(
1103 next_literal_two_byte_string(), tenured).ToHandleChecked();
1104 } 1100 }
1101 return ast_value_factory->GetTwoByteString(literal_two_byte_string());
1105 } 1102 }
1106 1103
1107 1104
1108 Handle<String> Scanner::AllocateInternalizedString(Isolate* isolate) { 1105 const AstString* Scanner::NextSymbol(AstValueFactory* ast_value_factory) {
1109 if (is_literal_one_byte()) { 1106 if (is_next_literal_one_byte()) {
1110 return isolate->factory()->InternalizeOneByteString( 1107 return ast_value_factory->GetOneByteString(next_literal_one_byte_string());
1111 literal_one_byte_string());
1112 } else {
1113 return isolate->factory()->InternalizeTwoByteString(
1114 literal_two_byte_string());
1115 } 1108 }
1109 return ast_value_factory->GetTwoByteString(next_literal_two_byte_string());
1116 } 1110 }
1117 1111
1118 1112
1119 double Scanner::DoubleValue() { 1113 double Scanner::DoubleValue() {
1120 ASSERT(is_literal_one_byte()); 1114 ASSERT(is_literal_one_byte());
1121 return StringToDouble( 1115 return StringToDouble(
1122 unicode_cache_, 1116 unicode_cache_,
1123 literal_one_byte_string(), 1117 literal_one_byte_string(),
1124 ALLOW_HEX | ALLOW_OCTAL | ALLOW_IMPLICIT_OCTAL | ALLOW_BINARY); 1118 ALLOW_HEX | ALLOW_OCTAL | ALLOW_IMPLICIT_OCTAL | ALLOW_BINARY);
1125 } 1119 }
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 } 1265 }
1272 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); 1266 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u));
1273 } 1267 }
1274 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); 1268 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f));
1275 1269
1276 backing_store_.AddBlock(bytes); 1270 backing_store_.AddBlock(bytes);
1277 return backing_store_.EndSequence().start(); 1271 return backing_store_.EndSequence().start();
1278 } 1272 }
1279 1273
1280 } } // namespace v8::internal 1274 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/scanner.h ('k') | src/scopeinfo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698