| 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 8720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Context* result; |
| 8748 MaybeObject* maybe_result = |
| 8749 isolate->heap()->AllocateGlobalContext(function, scope_info); |
| 8750 if (!maybe_result->To(&result)) return maybe_result; |
| 8751 |
| 8752 isolate->set_context(result); |
| 8753 |
| 8754 return result; // non-failure |
| 8755 } |
| 8756 |
| 8757 |
| 8741 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewFunctionContext) { | 8758 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewFunctionContext) { |
| 8742 NoHandleAllocation ha; | 8759 NoHandleAllocation ha; |
| 8743 ASSERT(args.length() == 1); | 8760 ASSERT(args.length() == 1); |
| 8744 | 8761 |
| 8745 CONVERT_ARG_CHECKED(JSFunction, function, 0); | 8762 CONVERT_ARG_CHECKED(JSFunction, function, 0); |
| 8746 int length = function->shared()->scope_info()->ContextLength(); | 8763 int length = function->shared()->scope_info()->ContextLength(); |
| 8747 Object* result; | 8764 Context* result; |
| 8748 { MaybeObject* maybe_result = | 8765 MaybeObject* maybe_result = |
| 8749 isolate->heap()->AllocateFunctionContext(length, function); | 8766 isolate->heap()->AllocateFunctionContext(length, function); |
| 8750 if (!maybe_result->ToObject(&result)) return maybe_result; | 8767 if (!maybe_result->To(&result)) return maybe_result; |
| 8751 } | |
| 8752 | 8768 |
| 8753 isolate->set_context(Context::cast(result)); | 8769 isolate->set_context(result); |
| 8754 | 8770 |
| 8755 return result; // non-failure | 8771 return result; // non-failure |
| 8756 } | 8772 } |
| 8757 | 8773 |
| 8758 | 8774 |
| 8759 RUNTIME_FUNCTION(MaybeObject*, Runtime_PushWithContext) { | 8775 RUNTIME_FUNCTION(MaybeObject*, Runtime_PushWithContext) { |
| 8760 NoHandleAllocation ha; | 8776 NoHandleAllocation ha; |
| 8761 ASSERT(args.length() == 2); | 8777 ASSERT(args.length() == 2); |
| 8762 JSObject* extension_object; | 8778 JSObject* extension_object; |
| 8763 if (args[0]->IsJSObject()) { | 8779 if (args[0]->IsJSObject()) { |
| (...skipping 4954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13718 // Handle last resort GC and make sure to allow future allocations | 13734 // Handle last resort GC and make sure to allow future allocations |
| 13719 // to grow the heap without causing GCs (if possible). | 13735 // to grow the heap without causing GCs (if possible). |
| 13720 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13736 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 13721 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13737 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 13722 "Runtime::PerformGC"); | 13738 "Runtime::PerformGC"); |
| 13723 } | 13739 } |
| 13724 } | 13740 } |
| 13725 | 13741 |
| 13726 | 13742 |
| 13727 } } // namespace v8::internal | 13743 } } // namespace v8::internal |
| OLD | NEW |