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

Side by Side Diff: src/runtime/runtime-scopes.cc

Issue 1437003006: Fix harmony sloppy block scoping dynamic redeclaration check (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Tighten test, fix bug in redeclaration check Created 5 years, 1 month 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/arguments.h" 8 #include "src/arguments.h"
9 #include "src/frames-inl.h" 9 #include "src/frames-inl.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 int index; 224 int index;
225 PropertyAttributes attributes; 225 PropertyAttributes attributes;
226 BindingFlags binding_flags; 226 BindingFlags binding_flags;
227 227
228 if ((attr & EVAL_DECLARED) != 0) { 228 if ((attr & EVAL_DECLARED) != 0) {
229 // Check for a conflict with a lexically scoped variable 229 // Check for a conflict with a lexically scoped variable
230 context_arg->Lookup(name, LEXICAL_TEST, &index, &attributes, 230 context_arg->Lookup(name, LEXICAL_TEST, &index, &attributes,
231 &binding_flags); 231 &binding_flags);
232 if (attributes != ABSENT && 232 if (attributes != ABSENT &&
233 (binding_flags == MUTABLE_CHECK_INITIALIZED || 233 (binding_flags == MUTABLE_CHECK_INITIALIZED ||
234 binding_flags == IMMUTABLE_CHECK_INITIALIZED)) { 234 binding_flags == IMMUTABLE_CHECK_INITIALIZED ||
adamk 2015/11/12 23:22:27 This is for CONST_LEGACY, I wonder if it even belo
adamk 2015/11/13 07:06:01 Any thoughts on this? The comment above claims thi
235 binding_flags == IMMUTABLE_CHECK_INITIALIZED_HARMONY)) {
235 return ThrowRedeclarationError(isolate, name); 236 return ThrowRedeclarationError(isolate, name);
236 } 237 }
237 attr = static_cast<PropertyAttributes>(attr & ~EVAL_DECLARED); 238 attr = static_cast<PropertyAttributes>(attr & ~EVAL_DECLARED);
238 } 239 }
239 240
240 Handle<Object> holder = context->Lookup(name, DONT_FOLLOW_CHAINS, &index, 241 Handle<Object> holder = context->Lookup(name, DONT_FOLLOW_CHAINS, &index,
241 &attributes, &binding_flags); 242 &attributes, &binding_flags);
242 if (holder.is_null()) { 243 if (holder.is_null()) {
243 // In case of JSProxy, an exception might have been thrown. 244 // In case of JSProxy, an exception might have been thrown.
244 if (isolate->has_pending_exception()) return isolate->heap()->exception(); 245 if (isolate->has_pending_exception()) return isolate->heap()->exception();
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
1166 1167
1167 // Lookup in the initial Object.prototype object. 1168 // Lookup in the initial Object.prototype object.
1168 Handle<Object> result; 1169 Handle<Object> result;
1169 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 1170 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1170 isolate, result, 1171 isolate, result,
1171 Object::GetProperty(isolate->initial_object_prototype(), key)); 1172 Object::GetProperty(isolate->initial_object_prototype(), key));
1172 return *result; 1173 return *result;
1173 } 1174 }
1174 } // namespace internal 1175 } // namespace internal
1175 } // namespace v8 1176 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698