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