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 11050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11061 serialized_scope_info, scope_info, | 11061 serialized_scope_info, scope_info, |
11062 context, block_scope)) { | 11062 context, block_scope)) { |
11063 return Handle<JSObject>(); | 11063 return Handle<JSObject>(); |
11064 } | 11064 } |
11065 } | 11065 } |
11066 | 11066 |
11067 return block_scope; | 11067 return block_scope; |
11068 } | 11068 } |
11069 | 11069 |
11070 | 11070 |
11071 // Iterate over the actual scopes visible from a stack frame. All scopes are | 11071 // Iterate over the actual scopes visible from a stack frame. The iteration |
| 11072 // proceeds from the innermost visible nested scope outwards. All scopes are |
11072 // backed by an actual context except the local scope, which is inserted | 11073 // backed by an actual context except the local scope, which is inserted |
11073 // "artifically" in the context chain. | 11074 // "artificially" in the context chain. |
11074 class ScopeIterator { | 11075 class ScopeIterator { |
11075 public: | 11076 public: |
11076 enum ScopeType { | 11077 enum ScopeType { |
11077 ScopeTypeGlobal = 0, | 11078 ScopeTypeGlobal = 0, |
11078 ScopeTypeLocal, | 11079 ScopeTypeLocal, |
11079 ScopeTypeWith, | 11080 ScopeTypeWith, |
11080 ScopeTypeClosure, | 11081 ScopeTypeClosure, |
11081 ScopeTypeCatch, | 11082 ScopeTypeCatch, |
11082 ScopeTypeBlock | 11083 ScopeTypeBlock |
11083 }; | 11084 }; |
11084 | 11085 |
11085 ScopeIterator(Isolate* isolate, | 11086 ScopeIterator(Isolate* isolate, |
11086 JavaScriptFrame* frame, | 11087 JavaScriptFrame* frame, |
11087 int inlined_frame_index) | 11088 int inlined_frame_index) |
11088 : isolate_(isolate), | 11089 : isolate_(isolate), |
11089 frame_(frame), | 11090 frame_(frame), |
11090 inlined_frame_index_(inlined_frame_index), | 11091 inlined_frame_index_(inlined_frame_index), |
11091 function_(JSFunction::cast(frame->function())), | 11092 function_(JSFunction::cast(frame->function())), |
11092 context_(Context::cast(frame->context())), | 11093 context_(Context::cast(frame->context())), |
11093 local_done_(false), | 11094 nested_scope_chain_(4) { |
11094 at_local_(false) { | |
11095 | 11095 |
11096 // Check whether the first scope is actually a local scope. | 11096 // Check whether we are in global code or function code. If there is a stack |
11097 // If there is a stack slot for .result then this local scope has been | 11097 // slot for .result then this function has been created for evaluating |
11098 // created for evaluating top level code and it is not a real local scope. | 11098 // global code and it is not a real function. |
11099 // Checking for the existence of .result seems fragile, but the scope info | 11099 // Checking for the existence of .result seems fragile, but the scope info |
11100 // saved with the code object does not otherwise have that information. | 11100 // saved with the code object does not otherwise have that information. |
11101 int index = function_->shared()->scope_info()-> | 11101 int index = function_->shared()->scope_info()-> |
11102 StackSlotIndex(isolate_->heap()->result_symbol()); | 11102 StackSlotIndex(isolate_->heap()->result_symbol()); |
| 11103 |
| 11104 // Reparse the code and analyze the scopes. |
| 11105 ZoneScope zone_scope(isolate, DELETE_ON_EXIT); |
| 11106 Handle<SharedFunctionInfo> shared_info(function_->shared()); |
| 11107 Handle<Script> script(Script::cast(shared_info->script())); |
| 11108 Scope* scope; |
11103 if (index >= 0) { | 11109 if (index >= 0) { |
11104 local_done_ = true; | 11110 // Global code |
11105 } else if (context_->IsGlobalContext() || | 11111 CompilationInfo info(script); |
11106 context_->IsFunctionContext()) { | 11112 info.MarkAsGlobal(); |
11107 at_local_ = true; | 11113 bool result = ParserApi::Parse(&info); |
11108 } else if (context_->closure() != *function_) { | 11114 ASSERT(result); |
11109 // The context_ is a block or with or catch block from the outer function. | 11115 result = Scope::Analyze(&info); |
11110 ASSERT(context_->IsWithContext() || | 11116 ASSERT(result); |
11111 context_->IsCatchContext() || | 11117 scope = info.function()->scope(); |
11112 context_->IsBlockContext()); | 11118 } else { |
11113 at_local_ = true; | 11119 // Function code |
| 11120 CompilationInfo info(shared_info); |
| 11121 bool result = ParserApi::Parse(&info); |
| 11122 ASSERT(result); |
| 11123 result = Scope::Analyze(&info); |
| 11124 ASSERT(result); |
| 11125 scope = info.function()->scope(); |
11114 } | 11126 } |
| 11127 |
| 11128 // Retrieve the scope chain for the current position. |
| 11129 int statement_position = |
| 11130 shared_info->code()->SourceStatementPosition(frame_->pc()); |
| 11131 scope->GetNestedScopeChain(&nested_scope_chain_, statement_position); |
11115 } | 11132 } |
11116 | 11133 |
11117 // More scopes? | 11134 // More scopes? |
11118 bool Done() { return context_.is_null(); } | 11135 bool Done() { return context_.is_null(); } |
11119 | 11136 |
11120 // Move to the next scope. | 11137 // Move to the next scope. |
11121 void Next() { | 11138 void Next() { |
11122 // If at a local scope mark the local scope as passed. | 11139 ScopeType scope_type = Type(); |
11123 if (at_local_) { | 11140 if (scope_type == ScopeTypeGlobal) { |
11124 at_local_ = false; | 11141 // The global scope is always the last in the chain. |
11125 local_done_ = true; | 11142 ASSERT(context_->IsGlobalContext()); |
11126 | |
11127 // If the current context is not associated with the local scope the | |
11128 // current context is the next real scope, so don't move to the next | |
11129 // context in this case. | |
11130 if (context_->closure() != *function_) { | |
11131 return; | |
11132 } | |
11133 } | |
11134 | |
11135 // The global scope is always the last in the chain. | |
11136 if (context_->IsGlobalContext()) { | |
11137 context_ = Handle<Context>(); | 11143 context_ = Handle<Context>(); |
11138 return; | 11144 return; |
11139 } | 11145 } |
11140 | 11146 if (nested_scope_chain_.is_empty()) { |
11141 // Move to the next context. | 11147 context_ = Handle<Context>(context_->previous(), isolate_); |
11142 context_ = Handle<Context>(context_->previous(), isolate_); | 11148 } else { |
11143 | 11149 if (nested_scope_chain_.last()->HasContext()) { |
11144 // If passing the local scope indicate that the current scope is now the | 11150 context_ = Handle<Context>(context_->previous(), isolate_); |
11145 // local scope. | 11151 } |
11146 if (!local_done_ && | 11152 nested_scope_chain_.RemoveLast(); |
11147 (context_->IsGlobalContext() || context_->IsFunctionContext())) { | |
11148 at_local_ = true; | |
11149 } | 11153 } |
11150 } | 11154 } |
11151 | 11155 |
11152 // Return the type of the current scope. | 11156 // Return the type of the current scope. |
11153 ScopeType Type() { | 11157 ScopeType Type() { |
11154 if (at_local_) { | 11158 if (!nested_scope_chain_.is_empty()) { |
11155 return ScopeTypeLocal; | 11159 Handle<SerializedScopeInfo> scope_info = nested_scope_chain_.last(); |
| 11160 switch (scope_info->Type()) { |
| 11161 case FUNCTION_SCOPE: |
| 11162 ASSERT(context_->IsFunctionContext() || |
| 11163 !scope_info->HasContext()); |
| 11164 return ScopeTypeLocal; |
| 11165 case GLOBAL_SCOPE: |
| 11166 ASSERT(context_->IsGlobalContext()); |
| 11167 return ScopeTypeGlobal; |
| 11168 case WITH_SCOPE: |
| 11169 ASSERT(context_->IsWithContext()); |
| 11170 return ScopeTypeWith; |
| 11171 case CATCH_SCOPE: |
| 11172 ASSERT(context_->IsCatchContext()); |
| 11173 return ScopeTypeCatch; |
| 11174 case BLOCK_SCOPE: |
| 11175 ASSERT(!scope_info->HasContext() || |
| 11176 context_->IsBlockContext()); |
| 11177 return ScopeTypeBlock; |
| 11178 case EVAL_SCOPE: |
| 11179 UNREACHABLE(); |
| 11180 } |
11156 } | 11181 } |
11157 if (context_->IsGlobalContext()) { | 11182 if (context_->IsGlobalContext()) { |
11158 ASSERT(context_->global()->IsGlobalObject()); | 11183 ASSERT(context_->global()->IsGlobalObject()); |
11159 return ScopeTypeGlobal; | 11184 return ScopeTypeGlobal; |
11160 } | 11185 } |
11161 if (context_->IsFunctionContext()) { | 11186 if (context_->IsFunctionContext()) { |
11162 return ScopeTypeClosure; | 11187 return ScopeTypeClosure; |
11163 } | 11188 } |
11164 if (context_->IsCatchContext()) { | 11189 if (context_->IsCatchContext()) { |
11165 return ScopeTypeCatch; | 11190 return ScopeTypeCatch; |
11166 } | 11191 } |
11167 if (context_->IsBlockContext()) { | 11192 if (context_->IsBlockContext()) { |
11168 return ScopeTypeBlock; | 11193 return ScopeTypeBlock; |
11169 } | 11194 } |
11170 ASSERT(context_->IsWithContext()); | 11195 ASSERT(context_->IsWithContext()); |
11171 return ScopeTypeWith; | 11196 return ScopeTypeWith; |
11172 } | 11197 } |
11173 | 11198 |
11174 // Return the JavaScript object with the content of the current scope. | 11199 // Return the JavaScript object with the content of the current scope. |
11175 Handle<JSObject> ScopeObject() { | 11200 Handle<JSObject> ScopeObject() { |
11176 switch (Type()) { | 11201 switch (Type()) { |
11177 case ScopeIterator::ScopeTypeGlobal: | 11202 case ScopeIterator::ScopeTypeGlobal: |
11178 return Handle<JSObject>(CurrentContext()->global()); | 11203 return Handle<JSObject>(CurrentContext()->global()); |
11179 case ScopeIterator::ScopeTypeLocal: | 11204 case ScopeIterator::ScopeTypeLocal: |
11180 // Materialize the content of the local scope into a JSObject. | 11205 // Materialize the content of the local scope into a JSObject. |
| 11206 ASSERT(nested_scope_chain_.length() == 1); |
11181 return MaterializeLocalScope(isolate_, frame_, inlined_frame_index_); | 11207 return MaterializeLocalScope(isolate_, frame_, inlined_frame_index_); |
11182 case ScopeIterator::ScopeTypeWith: | 11208 case ScopeIterator::ScopeTypeWith: |
11183 // Return the with object. | 11209 // Return the with object. |
11184 return Handle<JSObject>(JSObject::cast(CurrentContext()->extension())); | 11210 return Handle<JSObject>(JSObject::cast(CurrentContext()->extension())); |
11185 case ScopeIterator::ScopeTypeCatch: | 11211 case ScopeIterator::ScopeTypeCatch: |
11186 return MaterializeCatchScope(isolate_, CurrentContext()); | 11212 return MaterializeCatchScope(isolate_, CurrentContext()); |
11187 case ScopeIterator::ScopeTypeClosure: | 11213 case ScopeIterator::ScopeTypeClosure: |
11188 // Materialize the content of the closure scope into a JSObject. | 11214 // Materialize the content of the closure scope into a JSObject. |
11189 return MaterializeClosure(isolate_, CurrentContext()); | 11215 return MaterializeClosure(isolate_, CurrentContext()); |
11190 case ScopeIterator::ScopeTypeBlock: | 11216 case ScopeIterator::ScopeTypeBlock: |
11191 return MaterializeBlockScope(isolate_, CurrentContext()); | 11217 return MaterializeBlockScope(isolate_, CurrentContext()); |
11192 } | 11218 } |
11193 UNREACHABLE(); | 11219 UNREACHABLE(); |
11194 return Handle<JSObject>(); | 11220 return Handle<JSObject>(); |
11195 } | 11221 } |
11196 | 11222 |
| 11223 Handle<SerializedScopeInfo> CurrentScopeInfo() { |
| 11224 if (!nested_scope_chain_.is_empty()) { |
| 11225 return nested_scope_chain_.last(); |
| 11226 } else if (context_->IsBlockContext()) { |
| 11227 return Handle<SerializedScopeInfo>( |
| 11228 SerializedScopeInfo::cast(context_->extension())); |
| 11229 } else if (context_->IsFunctionContext()) { |
| 11230 return Handle<SerializedScopeInfo>( |
| 11231 context_->closure()->shared()->scope_info()); |
| 11232 } |
| 11233 return Handle<SerializedScopeInfo>::null(); |
| 11234 } |
| 11235 |
11197 // Return the context for this scope. For the local context there might not | 11236 // Return the context for this scope. For the local context there might not |
11198 // be an actual context. | 11237 // be an actual context. |
11199 Handle<Context> CurrentContext() { | 11238 Handle<Context> CurrentContext() { |
11200 if (at_local_ && context_->closure() != *function_) { | 11239 if (Type() == ScopeTypeGlobal || |
| 11240 nested_scope_chain_.is_empty()) { |
| 11241 return context_; |
| 11242 } else if (nested_scope_chain_.last()->HasContext()) { |
| 11243 return context_; |
| 11244 } else { |
11201 return Handle<Context>(); | 11245 return Handle<Context>(); |
11202 } | 11246 } |
11203 return context_; | |
11204 } | 11247 } |
11205 | 11248 |
11206 #ifdef DEBUG | 11249 #ifdef DEBUG |
11207 // Debug print of the content of the current scope. | 11250 // Debug print of the content of the current scope. |
11208 void DebugPrint() { | 11251 void DebugPrint() { |
11209 switch (Type()) { | 11252 switch (Type()) { |
11210 case ScopeIterator::ScopeTypeGlobal: | 11253 case ScopeIterator::ScopeTypeGlobal: |
11211 PrintF("Global:\n"); | 11254 PrintF("Global:\n"); |
11212 CurrentContext()->Print(); | 11255 CurrentContext()->Print(); |
11213 break; | 11256 break; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11256 PrintF("\n"); | 11299 PrintF("\n"); |
11257 } | 11300 } |
11258 #endif | 11301 #endif |
11259 | 11302 |
11260 private: | 11303 private: |
11261 Isolate* isolate_; | 11304 Isolate* isolate_; |
11262 JavaScriptFrame* frame_; | 11305 JavaScriptFrame* frame_; |
11263 int inlined_frame_index_; | 11306 int inlined_frame_index_; |
11264 Handle<JSFunction> function_; | 11307 Handle<JSFunction> function_; |
11265 Handle<Context> context_; | 11308 Handle<Context> context_; |
11266 bool local_done_; | 11309 List<Handle<SerializedScopeInfo> > nested_scope_chain_; |
11267 bool at_local_; | |
11268 | 11310 |
11269 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopeIterator); | 11311 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopeIterator); |
11270 }; | 11312 }; |
11271 | 11313 |
11272 | 11314 |
11273 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetScopeCount) { | 11315 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetScopeCount) { |
11274 HandleScope scope(isolate); | 11316 HandleScope scope(isolate); |
11275 ASSERT(args.length() == 2); | 11317 ASSERT(args.length() == 2); |
11276 | 11318 |
11277 // Check arguments. | 11319 // Check arguments. |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11720 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClearStepping) { | 11762 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClearStepping) { |
11721 HandleScope scope(isolate); | 11763 HandleScope scope(isolate); |
11722 ASSERT(args.length() == 0); | 11764 ASSERT(args.length() == 0); |
11723 isolate->debug()->ClearStepping(); | 11765 isolate->debug()->ClearStepping(); |
11724 return isolate->heap()->undefined_value(); | 11766 return isolate->heap()->undefined_value(); |
11725 } | 11767 } |
11726 | 11768 |
11727 | 11769 |
11728 // Creates a copy of the with context chain. The copy of the context chain is | 11770 // Creates a copy of the with context chain. The copy of the context chain is |
11729 // is linked to the function context supplied. | 11771 // is linked to the function context supplied. |
11730 static Handle<Context> CopyWithContextChain(Isolate* isolate, | 11772 static Handle<Context> CopyNestedScopeContextChain(Isolate* isolate, |
11731 Handle<JSFunction> function, | 11773 Handle<JSFunction> function, |
11732 Handle<Context> current, | 11774 Handle<Context> base, |
11733 Handle<Context> base) { | 11775 JavaScriptFrame* frame, |
11734 // At the end of the chain. Return the base context to link to. | 11776 int inlined_frame_index) { |
11735 if (current->IsFunctionContext() || current->IsGlobalContext()) { | 11777 HandleScope scope(isolate); |
11736 return base; | 11778 List<Handle<SerializedScopeInfo> > scope_chain; |
| 11779 List<Handle<Context> > context_chain; |
| 11780 |
| 11781 ScopeIterator it(isolate, frame, inlined_frame_index); |
| 11782 for (; it.Type() != ScopeIterator::ScopeTypeGlobal && |
| 11783 it.Type() != ScopeIterator::ScopeTypeLocal ; it.Next()) { |
| 11784 ASSERT(!it.Done()); |
| 11785 scope_chain.Add(it.CurrentScopeInfo()); |
| 11786 context_chain.Add(it.CurrentContext()); |
11737 } | 11787 } |
11738 | 11788 |
11739 // Recursively copy the with and catch contexts. | 11789 // At the end of the chain. Return the base context to link to. |
11740 HandleScope scope(isolate); | 11790 Handle<Context> context = base; |
11741 Handle<Context> previous(current->previous()); | 11791 |
11742 Handle<Context> new_previous = | 11792 // Iteratively copy and or materialize the nested contexts. |
11743 CopyWithContextChain(isolate, function, previous, base); | 11793 while (!scope_chain.is_empty()) { |
11744 Handle<Context> new_current; | 11794 Handle<SerializedScopeInfo> scope_info = scope_chain.RemoveLast(); |
11745 if (current->IsCatchContext()) { | 11795 Handle<Context> current = context_chain.RemoveLast(); |
11746 Handle<String> name(String::cast(current->extension())); | 11796 ASSERT(!(scope_info->HasContext() & current.is_null())); |
11747 Handle<Object> thrown_object(current->get(Context::THROWN_OBJECT_INDEX)); | 11797 |
11748 new_current = | 11798 if (scope_info->Type() == CATCH_SCOPE) { |
11749 isolate->factory()->NewCatchContext(function, | 11799 Handle<String> name(String::cast(current->extension())); |
11750 new_previous, | 11800 Handle<Object> thrown_object(current->get(Context::THROWN_OBJECT_INDEX)); |
11751 name, | 11801 context = |
11752 thrown_object); | 11802 isolate->factory()->NewCatchContext(function, |
11753 } else if (current->IsBlockContext()) { | 11803 context, |
11754 Handle<SerializedScopeInfo> scope_info( | 11804 name, |
11755 SerializedScopeInfo::cast(current->extension())); | 11805 thrown_object); |
11756 new_current = | 11806 } else if (scope_info->Type() == BLOCK_SCOPE) { |
11757 isolate->factory()->NewBlockContext(function, new_previous, scope_info); | 11807 // Materialize the contents of the block scope into a JSObject. |
11758 // Copy context slots. | 11808 Handle<JSObject> block_scope_object = |
11759 int num_context_slots = scope_info->NumberOfContextSlots(); | 11809 MaterializeBlockScope(isolate, current); |
11760 for (int i = Context::MIN_CONTEXT_SLOTS; i < num_context_slots; ++i) { | 11810 if (block_scope_object.is_null()) { |
11761 new_current->set(i, current->get(i)); | 11811 return Handle<Context>::null(); |
| 11812 } |
| 11813 // Allocate a new function context for the debug evaluation and set the |
| 11814 // extension object. |
| 11815 Handle<Context> new_context = |
| 11816 isolate->factory()->NewFunctionContext(Context::MIN_CONTEXT_SLOTS, |
| 11817 function); |
| 11818 new_context->set_extension(*block_scope_object); |
| 11819 new_context->set_previous(*context); |
| 11820 context = new_context; |
| 11821 } else { |
| 11822 ASSERT(scope_info->Type() == WITH_SCOPE); |
| 11823 ASSERT(current->IsWithContext()); |
| 11824 Handle<JSObject> extension(JSObject::cast(current->extension())); |
| 11825 context = |
| 11826 isolate->factory()->NewWithContext(function, context, extension); |
11762 } | 11827 } |
11763 } else { | |
11764 ASSERT(current->IsWithContext()); | |
11765 Handle<JSObject> extension(JSObject::cast(current->extension())); | |
11766 new_current = | |
11767 isolate->factory()->NewWithContext(function, new_previous, extension); | |
11768 } | 11828 } |
11769 return scope.CloseAndEscape(new_current); | 11829 |
| 11830 return scope.CloseAndEscape(context); |
11770 } | 11831 } |
11771 | 11832 |
11772 | 11833 |
11773 // Helper function to find or create the arguments object for | 11834 // Helper function to find or create the arguments object for |
11774 // Runtime_DebugEvaluate. | 11835 // Runtime_DebugEvaluate. |
11775 static Handle<Object> GetArgumentsObject(Isolate* isolate, | 11836 static Handle<Object> GetArgumentsObject(Isolate* isolate, |
11776 JavaScriptFrame* frame, | 11837 JavaScriptFrame* frame, |
11777 int inlined_frame_index, | 11838 int inlined_frame_index, |
11778 Handle<JSFunction> function, | 11839 Handle<JSFunction> function, |
11779 Handle<SerializedScopeInfo> scope_info, | 11840 Handle<SerializedScopeInfo> scope_info, |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11897 isolate->factory()->NewFunctionContext(Context::MIN_CONTEXT_SLOTS, | 11958 isolate->factory()->NewFunctionContext(Context::MIN_CONTEXT_SLOTS, |
11898 go_between); | 11959 go_between); |
11899 context->set_extension(*local_scope); | 11960 context->set_extension(*local_scope); |
11900 // Copy any with contexts present and chain them in front of this context. | 11961 // Copy any with contexts present and chain them in front of this context. |
11901 Handle<Context> frame_context(Context::cast(frame->context())); | 11962 Handle<Context> frame_context(Context::cast(frame->context())); |
11902 Handle<Context> function_context; | 11963 Handle<Context> function_context; |
11903 // Get the function's context if it has one. | 11964 // Get the function's context if it has one. |
11904 if (scope_info->HasHeapAllocatedLocals()) { | 11965 if (scope_info->HasHeapAllocatedLocals()) { |
11905 function_context = Handle<Context>(frame_context->declaration_context()); | 11966 function_context = Handle<Context>(frame_context->declaration_context()); |
11906 } | 11967 } |
11907 context = CopyWithContextChain(isolate, go_between, frame_context, context); | 11968 context = CopyNestedScopeContextChain(isolate, |
| 11969 go_between, |
| 11970 context, |
| 11971 frame, |
| 11972 inlined_frame_index); |
11908 | 11973 |
11909 if (additional_context->IsJSObject()) { | 11974 if (additional_context->IsJSObject()) { |
11910 Handle<JSObject> extension = Handle<JSObject>::cast(additional_context); | 11975 Handle<JSObject> extension = Handle<JSObject>::cast(additional_context); |
11911 context = | 11976 context = |
11912 isolate->factory()->NewWithContext(go_between, context, extension); | 11977 isolate->factory()->NewWithContext(go_between, context, extension); |
11913 } | 11978 } |
11914 | 11979 |
11915 // Wrap the evaluation statement in a new function compiled in the newly | 11980 // Wrap the evaluation statement in a new function compiled in the newly |
11916 // created context. The function has one parameter which has to be called | 11981 // created context. The function has one parameter which has to be called |
11917 // 'arguments'. This it to have access to what would have been 'arguments' in | 11982 // '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... |
13346 } else { | 13411 } else { |
13347 // Handle last resort GC and make sure to allow future allocations | 13412 // Handle last resort GC and make sure to allow future allocations |
13348 // to grow the heap without causing GCs (if possible). | 13413 // to grow the heap without causing GCs (if possible). |
13349 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13414 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13350 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | 13415 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); |
13351 } | 13416 } |
13352 } | 13417 } |
13353 | 13418 |
13354 | 13419 |
13355 } } // namespace v8::internal | 13420 } } // namespace v8::internal |
OLD | NEW |