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

Side by Side Diff: src/contexts.cc

Issue 1895973002: Remove all non-function-name uses of CONST_LEGACY (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove now-unused bits in TF and CS Created 4 years, 8 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/ast/scopeinfo.h" 7 #include "src/ast/scopeinfo.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/debug/debug.h" 9 #include "src/debug/debug.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 return Just(!blacklist->BooleanValue()); 177 return Just(!blacklist->BooleanValue());
178 } 178 }
179 179
180 static void GetAttributesAndBindingFlags(VariableMode mode, 180 static void GetAttributesAndBindingFlags(VariableMode mode,
181 InitializationFlag init_flag, 181 InitializationFlag init_flag,
182 PropertyAttributes* attributes, 182 PropertyAttributes* attributes,
183 BindingFlags* binding_flags) { 183 BindingFlags* binding_flags) {
184 switch (mode) { 184 switch (mode) {
185 case VAR: 185 case VAR:
186 *attributes = NONE; 186 *attributes = NONE;
187 *binding_flags = MUTABLE_IS_INITIALIZED; 187 *binding_flags = BINDING_IS_INITIALIZED;
188 break; 188 break;
189 case LET: 189 case LET:
190 *attributes = NONE; 190 *attributes = NONE;
191 *binding_flags = (init_flag == kNeedsInitialization) 191 *binding_flags = (init_flag == kNeedsInitialization)
192 ? MUTABLE_CHECK_INITIALIZED 192 ? BINDING_CHECK_INITIALIZED
193 : MUTABLE_IS_INITIALIZED; 193 : BINDING_IS_INITIALIZED;
194 break; 194 break;
195 case CONST_LEGACY: 195 case CONST_LEGACY:
196 DCHECK_EQ(kCreatedInitialized, init_flag);
196 *attributes = READ_ONLY; 197 *attributes = READ_ONLY;
197 *binding_flags = (init_flag == kNeedsInitialization) 198 *binding_flags = BINDING_IS_INITIALIZED;
198 ? IMMUTABLE_CHECK_INITIALIZED
199 : IMMUTABLE_IS_INITIALIZED;
200 break; 199 break;
201 case CONST: 200 case CONST:
202 *attributes = READ_ONLY; 201 *attributes = READ_ONLY;
203 *binding_flags = (init_flag == kNeedsInitialization) 202 *binding_flags = (init_flag == kNeedsInitialization)
204 ? IMMUTABLE_CHECK_INITIALIZED_HARMONY 203 ? BINDING_CHECK_INITIALIZED
205 : IMMUTABLE_IS_INITIALIZED_HARMONY; 204 : BINDING_IS_INITIALIZED;
206 break;
207 case IMPORT:
208 // TODO(ES6)
209 UNREACHABLE();
210 break; 205 break;
211 case DYNAMIC: 206 case DYNAMIC:
212 case DYNAMIC_GLOBAL: 207 case DYNAMIC_GLOBAL:
213 case DYNAMIC_LOCAL: 208 case DYNAMIC_LOCAL:
214 case TEMPORARY: 209 case TEMPORARY:
215 // Note: Fixed context slots are statically allocated by the compiler. 210 // Note: Fixed context slots are statically allocated by the compiler.
216 // Statically allocated variables always have a statically known mode, 211 // Statically allocated variables always have a statically known mode,
217 // which is the mode with which they were declared when added to the 212 // which is the mode with which they were declared when added to the
218 // scope. Thus, the DYNAMIC mode (which corresponds to dynamically 213 // scope. Thus, the DYNAMIC mode (which corresponds to dynamically
219 // declared variables that were introduced through declaration nodes) 214 // declared variables that were introduced through declaration nodes)
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 VariableMode mode; 350 VariableMode mode;
356 int function_index = scope_info->FunctionContextSlotIndex(*name, &mode); 351 int function_index = scope_info->FunctionContextSlotIndex(*name, &mode);
357 if (function_index >= 0) { 352 if (function_index >= 0) {
358 if (FLAG_trace_contexts) { 353 if (FLAG_trace_contexts) {
359 PrintF("=> found intermediate function in context slot %d\n", 354 PrintF("=> found intermediate function in context slot %d\n",
360 function_index); 355 function_index);
361 } 356 }
362 *index = function_index; 357 *index = function_index;
363 *attributes = READ_ONLY; 358 *attributes = READ_ONLY;
364 DCHECK(mode == CONST_LEGACY || mode == CONST); 359 DCHECK(mode == CONST_LEGACY || mode == CONST);
365 *binding_flags = (mode == CONST_LEGACY) 360 *binding_flags = BINDING_IS_INITIALIZED;
366 ? IMMUTABLE_IS_INITIALIZED : IMMUTABLE_IS_INITIALIZED_HARMONY;
367 return context; 361 return context;
368 } 362 }
369 } 363 }
370 364
371 } else if (context->IsCatchContext()) { 365 } else if (context->IsCatchContext()) {
372 // Catch contexts have the variable name in the extension slot. 366 // Catch contexts have the variable name in the extension slot.
373 if (String::Equals(name, handle(context->catch_name()))) { 367 if (String::Equals(name, handle(context->catch_name()))) {
374 if (FLAG_trace_contexts) { 368 if (FLAG_trace_contexts) {
375 PrintF("=> found in catch context\n"); 369 PrintF("=> found in catch context\n");
376 } 370 }
377 *index = Context::THROWN_OBJECT_INDEX; 371 *index = Context::THROWN_OBJECT_INDEX;
378 *attributes = NONE; 372 *attributes = NONE;
379 *binding_flags = MUTABLE_IS_INITIALIZED; 373 *binding_flags = BINDING_IS_INITIALIZED;
380 return context; 374 return context;
381 } 375 }
382 } else if (context->IsDebugEvaluateContext()) { 376 } else if (context->IsDebugEvaluateContext()) {
383 // Check materialized locals. 377 // Check materialized locals.
384 Object* obj = context->get(EXTENSION_INDEX); 378 Object* obj = context->get(EXTENSION_INDEX);
385 if (obj->IsJSReceiver()) { 379 if (obj->IsJSReceiver()) {
386 Handle<JSReceiver> extension(JSReceiver::cast(obj)); 380 Handle<JSReceiver> extension(JSReceiver::cast(obj));
387 LookupIterator it(extension, name, extension); 381 LookupIterator it(extension, name, extension);
388 Maybe<bool> found = JSReceiver::HasProperty(&it); 382 Maybe<bool> found = JSReceiver::HasProperty(&it);
389 if (found.FromMaybe(false)) { 383 if (found.FromMaybe(false)) {
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 607
614 int previous_value = errors_thrown()->value(); 608 int previous_value = errors_thrown()->value();
615 set_errors_thrown(Smi::FromInt(previous_value + 1)); 609 set_errors_thrown(Smi::FromInt(previous_value + 1));
616 } 610 }
617 611
618 612
619 int Context::GetErrorsThrown() { return errors_thrown()->value(); } 613 int Context::GetErrorsThrown() { return errors_thrown()->value(); }
620 614
621 } // namespace internal 615 } // namespace internal
622 } // namespace v8 616 } // 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