| 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 10 matching lines...) Expand all Loading... |
| 21 if (!callable->IsJSFunction()) { | 21 if (!callable->IsJSFunction()) { |
| 22 HandleScope scope(isolate); | 22 HandleScope scope(isolate); |
| 23 Handle<Object> delegate; | 23 Handle<Object> delegate; |
| 24 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 24 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 25 isolate, delegate, Execution::TryGetFunctionDelegate( | 25 isolate, delegate, Execution::TryGetFunctionDelegate( |
| 26 isolate, Handle<JSReceiver>(callable))); | 26 isolate, Handle<JSReceiver>(callable))); |
| 27 callable = JSFunction::cast(*delegate); | 27 callable = JSFunction::cast(*delegate); |
| 28 } | 28 } |
| 29 JSFunction* function = JSFunction::cast(callable); | 29 JSFunction* function = JSFunction::cast(callable); |
| 30 SharedFunctionInfo* shared = function->shared(); | 30 SharedFunctionInfo* shared = function->shared(); |
| 31 return isolate->heap()->ToBoolean(shared->strict_mode() == SLOPPY); | 31 return isolate->heap()->ToBoolean(is_sloppy(shared->language_mode())); |
| 32 } | 32 } |
| 33 | 33 |
| 34 | 34 |
| 35 RUNTIME_FUNCTION(Runtime_GetDefaultReceiver) { | 35 RUNTIME_FUNCTION(Runtime_GetDefaultReceiver) { |
| 36 SealHandleScope shs(isolate); | 36 SealHandleScope shs(isolate); |
| 37 DCHECK(args.length() == 1); | 37 DCHECK(args.length() == 1); |
| 38 CONVERT_ARG_CHECKED(JSReceiver, callable, 0); | 38 CONVERT_ARG_CHECKED(JSReceiver, callable, 0); |
| 39 | 39 |
| 40 if (!callable->IsJSFunction()) { | 40 if (!callable->IsJSFunction()) { |
| 41 HandleScope scope(isolate); | 41 HandleScope scope(isolate); |
| 42 Handle<Object> delegate; | 42 Handle<Object> delegate; |
| 43 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 43 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 44 isolate, delegate, Execution::TryGetFunctionDelegate( | 44 isolate, delegate, Execution::TryGetFunctionDelegate( |
| 45 isolate, Handle<JSReceiver>(callable))); | 45 isolate, Handle<JSReceiver>(callable))); |
| 46 callable = JSFunction::cast(*delegate); | 46 callable = JSFunction::cast(*delegate); |
| 47 } | 47 } |
| 48 JSFunction* function = JSFunction::cast(callable); | 48 JSFunction* function = JSFunction::cast(callable); |
| 49 | 49 |
| 50 SharedFunctionInfo* shared = function->shared(); | 50 SharedFunctionInfo* shared = function->shared(); |
| 51 if (shared->native() || shared->strict_mode() == STRICT) { | 51 if (shared->native() || is_strict(shared->language_mode())) { |
| 52 return isolate->heap()->undefined_value(); | 52 return isolate->heap()->undefined_value(); |
| 53 } | 53 } |
| 54 // Returns undefined for strict or native functions, or | 54 // Returns undefined for strict or native functions, or |
| 55 // the associated global receiver for "normal" functions. | 55 // the associated global receiver for "normal" functions. |
| 56 | 56 |
| 57 return function->global_proxy(); | 57 return function->global_proxy(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 | 60 |
| 61 RUNTIME_FUNCTION(Runtime_FunctionGetName) { | 61 RUNTIME_FUNCTION(Runtime_FunctionGetName) { |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 | 643 |
| 644 | 644 |
| 645 RUNTIME_FUNCTION(RuntimeReference_IsFunction) { | 645 RUNTIME_FUNCTION(RuntimeReference_IsFunction) { |
| 646 SealHandleScope shs(isolate); | 646 SealHandleScope shs(isolate); |
| 647 DCHECK(args.length() == 1); | 647 DCHECK(args.length() == 1); |
| 648 CONVERT_ARG_CHECKED(Object, obj, 0); | 648 CONVERT_ARG_CHECKED(Object, obj, 0); |
| 649 return isolate->heap()->ToBoolean(obj->IsJSFunction()); | 649 return isolate->heap()->ToBoolean(obj->IsJSFunction()); |
| 650 } | 650 } |
| 651 } | 651 } |
| 652 } // namespace v8::internal | 652 } // namespace v8::internal |
| OLD | NEW |