| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
| 8 #include "src/debug.h" | 8 #include "src/debug.h" |
| 9 #include "src/scopeinfo.h" | 9 #include "src/scopeinfo.h" |
| 10 | 10 |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 | 358 |
| 359 ScopeInfo* scope_info = ScopeInfo::cast(extension()); | 359 ScopeInfo* scope_info = ScopeInfo::cast(extension()); |
| 360 | 360 |
| 361 int context_globals = scope_info->ContextGlobalCount(); | 361 int context_globals = scope_info->ContextGlobalCount(); |
| 362 if (context_globals > 0) { | 362 if (context_globals > 0) { |
| 363 PropertyCell* empty_cell = GetHeap()->empty_property_cell(); | 363 PropertyCell* empty_cell = GetHeap()->empty_property_cell(); |
| 364 | 364 |
| 365 int context_locals = scope_info->ContextLocalCount(); | 365 int context_locals = scope_info->ContextLocalCount(); |
| 366 int index = Context::MIN_CONTEXT_SLOTS + context_locals; | 366 int index = Context::MIN_CONTEXT_SLOTS + context_locals; |
| 367 for (int i = 0; i < context_globals; i++) { | 367 for (int i = 0; i < context_globals; i++) { |
| 368 // Clear both read and write slots. | |
| 369 set(index++, empty_cell); | |
| 370 set(index++, empty_cell); | 368 set(index++, empty_cell); |
| 371 } | 369 } |
| 372 } | 370 } |
| 373 } | 371 } |
| 374 | 372 |
| 375 | 373 |
| 376 void Context::AddOptimizedFunction(JSFunction* function) { | 374 void Context::AddOptimizedFunction(JSFunction* function) { |
| 377 DCHECK(IsNativeContext()); | 375 DCHECK(IsNativeContext()); |
| 378 #ifdef ENABLE_SLOW_DCHECKS | 376 #ifdef ENABLE_SLOW_DCHECKS |
| 379 if (FLAG_enable_slow_asserts) { | 377 if (FLAG_enable_slow_asserts) { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 // During bootstrapping we allow all objects to pass as global | 508 // During bootstrapping we allow all objects to pass as global |
| 511 // objects. This is necessary to fix circular dependencies. | 509 // objects. This is necessary to fix circular dependencies. |
| 512 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || | 510 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || |
| 513 isolate->bootstrapper()->IsActive() || | 511 isolate->bootstrapper()->IsActive() || |
| 514 object->IsGlobalObject(); | 512 object->IsGlobalObject(); |
| 515 } | 513 } |
| 516 #endif | 514 #endif |
| 517 | 515 |
| 518 } // namespace internal | 516 } // namespace internal |
| 519 } // namespace v8 | 517 } // namespace v8 |
| OLD | NEW |