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 8589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8600 // it is bound in the global context. | 8600 // it is bound in the global context. |
8601 int index = -1; | 8601 int index = -1; |
8602 PropertyAttributes attributes = ABSENT; | 8602 PropertyAttributes attributes = ABSENT; |
8603 while (true) { | 8603 while (true) { |
8604 receiver = context->Lookup(isolate->factory()->eval_symbol(), | 8604 receiver = context->Lookup(isolate->factory()->eval_symbol(), |
8605 FOLLOW_PROTOTYPE_CHAIN, | 8605 FOLLOW_PROTOTYPE_CHAIN, |
8606 &index, &attributes); | 8606 &index, &attributes); |
8607 // Stop search when eval is found or when the global context is | 8607 // Stop search when eval is found or when the global context is |
8608 // reached. | 8608 // reached. |
8609 if (attributes != ABSENT || context->IsGlobalContext()) break; | 8609 if (attributes != ABSENT || context->IsGlobalContext()) break; |
8610 if (context->IsFunctionContext()) { | 8610 context = Handle<Context>(context->previous(), isolate); |
8611 context = Handle<Context>(context->closure()->context(), isolate); | |
8612 } else { | |
8613 context = Handle<Context>(context->previous(), isolate); | |
8614 } | |
8615 } | 8611 } |
8616 | 8612 |
8617 // If eval could not be resolved, it has been deleted and we need to | 8613 // If eval could not be resolved, it has been deleted and we need to |
8618 // throw a reference error. | 8614 // throw a reference error. |
8619 if (attributes == ABSENT) { | 8615 if (attributes == ABSENT) { |
8620 Handle<Object> name = isolate->factory()->eval_symbol(); | 8616 Handle<Object> name = isolate->factory()->eval_symbol(); |
8621 Handle<Object> reference_error = | 8617 Handle<Object> reference_error = |
8622 isolate->factory()->NewReferenceError("not_defined", | 8618 isolate->factory()->NewReferenceError("not_defined", |
8623 HandleVector(&name, 1)); | 8619 HandleVector(&name, 1)); |
8624 return MakePair(isolate->Throw(*reference_error), NULL); | 8620 return MakePair(isolate->Throw(*reference_error), NULL); |
(...skipping 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10261 } | 10257 } |
10262 } | 10258 } |
10263 | 10259 |
10264 // The global scope is always the last in the chain. | 10260 // The global scope is always the last in the chain. |
10265 if (context_->IsGlobalContext()) { | 10261 if (context_->IsGlobalContext()) { |
10266 context_ = Handle<Context>(); | 10262 context_ = Handle<Context>(); |
10267 return; | 10263 return; |
10268 } | 10264 } |
10269 | 10265 |
10270 // Move to the next context. | 10266 // Move to the next context. |
10271 if (context_->IsFunctionContext()) { | 10267 context_ = Handle<Context>(context_->previous(), isolate_); |
10272 context_ = Handle<Context>(context_->closure()->context()); | |
10273 } else { | |
10274 context_ = Handle<Context>(context_->previous()); | |
10275 } | |
10276 | 10268 |
10277 // If passing the local scope indicate that the current scope is now the | 10269 // If passing the local scope indicate that the current scope is now the |
10278 // local scope. | 10270 // local scope. |
10279 if (!local_done_ && | 10271 if (!local_done_ && |
10280 (context_->IsGlobalContext() || context_->IsFunctionContext())) { | 10272 (context_->IsGlobalContext() || context_->IsFunctionContext())) { |
10281 at_local_ = true; | 10273 at_local_ = true; |
10282 } | 10274 } |
10283 } | 10275 } |
10284 | 10276 |
10285 // Return the type of the current scope. | 10277 // Return the type of the current scope. |
(...skipping 2077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12363 } else { | 12355 } else { |
12364 // Handle last resort GC and make sure to allow future allocations | 12356 // Handle last resort GC and make sure to allow future allocations |
12365 // to grow the heap without causing GCs (if possible). | 12357 // to grow the heap without causing GCs (if possible). |
12366 isolate->counters()->gc_last_resort_from_js()->Increment(); | 12358 isolate->counters()->gc_last_resort_from_js()->Increment(); |
12367 isolate->heap()->CollectAllGarbage(false); | 12359 isolate->heap()->CollectAllGarbage(false); |
12368 } | 12360 } |
12369 } | 12361 } |
12370 | 12362 |
12371 | 12363 |
12372 } } // namespace v8::internal | 12364 } } // namespace v8::internal |
OLD | NEW |