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" |
11 #include "src/factory.h" | 11 #include "src/factory.h" |
12 #include "src/frames-inl.h" | 12 #include "src/frames-inl.h" |
13 #include "src/isolate-inl.h" | 13 #include "src/isolate-inl.h" |
14 #include "src/list-inl.h" | 14 #include "src/list-inl.h" |
15 #include "src/messages.h" | 15 #include "src/messages.h" |
16 #include "src/property-details.h" | 16 #include "src/property-details.h" |
17 #include "src/prototype.h" | 17 #include "src/prototype.h" |
18 | 18 |
19 namespace v8 { | 19 namespace v8 { |
20 namespace internal { | 20 namespace internal { |
21 | 21 |
22 | 22 |
23 Handle<AccessorInfo> Accessors::MakeAccessor( | 23 Handle<AccessorInfo> Accessors::MakeAccessor( |
24 Isolate* isolate, | 24 Isolate* isolate, |
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<ExecutableAccessorInfo> info = factory->NewExecutableAccessorInfo(); | 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_name(*name); | 35 info->set_name(*name); |
36 Handle<Object> get = v8::FromCData(isolate, getter); | 36 Handle<Object> get = v8::FromCData(isolate, getter); |
37 Handle<Object> set = v8::FromCData(isolate, setter); | 37 Handle<Object> set = v8::FromCData(isolate, setter); |
38 info->set_getter(*get); | 38 info->set_getter(*get); |
39 info->set_setter(*set); | 39 info->set_setter(*set); |
40 return info; | 40 return info; |
41 } | 41 } |
42 | 42 |
43 | 43 |
44 Handle<ExecutableAccessorInfo> Accessors::CloneAccessor( | 44 Handle<AccessorInfo> Accessors::CloneAccessor(Isolate* isolate, |
45 Isolate* isolate, | 45 Handle<AccessorInfo> accessor) { |
46 Handle<ExecutableAccessorInfo> accessor) { | |
47 Factory* factory = isolate->factory(); | 46 Factory* factory = isolate->factory(); |
48 Handle<ExecutableAccessorInfo> info = factory->NewExecutableAccessorInfo(); | 47 Handle<AccessorInfo> info = factory->NewAccessorInfo(); |
49 info->set_name(accessor->name()); | 48 info->set_name(accessor->name()); |
50 info->set_flag(accessor->flag()); | 49 info->set_flag(accessor->flag()); |
51 info->set_expected_receiver_type(accessor->expected_receiver_type()); | 50 info->set_expected_receiver_type(accessor->expected_receiver_type()); |
52 info->set_getter(accessor->getter()); | 51 info->set_getter(accessor->getter()); |
53 info->set_setter(accessor->setter()); | 52 info->set_setter(accessor->setter()); |
54 info->set_data(accessor->data()); | 53 info->set_data(accessor->data()); |
55 return info; | 54 return info; |
56 } | 55 } |
57 | 56 |
58 | 57 |
(...skipping 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1446 context->set(slot, *v8::Utils::OpenHandle(*value)); | 1445 context->set(slot, *v8::Utils::OpenHandle(*value)); |
1447 } | 1446 } |
1448 | 1447 |
1449 | 1448 |
1450 Handle<AccessorInfo> Accessors::MakeModuleExport( | 1449 Handle<AccessorInfo> Accessors::MakeModuleExport( |
1451 Handle<String> name, | 1450 Handle<String> name, |
1452 int index, | 1451 int index, |
1453 PropertyAttributes attributes) { | 1452 PropertyAttributes attributes) { |
1454 Isolate* isolate = name->GetIsolate(); | 1453 Isolate* isolate = name->GetIsolate(); |
1455 Factory* factory = isolate->factory(); | 1454 Factory* factory = isolate->factory(); |
1456 Handle<ExecutableAccessorInfo> info = factory->NewExecutableAccessorInfo(); | 1455 Handle<AccessorInfo> info = factory->NewAccessorInfo(); |
1457 info->set_property_attributes(attributes); | 1456 info->set_property_attributes(attributes); |
1458 info->set_all_can_read(true); | 1457 info->set_all_can_read(true); |
1459 info->set_all_can_write(true); | 1458 info->set_all_can_write(true); |
1460 info->set_name(*name); | 1459 info->set_name(*name); |
1461 info->set_data(Smi::FromInt(index)); | 1460 info->set_data(Smi::FromInt(index)); |
1462 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); | 1461 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); |
1463 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); | 1462 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); |
1464 info->set_getter(*getter); | 1463 info->set_getter(*getter); |
1465 if (!(attributes & ReadOnly)) info->set_setter(*setter); | 1464 if (!(attributes & ReadOnly)) info->set_setter(*setter); |
1466 return info; | 1465 return info; |
1467 } | 1466 } |
1468 | 1467 |
1469 | 1468 |
1470 } // namespace internal | 1469 } // namespace internal |
1471 } // namespace v8 | 1470 } // namespace v8 |
OLD | NEW |