| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1862 InstallBuiltin(isolate, holder, "unshift", Builtins::kArrayUnshift); | 1862 InstallBuiltin(isolate, holder, "unshift", Builtins::kArrayUnshift); |
| 1863 InstallBuiltin(isolate, holder, "slice", Builtins::kArraySlice); | 1863 InstallBuiltin(isolate, holder, "slice", Builtins::kArraySlice); |
| 1864 InstallBuiltin(isolate, holder, "splice", Builtins::kArraySplice); | 1864 InstallBuiltin(isolate, holder, "splice", Builtins::kArraySplice); |
| 1865 InstallBuiltin(isolate, holder, "concat", Builtins::kArrayConcat); | 1865 InstallBuiltin(isolate, holder, "concat", Builtins::kArrayConcat); |
| 1866 | 1866 |
| 1867 return *holder; | 1867 return *holder; |
| 1868 } | 1868 } |
| 1869 | 1869 |
| 1870 | 1870 |
| 1871 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetDefaultReceiver) { | 1871 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetDefaultReceiver) { |
| 1872 NoHandleAllocation handle_free; | |
| 1873 ASSERT(args.length() == 1); | 1872 ASSERT(args.length() == 1); |
| 1874 CONVERT_CHECKED(JSFunction, function, args[0]); | 1873 CONVERT_CHECKED(JSReceiver, callable, args[0]); |
| 1874 |
| 1875 if (!callable->IsJSFunction()) { |
| 1876 HandleScope scope(isolate); |
| 1877 bool threw = false; |
| 1878 Handle<Object> delegate = |
| 1879 Execution::TryGetFunctionDelegate(Handle<JSReceiver>(callable), &threw); |
| 1880 if (threw) return Failure::Exception(); |
| 1881 callable = JSFunction::cast(*delegate); |
| 1882 } |
| 1883 JSFunction* function = JSFunction::cast(callable); |
| 1884 |
| 1875 SharedFunctionInfo* shared = function->shared(); | 1885 SharedFunctionInfo* shared = function->shared(); |
| 1876 if (shared->native() || !shared->is_classic_mode()) { | 1886 if (shared->native() || !shared->is_classic_mode()) { |
| 1877 return isolate->heap()->undefined_value(); | 1887 return isolate->heap()->undefined_value(); |
| 1878 } | 1888 } |
| 1879 // Returns undefined for strict or native functions, or | 1889 // Returns undefined for strict or native functions, or |
| 1880 // the associated global receiver for "normal" functions. | 1890 // the associated global receiver for "normal" functions. |
| 1881 | 1891 |
| 1882 Context* global_context = | 1892 Context* global_context = |
| 1883 function->context()->global()->global_context(); | 1893 function->context()->global()->global_context(); |
| 1884 return global_context->global()->global_receiver(); | 1894 return global_context->global()->global_receiver(); |
| (...skipping 11740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13625 } else { | 13635 } else { |
| 13626 // Handle last resort GC and make sure to allow future allocations | 13636 // Handle last resort GC and make sure to allow future allocations |
| 13627 // to grow the heap without causing GCs (if possible). | 13637 // to grow the heap without causing GCs (if possible). |
| 13628 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13638 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 13629 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | 13639 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); |
| 13630 } | 13640 } |
| 13631 } | 13641 } |
| 13632 | 13642 |
| 13633 | 13643 |
| 13634 } } // namespace v8::internal | 13644 } } // namespace v8::internal |
| OLD | NEW |