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

Side by Side Diff: src/contexts.cc

Issue 181543002: Eliminate extended mode, and other modes clean-up (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 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 | « src/contexts.h ('k') | src/debug.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 // 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 case INTERNAL: // Fall through. 178 case INTERNAL: // Fall through.
179 case VAR: 179 case VAR:
180 *attributes = NONE; 180 *attributes = NONE;
181 *binding_flags = MUTABLE_IS_INITIALIZED; 181 *binding_flags = MUTABLE_IS_INITIALIZED;
182 break; 182 break;
183 case LET: 183 case LET:
184 *attributes = NONE; 184 *attributes = NONE;
185 *binding_flags = (init_flag == kNeedsInitialization) 185 *binding_flags = (init_flag == kNeedsInitialization)
186 ? MUTABLE_CHECK_INITIALIZED : MUTABLE_IS_INITIALIZED; 186 ? MUTABLE_CHECK_INITIALIZED : MUTABLE_IS_INITIALIZED;
187 break; 187 break;
188 case CONST_LEGACY:
189 *attributes = READ_ONLY;
190 *binding_flags = (init_flag == kNeedsInitialization)
191 ? IMMUTABLE_CHECK_INITIALIZED : IMMUTABLE_IS_INITIALIZED;
192 break;
188 case CONST: 193 case CONST:
189 *attributes = READ_ONLY; 194 *attributes = READ_ONLY;
190 *binding_flags = (init_flag == kNeedsInitialization) 195 *binding_flags = (init_flag == kNeedsInitialization)
191 ? IMMUTABLE_CHECK_INITIALIZED : IMMUTABLE_IS_INITIALIZED;
192 break;
193 case CONST_HARMONY:
194 *attributes = READ_ONLY;
195 *binding_flags = (init_flag == kNeedsInitialization)
196 ? IMMUTABLE_CHECK_INITIALIZED_HARMONY : 196 ? IMMUTABLE_CHECK_INITIALIZED_HARMONY :
197 IMMUTABLE_IS_INITIALIZED_HARMONY; 197 IMMUTABLE_IS_INITIALIZED_HARMONY;
198 break; 198 break;
199 case MODULE: 199 case MODULE:
200 *attributes = READ_ONLY; 200 *attributes = READ_ONLY;
201 *binding_flags = IMMUTABLE_IS_INITIALIZED_HARMONY; 201 *binding_flags = IMMUTABLE_IS_INITIALIZED_HARMONY;
202 break; 202 break;
203 case DYNAMIC: 203 case DYNAMIC:
204 case DYNAMIC_GLOBAL: 204 case DYNAMIC_GLOBAL:
205 case DYNAMIC_LOCAL: 205 case DYNAMIC_LOCAL:
206 case TEMPORARY: 206 case TEMPORARY:
207 UNREACHABLE(); 207 UNREACHABLE();
208 break; 208 break;
209 } 209 }
210 return context; 210 return context;
211 } 211 }
212 212
213 // Check the slot corresponding to the intermediate context holding 213 // Check the slot corresponding to the intermediate context holding
214 // only the function name variable. 214 // only the function name variable.
215 if (follow_context_chain && context->IsFunctionContext()) { 215 if (follow_context_chain && context->IsFunctionContext()) {
216 VariableMode mode; 216 VariableMode mode;
217 int function_index = scope_info->FunctionContextSlotIndex(*name, &mode); 217 int function_index = scope_info->FunctionContextSlotIndex(*name, &mode);
218 if (function_index >= 0) { 218 if (function_index >= 0) {
219 if (FLAG_trace_contexts) { 219 if (FLAG_trace_contexts) {
220 PrintF("=> found intermediate function in context slot %d\n", 220 PrintF("=> found intermediate function in context slot %d\n",
221 function_index); 221 function_index);
222 } 222 }
223 *index = function_index; 223 *index = function_index;
224 *attributes = READ_ONLY; 224 *attributes = READ_ONLY;
225 ASSERT(mode == CONST || mode == CONST_HARMONY); 225 ASSERT(mode == CONST_LEGACY || mode == CONST);
226 *binding_flags = (mode == CONST) 226 *binding_flags = (mode == CONST_LEGACY)
227 ? IMMUTABLE_IS_INITIALIZED : IMMUTABLE_IS_INITIALIZED_HARMONY; 227 ? IMMUTABLE_IS_INITIALIZED : IMMUTABLE_IS_INITIALIZED_HARMONY;
228 return context; 228 return context;
229 } 229 }
230 } 230 }
231 231
232 } else if (context->IsCatchContext()) { 232 } else if (context->IsCatchContext()) {
233 // Catch contexts have the variable name in the extension slot. 233 // Catch contexts have the variable name in the extension slot.
234 if (name->Equals(String::cast(context->extension()))) { 234 if (name->Equals(String::cast(context->extension()))) {
235 if (FLAG_trace_contexts) { 235 if (FLAG_trace_contexts) {
236 PrintF("=> found in catch context\n"); 236 PrintF("=> found in catch context\n");
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) { 389 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) {
390 // During bootstrapping we allow all objects to pass as global 390 // During bootstrapping we allow all objects to pass as global
391 // objects. This is necessary to fix circular dependencies. 391 // objects. This is necessary to fix circular dependencies.
392 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || 392 return isolate->heap()->gc_state() != Heap::NOT_IN_GC ||
393 isolate->bootstrapper()->IsActive() || 393 isolate->bootstrapper()->IsActive() ||
394 object->IsGlobalObject(); 394 object->IsGlobalObject();
395 } 395 }
396 #endif 396 #endif
397 397
398 } } // namespace v8::internal 398 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/contexts.h ('k') | src/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698