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

Side by Side Diff: src/runtime.cc

Issue 7741042: Make (some) functions called from builtin functions use the callback's global as receiver. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/runtime.h ('k') | src/string.js » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1848 matching lines...) Expand 10 before | Expand all | Expand 10 after
1859 InstallBuiltin(isolate, holder, "shift", Builtins::kArrayShift); 1859 InstallBuiltin(isolate, holder, "shift", Builtins::kArrayShift);
1860 InstallBuiltin(isolate, holder, "unshift", Builtins::kArrayUnshift); 1860 InstallBuiltin(isolate, holder, "unshift", Builtins::kArrayUnshift);
1861 InstallBuiltin(isolate, holder, "slice", Builtins::kArraySlice); 1861 InstallBuiltin(isolate, holder, "slice", Builtins::kArraySlice);
1862 InstallBuiltin(isolate, holder, "splice", Builtins::kArraySplice); 1862 InstallBuiltin(isolate, holder, "splice", Builtins::kArraySplice);
1863 InstallBuiltin(isolate, holder, "concat", Builtins::kArrayConcat); 1863 InstallBuiltin(isolate, holder, "concat", Builtins::kArrayConcat);
1864 1864
1865 return *holder; 1865 return *holder;
1866 } 1866 }
1867 1867
1868 1868
1869 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetGlobalReceiver) { 1869 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetDefaultReceiver) {
1870 // Returns a real global receiver, not one of builtins object. 1870 NoHandleAllocation handle_free;
1871 ASSERT(args.length() == 1);
1872 CONVERT_CHECKED(JSFunction, function, args[0]);
1873 SharedFunctionInfo* shared = function->shared();
1874 if (shared->native() || shared->strict_mode()) {
1875 return isolate->heap()->undefined_value();
1876 }
1877 // Returns undefined for strict or native functions, or
1878 // the associated global receiver for "normal" functions.
1879
1871 Context* global_context = 1880 Context* global_context =
1872 isolate->context()->global()->global_context(); 1881 function->context()->global()->global_context();
1873 return global_context->global()->global_receiver(); 1882 return global_context->global()->global_receiver();
1874 } 1883 }
1875 1884
1876 1885
1877 RUNTIME_FUNCTION(MaybeObject*, Runtime_MaterializeRegExpLiteral) { 1886 RUNTIME_FUNCTION(MaybeObject*, Runtime_MaterializeRegExpLiteral) {
1878 HandleScope scope(isolate); 1887 HandleScope scope(isolate);
1879 ASSERT(args.length() == 4); 1888 ASSERT(args.length() == 4);
1880 CONVERT_ARG_CHECKED(FixedArray, literals, 0); 1889 CONVERT_ARG_CHECKED(FixedArray, literals, 0);
1881 int index = args.smi_at(1); 1890 int index = args.smi_at(1);
1882 Handle<String> pattern = args.at<String>(2); 1891 Handle<String> pattern = args.at<String>(2);
(...skipping 11057 matching lines...) Expand 10 before | Expand all | Expand 10 after
12940 } else { 12949 } else {
12941 // Handle last resort GC and make sure to allow future allocations 12950 // Handle last resort GC and make sure to allow future allocations
12942 // to grow the heap without causing GCs (if possible). 12951 // to grow the heap without causing GCs (if possible).
12943 isolate->counters()->gc_last_resort_from_js()->Increment(); 12952 isolate->counters()->gc_last_resort_from_js()->Increment();
12944 isolate->heap()->CollectAllGarbage(false); 12953 isolate->heap()->CollectAllGarbage(false);
12945 } 12954 }
12946 } 12955 }
12947 12956
12948 12957
12949 } } // namespace v8::internal 12958 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | src/string.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698