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

Side by Side Diff: src/factory.cc

Issue 11597007: Rename LookupSymbol calls to use Utf8 or OneByte in names. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years 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/factory.h ('k') | src/handles.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 152
153 Handle<TypeFeedbackInfo> Factory::NewTypeFeedbackInfo() { 153 Handle<TypeFeedbackInfo> Factory::NewTypeFeedbackInfo() {
154 CALL_HEAP_FUNCTION(isolate(), 154 CALL_HEAP_FUNCTION(isolate(),
155 isolate()->heap()->AllocateTypeFeedbackInfo(), 155 isolate()->heap()->AllocateTypeFeedbackInfo(),
156 TypeFeedbackInfo); 156 TypeFeedbackInfo);
157 } 157 }
158 158
159 159
160 // Symbols are created in the old generation (data space). 160 // Symbols are created in the old generation (data space).
161 Handle<String> Factory::LookupSymbol(Vector<const char> string) { 161 Handle<String> Factory::LookupUtf8Symbol(Vector<const char> string) {
162 CALL_HEAP_FUNCTION(isolate(), 162 CALL_HEAP_FUNCTION(isolate(),
163 isolate()->heap()->LookupSymbol(string), 163 isolate()->heap()->LookupUtf8Symbol(string),
164 String); 164 String);
165 } 165 }
166 166
167 // Symbols are created in the old generation (data space). 167 // Symbols are created in the old generation (data space).
168 Handle<String> Factory::LookupSymbol(Handle<String> string) { 168 Handle<String> Factory::LookupSymbol(Handle<String> string) {
169 CALL_HEAP_FUNCTION(isolate(), 169 CALL_HEAP_FUNCTION(isolate(),
170 isolate()->heap()->LookupSymbol(*string), 170 isolate()->heap()->LookupSymbol(*string),
171 String); 171 String);
172 } 172 }
173 173
174 Handle<String> Factory::LookupAsciiSymbol(Vector<const char> string) { 174 Handle<String> Factory::LookupOneByteSymbol(Vector<const char> string) {
175 CALL_HEAP_FUNCTION(isolate(), 175 CALL_HEAP_FUNCTION(isolate(),
176 isolate()->heap()->LookupAsciiSymbol(string), 176 isolate()->heap()->LookupOneByteSymbol(string),
177 String); 177 String);
178 } 178 }
179 179
180 180
181 Handle<String> Factory::LookupAsciiSymbol(Handle<SeqOneByteString> string, 181 Handle<String> Factory::LookupOneByteSymbol(Handle<SeqOneByteString> string,
182 int from, 182 int from,
183 int length) { 183 int length) {
184 CALL_HEAP_FUNCTION(isolate(), 184 CALL_HEAP_FUNCTION(isolate(),
185 isolate()->heap()->LookupAsciiSymbol(string, 185 isolate()->heap()->LookupOneByteSymbol(string,
186 from, 186 from,
187 length), 187 length),
188 String); 188 String);
189 } 189 }
190 190
191 191
192 Handle<String> Factory::LookupTwoByteSymbol(Vector<const uc16> string) { 192 Handle<String> Factory::LookupTwoByteSymbol(Vector<const uc16> string) {
193 CALL_HEAP_FUNCTION(isolate(), 193 CALL_HEAP_FUNCTION(isolate(),
194 isolate()->heap()->LookupTwoByteSymbol(string), 194 isolate()->heap()->LookupTwoByteSymbol(string),
195 String); 195 String);
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 buffer[kBufferSize - 1] = '\0'; 734 buffer[kBufferSize - 1] = '\0';
735 } 735 }
736 Handle<String> error_string = NewStringFromUtf8(CStrVector(buffer), TENURED); 736 Handle<String> error_string = NewStringFromUtf8(CStrVector(buffer), TENURED);
737 return error_string; 737 return error_string;
738 } 738 }
739 739
740 740
741 Handle<Object> Factory::NewError(const char* maker, 741 Handle<Object> Factory::NewError(const char* maker,
742 const char* type, 742 const char* type,
743 Handle<JSArray> args) { 743 Handle<JSArray> args) {
744 Handle<String> make_str = LookupAsciiSymbol(maker); 744 Handle<String> make_str = LookupUtf8Symbol(maker);
745 Handle<Object> fun_obj( 745 Handle<Object> fun_obj(
746 isolate()->js_builtins_object()->GetPropertyNoExceptionThrown(*make_str)); 746 isolate()->js_builtins_object()->GetPropertyNoExceptionThrown(*make_str));
747 // If the builtins haven't been properly configured yet this error 747 // If the builtins haven't been properly configured yet this error
748 // constructor may not have been defined. Bail out. 748 // constructor may not have been defined. Bail out.
749 if (!fun_obj->IsJSFunction()) { 749 if (!fun_obj->IsJSFunction()) {
750 return EmergencyNewError(type, args); 750 return EmergencyNewError(type, args);
751 } 751 }
752 Handle<JSFunction> fun = Handle<JSFunction>::cast(fun_obj); 752 Handle<JSFunction> fun = Handle<JSFunction>::cast(fun_obj);
753 Handle<Object> type_obj = LookupAsciiSymbol(type); 753 Handle<Object> type_obj = LookupUtf8Symbol(type);
754 Handle<Object> argv[] = { type_obj, args }; 754 Handle<Object> argv[] = { type_obj, args };
755 755
756 // Invoke the JavaScript factory method. If an exception is thrown while 756 // Invoke the JavaScript factory method. If an exception is thrown while
757 // running the factory method, use the exception as the result. 757 // running the factory method, use the exception as the result.
758 bool caught_exception; 758 bool caught_exception;
759 Handle<Object> result = Execution::TryCall(fun, 759 Handle<Object> result = Execution::TryCall(fun,
760 isolate()->js_builtins_object(), 760 isolate()->js_builtins_object(),
761 ARRAY_SIZE(argv), 761 ARRAY_SIZE(argv),
762 argv, 762 argv,
763 &caught_exception); 763 &caught_exception);
764 return result; 764 return result;
765 } 765 }
766 766
767 767
768 Handle<Object> Factory::NewError(Handle<String> message) { 768 Handle<Object> Factory::NewError(Handle<String> message) {
769 return NewError("$Error", message); 769 return NewError("$Error", message);
770 } 770 }
771 771
772 772
773 Handle<Object> Factory::NewError(const char* constructor, 773 Handle<Object> Factory::NewError(const char* constructor,
774 Handle<String> message) { 774 Handle<String> message) {
775 Handle<String> constr = LookupAsciiSymbol(constructor); 775 Handle<String> constr = LookupUtf8Symbol(constructor);
776 Handle<JSFunction> fun = Handle<JSFunction>( 776 Handle<JSFunction> fun = Handle<JSFunction>(
777 JSFunction::cast(isolate()->js_builtins_object()-> 777 JSFunction::cast(isolate()->js_builtins_object()->
778 GetPropertyNoExceptionThrown(*constr))); 778 GetPropertyNoExceptionThrown(*constr)));
779 Handle<Object> argv[] = { message }; 779 Handle<Object> argv[] = { message };
780 780
781 // Invoke the JavaScript factory method. If an exception is thrown while 781 // Invoke the JavaScript factory method. If an exception is thrown while
782 // running the factory method, use the exception as the result. 782 // running the factory method, use the exception as the result.
783 bool caught_exception; 783 bool caught_exception;
784 Handle<Object> result = Execution::TryCall(fun, 784 Handle<Object> result = Execution::TryCall(fun,
785 isolate()->js_builtins_object(), 785 isolate()->js_builtins_object(),
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 1443
1444 1444
1445 Handle<Object> Factory::ToBoolean(bool value) { 1445 Handle<Object> Factory::ToBoolean(bool value) {
1446 return Handle<Object>(value 1446 return Handle<Object>(value
1447 ? isolate()->heap()->true_value() 1447 ? isolate()->heap()->true_value()
1448 : isolate()->heap()->false_value()); 1448 : isolate()->heap()->false_value());
1449 } 1449 }
1450 1450
1451 1451
1452 } } // namespace v8::internal 1452 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/factory.h ('k') | src/handles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698