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 6739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 RUNTIME_ASSERT(params->HasFastElements()); |
6760 FixedArray* fixed = FixedArray::cast(params->elements()); | 6761 FixedArray* fixed = FixedArray::cast(params->elements()); |
6761 | 6762 |
6762 bool exception = false; | 6763 int fixed_length = Smi::cast(params->length())->value(); |
6763 Object*** param_data = NewArray<Object**>(fixed->length()); | 6764 SmartPointer<Object**> param_data(NewArray<Object**>(fixed_length)); |
6764 for (int i = 0; i < fixed->length(); i++) { | 6765 for (int i = 0; i < fixed_length; i++) { |
6765 Handle<Object> val = Handle<Object>(fixed->get(i)); | 6766 Handle<Object> val = Handle<Object>(fixed->get(i)); |
6766 param_data[i] = val.location(); | 6767 param_data[i] = val.location(); |
6767 } | 6768 } |
6768 | 6769 |
| 6770 bool exception = false; |
6769 Handle<Object> result = Execution::New( | 6771 Handle<Object> result = Execution::New( |
6770 function, fixed->length(), param_data, &exception); | 6772 function, fixed_length, *param_data, &exception); |
| 6773 if (exception) { |
| 6774 return Failure::Exception(); |
| 6775 } |
| 6776 ASSERT(!result.is_null()); |
6771 return *result; | 6777 return *result; |
6772 } | 6778 } |
6773 | 6779 |
6774 | 6780 |
6775 static Code* ComputeConstructStub(Handle<JSFunction> function) { | 6781 static Code* ComputeConstructStub(Handle<JSFunction> function) { |
6776 Handle<Object> prototype = Factory::null_value(); | 6782 Handle<Object> prototype = Factory::null_value(); |
6777 if (function->has_instance_prototype()) { | 6783 if (function->has_instance_prototype()) { |
6778 prototype = Handle<Object>(function->instance_prototype()); | 6784 prototype = Handle<Object>(function->instance_prototype()); |
6779 } | 6785 } |
6780 if (function->shared()->CanGenerateInlineConstructor(*prototype)) { | 6786 if (function->shared()->CanGenerateInlineConstructor(*prototype)) { |
(...skipping 3809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10590 } else { | 10596 } else { |
10591 // Handle last resort GC and make sure to allow future allocations | 10597 // Handle last resort GC and make sure to allow future allocations |
10592 // to grow the heap without causing GCs (if possible). | 10598 // to grow the heap without causing GCs (if possible). |
10593 Counters::gc_last_resort_from_js.Increment(); | 10599 Counters::gc_last_resort_from_js.Increment(); |
10594 Heap::CollectAllGarbage(false); | 10600 Heap::CollectAllGarbage(false); |
10595 } | 10601 } |
10596 } | 10602 } |
10597 | 10603 |
10598 | 10604 |
10599 } } // namespace v8::internal | 10605 } } // namespace v8::internal |
OLD | NEW |