OLD | NEW |
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 Loading... |
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())) { |
244 return DeclareGlobals(isolate, Handle<JSGlobalObject>::cast(holder), name, | 246 return DeclareGlobals(isolate, Handle<JSGlobalObject>::cast(holder), name, |
245 value, attr, is_var, is_const, is_function); | 247 value, attr, is_var, is_const, is_function); |
246 } | 248 } |
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 } | |
254 | 249 |
255 if (attributes != ABSENT) { | 250 if (attributes != ABSENT) { |
256 // The name was declared before; check for conflicting re-declarations. | 251 // The name was declared before; check for conflicting re-declarations. |
257 if (is_const || (attributes & READ_ONLY) != 0) { | 252 if (is_const || (attributes & READ_ONLY) != 0) { |
258 return ThrowRedeclarationError(isolate, name); | 253 return ThrowRedeclarationError(isolate, name); |
259 } | 254 } |
260 | 255 |
261 // Skip var re-declarations. | 256 // Skip var re-declarations. |
262 if (is_var) return isolate->heap()->undefined_value(); | 257 if (is_var) return isolate->heap()->undefined_value(); |
263 | 258 |
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1120 return Smi::FromInt(frame->GetArgumentsLength()); | 1115 return Smi::FromInt(frame->GetArgumentsLength()); |
1121 } | 1116 } |
1122 | 1117 |
1123 | 1118 |
1124 RUNTIME_FUNCTION(Runtime_Arguments) { | 1119 RUNTIME_FUNCTION(Runtime_Arguments) { |
1125 SealHandleScope shs(isolate); | 1120 SealHandleScope shs(isolate); |
1126 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); | 1121 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); |
1127 } | 1122 } |
1128 } | 1123 } |
1129 } // namespace v8::internal | 1124 } // namespace v8::internal |
OLD | NEW |