OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 11318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11329 if (!receiver->IsJSObject() && | 11329 if (!receiver->IsJSObject() && |
11330 shared->is_classic_mode() && | 11330 shared->is_classic_mode() && |
11331 !function->IsBuiltin()) { | 11331 !function->IsBuiltin()) { |
11332 // If the receiver is not a JSObject and the function is not a | 11332 // If the receiver is not a JSObject and the function is not a |
11333 // builtin or strict-mode we have hit an optimization where a | 11333 // builtin or strict-mode we have hit an optimization where a |
11334 // value object is not converted into a wrapped JS objects. To | 11334 // value object is not converted into a wrapped JS objects. To |
11335 // hide this optimization from the debugger, we wrap the receiver | 11335 // hide this optimization from the debugger, we wrap the receiver |
11336 // by creating correct wrapper object based on the calling frame's | 11336 // by creating correct wrapper object based on the calling frame's |
11337 // native context. | 11337 // native context. |
11338 it.Advance(); | 11338 it.Advance(); |
11339 Handle<Context> calling_frames_native_context( | 11339 if (receiver->IsUndefined() || receiver->IsNull()) { |
11340 Context::cast(Context::cast(it.frame()->context())->native_context())); | 11340 Context* context = function->context(); |
11341 ASSERT(!receiver->IsUndefined() && !receiver->IsNull()); | 11341 receiver = handle(context->global_object()->global_receiver()); |
11342 receiver = | 11342 } else { |
11343 isolate->factory()->ToObject(receiver, calling_frames_native_context); | 11343 Context* context = Context::cast(it.frame()->context()); |
| 11344 Handle<Context> native_context(Context::cast(context->native_context())); |
| 11345 receiver = isolate->factory()->ToObject(receiver, native_context); |
| 11346 } |
11344 } | 11347 } |
11345 details->set(kFrameDetailsReceiverIndex, *receiver); | 11348 details->set(kFrameDetailsReceiverIndex, *receiver); |
11346 | 11349 |
11347 ASSERT_EQ(details_size, details_index); | 11350 ASSERT_EQ(details_size, details_index); |
11348 return *isolate->factory()->NewJSArrayWithElements(details); | 11351 return *isolate->factory()->NewJSArrayWithElements(details); |
11349 } | 11352 } |
11350 | 11353 |
11351 | 11354 |
11352 // Create a plain JSObject which materializes the local scope for the specified | 11355 // Create a plain JSObject which materializes the local scope for the specified |
11353 // frame. | 11356 // frame. |
(...skipping 3530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14884 // Handle last resort GC and make sure to allow future allocations | 14887 // Handle last resort GC and make sure to allow future allocations |
14885 // to grow the heap without causing GCs (if possible). | 14888 // to grow the heap without causing GCs (if possible). |
14886 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14889 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14887 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14890 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14888 "Runtime::PerformGC"); | 14891 "Runtime::PerformGC"); |
14889 } | 14892 } |
14890 } | 14893 } |
14891 | 14894 |
14892 | 14895 |
14893 } } // namespace v8::internal | 14896 } } // namespace v8::internal |
OLD | NEW |