| 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 11377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11388 JavaScriptFrame* frame) { | 11388 JavaScriptFrame* frame) { |
| 11389 HandleScope scope(isolate); | 11389 HandleScope scope(isolate); |
| 11390 Handle<SharedFunctionInfo> shared(function->shared()); | 11390 Handle<SharedFunctionInfo> shared(function->shared()); |
| 11391 Handle<ScopeInfo> scope_info(shared->scope_info()); | 11391 Handle<ScopeInfo> scope_info(shared->scope_info()); |
| 11392 | 11392 |
| 11393 if (!scope_info->HasContext()) return target; | 11393 if (!scope_info->HasContext()) return target; |
| 11394 | 11394 |
| 11395 // Third fill all context locals. | 11395 // Third fill all context locals. |
| 11396 Handle<Context> frame_context(Context::cast(frame->context())); | 11396 Handle<Context> frame_context(Context::cast(frame->context())); |
| 11397 Handle<Context> function_context(frame_context->declaration_context()); | 11397 Handle<Context> function_context(frame_context->declaration_context()); |
| 11398 if (!scope_info->CopyContextLocalsToScopeObject( | 11398 if (!ScopeInfo::CopyContextLocalsToScopeObject( |
| 11399 isolate, function_context, target)) { | 11399 scope_info, function_context, target)) { |
| 11400 return Handle<JSObject>(); | 11400 return Handle<JSObject>(); |
| 11401 } | 11401 } |
| 11402 | 11402 |
| 11403 // Finally copy any properties from the function context extension. | 11403 // Finally copy any properties from the function context extension. |
| 11404 // These will be variables introduced by eval. | 11404 // These will be variables introduced by eval. |
| 11405 if (function_context->closure() == *function) { | 11405 if (function_context->closure() == *function) { |
| 11406 if (function_context->has_extension() && | 11406 if (function_context->has_extension() && |
| 11407 !function_context->IsNativeContext()) { | 11407 !function_context->IsNativeContext()) { |
| 11408 Handle<JSObject> ext(JSObject::cast(function_context->extension())); | 11408 Handle<JSObject> ext(JSObject::cast(function_context->extension())); |
| 11409 bool threw = false; | 11409 bool threw = false; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11546 | 11546 |
| 11547 Handle<SharedFunctionInfo> shared(context->closure()->shared()); | 11547 Handle<SharedFunctionInfo> shared(context->closure()->shared()); |
| 11548 Handle<ScopeInfo> scope_info(shared->scope_info()); | 11548 Handle<ScopeInfo> scope_info(shared->scope_info()); |
| 11549 | 11549 |
| 11550 // Allocate and initialize a JSObject with all the content of this function | 11550 // Allocate and initialize a JSObject with all the content of this function |
| 11551 // closure. | 11551 // closure. |
| 11552 Handle<JSObject> closure_scope = | 11552 Handle<JSObject> closure_scope = |
| 11553 isolate->factory()->NewJSObject(isolate->object_function()); | 11553 isolate->factory()->NewJSObject(isolate->object_function()); |
| 11554 | 11554 |
| 11555 // Fill all context locals to the context extension. | 11555 // Fill all context locals to the context extension. |
| 11556 if (!scope_info->CopyContextLocalsToScopeObject( | 11556 if (!ScopeInfo::CopyContextLocalsToScopeObject( |
| 11557 isolate, context, closure_scope)) { | 11557 scope_info, context, closure_scope)) { |
| 11558 return Handle<JSObject>(); | 11558 return Handle<JSObject>(); |
| 11559 } | 11559 } |
| 11560 | 11560 |
| 11561 // Finally copy any properties from the function context extension. This will | 11561 // Finally copy any properties from the function context extension. This will |
| 11562 // be variables introduced by eval. | 11562 // be variables introduced by eval. |
| 11563 if (context->has_extension()) { | 11563 if (context->has_extension()) { |
| 11564 Handle<JSObject> ext(JSObject::cast(context->extension())); | 11564 Handle<JSObject> ext(JSObject::cast(context->extension())); |
| 11565 bool threw = false; | 11565 bool threw = false; |
| 11566 Handle<FixedArray> keys = | 11566 Handle<FixedArray> keys = |
| 11567 GetKeysInFixedArrayFor(ext, INCLUDE_PROTOS, &threw); | 11567 GetKeysInFixedArrayFor(ext, INCLUDE_PROTOS, &threw); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11667 Handle<Context> context) { | 11667 Handle<Context> context) { |
| 11668 ASSERT(context->IsBlockContext()); | 11668 ASSERT(context->IsBlockContext()); |
| 11669 Handle<ScopeInfo> scope_info(ScopeInfo::cast(context->extension())); | 11669 Handle<ScopeInfo> scope_info(ScopeInfo::cast(context->extension())); |
| 11670 | 11670 |
| 11671 // Allocate and initialize a JSObject with all the arguments, stack locals | 11671 // Allocate and initialize a JSObject with all the arguments, stack locals |
| 11672 // heap locals and extension properties of the debugged function. | 11672 // heap locals and extension properties of the debugged function. |
| 11673 Handle<JSObject> block_scope = | 11673 Handle<JSObject> block_scope = |
| 11674 isolate->factory()->NewJSObject(isolate->object_function()); | 11674 isolate->factory()->NewJSObject(isolate->object_function()); |
| 11675 | 11675 |
| 11676 // Fill all context locals. | 11676 // Fill all context locals. |
| 11677 if (!scope_info->CopyContextLocalsToScopeObject( | 11677 if (!ScopeInfo::CopyContextLocalsToScopeObject( |
| 11678 isolate, context, block_scope)) { | 11678 scope_info, context, block_scope)) { |
| 11679 return Handle<JSObject>(); | 11679 return Handle<JSObject>(); |
| 11680 } | 11680 } |
| 11681 | 11681 |
| 11682 return block_scope; | 11682 return block_scope; |
| 11683 } | 11683 } |
| 11684 | 11684 |
| 11685 | 11685 |
| 11686 // Create a plain JSObject which materializes the module scope for the specified | 11686 // Create a plain JSObject which materializes the module scope for the specified |
| 11687 // module context. | 11687 // module context. |
| 11688 static Handle<JSObject> MaterializeModuleScope( | 11688 static Handle<JSObject> MaterializeModuleScope( |
| 11689 Isolate* isolate, | 11689 Isolate* isolate, |
| 11690 Handle<Context> context) { | 11690 Handle<Context> context) { |
| 11691 ASSERT(context->IsModuleContext()); | 11691 ASSERT(context->IsModuleContext()); |
| 11692 Handle<ScopeInfo> scope_info(ScopeInfo::cast(context->extension())); | 11692 Handle<ScopeInfo> scope_info(ScopeInfo::cast(context->extension())); |
| 11693 | 11693 |
| 11694 // Allocate and initialize a JSObject with all the members of the debugged | 11694 // Allocate and initialize a JSObject with all the members of the debugged |
| 11695 // module. | 11695 // module. |
| 11696 Handle<JSObject> module_scope = | 11696 Handle<JSObject> module_scope = |
| 11697 isolate->factory()->NewJSObject(isolate->object_function()); | 11697 isolate->factory()->NewJSObject(isolate->object_function()); |
| 11698 | 11698 |
| 11699 // Fill all context locals. | 11699 // Fill all context locals. |
| 11700 if (!scope_info->CopyContextLocalsToScopeObject( | 11700 if (!ScopeInfo::CopyContextLocalsToScopeObject( |
| 11701 isolate, context, module_scope)) { | 11701 scope_info, context, module_scope)) { |
| 11702 return Handle<JSObject>(); | 11702 return Handle<JSObject>(); |
| 11703 } | 11703 } |
| 11704 | 11704 |
| 11705 return module_scope; | 11705 return module_scope; |
| 11706 } | 11706 } |
| 11707 | 11707 |
| 11708 | 11708 |
| 11709 // Iterate over the actual scopes visible from a stack frame or from a closure. | 11709 // Iterate over the actual scopes visible from a stack frame or from a closure. |
| 11710 // The iteration proceeds from the innermost visible nested scope outwards. | 11710 // The iteration proceeds from the innermost visible nested scope outwards. |
| 11711 // All scopes are backed by an actual context except the local scope, | 11711 // All scopes are backed by an actual context except the local scope, |
| (...skipping 3094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14806 // Handle last resort GC and make sure to allow future allocations | 14806 // Handle last resort GC and make sure to allow future allocations |
| 14807 // to grow the heap without causing GCs (if possible). | 14807 // to grow the heap without causing GCs (if possible). |
| 14808 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14808 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14809 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14809 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14810 "Runtime::PerformGC"); | 14810 "Runtime::PerformGC"); |
| 14811 } | 14811 } |
| 14812 } | 14812 } |
| 14813 | 14813 |
| 14814 | 14814 |
| 14815 } } // namespace v8::internal | 14815 } } // namespace v8::internal |
| OLD | NEW |