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/debug.h" | 9 #include "src/debug.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 // Check if the name is trivially convertible to an index and get the element | 129 // Check if the name is trivially convertible to an index and get the element |
130 // if so. | 130 // if so. |
131 uint32_t index; | 131 uint32_t index; |
132 if (name->AsArrayIndex(&index)) { | 132 if (name->AsArrayIndex(&index)) { |
133 Handle<FixedArray> details = isolate->factory()->NewFixedArray(2); | 133 Handle<FixedArray> details = isolate->factory()->NewFixedArray(2); |
134 Handle<Object> element_or_char; | 134 Handle<Object> element_or_char; |
135 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 135 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
136 isolate, element_or_char, | 136 isolate, element_or_char, |
137 Runtime::GetElementOrCharAt(isolate, obj, index)); | 137 Runtime::GetElementOrCharAt(isolate, obj, index)); |
138 details->set(0, *element_or_char); | 138 details->set(0, *element_or_char); |
139 details->set(1, PropertyDetails(NONE, FIELD, 0).AsSmi()); | 139 details->set(1, PropertyDetails(NONE, DATA, 0).AsSmi()); |
140 return *isolate->factory()->NewJSArrayWithElements(details); | 140 return *isolate->factory()->NewJSArrayWithElements(details); |
141 } | 141 } |
142 | 142 |
143 LookupIterator it(obj, name, LookupIterator::HIDDEN); | 143 LookupIterator it(obj, name, LookupIterator::HIDDEN); |
144 bool has_caught = false; | 144 bool has_caught = false; |
145 Handle<Object> value = DebugGetProperty(&it, &has_caught); | 145 Handle<Object> value = DebugGetProperty(&it, &has_caught); |
146 if (!it.IsFound()) return isolate->heap()->undefined_value(); | 146 if (!it.IsFound()) return isolate->heap()->undefined_value(); |
147 | 147 |
148 Handle<Object> maybe_pair; | 148 Handle<Object> maybe_pair; |
149 if (it.state() == LookupIterator::ACCESSOR) { | 149 if (it.state() == LookupIterator::ACCESSOR) { |
150 maybe_pair = it.GetAccessors(); | 150 maybe_pair = it.GetAccessors(); |
151 } | 151 } |
152 | 152 |
153 // If the callback object is a fixed array then it contains JavaScript | 153 // If the callback object is a fixed array then it contains JavaScript |
154 // getter and/or setter. | 154 // getter and/or setter. |
155 bool has_js_accessors = !maybe_pair.is_null() && maybe_pair->IsAccessorPair(); | 155 bool has_js_accessors = !maybe_pair.is_null() && maybe_pair->IsAccessorPair(); |
156 Handle<FixedArray> details = | 156 Handle<FixedArray> details = |
157 isolate->factory()->NewFixedArray(has_js_accessors ? 6 : 3); | 157 isolate->factory()->NewFixedArray(has_js_accessors ? 6 : 3); |
158 details->set(0, *value); | 158 details->set(0, *value); |
159 // TODO(verwaest): Get rid of this random way of handling interceptors. | 159 // TODO(verwaest): Get rid of this random way of handling interceptors. |
160 PropertyDetails d = it.state() == LookupIterator::INTERCEPTOR | 160 PropertyDetails d = it.state() == LookupIterator::INTERCEPTOR |
161 ? PropertyDetails(NONE, FIELD, 0) | 161 ? PropertyDetails(NONE, DATA, 0) |
162 : it.property_details(); | 162 : it.property_details(); |
163 details->set(1, d.AsSmi()); | 163 details->set(1, d.AsSmi()); |
164 details->set( | 164 details->set( |
165 2, isolate->heap()->ToBoolean(it.state() == LookupIterator::INTERCEPTOR)); | 165 2, isolate->heap()->ToBoolean(it.state() == LookupIterator::INTERCEPTOR)); |
166 if (has_js_accessors) { | 166 if (has_js_accessors) { |
167 AccessorPair* accessors = AccessorPair::cast(*maybe_pair); | 167 AccessorPair* accessors = AccessorPair::cast(*maybe_pair); |
168 details->set(3, isolate->heap()->ToBoolean(has_caught)); | 168 details->set(3, isolate->heap()->ToBoolean(has_caught)); |
169 details->set(4, accessors->GetComponent(ACCESSOR_GETTER)); | 169 details->set(4, accessors->GetComponent(ACCESSOR_GETTER)); |
170 details->set(5, accessors->GetComponent(ACCESSOR_SETTER)); | 170 details->set(5, accessors->GetComponent(ACCESSOR_SETTER)); |
171 } | 171 } |
(...skipping 2637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2809 return Smi::FromInt(isolate->debug()->is_active()); | 2809 return Smi::FromInt(isolate->debug()->is_active()); |
2810 } | 2810 } |
2811 | 2811 |
2812 | 2812 |
2813 RUNTIME_FUNCTION(RuntimeReference_DebugBreakInOptimizedCode) { | 2813 RUNTIME_FUNCTION(RuntimeReference_DebugBreakInOptimizedCode) { |
2814 UNIMPLEMENTED(); | 2814 UNIMPLEMENTED(); |
2815 return NULL; | 2815 return NULL; |
2816 } | 2816 } |
2817 } | 2817 } |
2818 } // namespace v8::internal | 2818 } // namespace v8::internal |
OLD | NEW |