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(1, PropertyDetails::Empty().AsSmi()); |
142 return *isolate->factory()->NewJSArrayWithElements(details); | 142 return *isolate->factory()->NewJSArrayWithElements(details); |
143 } | 143 } |
144 | 144 |
145 LookupIterator it(obj, name, LookupIterator::HIDDEN); | 145 LookupIterator it(obj, name, LookupIterator::HIDDEN); |
146 bool has_caught = false; | 146 bool has_caught = false; |
147 Handle<Object> value = DebugGetProperty(&it, &has_caught); | 147 Handle<Object> value = DebugGetProperty(&it, &has_caught); |
148 if (!it.IsFound()) return isolate->heap()->undefined_value(); | 148 if (!it.IsFound()) return isolate->heap()->undefined_value(); |
149 | 149 |
150 Handle<Object> maybe_pair; | 150 Handle<Object> maybe_pair; |
151 if (it.state() == LookupIterator::ACCESSOR) { | 151 if (it.state() == LookupIterator::ACCESSOR) { |
152 maybe_pair = it.GetAccessors(); | 152 maybe_pair = it.GetAccessors(); |
153 } | 153 } |
154 | 154 |
155 // If the callback object is a fixed array then it contains JavaScript | 155 // If the callback object is a fixed array then it contains JavaScript |
156 // getter and/or setter. | 156 // getter and/or setter. |
157 bool has_js_accessors = !maybe_pair.is_null() && maybe_pair->IsAccessorPair(); | 157 bool has_js_accessors = !maybe_pair.is_null() && maybe_pair->IsAccessorPair(); |
158 Handle<FixedArray> details = | 158 Handle<FixedArray> details = |
159 isolate->factory()->NewFixedArray(has_js_accessors ? 6 : 3); | 159 isolate->factory()->NewFixedArray(has_js_accessors ? 6 : 3); |
160 details->set(0, *value); | 160 details->set(0, *value); |
161 // TODO(verwaest): Get rid of this random way of handling interceptors. | 161 // TODO(verwaest): Get rid of this random way of handling interceptors. |
162 PropertyDetails d = it.state() == LookupIterator::INTERCEPTOR | 162 PropertyDetails d = it.state() == LookupIterator::INTERCEPTOR |
163 ? PropertyDetails(NONE, DATA, 0) | 163 ? PropertyDetails::Empty() |
164 : it.property_details(); | 164 : it.property_details(); |
165 details->set(1, d.AsSmi()); | 165 details->set(1, d.AsSmi()); |
166 details->set( | 166 details->set( |
167 2, isolate->heap()->ToBoolean(it.state() == LookupIterator::INTERCEPTOR)); | 167 2, isolate->heap()->ToBoolean(it.state() == LookupIterator::INTERCEPTOR)); |
168 if (has_js_accessors) { | 168 if (has_js_accessors) { |
169 AccessorPair* accessors = AccessorPair::cast(*maybe_pair); | 169 AccessorPair* accessors = AccessorPair::cast(*maybe_pair); |
170 details->set(3, isolate->heap()->ToBoolean(has_caught)); | 170 details->set(3, isolate->heap()->ToBoolean(has_caught)); |
171 details->set(4, accessors->GetComponent(ACCESSOR_GETTER)); | 171 details->set(4, accessors->GetComponent(ACCESSOR_GETTER)); |
172 details->set(5, accessors->GetComponent(ACCESSOR_SETTER)); | 172 details->set(5, accessors->GetComponent(ACCESSOR_SETTER)); |
173 } | 173 } |
(...skipping 2646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2820 return Smi::FromInt(isolate->debug()->is_active()); | 2820 return Smi::FromInt(isolate->debug()->is_active()); |
2821 } | 2821 } |
2822 | 2822 |
2823 | 2823 |
2824 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { | 2824 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { |
2825 UNIMPLEMENTED(); | 2825 UNIMPLEMENTED(); |
2826 return NULL; | 2826 return NULL; |
2827 } | 2827 } |
2828 } | 2828 } |
2829 } // namespace v8::internal | 2829 } // namespace v8::internal |
OLD | NEW |