| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 6734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6745 | 6745 |
| 6746 PretenureFlag pretenure = (context->global_context() == *context) | 6746 PretenureFlag pretenure = (context->global_context() == *context) |
| 6747 ? TENURED // Allocate global closures in old space. | 6747 ? TENURED // Allocate global closures in old space. |
| 6748 : NOT_TENURED; // Allocate local closures in new space. | 6748 : NOT_TENURED; // Allocate local closures in new space. |
| 6749 Handle<JSFunction> result = | 6749 Handle<JSFunction> result = |
| 6750 Factory::NewFunctionFromSharedFunctionInfo(shared, context, pretenure); | 6750 Factory::NewFunctionFromSharedFunctionInfo(shared, context, pretenure); |
| 6751 return *result; | 6751 return *result; |
| 6752 } | 6752 } |
| 6753 | 6753 |
| 6754 static Object* Runtime_NewObjectFromBound(Arguments args) { | 6754 static Object* Runtime_NewObjectFromBound(Arguments args) { |
| 6755 HandleScope scope; | 6755 HandleScope scope; |
| 6756 ASSERT(args.length() == 2); | 6756 ASSERT(args.length() == 2); |
| 6757 CONVERT_ARG_CHECKED(JSFunction, function, 0); | 6757 CONVERT_ARG_CHECKED(JSFunction, function, 0); |
| 6758 CONVERT_ARG_CHECKED(JSArray, params, 1); | 6758 CONVERT_ARG_CHECKED(JSArray, params, 1); |
| 6759 | 6759 |
| 6760 FixedArray* fixed = FixedArray::cast(params->elements()); | 6760 FixedArray* fixed = FixedArray::cast(params->elements()); |
| 6761 | 6761 |
| 6762 bool exception = false; | 6762 bool exception = false; |
| 6763 Object*** param_data = NewArray<Object**>(fixed->length()); | 6763 Object*** param_data = NewArray<Object**>(fixed->length()); |
| 6764 for (int i = 0; i < fixed->length(); i++) { | 6764 for (int i = 0; i < fixed->length(); i++) { |
| 6765 Handle<Object> val = Handle<Object>(fixed->get(i)); | 6765 Handle<Object> val = Handle<Object>(fixed->get(i)); |
| 6766 param_data[i] = val.location(); | 6766 param_data[i] = val.location(); |
| 6767 } | 6767 } |
| 6768 | 6768 |
| 6769 Handle<Object> result = Execution::New( | 6769 Handle<Object> result = Execution::New( |
| 6770 function, fixed->length(), param_data, &exception); | 6770 function, fixed->length(), param_data, &exception); |
| 6771 return *result; | 6771 return *result; |
| 6772 | |
| 6773 } | 6772 } |
| 6774 | 6773 |
| 6775 | 6774 |
| 6776 static Code* ComputeConstructStub(Handle<JSFunction> function) { | 6775 static Code* ComputeConstructStub(Handle<JSFunction> function) { |
| 6777 Handle<Object> prototype = Factory::null_value(); | 6776 Handle<Object> prototype = Factory::null_value(); |
| 6778 if (function->has_instance_prototype()) { | 6777 if (function->has_instance_prototype()) { |
| 6779 prototype = Handle<Object>(function->instance_prototype()); | 6778 prototype = Handle<Object>(function->instance_prototype()); |
| 6780 } | 6779 } |
| 6781 if (function->shared()->CanGenerateInlineConstructor(*prototype)) { | 6780 if (function->shared()->CanGenerateInlineConstructor(*prototype)) { |
| 6782 ConstructStubCompiler compiler; | 6781 ConstructStubCompiler compiler; |
| (...skipping 3801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10584 } else { | 10583 } else { |
| 10585 // Handle last resort GC and make sure to allow future allocations | 10584 // Handle last resort GC and make sure to allow future allocations |
| 10586 // to grow the heap without causing GCs (if possible). | 10585 // to grow the heap without causing GCs (if possible). |
| 10587 Counters::gc_last_resort_from_js.Increment(); | 10586 Counters::gc_last_resort_from_js.Increment(); |
| 10588 Heap::CollectAllGarbage(false); | 10587 Heap::CollectAllGarbage(false); |
| 10589 } | 10588 } |
| 10590 } | 10589 } |
| 10591 | 10590 |
| 10592 | 10591 |
| 10593 } } // namespace v8::internal | 10592 } } // namespace v8::internal |
| OLD | NEW |