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 11183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11194 }; | 11194 }; |
11195 | 11195 |
11196 ScopeIterator(Isolate* isolate, | 11196 ScopeIterator(Isolate* isolate, |
11197 JavaScriptFrame* frame, | 11197 JavaScriptFrame* frame, |
11198 int inlined_frame_index) | 11198 int inlined_frame_index) |
11199 : isolate_(isolate), | 11199 : isolate_(isolate), |
11200 frame_(frame), | 11200 frame_(frame), |
11201 inlined_frame_index_(inlined_frame_index), | 11201 inlined_frame_index_(inlined_frame_index), |
11202 function_(JSFunction::cast(frame->function())), | 11202 function_(JSFunction::cast(frame->function())), |
11203 context_(Context::cast(frame->context())), | 11203 context_(Context::cast(frame->context())), |
11204 nested_scope_chain_(4) { | 11204 local_done_(false), |
| 11205 at_local_(false) { |
11205 | 11206 |
11206 // Catch the case when the debugger stops in an internal function. | 11207 // Check whether the first scope is actually a local scope. |
11207 Handle<SharedFunctionInfo> shared_info(function_->shared()); | 11208 // If there is a stack slot for .result then this local scope has been |
11208 Handle<ScopeInfo> scope_info(shared_info->scope_info()); | 11209 // created for evaluating top level code and it is not a real local scope. |
11209 if (shared_info->script() == isolate->heap()->undefined_value()) { | 11210 // Checking for the existence of .result seems fragile, but the scope info |
11210 while (context_->closure() == *function_) { | 11211 // saved with the code object does not otherwise have that information. |
11211 context_ = Handle<Context>(context_->previous(), isolate_); | 11212 int index = function_->shared()->scope_info()-> |
11212 } | 11213 StackSlotIndex(isolate_->heap()->result_symbol()); |
11213 return; | 11214 if (index >= 0) { |
11214 } | 11215 local_done_ = true; |
11215 | 11216 } else if (context_->IsGlobalContext() || |
11216 // Get the start of the frame exit code. | 11217 context_->IsFunctionContext()) { |
11217 Handle<Code> code(shared_info->code()); | 11218 at_local_ = true; |
11218 RelocIterator it(*code, RelocInfo::ModeMask(RelocInfo::JS_RETURN)); | 11219 } else if (context_->closure() != *function_) { |
11219 RelocInfo* info = it.rinfo(); | 11220 // The context_ is a block or with or catch block from the outer function. |
11220 Address frame_exit_code = info->pc(); | 11221 ASSERT(context_->IsWithContext() || |
11221 it.next(); | 11222 context_->IsCatchContext() || |
11222 ASSERT(it.done()); | 11223 context_->IsBlockContext()); |
11223 | 11224 at_local_ = true; |
11224 Address frame_exit_return = | |
11225 frame_exit_code + Assembler::kCallInstructionLength; | |
11226 if (frame_->pc() == frame_exit_return) { | |
11227 // We are within the return sequence. At the momemt it is not possible to | |
11228 // get a source position which is consistent with the current scope chain. | |
11229 // Thus all nested with, catch and block contexts are skipped and we only | |
11230 // provide the function scope. | |
11231 if (scope_info->HasContext()) { | |
11232 context_ = Handle<Context>(context_->declaration_context(), isolate_); | |
11233 } else { | |
11234 while (context_->closure() == *function_) { | |
11235 context_ = Handle<Context>(context_->previous(), isolate_); | |
11236 } | |
11237 } | |
11238 if (scope_info->Type() != EVAL_SCOPE) nested_scope_chain_.Add(scope_info); | |
11239 } else { | |
11240 // Reparse the code and analyze the scopes. | |
11241 ZoneScope zone_scope(isolate, DELETE_ON_EXIT); | |
11242 Handle<Script> script(Script::cast(shared_info->script())); | |
11243 Scope* scope = NULL; | |
11244 | |
11245 // Check whether we are in global, eval or function code. | |
11246 Handle<ScopeInfo> scope_info(shared_info->scope_info()); | |
11247 if (scope_info->Type() != FUNCTION_SCOPE) { | |
11248 // Global or eval code. | |
11249 CompilationInfo info(script); | |
11250 if (scope_info->Type() == GLOBAL_SCOPE) { | |
11251 info.MarkAsGlobal(); | |
11252 } else { | |
11253 ASSERT(scope_info->Type() == EVAL_SCOPE); | |
11254 info.MarkAsEval(); | |
11255 info.SetCallingContext(Handle<Context>(function_->context())); | |
11256 } | |
11257 if (ParserApi::Parse(&info, kNoParsingFlags) && Scope::Analyze(&info)) { | |
11258 scope = info.function()->scope(); | |
11259 } | |
11260 } else { | |
11261 // Function code | |
11262 CompilationInfo info(shared_info); | |
11263 if (ParserApi::Parse(&info, kNoParsingFlags) && Scope::Analyze(&info)) { | |
11264 scope = info.function()->scope(); | |
11265 } | |
11266 } | |
11267 | |
11268 // Retrieve the scope chain for the current position. | |
11269 if (scope != NULL) { | |
11270 int source_position = shared_info->code()->SourcePosition(frame_->pc()); | |
11271 scope->GetNestedScopeChain(&nested_scope_chain_, source_position); | |
11272 } else { | |
11273 // A failed reparse indicates that the preparser has diverged from the | |
11274 // parser or that the preparse data given to the initial parse has been | |
11275 // faulty. We fail in debug mode but in release mode we only provide the | |
11276 // information we get from the context chain but nothing about | |
11277 // completely stack allocated scopes or stack allocated locals. | |
11278 UNREACHABLE(); | |
11279 } | |
11280 } | 11225 } |
11281 } | 11226 } |
11282 | 11227 |
11283 // More scopes? | 11228 // More scopes? |
11284 bool Done() { return context_.is_null(); } | 11229 bool Done() { return context_.is_null(); } |
11285 | 11230 |
11286 // Move to the next scope. | 11231 // Move to the next scope. |
11287 void Next() { | 11232 void Next() { |
11288 ScopeType scope_type = Type(); | 11233 // If at a local scope mark the local scope as passed. |
11289 if (scope_type == ScopeTypeGlobal) { | 11234 if (at_local_) { |
11290 // The global scope is always the last in the chain. | 11235 at_local_ = false; |
11291 ASSERT(context_->IsGlobalContext()); | 11236 local_done_ = true; |
| 11237 |
| 11238 // If the current context is not associated with the local scope the |
| 11239 // current context is the next real scope, so don't move to the next |
| 11240 // context in this case. |
| 11241 if (context_->closure() != *function_) { |
| 11242 return; |
| 11243 } |
| 11244 } |
| 11245 |
| 11246 // The global scope is always the last in the chain. |
| 11247 if (context_->IsGlobalContext()) { |
11292 context_ = Handle<Context>(); | 11248 context_ = Handle<Context>(); |
11293 return; | 11249 return; |
11294 } | 11250 } |
11295 if (nested_scope_chain_.is_empty()) { | 11251 |
11296 context_ = Handle<Context>(context_->previous(), isolate_); | 11252 // Move to the next context. |
11297 } else { | 11253 context_ = Handle<Context>(context_->previous(), isolate_); |
11298 if (nested_scope_chain_.last()->HasContext()) { | 11254 |
11299 ASSERT(context_->previous() != NULL); | 11255 // If passing the local scope indicate that the current scope is now the |
11300 context_ = Handle<Context>(context_->previous(), isolate_); | 11256 // local scope. |
11301 } | 11257 if (!local_done_ && |
11302 nested_scope_chain_.RemoveLast(); | 11258 (context_->IsGlobalContext() || context_->IsFunctionContext())) { |
| 11259 at_local_ = true; |
11303 } | 11260 } |
11304 } | 11261 } |
11305 | 11262 |
11306 // Return the type of the current scope. | 11263 // Return the type of the current scope. |
11307 ScopeType Type() { | 11264 ScopeType Type() { |
11308 if (!nested_scope_chain_.is_empty()) { | 11265 if (at_local_) { |
11309 Handle<ScopeInfo> scope_info = nested_scope_chain_.last(); | 11266 return ScopeTypeLocal; |
11310 switch (scope_info->Type()) { | |
11311 case FUNCTION_SCOPE: | |
11312 ASSERT(context_->IsFunctionContext() || | |
11313 !scope_info->HasContext()); | |
11314 return ScopeTypeLocal; | |
11315 case GLOBAL_SCOPE: | |
11316 ASSERT(context_->IsGlobalContext()); | |
11317 return ScopeTypeGlobal; | |
11318 case WITH_SCOPE: | |
11319 ASSERT(context_->IsWithContext()); | |
11320 return ScopeTypeWith; | |
11321 case CATCH_SCOPE: | |
11322 ASSERT(context_->IsCatchContext()); | |
11323 return ScopeTypeCatch; | |
11324 case BLOCK_SCOPE: | |
11325 ASSERT(!scope_info->HasContext() || | |
11326 context_->IsBlockContext()); | |
11327 return ScopeTypeBlock; | |
11328 case EVAL_SCOPE: | |
11329 UNREACHABLE(); | |
11330 } | |
11331 } | 11267 } |
11332 if (context_->IsGlobalContext()) { | 11268 if (context_->IsGlobalContext()) { |
11333 ASSERT(context_->global()->IsGlobalObject()); | 11269 ASSERT(context_->global()->IsGlobalObject()); |
11334 return ScopeTypeGlobal; | 11270 return ScopeTypeGlobal; |
11335 } | 11271 } |
11336 if (context_->IsFunctionContext()) { | 11272 if (context_->IsFunctionContext()) { |
11337 return ScopeTypeClosure; | 11273 return ScopeTypeClosure; |
11338 } | 11274 } |
11339 if (context_->IsCatchContext()) { | 11275 if (context_->IsCatchContext()) { |
11340 return ScopeTypeCatch; | 11276 return ScopeTypeCatch; |
11341 } | 11277 } |
11342 if (context_->IsBlockContext()) { | 11278 if (context_->IsBlockContext()) { |
11343 return ScopeTypeBlock; | 11279 return ScopeTypeBlock; |
11344 } | 11280 } |
11345 ASSERT(context_->IsWithContext()); | 11281 ASSERT(context_->IsWithContext()); |
11346 return ScopeTypeWith; | 11282 return ScopeTypeWith; |
11347 } | 11283 } |
11348 | 11284 |
11349 // Return the JavaScript object with the content of the current scope. | 11285 // Return the JavaScript object with the content of the current scope. |
11350 Handle<JSObject> ScopeObject() { | 11286 Handle<JSObject> ScopeObject() { |
11351 switch (Type()) { | 11287 switch (Type()) { |
11352 case ScopeIterator::ScopeTypeGlobal: | 11288 case ScopeIterator::ScopeTypeGlobal: |
11353 return Handle<JSObject>(CurrentContext()->global()); | 11289 return Handle<JSObject>(CurrentContext()->global()); |
11354 case ScopeIterator::ScopeTypeLocal: | 11290 case ScopeIterator::ScopeTypeLocal: |
11355 // Materialize the content of the local scope into a JSObject. | 11291 // Materialize the content of the local scope into a JSObject. |
11356 ASSERT(nested_scope_chain_.length() == 1); | |
11357 return MaterializeLocalScope(isolate_, frame_, inlined_frame_index_); | 11292 return MaterializeLocalScope(isolate_, frame_, inlined_frame_index_); |
11358 case ScopeIterator::ScopeTypeWith: | 11293 case ScopeIterator::ScopeTypeWith: |
11359 // Return the with object. | 11294 // Return the with object. |
11360 return Handle<JSObject>(JSObject::cast(CurrentContext()->extension())); | 11295 return Handle<JSObject>(JSObject::cast(CurrentContext()->extension())); |
11361 case ScopeIterator::ScopeTypeCatch: | 11296 case ScopeIterator::ScopeTypeCatch: |
11362 return MaterializeCatchScope(isolate_, CurrentContext()); | 11297 return MaterializeCatchScope(isolate_, CurrentContext()); |
11363 case ScopeIterator::ScopeTypeClosure: | 11298 case ScopeIterator::ScopeTypeClosure: |
11364 // Materialize the content of the closure scope into a JSObject. | 11299 // Materialize the content of the closure scope into a JSObject. |
11365 return MaterializeClosure(isolate_, CurrentContext()); | 11300 return MaterializeClosure(isolate_, CurrentContext()); |
11366 case ScopeIterator::ScopeTypeBlock: | 11301 case ScopeIterator::ScopeTypeBlock: |
11367 return MaterializeBlockScope(isolate_, CurrentContext()); | 11302 return MaterializeBlockScope(isolate_, CurrentContext()); |
11368 } | 11303 } |
11369 UNREACHABLE(); | 11304 UNREACHABLE(); |
11370 return Handle<JSObject>(); | 11305 return Handle<JSObject>(); |
11371 } | 11306 } |
11372 | 11307 |
11373 Handle<ScopeInfo> CurrentScopeInfo() { | |
11374 if (!nested_scope_chain_.is_empty()) { | |
11375 return nested_scope_chain_.last(); | |
11376 } else if (context_->IsBlockContext()) { | |
11377 return Handle<ScopeInfo>(ScopeInfo::cast(context_->extension())); | |
11378 } else if (context_->IsFunctionContext()) { | |
11379 return Handle<ScopeInfo>(context_->closure()->shared()->scope_info()); | |
11380 } | |
11381 return Handle<ScopeInfo>::null(); | |
11382 } | |
11383 | |
11384 // Return the context for this scope. For the local context there might not | 11308 // Return the context for this scope. For the local context there might not |
11385 // be an actual context. | 11309 // be an actual context. |
11386 Handle<Context> CurrentContext() { | 11310 Handle<Context> CurrentContext() { |
11387 if (Type() == ScopeTypeGlobal || | 11311 if (at_local_ && context_->closure() != *function_) { |
11388 nested_scope_chain_.is_empty()) { | |
11389 return context_; | |
11390 } else if (nested_scope_chain_.last()->HasContext()) { | |
11391 return context_; | |
11392 } else { | |
11393 return Handle<Context>(); | 11312 return Handle<Context>(); |
11394 } | 11313 } |
| 11314 return context_; |
11395 } | 11315 } |
11396 | 11316 |
11397 #ifdef DEBUG | 11317 #ifdef DEBUG |
11398 // Debug print of the content of the current scope. | 11318 // Debug print of the content of the current scope. |
11399 void DebugPrint() { | 11319 void DebugPrint() { |
11400 switch (Type()) { | 11320 switch (Type()) { |
11401 case ScopeIterator::ScopeTypeGlobal: | 11321 case ScopeIterator::ScopeTypeGlobal: |
11402 PrintF("Global:\n"); | 11322 PrintF("Global:\n"); |
11403 CurrentContext()->Print(); | 11323 CurrentContext()->Print(); |
11404 break; | 11324 break; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11446 PrintF("\n"); | 11366 PrintF("\n"); |
11447 } | 11367 } |
11448 #endif | 11368 #endif |
11449 | 11369 |
11450 private: | 11370 private: |
11451 Isolate* isolate_; | 11371 Isolate* isolate_; |
11452 JavaScriptFrame* frame_; | 11372 JavaScriptFrame* frame_; |
11453 int inlined_frame_index_; | 11373 int inlined_frame_index_; |
11454 Handle<JSFunction> function_; | 11374 Handle<JSFunction> function_; |
11455 Handle<Context> context_; | 11375 Handle<Context> context_; |
11456 List<Handle<ScopeInfo> > nested_scope_chain_; | 11376 bool local_done_; |
| 11377 bool at_local_; |
11457 | 11378 |
11458 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopeIterator); | 11379 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopeIterator); |
11459 }; | 11380 }; |
11460 | 11381 |
11461 | 11382 |
11462 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetScopeCount) { | 11383 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetScopeCount) { |
11463 HandleScope scope(isolate); | 11384 HandleScope scope(isolate); |
11464 ASSERT(args.length() == 2); | 11385 ASSERT(args.length() == 2); |
11465 | 11386 |
11466 // Check arguments. | 11387 // Check arguments. |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11909 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClearStepping) { | 11830 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClearStepping) { |
11910 HandleScope scope(isolate); | 11831 HandleScope scope(isolate); |
11911 ASSERT(args.length() == 0); | 11832 ASSERT(args.length() == 0); |
11912 isolate->debug()->ClearStepping(); | 11833 isolate->debug()->ClearStepping(); |
11913 return isolate->heap()->undefined_value(); | 11834 return isolate->heap()->undefined_value(); |
11914 } | 11835 } |
11915 | 11836 |
11916 | 11837 |
11917 // Creates a copy of the with context chain. The copy of the context chain is | 11838 // Creates a copy of the with context chain. The copy of the context chain is |
11918 // is linked to the function context supplied. | 11839 // is linked to the function context supplied. |
11919 static Handle<Context> CopyNestedScopeContextChain(Isolate* isolate, | 11840 static Handle<Context> CopyWithContextChain(Isolate* isolate, |
11920 Handle<JSFunction> function, | 11841 Handle<JSFunction> function, |
11921 Handle<Context> base, | 11842 Handle<Context> current, |
11922 JavaScriptFrame* frame, | 11843 Handle<Context> base) { |
11923 int inlined_frame_index) { | 11844 // At the end of the chain. Return the base context to link to. |
11924 HandleScope scope(isolate); | 11845 if (current->IsFunctionContext() || current->IsGlobalContext()) { |
11925 List<Handle<ScopeInfo> > scope_chain; | 11846 return base; |
11926 List<Handle<Context> > context_chain; | |
11927 | |
11928 ScopeIterator it(isolate, frame, inlined_frame_index); | |
11929 for (; it.Type() != ScopeIterator::ScopeTypeGlobal && | |
11930 it.Type() != ScopeIterator::ScopeTypeLocal ; it.Next()) { | |
11931 ASSERT(!it.Done()); | |
11932 scope_chain.Add(it.CurrentScopeInfo()); | |
11933 context_chain.Add(it.CurrentContext()); | |
11934 } | 11847 } |
11935 | 11848 |
11936 // At the end of the chain. Return the base context to link to. | 11849 // Recursively copy the with and catch contexts. |
11937 Handle<Context> context = base; | 11850 HandleScope scope(isolate); |
11938 | 11851 Handle<Context> previous(current->previous()); |
11939 // Iteratively copy and or materialize the nested contexts. | 11852 Handle<Context> new_previous = |
11940 while (!scope_chain.is_empty()) { | 11853 CopyWithContextChain(isolate, function, previous, base); |
11941 Handle<ScopeInfo> scope_info = scope_chain.RemoveLast(); | 11854 Handle<Context> new_current; |
11942 Handle<Context> current = context_chain.RemoveLast(); | 11855 if (current->IsCatchContext()) { |
11943 ASSERT(!(scope_info->HasContext() & current.is_null())); | 11856 Handle<String> name(String::cast(current->extension())); |
11944 | 11857 Handle<Object> thrown_object(current->get(Context::THROWN_OBJECT_INDEX)); |
11945 if (scope_info->Type() == CATCH_SCOPE) { | 11858 new_current = |
11946 Handle<String> name(String::cast(current->extension())); | 11859 isolate->factory()->NewCatchContext(function, |
11947 Handle<Object> thrown_object(current->get(Context::THROWN_OBJECT_INDEX)); | 11860 new_previous, |
11948 context = | 11861 name, |
11949 isolate->factory()->NewCatchContext(function, | 11862 thrown_object); |
11950 context, | 11863 } else if (current->IsBlockContext()) { |
11951 name, | 11864 Handle<ScopeInfo> scope_info(ScopeInfo::cast(current->extension())); |
11952 thrown_object); | 11865 new_current = |
11953 } else if (scope_info->Type() == BLOCK_SCOPE) { | 11866 isolate->factory()->NewBlockContext(function, new_previous, scope_info); |
11954 // Materialize the contents of the block scope into a JSObject. | 11867 // Copy context slots. |
11955 Handle<JSObject> block_scope_object = | 11868 int num_context_slots = scope_info->ContextLength(); |
11956 MaterializeBlockScope(isolate, current); | 11869 for (int i = Context::MIN_CONTEXT_SLOTS; i < num_context_slots; ++i) { |
11957 if (block_scope_object.is_null()) { | 11870 new_current->set(i, current->get(i)); |
11958 return Handle<Context>::null(); | |
11959 } | |
11960 // Allocate a new function context for the debug evaluation and set the | |
11961 // extension object. | |
11962 Handle<Context> new_context = | |
11963 isolate->factory()->NewFunctionContext(Context::MIN_CONTEXT_SLOTS, | |
11964 function); | |
11965 new_context->set_extension(*block_scope_object); | |
11966 new_context->set_previous(*context); | |
11967 context = new_context; | |
11968 } else { | |
11969 ASSERT(scope_info->Type() == WITH_SCOPE); | |
11970 ASSERT(current->IsWithContext()); | |
11971 Handle<JSObject> extension(JSObject::cast(current->extension())); | |
11972 context = | |
11973 isolate->factory()->NewWithContext(function, context, extension); | |
11974 } | 11871 } |
| 11872 } else { |
| 11873 ASSERT(current->IsWithContext()); |
| 11874 Handle<JSObject> extension(JSObject::cast(current->extension())); |
| 11875 new_current = |
| 11876 isolate->factory()->NewWithContext(function, new_previous, extension); |
11975 } | 11877 } |
11976 | 11878 return scope.CloseAndEscape(new_current); |
11977 return scope.CloseAndEscape(context); | |
11978 } | 11879 } |
11979 | 11880 |
11980 | 11881 |
11981 // Helper function to find or create the arguments object for | 11882 // Helper function to find or create the arguments object for |
11982 // Runtime_DebugEvaluate. | 11883 // Runtime_DebugEvaluate. |
11983 static Handle<Object> GetArgumentsObject(Isolate* isolate, | 11884 static Handle<Object> GetArgumentsObject(Isolate* isolate, |
11984 JavaScriptFrame* frame, | 11885 JavaScriptFrame* frame, |
11985 int inlined_frame_index, | 11886 int inlined_frame_index, |
11986 Handle<JSFunction> function, | 11887 Handle<JSFunction> function, |
11987 Handle<ScopeInfo> scope_info, | 11888 Handle<ScopeInfo> scope_info, |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12102 isolate->factory()->NewFunctionContext(Context::MIN_CONTEXT_SLOTS, | 12003 isolate->factory()->NewFunctionContext(Context::MIN_CONTEXT_SLOTS, |
12103 go_between); | 12004 go_between); |
12104 context->set_extension(*local_scope); | 12005 context->set_extension(*local_scope); |
12105 // Copy any with contexts present and chain them in front of this context. | 12006 // Copy any with contexts present and chain them in front of this context. |
12106 Handle<Context> frame_context(Context::cast(frame->context())); | 12007 Handle<Context> frame_context(Context::cast(frame->context())); |
12107 Handle<Context> function_context; | 12008 Handle<Context> function_context; |
12108 // Get the function's context if it has one. | 12009 // Get the function's context if it has one. |
12109 if (scope_info->HasContext()) { | 12010 if (scope_info->HasContext()) { |
12110 function_context = Handle<Context>(frame_context->declaration_context()); | 12011 function_context = Handle<Context>(frame_context->declaration_context()); |
12111 } | 12012 } |
12112 context = CopyNestedScopeContextChain(isolate, | 12013 context = CopyWithContextChain(isolate, go_between, frame_context, context); |
12113 go_between, | |
12114 context, | |
12115 frame, | |
12116 inlined_frame_index); | |
12117 | 12014 |
12118 if (additional_context->IsJSObject()) { | 12015 if (additional_context->IsJSObject()) { |
12119 Handle<JSObject> extension = Handle<JSObject>::cast(additional_context); | 12016 Handle<JSObject> extension = Handle<JSObject>::cast(additional_context); |
12120 context = | 12017 context = |
12121 isolate->factory()->NewWithContext(go_between, context, extension); | 12018 isolate->factory()->NewWithContext(go_between, context, extension); |
12122 } | 12019 } |
12123 | 12020 |
12124 // Wrap the evaluation statement in a new function compiled in the newly | 12021 // Wrap the evaluation statement in a new function compiled in the newly |
12125 // created context. The function has one parameter which has to be called | 12022 // created context. The function has one parameter which has to be called |
12126 // 'arguments'. This it to have access to what would have been 'arguments' in | 12023 // 'arguments'. This it to have access to what would have been 'arguments' in |
(...skipping 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13561 } else { | 13458 } else { |
13562 // Handle last resort GC and make sure to allow future allocations | 13459 // Handle last resort GC and make sure to allow future allocations |
13563 // to grow the heap without causing GCs (if possible). | 13460 // to grow the heap without causing GCs (if possible). |
13564 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13461 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13565 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | 13462 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); |
13566 } | 13463 } |
13567 } | 13464 } |
13568 | 13465 |
13569 | 13466 |
13570 } } // namespace v8::internal | 13467 } } // namespace v8::internal |
OLD | NEW |