OLD | NEW |
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/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/frames-inl.h" | 10 #include "src/frames-inl.h" |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 Execution::Call(isolate, target, receiver, argc, argv.start())); | 273 Execution::Call(isolate, target, receiver, argc, argv.start())); |
274 return *result; | 274 return *result; |
275 } | 275 } |
276 | 276 |
277 | 277 |
278 // ES6 section 9.2.1.2, OrdinaryCallBindThis for sloppy callee. | 278 // ES6 section 9.2.1.2, OrdinaryCallBindThis for sloppy callee. |
279 RUNTIME_FUNCTION(Runtime_ConvertReceiver) { | 279 RUNTIME_FUNCTION(Runtime_ConvertReceiver) { |
280 HandleScope scope(isolate); | 280 HandleScope scope(isolate); |
281 DCHECK(args.length() == 1); | 281 DCHECK(args.length() == 1); |
282 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0); | 282 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0); |
283 if (receiver->IsNull() || receiver->IsUndefined()) { | 283 return *Object::ConvertReceiver(isolate, receiver).ToHandleChecked(); |
284 return isolate->global_proxy(); | |
285 } | |
286 return *Object::ToObject(isolate, receiver).ToHandleChecked(); | |
287 } | 284 } |
288 | 285 |
289 | 286 |
290 RUNTIME_FUNCTION(Runtime_IsFunction) { | 287 RUNTIME_FUNCTION(Runtime_IsFunction) { |
291 SealHandleScope shs(isolate); | 288 SealHandleScope shs(isolate); |
292 DCHECK_EQ(1, args.length()); | 289 DCHECK_EQ(1, args.length()); |
293 CONVERT_ARG_CHECKED(Object, object, 0); | 290 CONVERT_ARG_CHECKED(Object, object, 0); |
294 return isolate->heap()->ToBoolean(object->IsFunction()); | 291 return isolate->heap()->ToBoolean(object->IsFunction()); |
295 } | 292 } |
296 | 293 |
297 | 294 |
298 RUNTIME_FUNCTION(Runtime_FunctionToString) { | 295 RUNTIME_FUNCTION(Runtime_FunctionToString) { |
299 HandleScope scope(isolate); | 296 HandleScope scope(isolate); |
300 DCHECK_EQ(1, args.length()); | 297 DCHECK_EQ(1, args.length()); |
301 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0); | 298 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0); |
302 return function->IsJSBoundFunction() | 299 return function->IsJSBoundFunction() |
303 ? *JSBoundFunction::ToString( | 300 ? *JSBoundFunction::ToString( |
304 Handle<JSBoundFunction>::cast(function)) | 301 Handle<JSBoundFunction>::cast(function)) |
305 : *JSFunction::ToString(Handle<JSFunction>::cast(function)); | 302 : *JSFunction::ToString(Handle<JSFunction>::cast(function)); |
306 } | 303 } |
307 | 304 |
308 } // namespace internal | 305 } // namespace internal |
309 } // namespace v8 | 306 } // namespace v8 |
OLD | NEW |