OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/api.h" | 8 #include "src/api.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/contexts.h" | 10 #include "src/contexts.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 Isolate* isolate, const v8::PropertyCallbackInfo<void>& info, | 129 Isolate* isolate, const v8::PropertyCallbackInfo<void>& info, |
130 v8::Local<v8::Name> name, Handle<Object> value) { | 130 v8::Local<v8::Name> name, Handle<Object> value) { |
131 Handle<Object> holder = Utils::OpenHandle(*info.Holder()); | 131 Handle<Object> holder = Utils::OpenHandle(*info.Holder()); |
132 Handle<Object> receiver = Utils::OpenHandle(*info.This()); | 132 Handle<Object> receiver = Utils::OpenHandle(*info.This()); |
133 if (*holder == *receiver) return false; | 133 if (*holder == *receiver) return false; |
134 if (receiver->IsJSObject()) { | 134 if (receiver->IsJSObject()) { |
135 Handle<JSObject> object = Handle<JSObject>::cast(receiver); | 135 Handle<JSObject> object = Handle<JSObject>::cast(receiver); |
136 // This behaves sloppy since we lost the actual strict-mode. | 136 // This behaves sloppy since we lost the actual strict-mode. |
137 // TODO(verwaest): Fix by making ExecutableAccessorInfo behave like data | 137 // TODO(verwaest): Fix by making ExecutableAccessorInfo behave like data |
138 // properties. | 138 // properties. |
| 139 if (object->IsJSGlobalProxy()) { |
| 140 PrototypeIterator iter(isolate, object); |
| 141 if (iter.IsAtEnd()) return true; |
| 142 DCHECK(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject()); |
| 143 object = Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)); |
| 144 } |
139 if (!object->map()->is_extensible()) return true; | 145 if (!object->map()->is_extensible()) return true; |
140 JSObject::SetOwnPropertyIgnoreAttributes(object, Utils::OpenHandle(*name), | 146 JSObject::SetOwnPropertyIgnoreAttributes(object, Utils::OpenHandle(*name), |
141 value, NONE).Check(); | 147 value, NONE).Check(); |
142 } | 148 } |
143 return true; | 149 return true; |
144 } | 150 } |
145 | 151 |
146 | 152 |
147 // | 153 // |
148 // Accessors::ArgumentsIterator | 154 // Accessors::ArgumentsIterator |
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1528 info->set_data(Smi::FromInt(index)); | 1534 info->set_data(Smi::FromInt(index)); |
1529 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); | 1535 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); |
1530 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); | 1536 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); |
1531 info->set_getter(*getter); | 1537 info->set_getter(*getter); |
1532 if (!(attributes & ReadOnly)) info->set_setter(*setter); | 1538 if (!(attributes & ReadOnly)) info->set_setter(*setter); |
1533 return info; | 1539 return info; |
1534 } | 1540 } |
1535 | 1541 |
1536 | 1542 |
1537 } } // namespace v8::internal | 1543 } } // namespace v8::internal |
OLD | NEW |