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

Side by Side Diff: src/runtime.h

Issue 9213002: Fast path for string.replace that replaces a single character by a string. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 11 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/heap.cc ('k') | src/runtime.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 // 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 /* JSON */ \ 190 /* JSON */ \
191 F(ParseJson, 1, 1) \ 191 F(ParseJson, 1, 1) \
192 \ 192 \
193 /* Strings */ \ 193 /* Strings */ \
194 F(StringCharCodeAt, 2, 1) \ 194 F(StringCharCodeAt, 2, 1) \
195 F(StringIndexOf, 3, 1) \ 195 F(StringIndexOf, 3, 1) \
196 F(StringLastIndexOf, 3, 1) \ 196 F(StringLastIndexOf, 3, 1) \
197 F(StringLocaleCompare, 2, 1) \ 197 F(StringLocaleCompare, 2, 1) \
198 F(SubString, 3, 1) \ 198 F(SubString, 3, 1) \
199 F(StringReplaceRegExpWithString, 4, 1) \ 199 F(StringReplaceRegExpWithString, 4, 1) \
200 F(StringReplaceOneCharWithString, 3, 1) \
200 F(StringMatch, 3, 1) \ 201 F(StringMatch, 3, 1) \
201 F(StringTrim, 3, 1) \ 202 F(StringTrim, 3, 1) \
202 F(StringToArray, 2, 1) \ 203 F(StringToArray, 2, 1) \
203 F(NewStringWrapper, 1, 1) \ 204 F(NewStringWrapper, 1, 1) \
204 \ 205 \
205 /* Numbers */ \ 206 /* Numbers */ \
206 F(NumberToRadixString, 2, 1) \ 207 F(NumberToRadixString, 2, 1) \
207 F(NumberToFixed, 2, 1) \ 208 F(NumberToFixed, 2, 1) \
208 F(NumberToExponential, 2, 1) \ 209 F(NumberToExponential, 2, 1) \
209 F(NumberToPrecision, 2, 1) 210 F(NumberToPrecision, 2, 1)
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 // Alternatively, heap initialization can be completely restarted. 623 // Alternatively, heap initialization can be completely restarted.
623 MUST_USE_RESULT static MaybeObject* InitializeIntrinsicFunctionNames( 624 MUST_USE_RESULT static MaybeObject* InitializeIntrinsicFunctionNames(
624 Heap* heap, Object* dictionary); 625 Heap* heap, Object* dictionary);
625 626
626 // Get the intrinsic function with the given name, which must be a symbol. 627 // Get the intrinsic function with the given name, which must be a symbol.
627 static const Function* FunctionForSymbol(Handle<String> name); 628 static const Function* FunctionForSymbol(Handle<String> name);
628 629
629 // Get the intrinsic function with the given FunctionId. 630 // Get the intrinsic function with the given FunctionId.
630 static const Function* FunctionForId(FunctionId id); 631 static const Function* FunctionForId(FunctionId id);
631 632
633 static Handle<String> StringReplaceOneCharWithString(Isolate* isolate,
634 Handle<String> subject,
635 Handle<String> search,
636 Handle<String> replace,
637 bool* found);
638
632 // General-purpose helper functions for runtime system. 639 // General-purpose helper functions for runtime system.
633 static int StringMatch(Isolate* isolate, 640 static int StringMatch(Isolate* isolate,
634 Handle<String> sub, 641 Handle<String> sub,
635 Handle<String> pat, 642 Handle<String> pat,
636 int index); 643 int index);
637 644
638 static bool IsUpperCaseChar(RuntimeState* runtime_state, uint16_t ch); 645 static bool IsUpperCaseChar(RuntimeState* runtime_state, uint16_t ch);
639 646
640 // TODO(1240886): Some of the following methods are *not* handle safe, but 647 // TODO(1240886): Some of the following methods are *not* handle safe, but
641 // accept handle arguments. This seems fragile. 648 // accept handle arguments. This seems fragile.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 //--------------------------------------------------------------------------- 697 //---------------------------------------------------------------------------
691 // Constants used by interface to runtime functions. 698 // Constants used by interface to runtime functions.
692 699
693 class DeclareGlobalsEvalFlag: public BitField<bool, 0, 1> {}; 700 class DeclareGlobalsEvalFlag: public BitField<bool, 0, 1> {};
694 class DeclareGlobalsNativeFlag: public BitField<bool, 1, 1> {}; 701 class DeclareGlobalsNativeFlag: public BitField<bool, 1, 1> {};
695 class DeclareGlobalsLanguageMode: public BitField<LanguageMode, 2, 2> {}; 702 class DeclareGlobalsLanguageMode: public BitField<LanguageMode, 2, 2> {};
696 703
697 } } // namespace v8::internal 704 } } // namespace v8::internal
698 705
699 #endif // V8_RUNTIME_H_ 706 #endif // V8_RUNTIME_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698