| 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 4318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4329 static Object* Runtime_NewArgumentsFast(Arguments args) { | 4329 static Object* Runtime_NewArgumentsFast(Arguments args) { |
| 4330 NoHandleAllocation ha; | 4330 NoHandleAllocation ha; |
| 4331 ASSERT(args.length() == 3); | 4331 ASSERT(args.length() == 3); |
| 4332 | 4332 |
| 4333 JSFunction* callee = JSFunction::cast(args[0]); | 4333 JSFunction* callee = JSFunction::cast(args[0]); |
| 4334 Object** parameters = reinterpret_cast<Object**>(args[1]); | 4334 Object** parameters = reinterpret_cast<Object**>(args[1]); |
| 4335 const int length = Smi::cast(args[2])->value(); | 4335 const int length = Smi::cast(args[2])->value(); |
| 4336 | 4336 |
| 4337 Object* result = Heap::AllocateArgumentsObject(callee, length); | 4337 Object* result = Heap::AllocateArgumentsObject(callee, length); |
| 4338 if (result->IsFailure()) return result; | 4338 if (result->IsFailure()) return result; |
| 4339 ASSERT(Heap::InNewSpace(result)); | |
| 4340 | |
| 4341 // Allocate the elements if needed. | 4339 // Allocate the elements if needed. |
| 4342 if (length > 0) { | 4340 if (length > 0) { |
| 4343 // Allocate the fixed array. | 4341 // Allocate the fixed array. |
| 4344 Object* obj = Heap::AllocateRawFixedArray(length); | 4342 Object* obj = Heap::AllocateRawFixedArray(length); |
| 4345 if (obj->IsFailure()) return obj; | 4343 if (obj->IsFailure()) return obj; |
| 4346 reinterpret_cast<Array*>(obj)->set_map(Heap::fixed_array_map()); | 4344 reinterpret_cast<Array*>(obj)->set_map(Heap::fixed_array_map()); |
| 4347 FixedArray* array = FixedArray::cast(obj); | 4345 FixedArray* array = FixedArray::cast(obj); |
| 4348 array->set_length(length); | 4346 array->set_length(length); |
| 4349 WriteBarrierMode mode = array->GetWriteBarrierMode(); | 4347 WriteBarrierMode mode = array->GetWriteBarrierMode(); |
| 4350 for (int i = 0; i < length; i++) { | 4348 for (int i = 0; i < length; i++) { |
| 4351 array->set(i, *--parameters, mode); | 4349 array->set(i, *--parameters, mode); |
| 4352 } | 4350 } |
| 4353 JSObject::cast(result)->set_elements(FixedArray::cast(obj), | 4351 JSObject::cast(result)->set_elements(FixedArray::cast(obj)); |
| 4354 SKIP_WRITE_BARRIER); | |
| 4355 } | 4352 } |
| 4356 return result; | 4353 return result; |
| 4357 } | 4354 } |
| 4358 | 4355 |
| 4359 | 4356 |
| 4360 static Object* Runtime_NewClosure(Arguments args) { | 4357 static Object* Runtime_NewClosure(Arguments args) { |
| 4361 HandleScope scope; | 4358 HandleScope scope; |
| 4362 ASSERT(args.length() == 2); | 4359 ASSERT(args.length() == 2); |
| 4363 CONVERT_ARG_CHECKED(Context, context, 0); | 4360 CONVERT_ARG_CHECKED(Context, context, 0); |
| 4364 CONVERT_ARG_CHECKED(JSFunction, boilerplate, 1); | 4361 CONVERT_ARG_CHECKED(JSFunction, boilerplate, 1); |
| (...skipping 3493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7858 } else { | 7855 } else { |
| 7859 // Handle last resort GC and make sure to allow future allocations | 7856 // Handle last resort GC and make sure to allow future allocations |
| 7860 // to grow the heap without causing GCs (if possible). | 7857 // to grow the heap without causing GCs (if possible). |
| 7861 Counters::gc_last_resort_from_js.Increment(); | 7858 Counters::gc_last_resort_from_js.Increment(); |
| 7862 Heap::CollectAllGarbage(false); | 7859 Heap::CollectAllGarbage(false); |
| 7863 } | 7860 } |
| 7864 } | 7861 } |
| 7865 | 7862 |
| 7866 | 7863 |
| 7867 } } // namespace v8::internal | 7864 } } // namespace v8::internal |
| OLD | NEW |