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

Side by Side Diff: src/contexts.cc

Issue 253263003: ScopeInfo::ContextSlotIndex() handlified. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/objects.h » ('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 "v8.h" 5 #include "v8.h"
6 6
7 #include "bootstrapper.h" 7 #include "bootstrapper.h"
8 #include "debug.h" 8 #include "debug.h"
9 #include "scopeinfo.h" 9 #include "scopeinfo.h"
10 10
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 Handle<ScopeInfo> scope_info; 130 Handle<ScopeInfo> scope_info;
131 if (context->IsFunctionContext()) { 131 if (context->IsFunctionContext()) {
132 scope_info = Handle<ScopeInfo>( 132 scope_info = Handle<ScopeInfo>(
133 context->closure()->shared()->scope_info(), isolate); 133 context->closure()->shared()->scope_info(), isolate);
134 } else { 134 } else {
135 scope_info = Handle<ScopeInfo>( 135 scope_info = Handle<ScopeInfo>(
136 ScopeInfo::cast(context->extension()), isolate); 136 ScopeInfo::cast(context->extension()), isolate);
137 } 137 }
138 VariableMode mode; 138 VariableMode mode;
139 InitializationFlag init_flag; 139 InitializationFlag init_flag;
140 int slot_index = scope_info->ContextSlotIndex(*name, &mode, &init_flag); 140 int slot_index =
141 ScopeInfo::ContextSlotIndex(scope_info, name, &mode, &init_flag);
141 ASSERT(slot_index < 0 || slot_index >= MIN_CONTEXT_SLOTS); 142 ASSERT(slot_index < 0 || slot_index >= MIN_CONTEXT_SLOTS);
142 if (slot_index >= 0) { 143 if (slot_index >= 0) {
143 if (FLAG_trace_contexts) { 144 if (FLAG_trace_contexts) {
144 PrintF("=> found local in context slot %d (mode = %d)\n", 145 PrintF("=> found local in context slot %d (mode = %d)\n",
145 slot_index, mode); 146 slot_index, mode);
146 } 147 }
147 *index = slot_index; 148 *index = slot_index;
148 // Note: Fixed context slots are statically allocated by the compiler. 149 // Note: Fixed context slots are statically allocated by the compiler.
149 // Statically allocated variables always have a statically known mode, 150 // Statically allocated variables always have a statically known mode,
150 // which is the mode with which they were declared when added to the 151 // which is the mode with which they were declared when added to the
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) { 367 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) {
367 // During bootstrapping we allow all objects to pass as global 368 // During bootstrapping we allow all objects to pass as global
368 // objects. This is necessary to fix circular dependencies. 369 // objects. This is necessary to fix circular dependencies.
369 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || 370 return isolate->heap()->gc_state() != Heap::NOT_IN_GC ||
370 isolate->bootstrapper()->IsActive() || 371 isolate->bootstrapper()->IsActive() ||
371 object->IsGlobalObject(); 372 object->IsGlobalObject();
372 } 373 }
373 #endif 374 #endif
374 375
375 } } // namespace v8::internal 376 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698