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

Side by Side Diff: src/messages.cc

Issue 235083002: Reland "Handlify GetProperty." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix Created 6 years, 8 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/log.cc ('k') | src/objects.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 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 } 147 }
148 } 148 }
149 } 149 }
150 150
151 151
152 Handle<String> MessageHandler::GetMessage(Isolate* isolate, 152 Handle<String> MessageHandler::GetMessage(Isolate* isolate,
153 Handle<Object> data) { 153 Handle<Object> data) {
154 Factory* factory = isolate->factory(); 154 Factory* factory = isolate->factory();
155 Handle<String> fmt_str = 155 Handle<String> fmt_str =
156 factory->InternalizeOneByteString(STATIC_ASCII_VECTOR("FormatMessage")); 156 factory->InternalizeOneByteString(STATIC_ASCII_VECTOR("FormatMessage"));
157 Handle<JSFunction> fun = Handle<JSFunction>::cast( 157 Handle<JSFunction> fun = Handle<JSFunction>::cast(Object::GetProperty(
158 GlobalObject::GetPropertyNoExceptionThrown( 158 isolate->js_builtins_object(), fmt_str).ToHandleChecked());
159 isolate->js_builtins_object(), fmt_str));
160 Handle<JSMessageObject> message = Handle<JSMessageObject>::cast(data); 159 Handle<JSMessageObject> message = Handle<JSMessageObject>::cast(data);
161 Handle<Object> argv[] = { Handle<Object>(message->type(), isolate), 160 Handle<Object> argv[] = { Handle<Object>(message->type(), isolate),
162 Handle<Object>(message->arguments(), isolate) }; 161 Handle<Object>(message->arguments(), isolate) };
163 162
164 MaybeHandle<Object> maybe_result = Execution::TryCall( 163 MaybeHandle<Object> maybe_result = Execution::TryCall(
165 fun, isolate->js_builtins_object(), ARRAY_SIZE(argv), argv); 164 fun, isolate->js_builtins_object(), ARRAY_SIZE(argv), argv);
166 Handle<Object> result; 165 Handle<Object> result;
167 if (!maybe_result.ToHandle(&result) || !result->IsString()) { 166 if (!maybe_result.ToHandle(&result) || !result->IsString()) {
168 return factory->InternalizeOneByteString(STATIC_ASCII_VECTOR("<error>")); 167 return factory->InternalizeOneByteString(STATIC_ASCII_VECTOR("<error>"));
169 } 168 }
(...skipping 10 matching lines...) Expand all
180 179
181 SmartArrayPointer<char> MessageHandler::GetLocalizedMessage( 180 SmartArrayPointer<char> MessageHandler::GetLocalizedMessage(
182 Isolate* isolate, 181 Isolate* isolate,
183 Handle<Object> data) { 182 Handle<Object> data) {
184 HandleScope scope(isolate); 183 HandleScope scope(isolate);
185 return GetMessage(isolate, data)->ToCString(DISALLOW_NULLS); 184 return GetMessage(isolate, data)->ToCString(DISALLOW_NULLS);
186 } 185 }
187 186
188 187
189 } } // namespace v8::internal 188 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/log.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698