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

Side by Side Diff: src/runtime.cc

Issue 145513002: Turn FastNewContextStub into a HydrogenCodeStub. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 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/isolate.cc ('k') | src/x64/code-stubs-x64.cc » ('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 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 8851 matching lines...) Expand 10 before | Expand all | Expand 10 after
8862 8862
8863 CONVERT_ARG_CHECKED(JSFunction, function, 0); 8863 CONVERT_ARG_CHECKED(JSFunction, function, 0);
8864 CONVERT_ARG_CHECKED(ScopeInfo, scope_info, 1); 8864 CONVERT_ARG_CHECKED(ScopeInfo, scope_info, 1);
8865 Context* result; 8865 Context* result;
8866 MaybeObject* maybe_result = 8866 MaybeObject* maybe_result =
8867 isolate->heap()->AllocateGlobalContext(function, scope_info); 8867 isolate->heap()->AllocateGlobalContext(function, scope_info);
8868 if (!maybe_result->To(&result)) return maybe_result; 8868 if (!maybe_result->To(&result)) return maybe_result;
8869 8869
8870 ASSERT(function->context() == isolate->context()); 8870 ASSERT(function->context() == isolate->context());
8871 ASSERT(function->context()->global_object() == result->global_object()); 8871 ASSERT(function->context()->global_object() == result->global_object());
8872 isolate->set_context(result);
8873 result->global_object()->set_global_context(result); 8872 result->global_object()->set_global_context(result);
8874 8873
8875 return result; // non-failure 8874 return result; // non-failure
8876 } 8875 }
8877 8876
8878 8877
8879 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewFunctionContext) { 8878 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewFunctionContext) {
8880 SealHandleScope shs(isolate); 8879 SealHandleScope shs(isolate);
8881 ASSERT(args.length() == 1); 8880 ASSERT(args.length() == 1);
8882 8881
8883 CONVERT_ARG_CHECKED(JSFunction, function, 0); 8882 CONVERT_ARG_CHECKED(JSFunction, function, 0);
8884 int length = function->shared()->scope_info()->ContextLength(); 8883 int length = function->shared()->scope_info()->ContextLength();
8885 Context* result; 8884 return isolate->heap()->AllocateFunctionContext(length, function);
8886 MaybeObject* maybe_result =
8887 isolate->heap()->AllocateFunctionContext(length, function);
8888 if (!maybe_result->To(&result)) return maybe_result;
8889
8890 isolate->set_context(result);
8891
8892 return result; // non-failure
8893 } 8885 }
8894 8886
8895 8887
8896 RUNTIME_FUNCTION(MaybeObject*, Runtime_PushWithContext) { 8888 RUNTIME_FUNCTION(MaybeObject*, Runtime_PushWithContext) {
8897 SealHandleScope shs(isolate); 8889 SealHandleScope shs(isolate);
8898 ASSERT(args.length() == 2); 8890 ASSERT(args.length() == 2);
8899 JSReceiver* extension_object; 8891 JSReceiver* extension_object;
8900 if (args[0]->IsJSReceiver()) { 8892 if (args[0]->IsJSReceiver()) {
8901 extension_object = JSReceiver::cast(args[0]); 8893 extension_object = JSReceiver::cast(args[0]);
8902 } else { 8894 } else {
(...skipping 5996 matching lines...) Expand 10 before | Expand all | Expand 10 after
14899 // Handle last resort GC and make sure to allow future allocations 14891 // Handle last resort GC and make sure to allow future allocations
14900 // to grow the heap without causing GCs (if possible). 14892 // to grow the heap without causing GCs (if possible).
14901 isolate->counters()->gc_last_resort_from_js()->Increment(); 14893 isolate->counters()->gc_last_resort_from_js()->Increment();
14902 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14894 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14903 "Runtime::PerformGC"); 14895 "Runtime::PerformGC");
14904 } 14896 }
14905 } 14897 }
14906 14898
14907 14899
14908 } } // namespace v8::internal 14900 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698