| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/arguments.h" | 8 #include "src/arguments.h" |
| 9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
| 10 #include "src/debug.h" | 10 #include "src/debug.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 // Check if the name is trivially convertible to an index and get the element | 131 // Check if the name is trivially convertible to an index and get the element |
| 132 // if so. | 132 // if so. |
| 133 uint32_t index; | 133 uint32_t index; |
| 134 if (name->AsArrayIndex(&index)) { | 134 if (name->AsArrayIndex(&index)) { |
| 135 Handle<FixedArray> details = isolate->factory()->NewFixedArray(2); | 135 Handle<FixedArray> details = isolate->factory()->NewFixedArray(2); |
| 136 Handle<Object> element_or_char; | 136 Handle<Object> element_or_char; |
| 137 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 137 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 138 isolate, element_or_char, | 138 isolate, element_or_char, |
| 139 Runtime::GetElementOrCharAt(isolate, obj, index)); | 139 Runtime::GetElementOrCharAt(isolate, obj, index)); |
| 140 details->set(0, *element_or_char); | 140 details->set(0, *element_or_char); |
| 141 details->set(1, PropertyDetails(NONE, DATA, 0).AsSmi()); | 141 details->set( |
| 142 1, PropertyDetails(NONE, DATA, 0, PropertyCellType::kInvalid).AsSmi()); |
| 142 return *isolate->factory()->NewJSArrayWithElements(details); | 143 return *isolate->factory()->NewJSArrayWithElements(details); |
| 143 } | 144 } |
| 144 | 145 |
| 145 LookupIterator it(obj, name, LookupIterator::HIDDEN); | 146 LookupIterator it(obj, name, LookupIterator::HIDDEN); |
| 146 bool has_caught = false; | 147 bool has_caught = false; |
| 147 Handle<Object> value = DebugGetProperty(&it, &has_caught); | 148 Handle<Object> value = DebugGetProperty(&it, &has_caught); |
| 148 if (!it.IsFound()) return isolate->heap()->undefined_value(); | 149 if (!it.IsFound()) return isolate->heap()->undefined_value(); |
| 149 | 150 |
| 150 Handle<Object> maybe_pair; | 151 Handle<Object> maybe_pair; |
| 151 if (it.state() == LookupIterator::ACCESSOR) { | 152 if (it.state() == LookupIterator::ACCESSOR) { |
| 152 maybe_pair = it.GetAccessors(); | 153 maybe_pair = it.GetAccessors(); |
| 153 } | 154 } |
| 154 | 155 |
| 155 // If the callback object is a fixed array then it contains JavaScript | 156 // If the callback object is a fixed array then it contains JavaScript |
| 156 // getter and/or setter. | 157 // getter and/or setter. |
| 157 bool has_js_accessors = !maybe_pair.is_null() && maybe_pair->IsAccessorPair(); | 158 bool has_js_accessors = !maybe_pair.is_null() && maybe_pair->IsAccessorPair(); |
| 158 Handle<FixedArray> details = | 159 Handle<FixedArray> details = |
| 159 isolate->factory()->NewFixedArray(has_js_accessors ? 6 : 3); | 160 isolate->factory()->NewFixedArray(has_js_accessors ? 6 : 3); |
| 160 details->set(0, *value); | 161 details->set(0, *value); |
| 161 // TODO(verwaest): Get rid of this random way of handling interceptors. | 162 // TODO(verwaest): Get rid of this random way of handling interceptors. |
| 162 PropertyDetails d = it.state() == LookupIterator::INTERCEPTOR | 163 PropertyDetails d = |
| 163 ? PropertyDetails(NONE, DATA, 0) | 164 it.state() == LookupIterator::INTERCEPTOR |
| 164 : it.property_details(); | 165 ? PropertyDetails(NONE, DATA, 0, PropertyCellType::kInvalid) |
| 166 : it.property_details(); |
| 165 details->set(1, d.AsSmi()); | 167 details->set(1, d.AsSmi()); |
| 166 details->set( | 168 details->set( |
| 167 2, isolate->heap()->ToBoolean(it.state() == LookupIterator::INTERCEPTOR)); | 169 2, isolate->heap()->ToBoolean(it.state() == LookupIterator::INTERCEPTOR)); |
| 168 if (has_js_accessors) { | 170 if (has_js_accessors) { |
| 169 AccessorPair* accessors = AccessorPair::cast(*maybe_pair); | 171 AccessorPair* accessors = AccessorPair::cast(*maybe_pair); |
| 170 details->set(3, isolate->heap()->ToBoolean(has_caught)); | 172 details->set(3, isolate->heap()->ToBoolean(has_caught)); |
| 171 details->set(4, accessors->GetComponent(ACCESSOR_GETTER)); | 173 details->set(4, accessors->GetComponent(ACCESSOR_GETTER)); |
| 172 details->set(5, accessors->GetComponent(ACCESSOR_SETTER)); | 174 details->set(5, accessors->GetComponent(ACCESSOR_SETTER)); |
| 173 } | 175 } |
| 174 | 176 |
| (...skipping 2645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2820 return Smi::FromInt(isolate->debug()->is_active()); | 2822 return Smi::FromInt(isolate->debug()->is_active()); |
| 2821 } | 2823 } |
| 2822 | 2824 |
| 2823 | 2825 |
| 2824 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { | 2826 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { |
| 2825 UNIMPLEMENTED(); | 2827 UNIMPLEMENTED(); |
| 2826 return NULL; | 2828 return NULL; |
| 2827 } | 2829 } |
| 2828 } | 2830 } |
| 2829 } // namespace v8::internal | 2831 } // namespace v8::internal |
| OLD | NEW |