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

Side by Side Diff: src/parser.cc

Issue 1700: Do not shortcut cons string symbols during garbage collection.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 3 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/objects.cc ('k') | src/property.h » ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2538 matching lines...) Expand 10 before | Expand all | Expand 10 after
2549 double value = 2549 double value =
2550 StringToDouble(scanner_.literal_string(), ALLOW_HEX | ALLOW_OCTALS); 2550 StringToDouble(scanner_.literal_string(), ALLOW_HEX | ALLOW_OCTALS);
2551 result = NewNumberLiteral(value); 2551 result = NewNumberLiteral(value);
2552 break; 2552 break;
2553 } 2553 }
2554 2554
2555 case Token::STRING: { 2555 case Token::STRING: {
2556 Consume(Token::STRING); 2556 Consume(Token::STRING);
2557 Handle<String> symbol = 2557 Handle<String> symbol =
2558 factory()->LookupSymbol(scanner_.literal_string(), 2558 factory()->LookupSymbol(scanner_.literal_string(),
2559 scanner_.literal_length()); 2559 scanner_.literal_length());
2560 result = NEW(Literal(symbol)); 2560 result = NEW(Literal(symbol));
2561 break; 2561 break;
2562 } 2562 }
2563 2563
2564 case Token::ASSIGN_DIV: 2564 case Token::ASSIGN_DIV:
2565 result = ParseRegExpLiteral(true, CHECK_OK); 2565 result = ParseRegExpLiteral(true, CHECK_OK);
2566 break; 2566 break;
2567 2567
2568 case Token::DIV: 2568 case Token::DIV:
2569 result = ParseRegExpLiteral(false, CHECK_OK); 2569 result = ParseRegExpLiteral(false, CHECK_OK);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
2701 continue; // restart the while 2701 continue; // restart the while
2702 } 2702 }
2703 } 2703 }
2704 key = NEW(Literal(id)); 2704 key = NEW(Literal(id));
2705 break; 2705 break;
2706 } 2706 }
2707 2707
2708 case Token::STRING: { 2708 case Token::STRING: {
2709 Consume(Token::STRING); 2709 Consume(Token::STRING);
2710 Handle<String> string = 2710 Handle<String> string =
2711 factory()->LookupSymbol(scanner_.literal_string(), 2711 factory()->LookupSymbol(scanner_.literal_string(),
2712 scanner_.literal_length()); 2712 scanner_.literal_length());
2713 uint32_t index; 2713 uint32_t index;
2714 if (!string.is_null() && string->AsArrayIndex(&index)) { 2714 if (!string.is_null() && string->AsArrayIndex(&index)) {
2715 key = NewNumberLiteral(index); 2715 key = NewNumberLiteral(index);
2716 } else { 2716 } else {
2717 key = NEW(Literal(string)); 2717 key = NEW(Literal(string));
2718 } 2718 }
2719 break; 2719 break;
2720 } 2720 }
2721 2721
2722 case Token::NUMBER: { 2722 case Token::NUMBER: {
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
3025 3025
3026 Literal* Parser::GetLiteralNumber(double value) { 3026 Literal* Parser::GetLiteralNumber(double value) {
3027 return NewNumberLiteral(value); 3027 return NewNumberLiteral(value);
3028 } 3028 }
3029 3029
3030 3030
3031 Handle<String> Parser::ParseIdentifier(bool* ok) { 3031 Handle<String> Parser::ParseIdentifier(bool* ok) {
3032 Expect(Token::IDENTIFIER, ok); 3032 Expect(Token::IDENTIFIER, ok);
3033 if (!*ok) return Handle<String>(); 3033 if (!*ok) return Handle<String>();
3034 return factory()->LookupSymbol(scanner_.literal_string(), 3034 return factory()->LookupSymbol(scanner_.literal_string(),
3035 scanner_.literal_length()); 3035 scanner_.literal_length());
3036 } 3036 }
3037 3037
3038 // This function reads an identifier and determines whether or not it 3038 // This function reads an identifier and determines whether or not it
3039 // is 'get' or 'set'. The reason for not using ParseIdentifier and 3039 // is 'get' or 'set'. The reason for not using ParseIdentifier and
3040 // checking on the output is that this involves heap allocation which 3040 // checking on the output is that this involves heap allocation which
3041 // we can't do during preparsing. 3041 // we can't do during preparsing.
3042 Handle<String> Parser::ParseIdentifierOrGetOrSet(bool* is_get, 3042 Handle<String> Parser::ParseIdentifierOrGetOrSet(bool* is_get,
3043 bool* is_set, 3043 bool* is_set,
3044 bool* ok) { 3044 bool* ok) {
3045 Expect(Token::IDENTIFIER, ok); 3045 Expect(Token::IDENTIFIER, ok);
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
3257 start_position, 3257 start_position,
3258 is_expression); 3258 is_expression);
3259 return result; 3259 return result;
3260 } 3260 }
3261 3261
3262 3262
3263 #undef NEW 3263 #undef NEW
3264 3264
3265 3265
3266 } } // namespace v8::internal 3266 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/property.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698