Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 6667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6678 Factory::NewFunctionFromSharedFunctionInfo(shared, | 6678 Factory::NewFunctionFromSharedFunctionInfo(shared, |
| 6679 context, | 6679 context, |
| 6680 pretenure_flag); | 6680 pretenure_flag); |
| 6681 return *result; | 6681 return *result; |
| 6682 } | 6682 } |
| 6683 | 6683 |
| 6684 static MaybeObject* Runtime_NewObjectFromBound(Arguments args) { | 6684 static MaybeObject* Runtime_NewObjectFromBound(Arguments args) { |
| 6685 HandleScope scope; | 6685 HandleScope scope; |
| 6686 ASSERT(args.length() == 2); | 6686 ASSERT(args.length() == 2); |
| 6687 CONVERT_ARG_CHECKED(JSFunction, function, 0); | 6687 CONVERT_ARG_CHECKED(JSFunction, function, 0); |
| 6688 CONVERT_ARG_CHECKED(JSArray, params, 1); | |
| 6689 | 6688 |
| 6690 RUNTIME_ASSERT(params->HasFastElements()); | 6689 FixedArray* bound_args = NULL; |
| 6691 FixedArray* fixed = FixedArray::cast(params->elements()); | 6690 int bound_argc = 0; |
| 6691 if (!args[1]->IsNull()) { | |
| 6692 CONVERT_ARG_CHECKED(JSArray, params, 1); | |
| 6693 RUNTIME_ASSERT(params->HasFastElements()); | |
| 6694 bound_args = FixedArray::cast(params->elements()); | |
| 6695 bound_argc = Smi::cast(params->length())->value(); | |
| 6696 } | |
| 6692 | 6697 |
| 6693 int fixed_length = Smi::cast(params->length())->value(); | 6698 JavaScriptFrameIterator it; |
| 6694 SmartPointer<Object**> param_data(NewArray<Object**>(fixed_length)); | 6699 JavaScriptFrame* frame = it.frame(); |
| 6695 for (int i = 0; i < fixed_length; i++) { | 6700 ASSERT(!frame->is_optimized()); |
| 6696 Handle<Object> val = Handle<Object>(fixed->get(i)); | 6701 it.AdvanceToArgumentsFrame(); |
| 6702 frame = it.frame(); | |
| 6703 int argc = frame->GetProvidedParametersCount(); | |
| 6704 | |
| 6705 int total_argc = bound_argc + argc; | |
| 6706 SmartPointer<Object**> param_data(NewArray<Object**>(total_argc)); | |
| 6707 for (int i = 0; i < bound_argc; i++) { | |
| 6708 Handle<Object> val = Handle<Object>(bound_args->get(i)); | |
| 6697 param_data[i] = val.location(); | 6709 param_data[i] = val.location(); |
| 6698 } | 6710 } |
| 6711 for (int i = 0; i < argc; i++) { | |
| 6712 Handle<Object> val = Handle<Object>(frame->GetParameter(i)); | |
| 6713 param_data[bound_argc + i] = val.location(); | |
| 6714 } | |
| 6699 | 6715 |
| 6700 bool exception = false; | 6716 bool exception = false; |
| 6701 Handle<Object> result = Execution::New( | 6717 Handle<Object> result = Execution::New( |
|
Mads Ager (chromium)
2011/02/08 07:09:44
Move "Execution::New(" to the next line as well?
| |
| 6702 function, fixed_length, *param_data, &exception); | 6718 function, total_argc, *param_data, &exception); |
| 6703 if (exception) { | 6719 if (exception) { |
| 6704 return Failure::Exception(); | 6720 return Failure::Exception(); |
| 6705 } | 6721 } |
| 6706 ASSERT(!result.is_null()); | 6722 ASSERT(!result.is_null()); |
| 6707 return *result; | 6723 return *result; |
| 6708 } | 6724 } |
| 6709 | 6725 |
| 6710 | 6726 |
| 6711 static void TrySettingInlineConstructStub(Handle<JSFunction> function) { | 6727 static void TrySettingInlineConstructStub(Handle<JSFunction> function) { |
| 6712 Handle<Object> prototype = Factory::null_value(); | 6728 Handle<Object> prototype = Factory::null_value(); |
| (...skipping 4332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11045 } else { | 11061 } else { |
| 11046 // Handle last resort GC and make sure to allow future allocations | 11062 // Handle last resort GC and make sure to allow future allocations |
| 11047 // to grow the heap without causing GCs (if possible). | 11063 // to grow the heap without causing GCs (if possible). |
| 11048 Counters::gc_last_resort_from_js.Increment(); | 11064 Counters::gc_last_resort_from_js.Increment(); |
| 11049 Heap::CollectAllGarbage(false); | 11065 Heap::CollectAllGarbage(false); |
| 11050 } | 11066 } |
| 11051 } | 11067 } |
| 11052 | 11068 |
| 11053 | 11069 |
| 11054 } } // namespace v8::internal | 11070 } } // namespace v8::internal |
| OLD | NEW |