| 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/v8.h" | 5 #include "src/v8.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/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 CONVERT_ARG_CHECKED(Object, object, 0); | 319 CONVERT_ARG_CHECKED(Object, object, 0); |
| 320 | 320 |
| 321 if (object->IsJSFunction()) { | 321 if (object->IsJSFunction()) { |
| 322 JSFunction* func = JSFunction::cast(object); | 322 JSFunction* func = JSFunction::cast(object); |
| 323 func->shared()->set_native(true); | 323 func->shared()->set_native(true); |
| 324 } | 324 } |
| 325 return isolate->heap()->undefined_value(); | 325 return isolate->heap()->undefined_value(); |
| 326 } | 326 } |
| 327 | 327 |
| 328 | 328 |
| 329 RUNTIME_FUNCTION(Runtime_IsConstructor) { |
| 330 HandleScope handles(isolate); |
| 331 RUNTIME_ASSERT(args.length() == 1); |
| 332 |
| 333 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
| 334 |
| 335 // TODO(caitp): implement this in a better/simpler way, allow inlining via TF |
| 336 if (object->IsJSFunction()) { |
| 337 Handle<JSFunction> func = Handle<JSFunction>::cast(object); |
| 338 bool should_have_prototype = func->should_have_prototype(); |
| 339 if (func->shared()->bound()) { |
| 340 Handle<FixedArray> bound_args = |
| 341 Handle<FixedArray>(FixedArray::cast(func->function_bindings())); |
| 342 Handle<Object> bound_function( |
| 343 JSReceiver::cast(bound_args->get(JSFunction::kBoundFunctionIndex)), |
| 344 isolate); |
| 345 if (bound_function->IsJSFunction()) { |
| 346 Handle<JSFunction> bound = Handle<JSFunction>::cast(bound_function); |
| 347 DCHECK(!bound->shared()->bound()); |
| 348 should_have_prototype = bound->should_have_prototype(); |
| 349 } |
| 350 } |
| 351 return isolate->heap()->ToBoolean(should_have_prototype); |
| 352 } |
| 353 return isolate->heap()->false_value(); |
| 354 } |
| 355 |
| 356 |
| 329 RUNTIME_FUNCTION(Runtime_SetInlineBuiltinFlag) { | 357 RUNTIME_FUNCTION(Runtime_SetInlineBuiltinFlag) { |
| 330 SealHandleScope shs(isolate); | 358 SealHandleScope shs(isolate); |
| 331 RUNTIME_ASSERT(args.length() == 1); | 359 RUNTIME_ASSERT(args.length() == 1); |
| 332 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); | 360 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
| 333 | 361 |
| 334 if (object->IsJSFunction()) { | 362 if (object->IsJSFunction()) { |
| 335 JSFunction* func = JSFunction::cast(*object); | 363 JSFunction* func = JSFunction::cast(*object); |
| 336 func->shared()->set_inline_builtin(true); | 364 func->shared()->set_inline_builtin(true); |
| 337 } | 365 } |
| 338 return isolate->heap()->undefined_value(); | 366 return isolate->heap()->undefined_value(); |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 | 643 |
| 616 | 644 |
| 617 RUNTIME_FUNCTION(RuntimeReference_IsFunction) { | 645 RUNTIME_FUNCTION(RuntimeReference_IsFunction) { |
| 618 SealHandleScope shs(isolate); | 646 SealHandleScope shs(isolate); |
| 619 DCHECK(args.length() == 1); | 647 DCHECK(args.length() == 1); |
| 620 CONVERT_ARG_CHECKED(Object, obj, 0); | 648 CONVERT_ARG_CHECKED(Object, obj, 0); |
| 621 return isolate->heap()->ToBoolean(obj->IsJSFunction()); | 649 return isolate->heap()->ToBoolean(obj->IsJSFunction()); |
| 622 } | 650 } |
| 623 } | 651 } |
| 624 } // namespace v8::internal | 652 } // namespace v8::internal |
| OLD | NEW |