OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 11090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11101 serialized_scope_info, scope_info, | 11101 serialized_scope_info, scope_info, |
11102 context, block_scope)) { | 11102 context, block_scope)) { |
11103 return Handle<JSObject>(); | 11103 return Handle<JSObject>(); |
11104 } | 11104 } |
11105 } | 11105 } |
11106 | 11106 |
11107 return block_scope; | 11107 return block_scope; |
11108 } | 11108 } |
11109 | 11109 |
11110 | 11110 |
11111 // Iterate over the actual scopes visible from a stack frame. All scopes are | 11111 // Iterate over the actual scopes visible from a stack frame. The iteration |
| 11112 // proceeds from the innermost visible nested scope outwards. All scopes are |
11112 // backed by an actual context except the local scope, which is inserted | 11113 // backed by an actual context except the local scope, which is inserted |
11113 // "artifically" in the context chain. | 11114 // "artificially" in the context chain. |
11114 class ScopeIterator { | 11115 class ScopeIterator { |
11115 public: | 11116 public: |
11116 enum ScopeType { | 11117 enum ScopeType { |
11117 ScopeTypeGlobal = 0, | 11118 ScopeTypeGlobal = 0, |
11118 ScopeTypeLocal, | 11119 ScopeTypeLocal, |
11119 ScopeTypeWith, | 11120 ScopeTypeWith, |
11120 ScopeTypeClosure, | 11121 ScopeTypeClosure, |
11121 ScopeTypeCatch, | 11122 ScopeTypeCatch, |
11122 ScopeTypeBlock | 11123 ScopeTypeBlock |
11123 }; | 11124 }; |
11124 | 11125 |
11125 ScopeIterator(Isolate* isolate, | 11126 ScopeIterator(Isolate* isolate, |
11126 JavaScriptFrame* frame, | 11127 JavaScriptFrame* frame, |
11127 int inlined_frame_index) | 11128 int inlined_frame_index) |
11128 : isolate_(isolate), | 11129 : isolate_(isolate), |
11129 frame_(frame), | 11130 frame_(frame), |
11130 inlined_frame_index_(inlined_frame_index), | 11131 inlined_frame_index_(inlined_frame_index), |
11131 function_(JSFunction::cast(frame->function())), | 11132 function_(JSFunction::cast(frame->function())), |
11132 context_(Context::cast(frame->context())), | 11133 context_(Context::cast(frame->context())), |
11133 local_done_(false), | 11134 nested_scope_chain_(4) { |
11134 at_local_(false) { | |
11135 | 11135 |
11136 // Check whether the first scope is actually a local scope. | 11136 // Catch the case when the debugger stops in an internal function. |
11137 // If there is a stack slot for .result then this local scope has been | 11137 Handle<SharedFunctionInfo> shared_info(function_->shared()); |
11138 // created for evaluating top level code and it is not a real local scope. | 11138 if (shared_info->script() == isolate->heap()->undefined_value()) { |
| 11139 while (context_->closure() == *function_) { |
| 11140 context_ = Handle<Context>(context_->previous(), isolate_); |
| 11141 } |
| 11142 return; |
| 11143 } |
| 11144 |
| 11145 // Check whether we are in global code or function code. If there is a stack |
| 11146 // slot for .result then this function has been created for evaluating |
| 11147 // global code and it is not a real function. |
11139 // Checking for the existence of .result seems fragile, but the scope info | 11148 // Checking for the existence of .result seems fragile, but the scope info |
11140 // saved with the code object does not otherwise have that information. | 11149 // saved with the code object does not otherwise have that information. |
11141 int index = function_->shared()->scope_info()-> | 11150 int index = shared_info->scope_info()-> |
11142 StackSlotIndex(isolate_->heap()->result_symbol()); | 11151 StackSlotIndex(isolate_->heap()->result_symbol()); |
| 11152 |
| 11153 // Reparse the code and analyze the scopes. |
| 11154 ZoneScope zone_scope(isolate, DELETE_ON_EXIT); |
| 11155 Handle<Script> script(Script::cast(shared_info->script())); |
| 11156 Scope* scope; |
11143 if (index >= 0) { | 11157 if (index >= 0) { |
11144 local_done_ = true; | 11158 // Global code |
11145 } else if (context_->IsGlobalContext() || | 11159 CompilationInfo info(script); |
11146 context_->IsFunctionContext()) { | 11160 info.MarkAsGlobal(); |
11147 at_local_ = true; | 11161 bool result = ParserApi::Parse(&info); |
11148 } else if (context_->closure() != *function_) { | 11162 ASSERT(result); |
11149 // The context_ is a block or with or catch block from the outer function. | 11163 result = Scope::Analyze(&info); |
11150 ASSERT(context_->IsWithContext() || | 11164 ASSERT(result); |
11151 context_->IsCatchContext() || | 11165 scope = info.function()->scope(); |
11152 context_->IsBlockContext()); | 11166 } else { |
11153 at_local_ = true; | 11167 // Function code |
| 11168 CompilationInfo info(shared_info); |
| 11169 bool result = ParserApi::Parse(&info); |
| 11170 ASSERT(result); |
| 11171 result = Scope::Analyze(&info); |
| 11172 ASSERT(result); |
| 11173 scope = info.function()->scope(); |
11154 } | 11174 } |
| 11175 |
| 11176 // Retrieve the scope chain for the current position. |
| 11177 int statement_position = |
| 11178 shared_info->code()->SourceStatementPosition(frame_->pc()); |
| 11179 scope->GetNestedScopeChain(&nested_scope_chain_, statement_position); |
11155 } | 11180 } |
11156 | 11181 |
11157 // More scopes? | 11182 // More scopes? |
11158 bool Done() { return context_.is_null(); } | 11183 bool Done() { return context_.is_null(); } |
11159 | 11184 |
11160 // Move to the next scope. | 11185 // Move to the next scope. |
11161 void Next() { | 11186 void Next() { |
11162 // If at a local scope mark the local scope as passed. | 11187 ScopeType scope_type = Type(); |
11163 if (at_local_) { | 11188 if (scope_type == ScopeTypeGlobal) { |
11164 at_local_ = false; | 11189 // The global scope is always the last in the chain. |
11165 local_done_ = true; | 11190 ASSERT(context_->IsGlobalContext()); |
11166 | |
11167 // If the current context is not associated with the local scope the | |
11168 // current context is the next real scope, so don't move to the next | |
11169 // context in this case. | |
11170 if (context_->closure() != *function_) { | |
11171 return; | |
11172 } | |
11173 } | |
11174 | |
11175 // The global scope is always the last in the chain. | |
11176 if (context_->IsGlobalContext()) { | |
11177 context_ = Handle<Context>(); | 11191 context_ = Handle<Context>(); |
11178 return; | 11192 return; |
11179 } | 11193 } |
11180 | 11194 if (nested_scope_chain_.is_empty()) { |
11181 // Move to the next context. | 11195 context_ = Handle<Context>(context_->previous(), isolate_); |
11182 context_ = Handle<Context>(context_->previous(), isolate_); | 11196 } else { |
11183 | 11197 if (nested_scope_chain_.last()->HasContext()) { |
11184 // If passing the local scope indicate that the current scope is now the | 11198 context_ = Handle<Context>(context_->previous(), isolate_); |
11185 // local scope. | 11199 } |
11186 if (!local_done_ && | 11200 nested_scope_chain_.RemoveLast(); |
11187 (context_->IsGlobalContext() || context_->IsFunctionContext())) { | |
11188 at_local_ = true; | |
11189 } | 11201 } |
11190 } | 11202 } |
11191 | 11203 |
11192 // Return the type of the current scope. | 11204 // Return the type of the current scope. |
11193 ScopeType Type() { | 11205 ScopeType Type() { |
11194 if (at_local_) { | 11206 if (!nested_scope_chain_.is_empty()) { |
11195 return ScopeTypeLocal; | 11207 Handle<SerializedScopeInfo> scope_info = nested_scope_chain_.last(); |
| 11208 switch (scope_info->Type()) { |
| 11209 case FUNCTION_SCOPE: |
| 11210 ASSERT(context_->IsFunctionContext() || |
| 11211 !scope_info->HasContext()); |
| 11212 return ScopeTypeLocal; |
| 11213 case GLOBAL_SCOPE: |
| 11214 ASSERT(context_->IsGlobalContext()); |
| 11215 return ScopeTypeGlobal; |
| 11216 case WITH_SCOPE: |
| 11217 ASSERT(context_->IsWithContext()); |
| 11218 return ScopeTypeWith; |
| 11219 case CATCH_SCOPE: |
| 11220 ASSERT(context_->IsCatchContext()); |
| 11221 return ScopeTypeCatch; |
| 11222 case BLOCK_SCOPE: |
| 11223 ASSERT(!scope_info->HasContext() || |
| 11224 context_->IsBlockContext()); |
| 11225 return ScopeTypeBlock; |
| 11226 case EVAL_SCOPE: |
| 11227 UNREACHABLE(); |
| 11228 } |
11196 } | 11229 } |
11197 if (context_->IsGlobalContext()) { | 11230 if (context_->IsGlobalContext()) { |
11198 ASSERT(context_->global()->IsGlobalObject()); | 11231 ASSERT(context_->global()->IsGlobalObject()); |
11199 return ScopeTypeGlobal; | 11232 return ScopeTypeGlobal; |
11200 } | 11233 } |
11201 if (context_->IsFunctionContext()) { | 11234 if (context_->IsFunctionContext()) { |
11202 return ScopeTypeClosure; | 11235 return ScopeTypeClosure; |
11203 } | 11236 } |
11204 if (context_->IsCatchContext()) { | 11237 if (context_->IsCatchContext()) { |
11205 return ScopeTypeCatch; | 11238 return ScopeTypeCatch; |
11206 } | 11239 } |
11207 if (context_->IsBlockContext()) { | 11240 if (context_->IsBlockContext()) { |
11208 return ScopeTypeBlock; | 11241 return ScopeTypeBlock; |
11209 } | 11242 } |
11210 ASSERT(context_->IsWithContext()); | 11243 ASSERT(context_->IsWithContext()); |
11211 return ScopeTypeWith; | 11244 return ScopeTypeWith; |
11212 } | 11245 } |
11213 | 11246 |
11214 // Return the JavaScript object with the content of the current scope. | 11247 // Return the JavaScript object with the content of the current scope. |
11215 Handle<JSObject> ScopeObject() { | 11248 Handle<JSObject> ScopeObject() { |
11216 switch (Type()) { | 11249 switch (Type()) { |
11217 case ScopeIterator::ScopeTypeGlobal: | 11250 case ScopeIterator::ScopeTypeGlobal: |
11218 return Handle<JSObject>(CurrentContext()->global()); | 11251 return Handle<JSObject>(CurrentContext()->global()); |
11219 case ScopeIterator::ScopeTypeLocal: | 11252 case ScopeIterator::ScopeTypeLocal: |
11220 // Materialize the content of the local scope into a JSObject. | 11253 // Materialize the content of the local scope into a JSObject. |
| 11254 ASSERT(nested_scope_chain_.length() == 1); |
11221 return MaterializeLocalScope(isolate_, frame_, inlined_frame_index_); | 11255 return MaterializeLocalScope(isolate_, frame_, inlined_frame_index_); |
11222 case ScopeIterator::ScopeTypeWith: | 11256 case ScopeIterator::ScopeTypeWith: |
11223 // Return the with object. | 11257 // Return the with object. |
11224 return Handle<JSObject>(JSObject::cast(CurrentContext()->extension())); | 11258 return Handle<JSObject>(JSObject::cast(CurrentContext()->extension())); |
11225 case ScopeIterator::ScopeTypeCatch: | 11259 case ScopeIterator::ScopeTypeCatch: |
11226 return MaterializeCatchScope(isolate_, CurrentContext()); | 11260 return MaterializeCatchScope(isolate_, CurrentContext()); |
11227 case ScopeIterator::ScopeTypeClosure: | 11261 case ScopeIterator::ScopeTypeClosure: |
11228 // Materialize the content of the closure scope into a JSObject. | 11262 // Materialize the content of the closure scope into a JSObject. |
11229 return MaterializeClosure(isolate_, CurrentContext()); | 11263 return MaterializeClosure(isolate_, CurrentContext()); |
11230 case ScopeIterator::ScopeTypeBlock: | 11264 case ScopeIterator::ScopeTypeBlock: |
11231 return MaterializeBlockScope(isolate_, CurrentContext()); | 11265 return MaterializeBlockScope(isolate_, CurrentContext()); |
11232 } | 11266 } |
11233 UNREACHABLE(); | 11267 UNREACHABLE(); |
11234 return Handle<JSObject>(); | 11268 return Handle<JSObject>(); |
11235 } | 11269 } |
11236 | 11270 |
| 11271 Handle<SerializedScopeInfo> CurrentScopeInfo() { |
| 11272 if (!nested_scope_chain_.is_empty()) { |
| 11273 return nested_scope_chain_.last(); |
| 11274 } else if (context_->IsBlockContext()) { |
| 11275 return Handle<SerializedScopeInfo>( |
| 11276 SerializedScopeInfo::cast(context_->extension())); |
| 11277 } else if (context_->IsFunctionContext()) { |
| 11278 return Handle<SerializedScopeInfo>( |
| 11279 context_->closure()->shared()->scope_info()); |
| 11280 } |
| 11281 return Handle<SerializedScopeInfo>::null(); |
| 11282 } |
| 11283 |
11237 // Return the context for this scope. For the local context there might not | 11284 // Return the context for this scope. For the local context there might not |
11238 // be an actual context. | 11285 // be an actual context. |
11239 Handle<Context> CurrentContext() { | 11286 Handle<Context> CurrentContext() { |
11240 if (at_local_ && context_->closure() != *function_) { | 11287 if (Type() == ScopeTypeGlobal || |
| 11288 nested_scope_chain_.is_empty()) { |
| 11289 return context_; |
| 11290 } else if (nested_scope_chain_.last()->HasContext()) { |
| 11291 return context_; |
| 11292 } else { |
11241 return Handle<Context>(); | 11293 return Handle<Context>(); |
11242 } | 11294 } |
11243 return context_; | |
11244 } | 11295 } |
11245 | 11296 |
11246 #ifdef DEBUG | 11297 #ifdef DEBUG |
11247 // Debug print of the content of the current scope. | 11298 // Debug print of the content of the current scope. |
11248 void DebugPrint() { | 11299 void DebugPrint() { |
11249 switch (Type()) { | 11300 switch (Type()) { |
11250 case ScopeIterator::ScopeTypeGlobal: | 11301 case ScopeIterator::ScopeTypeGlobal: |
11251 PrintF("Global:\n"); | 11302 PrintF("Global:\n"); |
11252 CurrentContext()->Print(); | 11303 CurrentContext()->Print(); |
11253 break; | 11304 break; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11296 PrintF("\n"); | 11347 PrintF("\n"); |
11297 } | 11348 } |
11298 #endif | 11349 #endif |
11299 | 11350 |
11300 private: | 11351 private: |
11301 Isolate* isolate_; | 11352 Isolate* isolate_; |
11302 JavaScriptFrame* frame_; | 11353 JavaScriptFrame* frame_; |
11303 int inlined_frame_index_; | 11354 int inlined_frame_index_; |
11304 Handle<JSFunction> function_; | 11355 Handle<JSFunction> function_; |
11305 Handle<Context> context_; | 11356 Handle<Context> context_; |
11306 bool local_done_; | 11357 List<Handle<SerializedScopeInfo> > nested_scope_chain_; |
11307 bool at_local_; | |
11308 | 11358 |
11309 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopeIterator); | 11359 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopeIterator); |
11310 }; | 11360 }; |
11311 | 11361 |
11312 | 11362 |
11313 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetScopeCount) { | 11363 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetScopeCount) { |
11314 HandleScope scope(isolate); | 11364 HandleScope scope(isolate); |
11315 ASSERT(args.length() == 2); | 11365 ASSERT(args.length() == 2); |
11316 | 11366 |
11317 // Check arguments. | 11367 // Check arguments. |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11760 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClearStepping) { | 11810 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClearStepping) { |
11761 HandleScope scope(isolate); | 11811 HandleScope scope(isolate); |
11762 ASSERT(args.length() == 0); | 11812 ASSERT(args.length() == 0); |
11763 isolate->debug()->ClearStepping(); | 11813 isolate->debug()->ClearStepping(); |
11764 return isolate->heap()->undefined_value(); | 11814 return isolate->heap()->undefined_value(); |
11765 } | 11815 } |
11766 | 11816 |
11767 | 11817 |
11768 // Creates a copy of the with context chain. The copy of the context chain is | 11818 // Creates a copy of the with context chain. The copy of the context chain is |
11769 // is linked to the function context supplied. | 11819 // is linked to the function context supplied. |
11770 static Handle<Context> CopyWithContextChain(Isolate* isolate, | 11820 static Handle<Context> CopyNestedScopeContextChain(Isolate* isolate, |
11771 Handle<JSFunction> function, | 11821 Handle<JSFunction> function, |
11772 Handle<Context> current, | 11822 Handle<Context> base, |
11773 Handle<Context> base) { | 11823 JavaScriptFrame* frame, |
11774 // At the end of the chain. Return the base context to link to. | 11824 int inlined_frame_index) { |
11775 if (current->IsFunctionContext() || current->IsGlobalContext()) { | 11825 HandleScope scope(isolate); |
11776 return base; | 11826 List<Handle<SerializedScopeInfo> > scope_chain; |
| 11827 List<Handle<Context> > context_chain; |
| 11828 |
| 11829 ScopeIterator it(isolate, frame, inlined_frame_index); |
| 11830 for (; it.Type() != ScopeIterator::ScopeTypeGlobal && |
| 11831 it.Type() != ScopeIterator::ScopeTypeLocal ; it.Next()) { |
| 11832 ASSERT(!it.Done()); |
| 11833 scope_chain.Add(it.CurrentScopeInfo()); |
| 11834 context_chain.Add(it.CurrentContext()); |
11777 } | 11835 } |
11778 | 11836 |
11779 // Recursively copy the with and catch contexts. | 11837 // At the end of the chain. Return the base context to link to. |
11780 HandleScope scope(isolate); | 11838 Handle<Context> context = base; |
11781 Handle<Context> previous(current->previous()); | 11839 |
11782 Handle<Context> new_previous = | 11840 // Iteratively copy and or materialize the nested contexts. |
11783 CopyWithContextChain(isolate, function, previous, base); | 11841 while (!scope_chain.is_empty()) { |
11784 Handle<Context> new_current; | 11842 Handle<SerializedScopeInfo> scope_info = scope_chain.RemoveLast(); |
11785 if (current->IsCatchContext()) { | 11843 Handle<Context> current = context_chain.RemoveLast(); |
11786 Handle<String> name(String::cast(current->extension())); | 11844 ASSERT(!(scope_info->HasContext() & current.is_null())); |
11787 Handle<Object> thrown_object(current->get(Context::THROWN_OBJECT_INDEX)); | 11845 |
11788 new_current = | 11846 if (scope_info->Type() == CATCH_SCOPE) { |
11789 isolate->factory()->NewCatchContext(function, | 11847 Handle<String> name(String::cast(current->extension())); |
11790 new_previous, | 11848 Handle<Object> thrown_object(current->get(Context::THROWN_OBJECT_INDEX)); |
11791 name, | 11849 context = |
11792 thrown_object); | 11850 isolate->factory()->NewCatchContext(function, |
11793 } else if (current->IsBlockContext()) { | 11851 context, |
11794 Handle<SerializedScopeInfo> scope_info( | 11852 name, |
11795 SerializedScopeInfo::cast(current->extension())); | 11853 thrown_object); |
11796 new_current = | 11854 } else if (scope_info->Type() == BLOCK_SCOPE) { |
11797 isolate->factory()->NewBlockContext(function, new_previous, scope_info); | 11855 // Materialize the contents of the block scope into a JSObject. |
11798 // Copy context slots. | 11856 Handle<JSObject> block_scope_object = |
11799 int num_context_slots = scope_info->NumberOfContextSlots(); | 11857 MaterializeBlockScope(isolate, current); |
11800 for (int i = Context::MIN_CONTEXT_SLOTS; i < num_context_slots; ++i) { | 11858 if (block_scope_object.is_null()) { |
11801 new_current->set(i, current->get(i)); | 11859 return Handle<Context>::null(); |
| 11860 } |
| 11861 // Allocate a new function context for the debug evaluation and set the |
| 11862 // extension object. |
| 11863 Handle<Context> new_context = |
| 11864 isolate->factory()->NewFunctionContext(Context::MIN_CONTEXT_SLOTS, |
| 11865 function); |
| 11866 new_context->set_extension(*block_scope_object); |
| 11867 new_context->set_previous(*context); |
| 11868 context = new_context; |
| 11869 } else { |
| 11870 ASSERT(scope_info->Type() == WITH_SCOPE); |
| 11871 ASSERT(current->IsWithContext()); |
| 11872 Handle<JSObject> extension(JSObject::cast(current->extension())); |
| 11873 context = |
| 11874 isolate->factory()->NewWithContext(function, context, extension); |
11802 } | 11875 } |
11803 } else { | |
11804 ASSERT(current->IsWithContext()); | |
11805 Handle<JSObject> extension(JSObject::cast(current->extension())); | |
11806 new_current = | |
11807 isolate->factory()->NewWithContext(function, new_previous, extension); | |
11808 } | 11876 } |
11809 return scope.CloseAndEscape(new_current); | 11877 |
| 11878 return scope.CloseAndEscape(context); |
11810 } | 11879 } |
11811 | 11880 |
11812 | 11881 |
11813 // Helper function to find or create the arguments object for | 11882 // Helper function to find or create the arguments object for |
11814 // Runtime_DebugEvaluate. | 11883 // Runtime_DebugEvaluate. |
11815 static Handle<Object> GetArgumentsObject(Isolate* isolate, | 11884 static Handle<Object> GetArgumentsObject(Isolate* isolate, |
11816 JavaScriptFrame* frame, | 11885 JavaScriptFrame* frame, |
11817 int inlined_frame_index, | 11886 int inlined_frame_index, |
11818 Handle<JSFunction> function, | 11887 Handle<JSFunction> function, |
11819 Handle<SerializedScopeInfo> scope_info, | 11888 Handle<SerializedScopeInfo> scope_info, |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11937 isolate->factory()->NewFunctionContext(Context::MIN_CONTEXT_SLOTS, | 12006 isolate->factory()->NewFunctionContext(Context::MIN_CONTEXT_SLOTS, |
11938 go_between); | 12007 go_between); |
11939 context->set_extension(*local_scope); | 12008 context->set_extension(*local_scope); |
11940 // Copy any with contexts present and chain them in front of this context. | 12009 // Copy any with contexts present and chain them in front of this context. |
11941 Handle<Context> frame_context(Context::cast(frame->context())); | 12010 Handle<Context> frame_context(Context::cast(frame->context())); |
11942 Handle<Context> function_context; | 12011 Handle<Context> function_context; |
11943 // Get the function's context if it has one. | 12012 // Get the function's context if it has one. |
11944 if (scope_info->HasHeapAllocatedLocals()) { | 12013 if (scope_info->HasHeapAllocatedLocals()) { |
11945 function_context = Handle<Context>(frame_context->declaration_context()); | 12014 function_context = Handle<Context>(frame_context->declaration_context()); |
11946 } | 12015 } |
11947 context = CopyWithContextChain(isolate, go_between, frame_context, context); | 12016 context = CopyNestedScopeContextChain(isolate, |
| 12017 go_between, |
| 12018 context, |
| 12019 frame, |
| 12020 inlined_frame_index); |
11948 | 12021 |
11949 if (additional_context->IsJSObject()) { | 12022 if (additional_context->IsJSObject()) { |
11950 Handle<JSObject> extension = Handle<JSObject>::cast(additional_context); | 12023 Handle<JSObject> extension = Handle<JSObject>::cast(additional_context); |
11951 context = | 12024 context = |
11952 isolate->factory()->NewWithContext(go_between, context, extension); | 12025 isolate->factory()->NewWithContext(go_between, context, extension); |
11953 } | 12026 } |
11954 | 12027 |
11955 // Wrap the evaluation statement in a new function compiled in the newly | 12028 // Wrap the evaluation statement in a new function compiled in the newly |
11956 // created context. The function has one parameter which has to be called | 12029 // created context. The function has one parameter which has to be called |
11957 // 'arguments'. This it to have access to what would have been 'arguments' in | 12030 // 'arguments'. This it to have access to what would have been 'arguments' in |
(...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13386 } else { | 13459 } else { |
13387 // Handle last resort GC and make sure to allow future allocations | 13460 // Handle last resort GC and make sure to allow future allocations |
13388 // to grow the heap without causing GCs (if possible). | 13461 // to grow the heap without causing GCs (if possible). |
13389 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13462 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13390 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | 13463 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); |
13391 } | 13464 } |
13392 } | 13465 } |
13393 | 13466 |
13394 | 13467 |
13395 } } // namespace v8::internal | 13468 } } // namespace v8::internal |
OLD | NEW |