Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: src/runtime/runtime-debug.cc

Issue 733253004: PropertyDetails cleanup: NORMAL property type merged with FIELD. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: cleanup Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/runtime/runtime.cc ('k') | src/runtime/runtime-object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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, 139 details->set(1, PropertyDetails(NONE, FIELD, 0).AsSmi());
140 PropertyDetails(NONE, NORMAL, Representation::None()).AsSmi());
141 return *isolate->factory()->NewJSArrayWithElements(details); 140 return *isolate->factory()->NewJSArrayWithElements(details);
142 } 141 }
143 142
144 LookupIterator it(obj, name, LookupIterator::HIDDEN); 143 LookupIterator it(obj, name, LookupIterator::HIDDEN);
145 bool has_caught = false; 144 bool has_caught = false;
146 Handle<Object> value = DebugGetProperty(&it, &has_caught); 145 Handle<Object> value = DebugGetProperty(&it, &has_caught);
147 if (!it.IsFound()) return isolate->heap()->undefined_value(); 146 if (!it.IsFound()) return isolate->heap()->undefined_value();
148 147
149 Handle<Object> maybe_pair; 148 Handle<Object> maybe_pair;
150 if (it.state() == LookupIterator::ACCESSOR) { 149 if (it.state() == LookupIterator::ACCESSOR) {
151 maybe_pair = it.GetAccessors(); 150 maybe_pair = it.GetAccessors();
152 } 151 }
153 152
154 // 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
155 // getter and/or setter. 154 // getter and/or setter.
156 bool has_js_accessors = !maybe_pair.is_null() && maybe_pair->IsAccessorPair(); 155 bool has_js_accessors = !maybe_pair.is_null() && maybe_pair->IsAccessorPair();
157 Handle<FixedArray> details = 156 Handle<FixedArray> details =
158 isolate->factory()->NewFixedArray(has_js_accessors ? 6 : 3); 157 isolate->factory()->NewFixedArray(has_js_accessors ? 6 : 3);
159 details->set(0, *value); 158 details->set(0, *value);
160 // TODO(verwaest): Get rid of this random way of handling interceptors. 159 // TODO(verwaest): Get rid of this random way of handling interceptors.
161 PropertyDetails d = it.state() == LookupIterator::INTERCEPTOR 160 PropertyDetails d = it.state() == LookupIterator::INTERCEPTOR
162 ? PropertyDetails(NONE, NORMAL, 0) 161 ? PropertyDetails(NONE, FIELD, 0)
163 : it.property_details(); 162 : it.property_details();
164 details->set(1, d.AsSmi()); 163 details->set(1, d.AsSmi());
165 details->set( 164 details->set(
166 2, isolate->heap()->ToBoolean(it.state() == LookupIterator::INTERCEPTOR)); 165 2, isolate->heap()->ToBoolean(it.state() == LookupIterator::INTERCEPTOR));
167 if (has_js_accessors) { 166 if (has_js_accessors) {
168 AccessorPair* accessors = AccessorPair::cast(*maybe_pair); 167 AccessorPair* accessors = AccessorPair::cast(*maybe_pair);
169 details->set(3, isolate->heap()->ToBoolean(has_caught)); 168 details->set(3, isolate->heap()->ToBoolean(has_caught));
170 details->set(4, accessors->GetComponent(ACCESSOR_GETTER)); 169 details->set(4, accessors->GetComponent(ACCESSOR_GETTER));
171 details->set(5, accessors->GetComponent(ACCESSOR_SETTER)); 170 details->set(5, accessors->GetComponent(ACCESSOR_SETTER));
172 } 171 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 return Smi::FromInt(static_cast<int>(details.attributes())); 206 return Smi::FromInt(static_cast<int>(details.attributes()));
208 } 207 }
209 208
210 209
211 // Return the property insertion index calculated from the property details. 210 // Return the property insertion index calculated from the property details.
212 // args[0]: smi with property details. 211 // args[0]: smi with property details.
213 RUNTIME_FUNCTION(Runtime_DebugPropertyIndexFromDetails) { 212 RUNTIME_FUNCTION(Runtime_DebugPropertyIndexFromDetails) {
214 SealHandleScope shs(isolate); 213 SealHandleScope shs(isolate);
215 DCHECK(args.length() == 1); 214 DCHECK(args.length() == 1);
216 CONVERT_PROPERTY_DETAILS_CHECKED(details, 0); 215 CONVERT_PROPERTY_DETAILS_CHECKED(details, 0);
217 // TODO(verwaest): Depends on the type of details. 216 // TODO(verwaest): Works only for dictionary mode holders.
218 return Smi::FromInt(details.dictionary_index()); 217 return Smi::FromInt(details.dictionary_index());
219 } 218 }
220 219
221 220
222 // Return property value from named interceptor. 221 // Return property value from named interceptor.
223 // args[0]: object 222 // args[0]: object
224 // args[1]: property name 223 // args[1]: property name
225 RUNTIME_FUNCTION(Runtime_DebugNamedInterceptorPropertyValue) { 224 RUNTIME_FUNCTION(Runtime_DebugNamedInterceptorPropertyValue) {
226 HandleScope scope(isolate); 225 HandleScope scope(isolate);
227 DCHECK(args.length() == 2); 226 DCHECK(args.length() == 2);
(...skipping 2580 matching lines...) Expand 10 before | Expand all | Expand 10 after
2808 return Smi::FromInt(isolate->debug()->is_active()); 2807 return Smi::FromInt(isolate->debug()->is_active());
2809 } 2808 }
2810 2809
2811 2810
2812 RUNTIME_FUNCTION(RuntimeReference_DebugBreakInOptimizedCode) { 2811 RUNTIME_FUNCTION(RuntimeReference_DebugBreakInOptimizedCode) {
2813 UNIMPLEMENTED(); 2812 UNIMPLEMENTED();
2814 return NULL; 2813 return NULL;
2815 } 2814 }
2816 } 2815 }
2817 } // namespace v8::internal 2816 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime/runtime.cc ('k') | src/runtime/runtime-object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698