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

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

Issue 1085263003: Eagerly declare eval scopes, even for sloppy scopes (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: Rebase Created 5 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/parser.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/v8.h" 5 #include "src/v8.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/messages.h" 10 #include "src/messages.h"
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 Handle<Object> holder = 233 Handle<Object> holder =
234 context->Lookup(name, flags, &index, &attributes, &binding_flags); 234 context->Lookup(name, flags, &index, &attributes, &binding_flags);
235 235
236 Handle<JSObject> object; 236 Handle<JSObject> object;
237 Handle<Object> value = 237 Handle<Object> value =
238 is_function ? initial_value 238 is_function ? initial_value
239 : Handle<Object>::cast(isolate->factory()->undefined_value()); 239 : Handle<Object>::cast(isolate->factory()->undefined_value());
240 240
241 // TODO(verwaest): This case should probably not be covered by this function, 241 // TODO(verwaest): This case should probably not be covered by this function,
242 // but by DeclareGlobals instead. 242 // but by DeclareGlobals instead.
243 if ((attributes != ABSENT && holder->IsJSGlobalObject()) || 243 if (attributes != ABSENT && holder->IsJSGlobalObject()) {
244 (context_arg->has_extension() &&
245 context_arg->extension()->IsJSGlobalObject())) {
246 return DeclareGlobals(isolate, Handle<JSGlobalObject>::cast(holder), name, 244 return DeclareGlobals(isolate, Handle<JSGlobalObject>::cast(holder), name,
247 value, attr, is_var, is_const, is_function); 245 value, attr, is_var, is_const, is_function);
248 } 246 }
247 if (context_arg->has_extension() &&
248 context_arg->extension()->IsJSGlobalObject()) {
249 Handle<JSGlobalObject> global(
250 JSGlobalObject::cast(context_arg->extension()), isolate);
251 return DeclareGlobals(isolate, global, name, value, attr, is_var, is_const,
252 is_function);
253 }
249 254
250 if (attributes != ABSENT) { 255 if (attributes != ABSENT) {
251 // The name was declared before; check for conflicting re-declarations. 256 // The name was declared before; check for conflicting re-declarations.
252 if (is_const || (attributes & READ_ONLY) != 0) { 257 if (is_const || (attributes & READ_ONLY) != 0) {
253 return ThrowRedeclarationError(isolate, name); 258 return ThrowRedeclarationError(isolate, name);
254 } 259 }
255 260
256 // Skip var re-declarations. 261 // Skip var re-declarations.
257 if (is_var) return isolate->heap()->undefined_value(); 262 if (is_var) return isolate->heap()->undefined_value();
258 263
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 return Smi::FromInt(frame->GetArgumentsLength()); 1120 return Smi::FromInt(frame->GetArgumentsLength());
1116 } 1121 }
1117 1122
1118 1123
1119 RUNTIME_FUNCTION(Runtime_Arguments) { 1124 RUNTIME_FUNCTION(Runtime_Arguments) {
1120 SealHandleScope shs(isolate); 1125 SealHandleScope shs(isolate);
1121 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); 1126 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate);
1122 } 1127 }
1123 } 1128 }
1124 } // namespace v8::internal 1129 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698