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/runtime/runtime-utils.h" | 10 #include "src/runtime/runtime-utils.h" |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
232 Handle<Object> holder = | 232 Handle<Object> holder = |
233 context->Lookup(name, flags, &index, &attributes, &binding_flags); | 233 context->Lookup(name, flags, &index, &attributes, &binding_flags); |
234 | 234 |
235 Handle<JSObject> object; | 235 Handle<JSObject> object; |
236 Handle<Object> value = | 236 Handle<Object> value = |
237 is_function ? initial_value | 237 is_function ? initial_value |
238 : Handle<Object>::cast(isolate->factory()->undefined_value()); | 238 : Handle<Object>::cast(isolate->factory()->undefined_value()); |
239 | 239 |
240 // TODO(verwaest): This case should probably not be covered by this function, | 240 // TODO(verwaest): This case should probably not be covered by this function, |
241 // but by DeclareGlobals instead. | 241 // but by DeclareGlobals instead. |
242 if ((attributes != ABSENT && holder->IsJSGlobalObject()) || | 242 if (attributes != ABSENT && holder->IsJSGlobalObject()) { |
243 (context_arg->has_extension() && | |
244 context_arg->extension()->IsJSGlobalObject())) { | |
245 return DeclareGlobals(isolate, Handle<JSGlobalObject>::cast(holder), name, | 243 return DeclareGlobals(isolate, Handle<JSGlobalObject>::cast(holder), name, |
246 value, attr, is_var, is_const, is_function); | 244 value, attr, is_var, is_const, is_function); |
247 } | 245 } |
246 if (context_arg->has_extension() && | |
247 context_arg->extension()->IsJSGlobalObject()) { | |
Toon Verwaest
2015/04/20 10:59:14
If the holder is a JSGlobalObject, shouldn't it ==
wingo
2015/04/20 11:23:18
Thanks for looking into this. I think the issue I
| |
248 Handle<JSGlobalObject> global( | |
249 JSGlobalObject::cast(context_arg->extension()), isolate); | |
250 return DeclareGlobals(isolate, global, name, value, attr, is_var, is_const, | |
251 is_function); | |
252 } | |
248 | 253 |
249 if (attributes != ABSENT) { | 254 if (attributes != ABSENT) { |
250 // The name was declared before; check for conflicting re-declarations. | 255 // The name was declared before; check for conflicting re-declarations. |
251 if (is_const || (attributes & READ_ONLY) != 0) { | 256 if (is_const || (attributes & READ_ONLY) != 0) { |
252 return ThrowRedeclarationError(isolate, name); | 257 return ThrowRedeclarationError(isolate, name); |
253 } | 258 } |
254 | 259 |
255 // Skip var re-declarations. | 260 // Skip var re-declarations. |
256 if (is_var) return isolate->heap()->undefined_value(); | 261 if (is_var) return isolate->heap()->undefined_value(); |
257 | 262 |
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1114 return Smi::FromInt(frame->GetArgumentsLength()); | 1119 return Smi::FromInt(frame->GetArgumentsLength()); |
1115 } | 1120 } |
1116 | 1121 |
1117 | 1122 |
1118 RUNTIME_FUNCTION(Runtime_Arguments) { | 1123 RUNTIME_FUNCTION(Runtime_Arguments) { |
1119 SealHandleScope shs(isolate); | 1124 SealHandleScope shs(isolate); |
1120 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); | 1125 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); |
1121 } | 1126 } |
1122 } | 1127 } |
1123 } // namespace v8::internal | 1128 } // namespace v8::internal |
OLD | NEW |