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

Side by Side Diff: src/messages.cc

Issue 559913002: Rename ascii to one-byte where applicable. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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
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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/execution.h" 8 #include "src/execution.h"
9 #include "src/heap/spaces-inl.h" 9 #include "src/heap/spaces-inl.h"
10 #include "src/messages.h" 10 #include "src/messages.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 123 }
124 } 124 }
125 } 125 }
126 } 126 }
127 127
128 128
129 Handle<String> MessageHandler::GetMessage(Isolate* isolate, 129 Handle<String> MessageHandler::GetMessage(Isolate* isolate,
130 Handle<Object> data) { 130 Handle<Object> data) {
131 Factory* factory = isolate->factory(); 131 Factory* factory = isolate->factory();
132 Handle<String> fmt_str = 132 Handle<String> fmt_str =
133 factory->InternalizeOneByteString(STATIC_ASCII_VECTOR("FormatMessage")); 133 factory->InternalizeOneByteString(STATIC_CHAR_VECTOR("FormatMessage"));
134 Handle<JSFunction> fun = Handle<JSFunction>::cast(Object::GetProperty( 134 Handle<JSFunction> fun = Handle<JSFunction>::cast(Object::GetProperty(
135 isolate->js_builtins_object(), fmt_str).ToHandleChecked()); 135 isolate->js_builtins_object(), fmt_str).ToHandleChecked());
136 Handle<JSMessageObject> message = Handle<JSMessageObject>::cast(data); 136 Handle<JSMessageObject> message = Handle<JSMessageObject>::cast(data);
137 Handle<Object> argv[] = { Handle<Object>(message->type(), isolate), 137 Handle<Object> argv[] = { Handle<Object>(message->type(), isolate),
138 Handle<Object>(message->arguments(), isolate) }; 138 Handle<Object>(message->arguments(), isolate) };
139 139
140 MaybeHandle<Object> maybe_result = Execution::TryCall( 140 MaybeHandle<Object> maybe_result = Execution::TryCall(
141 fun, isolate->js_builtins_object(), arraysize(argv), argv); 141 fun, isolate->js_builtins_object(), arraysize(argv), argv);
142 Handle<Object> result; 142 Handle<Object> result;
143 if (!maybe_result.ToHandle(&result) || !result->IsString()) { 143 if (!maybe_result.ToHandle(&result) || !result->IsString()) {
144 return factory->InternalizeOneByteString(STATIC_ASCII_VECTOR("<error>")); 144 return factory->InternalizeOneByteString(STATIC_CHAR_VECTOR("<error>"));
145 } 145 }
146 Handle<String> result_string = Handle<String>::cast(result); 146 Handle<String> result_string = Handle<String>::cast(result);
147 // A string that has been obtained from JS code in this way is 147 // A string that has been obtained from JS code in this way is
148 // likely to be a complicated ConsString of some sort. We flatten it 148 // likely to be a complicated ConsString of some sort. We flatten it
149 // here to improve the efficiency of converting it to a C string and 149 // here to improve the efficiency of converting it to a C string and
150 // other operations that are likely to take place (see GetLocalizedMessage 150 // other operations that are likely to take place (see GetLocalizedMessage
151 // for example). 151 // for example).
152 result_string = String::Flatten(result_string); 152 result_string = String::Flatten(result_string);
153 return result_string; 153 return result_string;
154 } 154 }
155 155
156 156
157 SmartArrayPointer<char> MessageHandler::GetLocalizedMessage( 157 SmartArrayPointer<char> MessageHandler::GetLocalizedMessage(
158 Isolate* isolate, 158 Isolate* isolate,
159 Handle<Object> data) { 159 Handle<Object> data) {
160 HandleScope scope(isolate); 160 HandleScope scope(isolate);
161 return GetMessage(isolate, data)->ToCString(DISALLOW_NULLS); 161 return GetMessage(isolate, data)->ToCString(DISALLOW_NULLS);
162 } 162 }
163 163
164 164
165 } } // namespace v8::internal 165 } } // namespace v8::internal
OLDNEW
« src/jsregexp.cc ('K') | « src/liveedit.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698