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

Unified Diff: src/runtime/runtime-scopes.cc

Issue 2200303002: Replace BindingFlags enum with InitializationFlag enum (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@fix-lexical-test
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/contexts.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-scopes.cc
diff --git a/src/runtime/runtime-scopes.cc b/src/runtime/runtime-scopes.cc
index 4baef7b99ed012728fbbe5545cf85b3818d92c18..8fb06caaff2f771b6a139aab2fbaf9f709a00262 100644
--- a/src/runtime/runtime-scopes.cc
+++ b/src/runtime/runtime-scopes.cc
@@ -266,11 +266,11 @@ Object* DeclareEvalHelper(Isolate* isolate, Handle<String> name,
int index;
PropertyAttributes attributes;
- BindingFlags binding_flags;
+ InitializationFlag init_flag;
VariableMode mode;
// Check for a conflict with a lexically scoped variable
- context_arg->Lookup(name, LEXICAL_TEST, &index, &attributes, &binding_flags,
+ context_arg->Lookup(name, LEXICAL_TEST, &index, &attributes, &init_flag,
&mode);
if (attributes != ABSENT && IsLexicalVariableMode(mode)) {
// ES#sec-evaldeclarationinstantiation 5.a.i.1:
@@ -283,7 +283,7 @@ Object* DeclareEvalHelper(Isolate* isolate, Handle<String> name,
}
Handle<Object> holder = context->Lookup(name, DONT_FOLLOW_CHAINS, &index,
- &attributes, &binding_flags, &mode);
+ &attributes, &init_flag, &mode);
DCHECK(!isolate->has_pending_exception());
Handle<JSObject> object;
@@ -772,10 +772,10 @@ RUNTIME_FUNCTION(Runtime_DeleteLookupSlot) {
int index;
PropertyAttributes attributes;
- BindingFlags flags;
+ InitializationFlag flag;
VariableMode mode;
Handle<Object> holder = isolate->context()->Lookup(
- name, FOLLOW_CHAINS, &index, &attributes, &flags, &mode);
+ name, FOLLOW_CHAINS, &index, &attributes, &flag, &mode);
// If the slot was not found the result is true.
if (holder.is_null()) {
@@ -808,10 +808,10 @@ MaybeHandle<Object> LoadLookupSlot(Handle<String> name,
int index;
PropertyAttributes attributes;
- BindingFlags flags;
+ InitializationFlag flag;
VariableMode mode;
Handle<Object> holder = isolate->context()->Lookup(
- name, FOLLOW_CHAINS, &index, &attributes, &flags, &mode);
+ name, FOLLOW_CHAINS, &index, &attributes, &flag, &mode);
if (isolate->has_pending_exception()) return MaybeHandle<Object>();
if (index != Context::kNotFound) {
@@ -821,22 +821,14 @@ MaybeHandle<Object> LoadLookupSlot(Handle<String> name,
Handle<Object> receiver = isolate->factory()->undefined_value();
Handle<Object> value = handle(Context::cast(*holder)->get(index), isolate);
// Check for uninitialized bindings.
- switch (flags) {
- case BINDING_CHECK_INITIALIZED:
- if (value->IsTheHole(isolate)) {
- THROW_NEW_ERROR(isolate,
- NewReferenceError(MessageTemplate::kNotDefined, name),
- Object);
- }
- // FALLTHROUGH
- case BINDING_IS_INITIALIZED:
- DCHECK(!value->IsTheHole(isolate));
- if (receiver_return) *receiver_return = receiver;
- return value;
- case MISSING_BINDING:
- break;
+ if (flag == kNeedsInitialization && value->IsTheHole(isolate)) {
+ THROW_NEW_ERROR(isolate,
+ NewReferenceError(MessageTemplate::kNotDefined, name),
+ Object);
}
- UNREACHABLE();
+ DCHECK(!value->IsTheHole(isolate));
+ if (receiver_return) *receiver_return = receiver;
+ return value;
}
// Otherwise, if the slot was found the holder is a context extension
@@ -912,10 +904,10 @@ MaybeHandle<Object> StoreLookupSlot(Handle<String> name, Handle<Object> value,
int index;
PropertyAttributes attributes;
- BindingFlags flags;
+ InitializationFlag flag;
VariableMode mode;
Handle<Object> holder =
- context->Lookup(name, FOLLOW_CHAINS, &index, &attributes, &flags, &mode);
+ context->Lookup(name, FOLLOW_CHAINS, &index, &attributes, &flag, &mode);
if (holder.is_null()) {
// In case of JSProxy, an exception might have been thrown.
if (isolate->has_pending_exception()) return MaybeHandle<Object>();
@@ -923,7 +915,7 @@ MaybeHandle<Object> StoreLookupSlot(Handle<String> name, Handle<Object> value,
// The property was found in a context slot.
if (index != Context::kNotFound) {
- if (flags == BINDING_CHECK_INITIALIZED &&
+ if (flag == kNeedsInitialization &&
Handle<Context>::cast(holder)->is_the_hole(index)) {
THROW_NEW_ERROR(isolate,
NewReferenceError(MessageTemplate::kNotDefined, name),
« no previous file with comments | « src/contexts.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698