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

Side by Side Diff: src/factory.cc

Issue 1289203003: No longer use js builtins object as receiver for calls into JS. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « src/execution.cc ('k') | src/messages.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/factory.h" 5 #include "src/factory.h"
6 6
7 #include "src/allocation-site-scopes.h" 7 #include "src/allocation-site-scopes.h"
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 return EmergencyNewError(message, args); 1232 return EmergencyNewError(message, args);
1233 } 1233 }
1234 Handle<JSFunction> fun = Handle<JSFunction>::cast(fun_obj); 1234 Handle<JSFunction> fun = Handle<JSFunction>::cast(fun_obj);
1235 Handle<Object> message_obj = InternalizeUtf8String(message); 1235 Handle<Object> message_obj = InternalizeUtf8String(message);
1236 Handle<Object> argv[] = { message_obj, args }; 1236 Handle<Object> argv[] = { message_obj, args };
1237 1237
1238 // Invoke the JavaScript factory method. If an exception is thrown while 1238 // Invoke the JavaScript factory method. If an exception is thrown while
1239 // running the factory method, use the exception as the result. 1239 // running the factory method, use the exception as the result.
1240 Handle<Object> result; 1240 Handle<Object> result;
1241 MaybeHandle<Object> exception; 1241 MaybeHandle<Object> exception;
1242 if (!Execution::TryCall(fun, 1242 if (!Execution::TryCall(fun, undefined_value(), arraysize(argv), argv,
1243 isolate()->js_builtins_object(), 1243 &exception)
1244 arraysize(argv), 1244 .ToHandle(&result)) {
1245 argv,
1246 &exception).ToHandle(&result)) {
1247 Handle<Object> exception_obj; 1245 Handle<Object> exception_obj;
1248 if (exception.ToHandle(&exception_obj)) return exception_obj; 1246 if (exception.ToHandle(&exception_obj)) return exception_obj;
1249 return undefined_value(); 1247 return undefined_value();
1250 } 1248 }
1251 return result; 1249 return result;
1252 } 1250 }
1253 1251
1254 1252
1255 Handle<Object> Factory::NewError(const char* constructor, 1253 Handle<Object> Factory::NewError(const char* constructor,
1256 Handle<String> message) { 1254 Handle<String> message) {
1257 Handle<String> constr = InternalizeUtf8String(constructor); 1255 Handle<String> constr = InternalizeUtf8String(constructor);
1258 Handle<JSFunction> fun = Handle<JSFunction>::cast(Object::GetProperty( 1256 Handle<JSFunction> fun = Handle<JSFunction>::cast(Object::GetProperty(
1259 isolate()->js_builtins_object(), constr).ToHandleChecked()); 1257 isolate()->js_builtins_object(), constr).ToHandleChecked());
1260 Handle<Object> argv[] = { message }; 1258 Handle<Object> argv[] = { message };
1261 1259
1262 // Invoke the JavaScript factory method. If an exception is thrown while 1260 // Invoke the JavaScript factory method. If an exception is thrown while
1263 // running the factory method, use the exception as the result. 1261 // running the factory method, use the exception as the result.
1264 Handle<Object> result; 1262 Handle<Object> result;
1265 MaybeHandle<Object> exception; 1263 MaybeHandle<Object> exception;
1266 if (!Execution::TryCall(fun, 1264 if (!Execution::TryCall(fun, undefined_value(), arraysize(argv), argv,
1267 isolate()->js_builtins_object(), 1265 &exception)
1268 arraysize(argv), 1266 .ToHandle(&result)) {
1269 argv,
1270 &exception).ToHandle(&result)) {
1271 Handle<Object> exception_obj; 1267 Handle<Object> exception_obj;
1272 if (exception.ToHandle(&exception_obj)) return exception_obj; 1268 if (exception.ToHandle(&exception_obj)) return exception_obj;
1273 return undefined_value(); 1269 return undefined_value();
1274 } 1270 }
1275 return result; 1271 return result;
1276 } 1272 }
1277 1273
1278 1274
1279 void Factory::InitializeFunction(Handle<JSFunction> function, 1275 void Factory::InitializeFunction(Handle<JSFunction> function,
1280 Handle<SharedFunctionInfo> info, 1276 Handle<SharedFunctionInfo> info,
(...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after
2472 } 2468 }
2473 2469
2474 2470
2475 Handle<Object> Factory::ToBoolean(bool value) { 2471 Handle<Object> Factory::ToBoolean(bool value) {
2476 return value ? true_value() : false_value(); 2472 return value ? true_value() : false_value();
2477 } 2473 }
2478 2474
2479 2475
2480 } // namespace internal 2476 } // namespace internal
2481 } // namespace v8 2477 } // namespace v8
OLDNEW
« no previous file with comments | « src/execution.cc ('k') | src/messages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698