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 "v8.h" | 5 #include "v8.h" |
6 #include "accessors.h" | 6 #include "accessors.h" |
7 | 7 |
8 #include "compiler.h" | 8 #include "compiler.h" |
9 #include "contexts.h" | 9 #include "contexts.h" |
10 #include "deoptimizer.h" | 10 #include "deoptimizer.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 info->set_prohibits_overwriting(false); | 44 info->set_prohibits_overwriting(false); |
45 info->set_name(*name); | 45 info->set_name(*name); |
46 Handle<Object> get = v8::FromCData(isolate, getter); | 46 Handle<Object> get = v8::FromCData(isolate, getter); |
47 Handle<Object> set = v8::FromCData(isolate, setter); | 47 Handle<Object> set = v8::FromCData(isolate, setter); |
48 info->set_getter(*get); | 48 info->set_getter(*get); |
49 info->set_setter(*set); | 49 info->set_setter(*set); |
50 return info; | 50 return info; |
51 } | 51 } |
52 | 52 |
53 | 53 |
| 54 Handle<ExecutableAccessorInfo> Accessors::CloneAccessor( |
| 55 Isolate* isolate, |
| 56 Handle<ExecutableAccessorInfo> accessor) { |
| 57 Factory* factory = isolate->factory(); |
| 58 Handle<ExecutableAccessorInfo> info = factory->NewExecutableAccessorInfo(); |
| 59 info->set_name(accessor->name()); |
| 60 info->set_flag(accessor->flag()); |
| 61 info->set_expected_receiver_type(accessor->expected_receiver_type()); |
| 62 info->set_getter(accessor->getter()); |
| 63 info->set_setter(accessor->setter()); |
| 64 info->set_data(accessor->data()); |
| 65 return info; |
| 66 } |
| 67 |
| 68 |
54 template <class C> | 69 template <class C> |
55 static C* FindInstanceOf(Isolate* isolate, Object* obj) { | 70 static C* FindInstanceOf(Isolate* isolate, Object* obj) { |
56 for (Object* cur = obj; !cur->IsNull(); cur = cur->GetPrototype(isolate)) { | 71 for (Object* cur = obj; !cur->IsNull(); cur = cur->GetPrototype(isolate)) { |
57 if (Is<C>(cur)) return C::cast(cur); | 72 if (Is<C>(cur)) return C::cast(cur); |
58 } | 73 } |
59 return NULL; | 74 return NULL; |
60 } | 75 } |
61 | 76 |
62 | 77 |
63 static V8_INLINE bool CheckForName(Handle<String> name, | 78 static V8_INLINE bool CheckForName(Handle<String> name, |
(...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1338 info->set_data(Smi::FromInt(index)); | 1353 info->set_data(Smi::FromInt(index)); |
1339 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); | 1354 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); |
1340 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); | 1355 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); |
1341 info->set_getter(*getter); | 1356 info->set_getter(*getter); |
1342 if (!(attributes & ReadOnly)) info->set_setter(*setter); | 1357 if (!(attributes & ReadOnly)) info->set_setter(*setter); |
1343 return info; | 1358 return info; |
1344 } | 1359 } |
1345 | 1360 |
1346 | 1361 |
1347 } } // namespace v8::internal | 1362 } } // namespace v8::internal |
OLD | NEW |