| 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" |
| 11 #include "src/deoptimizer.h" | 11 #include "src/deoptimizer.h" |
| 12 #include "src/execution.h" | 12 #include "src/execution.h" |
| 13 #include "src/factory.h" | 13 #include "src/factory.h" |
| 14 #include "src/frames-inl.h" | 14 #include "src/frames-inl.h" |
| 15 #include "src/isolate.h" | 15 #include "src/isolate.h" |
| 16 #include "src/list-inl.h" | 16 #include "src/list-inl.h" |
| 17 #include "src/property-details.h" | 17 #include "src/property-details.h" |
| 18 #include "src/prototype.h" |
| 18 | 19 |
| 19 namespace v8 { | 20 namespace v8 { |
| 20 namespace internal { | 21 namespace internal { |
| 21 | 22 |
| 22 | 23 |
| 23 // We have a slight impedance mismatch between the external API and the way we | 24 // We have a slight impedance mismatch between the external API and the way we |
| 24 // use callbacks internally: Externally, callbacks can only be used with | 25 // use callbacks internally: Externally, callbacks can only be used with |
| 25 // v8::Object, but internally we even have callbacks on entities which are | 26 // v8::Object, but internally we even have callbacks on entities which are |
| 26 // higher in the hierarchy, so we can only return i::Object here, not | 27 // higher in the hierarchy, so we can only return i::Object here, not |
| 27 // i::JSObject. | 28 // i::JSObject. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 info->set_expected_receiver_type(accessor->expected_receiver_type()); | 61 info->set_expected_receiver_type(accessor->expected_receiver_type()); |
| 61 info->set_getter(accessor->getter()); | 62 info->set_getter(accessor->getter()); |
| 62 info->set_setter(accessor->setter()); | 63 info->set_setter(accessor->setter()); |
| 63 info->set_data(accessor->data()); | 64 info->set_data(accessor->data()); |
| 64 return info; | 65 return info; |
| 65 } | 66 } |
| 66 | 67 |
| 67 | 68 |
| 68 template <class C> | 69 template <class C> |
| 69 static C* FindInstanceOf(Isolate* isolate, Object* obj) { | 70 static C* FindInstanceOf(Isolate* isolate, Object* obj) { |
| 70 for (Object* cur = obj; !cur->IsNull(); cur = cur->GetPrototype(isolate)) { | 71 for (PrototypeIterator iter(isolate, obj, |
| 71 if (Is<C>(cur)) return C::cast(cur); | 72 PrototypeIterator::START_AT_RECEIVER); |
| 73 !iter.IsAtEnd(); iter.Advance()) { |
| 74 if (Is<C>(iter.GetCurrent())) return C::cast(iter.GetCurrent()); |
| 72 } | 75 } |
| 73 return NULL; | 76 return NULL; |
| 74 } | 77 } |
| 75 | 78 |
| 76 | 79 |
| 77 static V8_INLINE bool CheckForName(Handle<String> name, | 80 static V8_INLINE bool CheckForName(Handle<String> name, |
| 78 Handle<String> property_name, | 81 Handle<String> property_name, |
| 79 int offset, | 82 int offset, |
| 80 int* object_offset) { | 83 int* object_offset) { |
| 81 if (String::Equals(name, property_name)) { | 84 if (String::Equals(name, property_name)) { |
| (...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1420 info->set_data(Smi::FromInt(index)); | 1423 info->set_data(Smi::FromInt(index)); |
| 1421 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); | 1424 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); |
| 1422 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); | 1425 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); |
| 1423 info->set_getter(*getter); | 1426 info->set_getter(*getter); |
| 1424 if (!(attributes & ReadOnly)) info->set_setter(*setter); | 1427 if (!(attributes & ReadOnly)) info->set_setter(*setter); |
| 1425 return info; | 1428 return info; |
| 1426 } | 1429 } |
| 1427 | 1430 |
| 1428 | 1431 |
| 1429 } } // namespace v8::internal | 1432 } } // namespace v8::internal |
| OLD | NEW |