Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: src/contexts.cc

Issue 2287173002: Replace CollectVariables with locals(), update callsites to walk locals instead (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: restore undefined handling Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/contexts.h ('k') | src/crankshaft/hydrogen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/contexts.h ('k') | src/crankshaft/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698