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/contexts.h" | 5 #include "src/contexts.h" |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
9 #include "src/isolate-inl.h" | 9 #include "src/isolate-inl.h" |
10 | 10 |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 } | 380 } |
381 } while (follow_context_chain); | 381 } while (follow_context_chain); |
382 | 382 |
383 if (FLAG_trace_contexts) { | 383 if (FLAG_trace_contexts) { |
384 PrintF("=> no property/slot found\n"); | 384 PrintF("=> no property/slot found\n"); |
385 } | 385 } |
386 return Handle<Object>::null(); | 386 return Handle<Object>::null(); |
387 } | 387 } |
388 | 388 |
389 | 389 |
390 void Context::InitializeGlobalSlots() { | |
391 DCHECK(IsScriptContext()); | |
392 DisallowHeapAllocation no_gc; | |
393 | |
394 ScopeInfo* scope_info = this->scope_info(); | |
395 | |
396 int context_globals = scope_info->ContextGlobalCount(); | |
397 if (context_globals > 0) { | |
398 PropertyCell* empty_cell = GetHeap()->empty_property_cell(); | |
399 | |
400 int context_locals = scope_info->ContextLocalCount(); | |
401 int index = Context::MIN_CONTEXT_SLOTS + context_locals; | |
402 for (int i = 0; i < context_globals; i++) { | |
403 set(index++, empty_cell); | |
404 } | |
405 } | |
406 } | |
407 | |
408 | |
409 void Context::AddOptimizedFunction(JSFunction* function) { | 390 void Context::AddOptimizedFunction(JSFunction* function) { |
410 DCHECK(IsNativeContext()); | 391 DCHECK(IsNativeContext()); |
411 Isolate* isolate = GetIsolate(); | 392 Isolate* isolate = GetIsolate(); |
412 #ifdef ENABLE_SLOW_DCHECKS | 393 #ifdef ENABLE_SLOW_DCHECKS |
413 if (FLAG_enable_slow_asserts) { | 394 if (FLAG_enable_slow_asserts) { |
414 Object* element = get(OPTIMIZED_FUNCTIONS_LIST); | 395 Object* element = get(OPTIMIZED_FUNCTIONS_LIST); |
415 while (!element->IsUndefined(isolate)) { | 396 while (!element->IsUndefined(isolate)) { |
416 CHECK(element != function); | 397 CHECK(element != function); |
417 element = JSFunction::cast(element)->next_function_link(); | 398 element = JSFunction::cast(element)->next_function_link(); |
418 } | 399 } |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 | 555 |
575 int previous_value = errors_thrown()->value(); | 556 int previous_value = errors_thrown()->value(); |
576 set_errors_thrown(Smi::FromInt(previous_value + 1)); | 557 set_errors_thrown(Smi::FromInt(previous_value + 1)); |
577 } | 558 } |
578 | 559 |
579 | 560 |
580 int Context::GetErrorsThrown() { return errors_thrown()->value(); } | 561 int Context::GetErrorsThrown() { return errors_thrown()->value(); } |
581 | 562 |
582 } // namespace internal | 563 } // namespace internal |
583 } // namespace v8 | 564 } // namespace v8 |
OLD | NEW |