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/accessors.h" | 5 #include "src/accessors.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/contexts.h" | 8 #include "src/contexts.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/execution.h" | 10 #include "src/execution.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
154 Object* result = isolate->native_context()->array_values_iterator(); | 154 Object* result = isolate->native_context()->array_values_iterator(); |
155 info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(result, isolate))); | 155 info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(result, isolate))); |
156 } | 156 } |
157 | 157 |
158 | 158 |
159 void Accessors::ArgumentsIteratorSetter( | 159 void Accessors::ArgumentsIteratorSetter( |
160 v8::Local<v8::Name> name, v8::Local<v8::Value> val, | 160 v8::Local<v8::Name> name, v8::Local<v8::Value> val, |
161 const v8::PropertyCallbackInfo<void>& info) { | 161 const v8::PropertyCallbackInfo<void>& info) { |
162 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); | 162 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); |
163 HandleScope scope(isolate); | 163 HandleScope scope(isolate); |
164 Handle<JSObject> object_handle = Utils::OpenHandle(*info.This()); | 164 Handle<JSObject> object_handle = |
165 Handle<JSObject>::cast(Utils::OpenHandle(*info.This())); | |
165 Handle<Object> value_handle = Utils::OpenHandle(*val); | 166 Handle<Object> value_handle = Utils::OpenHandle(*val); |
166 Handle<Name> name_handle = Utils::OpenHandle(*name); | 167 Handle<Name> name_handle = Utils::OpenHandle(*name); |
167 | 168 |
169 // TODO(jochen): Update to JSReceiver. | |
Toon Verwaest
2015/11/02 09:41:26
These methods are guaranteed to be called directly
| |
168 if (JSObject::DefinePropertyOrElementIgnoreAttributes( | 170 if (JSObject::DefinePropertyOrElementIgnoreAttributes( |
169 object_handle, name_handle, value_handle, NONE) | 171 object_handle, name_handle, value_handle, NONE) |
170 .is_null()) { | 172 .is_null()) { |
171 isolate->OptionalRescheduleException(false); | 173 isolate->OptionalRescheduleException(false); |
172 } | 174 } |
173 } | 175 } |
174 | 176 |
175 | 177 |
176 Handle<AccessorInfo> Accessors::ArgumentsIteratorInfo( | 178 Handle<AccessorInfo> Accessors::ArgumentsIteratorInfo( |
177 Isolate* isolate, PropertyAttributes attributes) { | 179 Isolate* isolate, PropertyAttributes attributes) { |
(...skipping 20 matching lines...) Expand all Loading... | |
198 } | 200 } |
199 | 201 |
200 | 202 |
201 void Accessors::ArrayLengthSetter( | 203 void Accessors::ArrayLengthSetter( |
202 v8::Local<v8::Name> name, | 204 v8::Local<v8::Name> name, |
203 v8::Local<v8::Value> val, | 205 v8::Local<v8::Value> val, |
204 const v8::PropertyCallbackInfo<void>& info) { | 206 const v8::PropertyCallbackInfo<void>& info) { |
205 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); | 207 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); |
206 HandleScope scope(isolate); | 208 HandleScope scope(isolate); |
207 | 209 |
208 Handle<JSObject> object = Utils::OpenHandle(*info.This()); | 210 Handle<JSReceiver> object = Utils::OpenHandle(*info.This()); |
209 Handle<JSArray> array = Handle<JSArray>::cast(object); | 211 Handle<JSArray> array = Handle<JSArray>::cast(object); |
210 Handle<Object> length_obj = Utils::OpenHandle(*val); | 212 Handle<Object> length_obj = Utils::OpenHandle(*val); |
211 | 213 |
212 uint32_t length = 0; | 214 uint32_t length = 0; |
213 if (!JSArray::AnythingToArrayLength(isolate, length_obj, &length)) { | 215 if (!JSArray::AnythingToArrayLength(isolate, length_obj, &length)) { |
214 isolate->OptionalRescheduleException(false); | 216 isolate->OptionalRescheduleException(false); |
215 return; | 217 return; |
216 } | 218 } |
217 | 219 |
218 if (JSArray::ObservableSetLength(array, length).is_null()) { | 220 if (JSArray::ObservableSetLength(array, length).is_null()) { |
(...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1480 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); | 1482 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); |
1481 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); | 1483 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); |
1482 info->set_getter(*getter); | 1484 info->set_getter(*getter); |
1483 if (!(attributes & ReadOnly)) info->set_setter(*setter); | 1485 if (!(attributes & ReadOnly)) info->set_setter(*setter); |
1484 return info; | 1486 return info; |
1485 } | 1487 } |
1486 | 1488 |
1487 | 1489 |
1488 } // namespace internal | 1490 } // namespace internal |
1489 } // namespace v8 | 1491 } // namespace v8 |
OLD | NEW |