| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 String* name, | 198 String* name, |
| 199 PropertyAttributes* attributes) { | 199 PropertyAttributes* attributes) { |
| 200 LookupResult result(name->GetIsolate()); | 200 LookupResult result(name->GetIsolate()); |
| 201 Lookup(name, &result); | 201 Lookup(name, &result); |
| 202 MaybeObject* value = GetProperty(receiver, &result, name, attributes); | 202 MaybeObject* value = GetProperty(receiver, &result, name, attributes); |
| 203 ASSERT(*attributes <= ABSENT); | 203 ASSERT(*attributes <= ABSENT); |
| 204 return value; | 204 return value; |
| 205 } | 205 } |
| 206 | 206 |
| 207 | 207 |
| 208 // This may seem strange but the standard requires inline static const | |
| 209 // definition, and w/o these the code doesn't link when being built in debug | |
| 210 // mode using gcc. | |
| 211 const int JSObject::kGetterIndex; | |
| 212 const int JSObject::kSetterIndex; | |
| 213 | |
| 214 | |
| 215 MaybeObject* JSObject::GetPropertyWithCallback(Object* receiver, | 208 MaybeObject* JSObject::GetPropertyWithCallback(Object* receiver, |
| 216 Object* structure, | 209 Object* structure, |
| 217 String* name) { | 210 String* name) { |
| 218 Isolate* isolate = name->GetIsolate(); | 211 Isolate* isolate = name->GetIsolate(); |
| 219 // To accommodate both the old and the new api we switch on the | 212 // To accommodate both the old and the new api we switch on the |
| 220 // data structure used to store the callbacks. Eventually foreign | 213 // data structure used to store the callbacks. Eventually foreign |
| 221 // callbacks should be phased out. | 214 // callbacks should be phased out. |
| 222 if (structure->IsForeign()) { | 215 if (structure->IsForeign()) { |
| 223 AccessorDescriptor* callback = | 216 AccessorDescriptor* callback = |
| 224 reinterpret_cast<AccessorDescriptor*>( | 217 reinterpret_cast<AccessorDescriptor*>( |
| (...skipping 4406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4631 AssertNoContextChange ncc; | 4624 AssertNoContextChange ncc; |
| 4632 | 4625 |
| 4633 // Check access rights if needed. | 4626 // Check access rights if needed. |
| 4634 if (IsAccessCheckNeeded() && | 4627 if (IsAccessCheckNeeded() && |
| 4635 !heap->isolate()->MayNamedAccess(this, name, v8::ACCESS_HAS)) { | 4628 !heap->isolate()->MayNamedAccess(this, name, v8::ACCESS_HAS)) { |
| 4636 heap->isolate()->ReportFailedAccessCheck(this, v8::ACCESS_HAS); | 4629 heap->isolate()->ReportFailedAccessCheck(this, v8::ACCESS_HAS); |
| 4637 return heap->undefined_value(); | 4630 return heap->undefined_value(); |
| 4638 } | 4631 } |
| 4639 | 4632 |
| 4640 // Make the lookup and include prototypes. | 4633 // Make the lookup and include prototypes. |
| 4641 int accessor_index = is_getter ? kGetterIndex : kSetterIndex; | 4634 // Introducing constants below makes static constants usage purely static |
| 4635 // and avoids linker errors in debug build using gcc. |
| 4636 const int getter_index = kGetterIndex; |
| 4637 const int setter_index = kSetterIndex; |
| 4638 int accessor_index = is_getter ? getter_index : setter_index; |
| 4642 uint32_t index = 0; | 4639 uint32_t index = 0; |
| 4643 if (name->AsArrayIndex(&index)) { | 4640 if (name->AsArrayIndex(&index)) { |
| 4644 for (Object* obj = this; | 4641 for (Object* obj = this; |
| 4645 obj != heap->null_value(); | 4642 obj != heap->null_value(); |
| 4646 obj = JSObject::cast(obj)->GetPrototype()) { | 4643 obj = JSObject::cast(obj)->GetPrototype()) { |
| 4647 JSObject* js_object = JSObject::cast(obj); | 4644 JSObject* js_object = JSObject::cast(obj); |
| 4648 if (js_object->HasDictionaryElements()) { | 4645 if (js_object->HasDictionaryElements()) { |
| 4649 NumberDictionary* dictionary = js_object->element_dictionary(); | 4646 NumberDictionary* dictionary = js_object->element_dictionary(); |
| 4650 int entry = dictionary->FindEntry(index); | 4647 int entry = dictionary->FindEntry(index); |
| 4651 if (entry != NumberDictionary::kNotFound) { | 4648 if (entry != NumberDictionary::kNotFound) { |
| (...skipping 7887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12539 if (break_point_objects()->IsUndefined()) return 0; | 12536 if (break_point_objects()->IsUndefined()) return 0; |
| 12540 // Single break point. | 12537 // Single break point. |
| 12541 if (!break_point_objects()->IsFixedArray()) return 1; | 12538 if (!break_point_objects()->IsFixedArray()) return 1; |
| 12542 // Multiple break points. | 12539 // Multiple break points. |
| 12543 return FixedArray::cast(break_point_objects())->length(); | 12540 return FixedArray::cast(break_point_objects())->length(); |
| 12544 } | 12541 } |
| 12545 #endif // ENABLE_DEBUGGER_SUPPORT | 12542 #endif // ENABLE_DEBUGGER_SUPPORT |
| 12546 | 12543 |
| 12547 | 12544 |
| 12548 } } // namespace v8::internal | 12545 } } // namespace v8::internal |
| OLD | NEW |