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

Side by Side Diff: src/messages.cc

Issue 2840018: [Isolates] Moved more compilation-related globals (builtins, runtime, &c.)... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: rebase Created 10 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/liveedit.cc ('k') | src/parser.cc » ('j') | src/runtime.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 // Copyright 2006-2008 the V8 project authors. All rights reserved. 2 // Copyright 2006-2008 the V8 project authors. All rights reserved.
3 // Redistribution and use in source and binary forms, with or without 3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are 4 // modification, are permitted provided that the following conditions are
5 // met: 5 // met:
6 // 6 //
7 // * Redistributions of source code must retain the above copyright 7 // * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer. 8 // notice, this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above 9 // * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following 10 // copyright notice, this list of conditions and the following
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 142 }
143 } 143 }
144 } 144 }
145 145
146 146
147 Handle<String> MessageHandler::GetMessage(Handle<Object> data) { 147 Handle<String> MessageHandler::GetMessage(Handle<Object> data) {
148 Handle<String> fmt_str = Factory::LookupAsciiSymbol("FormatMessage"); 148 Handle<String> fmt_str = Factory::LookupAsciiSymbol("FormatMessage");
149 Handle<JSFunction> fun = 149 Handle<JSFunction> fun =
150 Handle<JSFunction>( 150 Handle<JSFunction>(
151 JSFunction::cast( 151 JSFunction::cast(
152 Isolate::Current()->builtins()->GetProperty(*fmt_str))); 152 Isolate::Current()->js_builtins_object()->GetProperty(*fmt_str)));
153 Object** argv[1] = { data.location() }; 153 Object** argv[1] = { data.location() };
154 154
155 bool caught_exception; 155 bool caught_exception;
156 Handle<Object> result = 156 Handle<Object> result =
157 Execution::TryCall(fun, 157 Execution::TryCall(fun,
158 Isolate::Current()->builtins(), 1, argv, &caught_exception); 158 Isolate::Current()->js_builtins_object(), 1, argv, &caught_exception);
159 159
160 if (caught_exception || !result->IsString()) { 160 if (caught_exception || !result->IsString()) {
161 return Factory::LookupAsciiSymbol("<error>"); 161 return Factory::LookupAsciiSymbol("<error>");
162 } 162 }
163 Handle<String> result_string = Handle<String>::cast(result); 163 Handle<String> result_string = Handle<String>::cast(result);
164 // A string that has been obtained from JS code in this way is 164 // A string that has been obtained from JS code in this way is
165 // likely to be a complicated ConsString of some sort. We flatten it 165 // likely to be a complicated ConsString of some sort. We flatten it
166 // here to improve the efficiency of converting it to a C string and 166 // here to improve the efficiency of converting it to a C string and
167 // other operations that are likely to take place (see GetLocalizedMessage 167 // other operations that are likely to take place (see GetLocalizedMessage
168 // for example). 168 // for example).
169 FlattenString(result_string); 169 FlattenString(result_string);
170 return result_string; 170 return result_string;
171 } 171 }
172 172
173 173
174 SmartPointer<char> MessageHandler::GetLocalizedMessage(Handle<Object> data) { 174 SmartPointer<char> MessageHandler::GetLocalizedMessage(Handle<Object> data) {
175 HandleScope scope; 175 HandleScope scope;
176 return GetMessage(data)->ToCString(DISALLOW_NULLS); 176 return GetMessage(data)->ToCString(DISALLOW_NULLS);
177 } 177 }
178 178
179 179
180 } } // namespace v8::internal 180 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/liveedit.cc ('k') | src/parser.cc » ('j') | src/runtime.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698