Chromium Code Reviews| 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 14 matching lines...) Expand all Loading... | |
| 25 Handle<Name> name, | 25 Handle<Name> name, |
| 26 AccessorNameGetterCallback getter, | 26 AccessorNameGetterCallback getter, |
| 27 AccessorNameSetterCallback setter, | 27 AccessorNameSetterCallback setter, |
| 28 PropertyAttributes attributes) { | 28 PropertyAttributes attributes) { |
| 29 Factory* factory = isolate->factory(); | 29 Factory* factory = isolate->factory(); |
| 30 Handle<AccessorInfo> info = factory->NewAccessorInfo(); | 30 Handle<AccessorInfo> info = factory->NewAccessorInfo(); |
| 31 info->set_property_attributes(attributes); | 31 info->set_property_attributes(attributes); |
| 32 info->set_all_can_read(false); | 32 info->set_all_can_read(false); |
| 33 info->set_all_can_write(false); | 33 info->set_all_can_write(false); |
| 34 info->set_is_special_data_property(true); | 34 info->set_is_special_data_property(true); |
| 35 info->set_is_sloppy(false); | |
| 35 name = factory->InternalizeName(name); | 36 name = factory->InternalizeName(name); |
| 36 info->set_name(*name); | 37 info->set_name(*name); |
| 37 Handle<Object> get = v8::FromCData(isolate, getter); | 38 Handle<Object> get = v8::FromCData(isolate, getter); |
| 38 if (setter == nullptr) setter = &ReconfigureToDataProperty; | 39 if (setter == nullptr) setter = &ReconfigureToDataProperty; |
| 39 Handle<Object> set = v8::FromCData(isolate, setter); | 40 Handle<Object> set = v8::FromCData(isolate, setter); |
| 40 info->set_getter(*get); | 41 info->set_getter(*get); |
| 41 info->set_setter(*set); | 42 info->set_setter(*set); |
| 42 Address redirected = info->redirected_getter(); | 43 Address redirected = info->redirected_getter(); |
| 43 if (redirected != nullptr) { | 44 if (redirected != nullptr) { |
| 44 Handle<Object> js_get = v8::FromCData(isolate, redirected); | 45 Handle<Object> js_get = v8::FromCData(isolate, redirected); |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 253 // Accessors::StringLength | 254 // Accessors::StringLength |
| 254 // | 255 // |
| 255 | 256 |
| 256 void Accessors::StringLengthGetter( | 257 void Accessors::StringLengthGetter( |
| 257 v8::Local<v8::Name> name, | 258 v8::Local<v8::Name> name, |
| 258 const v8::PropertyCallbackInfo<v8::Value>& info) { | 259 const v8::PropertyCallbackInfo<v8::Value>& info) { |
| 259 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); | 260 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); |
| 260 DisallowHeapAllocation no_allocation; | 261 DisallowHeapAllocation no_allocation; |
| 261 HandleScope scope(isolate); | 262 HandleScope scope(isolate); |
| 262 | 263 |
| 263 // We have a slight impedance mismatch between the external API and the way we | 264 // We have a slight impedance mismatch between the external API and the way we |
|
jochen (gone - plz use gerrit)
2016/05/06 13:56:39
slight? in the sense of how sloppy and strict are
| |
| 264 // use callbacks internally: Externally, callbacks can only be used with | 265 // use callbacks internally: Externally, callbacks can only be used with |
| 265 // v8::Object, but internally we have callbacks on entities which are higher | 266 // v8::Object, but internally we have callbacks on entities which are higher |
| 266 // in the hierarchy, in this case for String values. | 267 // in the hierarchy, in this case for String values. |
| 267 | 268 |
| 268 Object* value = *Utils::OpenHandle(*v8::Local<v8::Value>(info.This())); | 269 Object* value = *Utils::OpenHandle(*v8::Local<v8::Value>(info.This())); |
| 269 if (!value->IsString()) { | 270 if (!value->IsString()) { |
| 270 // Not a string value. That means that we either got a String wrapper or | 271 // Not a string value. That means that we either got a String wrapper or |
| 271 // a Value with a String wrapper in its prototype chain. | 272 // a Value with a String wrapper in its prototype chain. |
| 272 value = JSValue::cast(*Utils::OpenHandle(*info.Holder()))->value(); | 273 value = JSValue::cast(*Utils::OpenHandle(*info.Holder()))->value(); |
| 273 } | 274 } |
| (...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1204 Isolate* isolate = name->GetIsolate(); | 1205 Isolate* isolate = name->GetIsolate(); |
| 1205 Handle<AccessorInfo> info = MakeAccessor(isolate, name, &ModuleGetExport, | 1206 Handle<AccessorInfo> info = MakeAccessor(isolate, name, &ModuleGetExport, |
| 1206 &ModuleSetExport, attributes); | 1207 &ModuleSetExport, attributes); |
| 1207 info->set_data(Smi::FromInt(index)); | 1208 info->set_data(Smi::FromInt(index)); |
| 1208 return info; | 1209 return info; |
| 1209 } | 1210 } |
| 1210 | 1211 |
| 1211 | 1212 |
| 1212 } // namespace internal | 1213 } // namespace internal |
| 1213 } // namespace v8 | 1214 } // namespace v8 |
| OLD | NEW |