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

Side by Side Diff: src/runtime.cc

Issue 10876067: Introduce global contexts to represent lexical global scope(s). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 4 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
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 8720 matching lines...) Expand 10 before | Expand all | Expand 10 after
8731 8731
8732 8732
8733 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetConstructorDelegate) { 8733 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetConstructorDelegate) {
8734 HandleScope scope(isolate); 8734 HandleScope scope(isolate);
8735 ASSERT(args.length() == 1); 8735 ASSERT(args.length() == 1);
8736 RUNTIME_ASSERT(!args[0]->IsJSFunction()); 8736 RUNTIME_ASSERT(!args[0]->IsJSFunction());
8737 return *Execution::GetConstructorDelegate(args.at<Object>(0)); 8737 return *Execution::GetConstructorDelegate(args.at<Object>(0));
8738 } 8738 }
8739 8739
8740 8740
8741 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewGlobalContext) {
8742 NoHandleAllocation ha;
8743 ASSERT(args.length() == 2);
8744
8745 CONVERT_ARG_CHECKED(JSFunction, function, 0);
8746 CONVERT_ARG_CHECKED(ScopeInfo, scope_info, 1);
8747 Object* result;
8748 { MaybeObject* maybe_result =
8749 isolate->heap()->AllocateGlobalContext(function, scope_info);
8750 if (!maybe_result->ToObject(&result)) return maybe_result;
Sven Panne 2012/08/27 06:24:54 Make result a Context*, use "...->To(&result)" and
rossberg 2012/08/27 09:07:16 Done (here and for NewFunctionContext below).
8751 }
8752
8753 isolate->set_context(Context::cast(result));
8754
8755 return result; // non-failure
8756 }
8757
8758
8741 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewFunctionContext) { 8759 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewFunctionContext) {
8742 NoHandleAllocation ha; 8760 NoHandleAllocation ha;
8743 ASSERT(args.length() == 1); 8761 ASSERT(args.length() == 1);
8744 8762
8745 CONVERT_ARG_CHECKED(JSFunction, function, 0); 8763 CONVERT_ARG_CHECKED(JSFunction, function, 0);
8746 int length = function->shared()->scope_info()->ContextLength(); 8764 int length = function->shared()->scope_info()->ContextLength();
8747 Object* result; 8765 Object* result;
8748 { MaybeObject* maybe_result = 8766 { MaybeObject* maybe_result =
8749 isolate->heap()->AllocateFunctionContext(length, function); 8767 isolate->heap()->AllocateFunctionContext(length, function);
8750 if (!maybe_result->ToObject(&result)) return maybe_result; 8768 if (!maybe_result->ToObject(&result)) return maybe_result;
(...skipping 4967 matching lines...) Expand 10 before | Expand all | Expand 10 after
13718 // Handle last resort GC and make sure to allow future allocations 13736 // Handle last resort GC and make sure to allow future allocations
13719 // to grow the heap without causing GCs (if possible). 13737 // to grow the heap without causing GCs (if possible).
13720 isolate->counters()->gc_last_resort_from_js()->Increment(); 13738 isolate->counters()->gc_last_resort_from_js()->Increment();
13721 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13739 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13722 "Runtime::PerformGC"); 13740 "Runtime::PerformGC");
13723 } 13741 }
13724 } 13742 }
13725 13743
13726 13744
13727 } } // namespace v8::internal 13745 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698