| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 3305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3316 | 3316 |
| 3317 | 3317 |
| 3318 static Object* Runtime_NewObject(Arguments args) { | 3318 static Object* Runtime_NewObject(Arguments args) { |
| 3319 NoHandleAllocation ha; | 3319 NoHandleAllocation ha; |
| 3320 ASSERT(args.length() == 1); | 3320 ASSERT(args.length() == 1); |
| 3321 | 3321 |
| 3322 Object* constructor = args[0]; | 3322 Object* constructor = args[0]; |
| 3323 if (constructor->IsJSFunction()) { | 3323 if (constructor->IsJSFunction()) { |
| 3324 JSFunction* function = JSFunction::cast(constructor); | 3324 JSFunction* function = JSFunction::cast(constructor); |
| 3325 | 3325 |
| 3326 // Handle steping into constructors. | 3326 // Handle steping into constructors if step into is active. |
| 3327 if (Debug::StepInActive()) { | 3327 if (Debug::StepInActive()) { |
| 3328 StackFrameIterator it; | 3328 HandleScope scope; |
| 3329 it.Advance(); | 3329 Debug::HandleStepIn(Handle<JSFunction>(function), 0, true); |
| 3330 ASSERT(it.frame()->is_construct()); | |
| 3331 it.Advance(); | |
| 3332 if (it.frame()->fp() == Debug::step_in_fp()) { | |
| 3333 HandleScope scope; | |
| 3334 Debug::FloodWithOneShot(Handle<SharedFunctionInfo>(function->shared())); | |
| 3335 } | |
| 3336 } | 3330 } |
| 3337 | 3331 |
| 3338 if (function->has_initial_map() && | 3332 if (function->has_initial_map() && |
| 3339 function->initial_map()->instance_type() == JS_FUNCTION_TYPE) { | 3333 function->initial_map()->instance_type() == JS_FUNCTION_TYPE) { |
| 3340 // The 'Function' function ignores the receiver object when | 3334 // The 'Function' function ignores the receiver object when |
| 3341 // called using 'new' and creates a new JSFunction object that | 3335 // called using 'new' and creates a new JSFunction object that |
| 3342 // is returned. The receiver object is only used for error | 3336 // is returned. The receiver object is only used for error |
| 3343 // reporting if an error occurs when constructing the new | 3337 // reporting if an error occurs when constructing the new |
| 3344 // JSFunction. AllocateJSObject should not be used to allocate | 3338 // JSFunction. AllocateJSObject should not be used to allocate |
| 3345 // JSFunctions since it does not properly initialize the shared | 3339 // JSFunctions since it does not properly initialize the shared |
| (...skipping 2526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5872 } else { | 5866 } else { |
| 5873 // Handle last resort GC and make sure to allow future allocations | 5867 // Handle last resort GC and make sure to allow future allocations |
| 5874 // to grow the heap without causing GCs (if possible). | 5868 // to grow the heap without causing GCs (if possible). |
| 5875 Counters::gc_last_resort_from_js.Increment(); | 5869 Counters::gc_last_resort_from_js.Increment(); |
| 5876 Heap::CollectAllGarbage(); | 5870 Heap::CollectAllGarbage(); |
| 5877 } | 5871 } |
| 5878 } | 5872 } |
| 5879 | 5873 |
| 5880 | 5874 |
| 5881 } } // namespace v8::internal | 5875 } } // namespace v8::internal |
| OLD | NEW |