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

Side by Side Diff: src/objects.cc

Issue 300283002: Introduce FieldIndex to unify and abstract property/field offset (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix mutable boxed double runtime function Created 6 years, 6 months 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 | Annotate | Revision Log
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/allocation-site-scopes.h" 8 #include "src/allocation-site-scopes.h"
9 #include "src/api.h" 9 #include "src/api.h"
10 #include "src/arguments.h" 10 #include "src/arguments.h"
11 #include "src/bootstrapper.h" 11 #include "src/bootstrapper.h"
12 #include "src/codegen.h" 12 #include "src/codegen.h"
13 #include "src/code-stubs.h" 13 #include "src/code-stubs.h"
14 #include "src/cpu-profiler.h" 14 #include "src/cpu-profiler.h"
15 #include "src/debug.h" 15 #include "src/debug.h"
16 #include "src/deoptimizer.h" 16 #include "src/deoptimizer.h"
17 #include "src/date.h" 17 #include "src/date.h"
18 #include "src/elements.h" 18 #include "src/elements.h"
19 #include "src/execution.h" 19 #include "src/execution.h"
20 #include "src/field-index.h"
21 #include "src/field-index-inl.h"
20 #include "src/full-codegen.h" 22 #include "src/full-codegen.h"
21 #include "src/hydrogen.h" 23 #include "src/hydrogen.h"
22 #include "src/isolate-inl.h" 24 #include "src/isolate-inl.h"
23 #include "src/log.h" 25 #include "src/log.h"
24 #include "src/objects-inl.h" 26 #include "src/objects-inl.h"
25 #include "src/objects-visiting-inl.h" 27 #include "src/objects-visiting-inl.h"
26 #include "src/macro-assembler.h" 28 #include "src/macro-assembler.h"
27 #include "src/mark-compact.h" 29 #include "src/mark-compact.h"
28 #include "src/safepoint-table.h" 30 #include "src/safepoint-table.h"
29 #include "src/string-search.h" 31 #include "src/string-search.h"
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 842
841 Handle<Object> value; 843 Handle<Object> value;
842 switch (result->type()) { 844 switch (result->type()) {
843 case NORMAL: { 845 case NORMAL: {
844 value = JSObject::GetNormalizedProperty( 846 value = JSObject::GetNormalizedProperty(
845 handle(result->holder(), isolate), result); 847 handle(result->holder(), isolate), result);
846 break; 848 break;
847 } 849 }
848 case FIELD: 850 case FIELD:
849 value = JSObject::FastPropertyAt(handle(result->holder(), isolate), 851 value = JSObject::FastPropertyAt(handle(result->holder(), isolate),
850 result->representation(), 852 result->representation(), FieldIndex::ForLookupResult(result));
851 result->GetFieldIndex().field_index());
852 break; 853 break;
853 case CONSTANT: 854 case CONSTANT:
854 return handle(result->GetConstant(), isolate); 855 return handle(result->GetConstant(), isolate);
855 case CALLBACKS: 856 case CALLBACKS:
856 return GetPropertyWithCallback( 857 return GetPropertyWithCallback(
857 receiver, name, handle(result->holder(), isolate), 858 receiver, name, handle(result->holder(), isolate),
858 handle(result->GetCallbackObject(), isolate)); 859 handle(result->GetCallbackObject(), isolate));
859 case HANDLER: 860 case HANDLER:
860 return JSProxy::GetPropertyWithHandler( 861 return JSProxy::GetPropertyWithHandler(
861 handle(result->proxy(), isolate), receiver, name); 862 handle(result->proxy(), isolate), receiver, name);
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after
2273 if (details.type() != FIELD) continue; 2274 if (details.type() != FIELD) continue;
2274 PropertyDetails old_details = old_descriptors->GetDetails(i); 2275 PropertyDetails old_details = old_descriptors->GetDetails(i);
2275 if (old_details.type() == CALLBACKS) { 2276 if (old_details.type() == CALLBACKS) {
2276 ASSERT(details.representation().IsTagged()); 2277 ASSERT(details.representation().IsTagged());
2277 continue; 2278 continue;
2278 } 2279 }
2279 ASSERT(old_details.type() == CONSTANT || 2280 ASSERT(old_details.type() == CONSTANT ||
2280 old_details.type() == FIELD); 2281 old_details.type() == FIELD);
2281 Object* raw_value = old_details.type() == CONSTANT 2282 Object* raw_value = old_details.type() == CONSTANT
2282 ? old_descriptors->GetValue(i) 2283 ? old_descriptors->GetValue(i)
2283 : object->RawFastPropertyAt(old_descriptors->GetFieldIndex(i)); 2284 : object->RawFastPropertyAt(FieldIndex::ForDescriptor(*old_map, i));
2284 Handle<Object> value(raw_value, isolate); 2285 Handle<Object> value(raw_value, isolate);
2285 if (!old_details.representation().IsDouble() && 2286 if (!old_details.representation().IsDouble() &&
2286 details.representation().IsDouble()) { 2287 details.representation().IsDouble()) {
2287 if (old_details.representation().IsNone()) { 2288 if (old_details.representation().IsNone()) {
2288 value = handle(Smi::FromInt(0), isolate); 2289 value = handle(Smi::FromInt(0), isolate);
2289 } 2290 }
2290 value = Object::NewStorageFor(isolate, value, details.representation()); 2291 value = Object::NewStorageFor(isolate, value, details.representation());
2291 } 2292 }
2292 ASSERT(!(details.representation().IsDouble() && value->IsSmi())); 2293 ASSERT(!(details.representation().IsDouble() && value->IsSmi()));
2293 int target_index = new_descriptors->GetFieldIndex(i) - inobject; 2294 int target_index = new_descriptors->GetFieldIndex(i) - inobject;
(...skipping 15 matching lines...) Expand all
2309 array->set(target_index, *value); 2310 array->set(target_index, *value);
2310 } 2311 }
2311 2312
2312 // From here on we cannot fail and we shouldn't GC anymore. 2313 // From here on we cannot fail and we shouldn't GC anymore.
2313 DisallowHeapAllocation no_allocation; 2314 DisallowHeapAllocation no_allocation;
2314 2315
2315 // Copy (real) inobject properties. If necessary, stop at number_of_fields to 2316 // Copy (real) inobject properties. If necessary, stop at number_of_fields to
2316 // avoid overwriting |one_pointer_filler_map|. 2317 // avoid overwriting |one_pointer_filler_map|.
2317 int limit = Min(inobject, number_of_fields); 2318 int limit = Min(inobject, number_of_fields);
2318 for (int i = 0; i < limit; i++) { 2319 for (int i = 0; i < limit; i++) {
2319 object->FastPropertyAtPut(i, array->get(external + i)); 2320 FieldIndex index = FieldIndex::ForPropertyIndex(*new_map, i);
2321 object->FastPropertyAtPut(index, array->get(external + i));
2320 } 2322 }
2321 2323
2322 // Create filler object past the new instance size. 2324 // Create filler object past the new instance size.
2323 int new_instance_size = new_map->instance_size(); 2325 int new_instance_size = new_map->instance_size();
2324 int instance_size_delta = old_map->instance_size() - new_instance_size; 2326 int instance_size_delta = old_map->instance_size() - new_instance_size;
2325 ASSERT(instance_size_delta >= 0); 2327 ASSERT(instance_size_delta >= 0);
2326 Address address = object->address() + new_instance_size; 2328 Address address = object->address() + new_instance_size;
2327 2329
2328 // The trimming is performed on a newly allocated object, which is on a 2330 // The trimming is performed on a newly allocated object, which is on a
2329 // fresly allocated page or on an already swept page. Hence, the sweeper 2331 // fresly allocated page or on an already swept page. Hence, the sweeper
(...skipping 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after
3519 map()->LookupDescriptor(this, *name, result); 3521 map()->LookupDescriptor(this, *name, result);
3520 // A property or a map transition was found. We return all of these result 3522 // A property or a map transition was found. We return all of these result
3521 // types because LookupOwnRealNamedProperty is used when setting 3523 // types because LookupOwnRealNamedProperty is used when setting
3522 // properties where map transitions are handled. 3524 // properties where map transitions are handled.
3523 ASSERT(!result->IsFound() || 3525 ASSERT(!result->IsFound() ||
3524 (result->holder() == this && result->IsFastPropertyType())); 3526 (result->holder() == this && result->IsFastPropertyType()));
3525 // Disallow caching for uninitialized constants. These can only 3527 // Disallow caching for uninitialized constants. These can only
3526 // occur as fields. 3528 // occur as fields.
3527 if (result->IsField() && 3529 if (result->IsField() &&
3528 result->IsReadOnly() && 3530 result->IsReadOnly() &&
3529 RawFastPropertyAt(result->GetFieldIndex().field_index())->IsTheHole()) { 3531 RawFastPropertyAt(result->GetFieldIndex())->IsTheHole()) {
3530 result->DisallowCaching(); 3532 result->DisallowCaching();
3531 } 3533 }
3532 return; 3534 return;
3533 } 3535 }
3534 3536
3535 int entry = property_dictionary()->FindEntry(name); 3537 int entry = property_dictionary()->FindEntry(name);
3536 if (entry != NameDictionary::kNotFound) { 3538 if (entry != NameDictionary::kNotFound) {
3537 Object* value = property_dictionary()->ValueAt(entry); 3539 Object* value = property_dictionary()->ValueAt(entry);
3538 if (IsGlobalObject()) { 3540 if (IsGlobalObject()) {
3539 PropertyDetails d = property_dictionary()->DetailsAt(entry); 3541 PropertyDetails d = property_dictionary()->DetailsAt(entry);
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
4035 4037
4036 4038
4037 void JSObject::WriteToField(int descriptor, Object* value) { 4039 void JSObject::WriteToField(int descriptor, Object* value) {
4038 DisallowHeapAllocation no_gc; 4040 DisallowHeapAllocation no_gc;
4039 4041
4040 DescriptorArray* desc = map()->instance_descriptors(); 4042 DescriptorArray* desc = map()->instance_descriptors();
4041 PropertyDetails details = desc->GetDetails(descriptor); 4043 PropertyDetails details = desc->GetDetails(descriptor);
4042 4044
4043 ASSERT(details.type() == FIELD); 4045 ASSERT(details.type() == FIELD);
4044 4046
4045 int field_index = desc->GetFieldIndex(descriptor); 4047 FieldIndex index = FieldIndex::ForDescriptor(map(), descriptor);
4046 if (details.representation().IsDouble()) { 4048 if (details.representation().IsDouble()) {
4047 // Nothing more to be done. 4049 // Nothing more to be done.
4048 if (value->IsUninitialized()) return; 4050 if (value->IsUninitialized()) return;
4049 HeapNumber* box = HeapNumber::cast(RawFastPropertyAt(field_index)); 4051 HeapNumber* box = HeapNumber::cast(RawFastPropertyAt(index));
4050 box->set_value(value->Number()); 4052 box->set_value(value->Number());
4051 } else { 4053 } else {
4052 FastPropertyAtPut(field_index, value); 4054 FastPropertyAtPut(index, value);
4053 } 4055 }
4054 } 4056 }
4055 4057
4056 4058
4057 static void SetPropertyToField(LookupResult* lookup, 4059 static void SetPropertyToField(LookupResult* lookup,
4058 Handle<Object> value) { 4060 Handle<Object> value) {
4059 if (lookup->type() == CONSTANT || !lookup->CanHoldValue(value)) { 4061 if (lookup->type() == CONSTANT || !lookup->CanHoldValue(value)) {
4060 Representation field_representation = value->OptimalRepresentation(); 4062 Representation field_representation = value->OptimalRepresentation();
4061 Handle<HeapType> field_type = value->OptimalType( 4063 Handle<HeapType> field_type = value->OptimalType(
4062 lookup->isolate(), field_representation); 4064 lookup->isolate(), field_representation);
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
4731 case CONSTANT: { 4733 case CONSTANT: {
4732 Handle<Name> key(descs->GetKey(i)); 4734 Handle<Name> key(descs->GetKey(i));
4733 Handle<Object> value(descs->GetConstant(i), isolate); 4735 Handle<Object> value(descs->GetConstant(i), isolate);
4734 PropertyDetails d = PropertyDetails( 4736 PropertyDetails d = PropertyDetails(
4735 details.attributes(), NORMAL, i + 1); 4737 details.attributes(), NORMAL, i + 1);
4736 dictionary = NameDictionary::Add(dictionary, key, value, d); 4738 dictionary = NameDictionary::Add(dictionary, key, value, d);
4737 break; 4739 break;
4738 } 4740 }
4739 case FIELD: { 4741 case FIELD: {
4740 Handle<Name> key(descs->GetKey(i)); 4742 Handle<Name> key(descs->GetKey(i));
4743 FieldIndex index = FieldIndex::ForDescriptor(*map, i);
4741 Handle<Object> value( 4744 Handle<Object> value(
4742 object->RawFastPropertyAt(descs->GetFieldIndex(i)), isolate); 4745 object->RawFastPropertyAt(index), isolate);
4743 PropertyDetails d = 4746 PropertyDetails d =
4744 PropertyDetails(details.attributes(), NORMAL, i + 1); 4747 PropertyDetails(details.attributes(), NORMAL, i + 1);
4745 dictionary = NameDictionary::Add(dictionary, key, value, d); 4748 dictionary = NameDictionary::Add(dictionary, key, value, d);
4746 break; 4749 break;
4747 } 4750 }
4748 case CALLBACKS: { 4751 case CALLBACKS: {
4749 Handle<Name> key(descs->GetKey(i)); 4752 Handle<Name> key(descs->GetKey(i));
4750 Handle<Object> value(descs->GetCallbacksObject(i), isolate); 4753 Handle<Object> value(descs->GetCallbacksObject(i), isolate);
4751 PropertyDetails d = PropertyDetails( 4754 PropertyDetails d = PropertyDetails(
4752 details.attributes(), CALLBACKS, i + 1); 4755 details.attributes(), CALLBACKS, i + 1);
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
5239 // hidden strings hash code is zero (and no other name has hash 5242 // hidden strings hash code is zero (and no other name has hash
5240 // code zero) it will always occupy the first entry if present. 5243 // code zero) it will always occupy the first entry if present.
5241 DescriptorArray* descriptors = this->map()->instance_descriptors(); 5244 DescriptorArray* descriptors = this->map()->instance_descriptors();
5242 if (descriptors->number_of_descriptors() > 0) { 5245 if (descriptors->number_of_descriptors() > 0) {
5243 int sorted_index = descriptors->GetSortedKeyIndex(0); 5246 int sorted_index = descriptors->GetSortedKeyIndex(0);
5244 if (descriptors->GetKey(sorted_index) == GetHeap()->hidden_string() && 5247 if (descriptors->GetKey(sorted_index) == GetHeap()->hidden_string() &&
5245 sorted_index < map()->NumberOfOwnDescriptors()) { 5248 sorted_index < map()->NumberOfOwnDescriptors()) {
5246 ASSERT(descriptors->GetType(sorted_index) == FIELD); 5249 ASSERT(descriptors->GetType(sorted_index) == FIELD);
5247 ASSERT(descriptors->GetDetails(sorted_index).representation(). 5250 ASSERT(descriptors->GetDetails(sorted_index).representation().
5248 IsCompatibleForLoad(Representation::Tagged())); 5251 IsCompatibleForLoad(Representation::Tagged()));
5249 return this->RawFastPropertyAt( 5252 FieldIndex index = FieldIndex::ForDescriptor(this->map(),
5250 descriptors->GetFieldIndex(sorted_index)); 5253 sorted_index);
5254 return this->RawFastPropertyAt(index);
5251 } else { 5255 } else {
5252 return GetHeap()->undefined_value(); 5256 return GetHeap()->undefined_value();
5253 } 5257 }
5254 } else { 5258 } else {
5255 return GetHeap()->undefined_value(); 5259 return GetHeap()->undefined_value();
5256 } 5260 }
5257 } else { 5261 } else {
5258 Isolate* isolate = GetIsolate(); 5262 Isolate* isolate = GetIsolate();
5259 LookupResult result(isolate); 5263 LookupResult result(isolate);
5260 LookupOwnRealNamedProperty(isolate->factory()->hidden_string(), &result); 5264 LookupOwnRealNamedProperty(isolate->factory()->hidden_string(), &result);
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
5920 } else { 5924 } else {
5921 new_map = Map::Copy(old_map); 5925 new_map = Map::Copy(old_map);
5922 new_map->set_is_observed(); 5926 new_map->set_is_observed();
5923 } 5927 }
5924 JSObject::MigrateToMap(object, new_map); 5928 JSObject::MigrateToMap(object, new_map);
5925 } 5929 }
5926 5930
5927 5931
5928 Handle<Object> JSObject::FastPropertyAt(Handle<JSObject> object, 5932 Handle<Object> JSObject::FastPropertyAt(Handle<JSObject> object,
5929 Representation representation, 5933 Representation representation,
5930 int index) { 5934 FieldIndex index) {
5931 Isolate* isolate = object->GetIsolate(); 5935 Isolate* isolate = object->GetIsolate();
5932 Handle<Object> raw_value(object->RawFastPropertyAt(index), isolate); 5936 Handle<Object> raw_value(object->RawFastPropertyAt(index), isolate);
5933 return Object::NewStorageFor(isolate, raw_value, representation); 5937 return Object::NewStorageFor(isolate, raw_value, representation);
5934 } 5938 }
5935 5939
5936 5940
5937 template<class ContextObject> 5941 template<class ContextObject>
5938 class JSObjectWalkVisitor { 5942 class JSObjectWalkVisitor {
5939 public: 5943 public:
5940 JSObjectWalkVisitor(ContextObject* site_context, bool copying, 5944 JSObjectWalkVisitor(ContextObject* site_context, bool copying,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
6011 if (!shallow) { 6015 if (!shallow) {
6012 HandleScope scope(isolate); 6016 HandleScope scope(isolate);
6013 6017
6014 // Deep copy own properties. 6018 // Deep copy own properties.
6015 if (copy->HasFastProperties()) { 6019 if (copy->HasFastProperties()) {
6016 Handle<DescriptorArray> descriptors(copy->map()->instance_descriptors()); 6020 Handle<DescriptorArray> descriptors(copy->map()->instance_descriptors());
6017 int limit = copy->map()->NumberOfOwnDescriptors(); 6021 int limit = copy->map()->NumberOfOwnDescriptors();
6018 for (int i = 0; i < limit; i++) { 6022 for (int i = 0; i < limit; i++) {
6019 PropertyDetails details = descriptors->GetDetails(i); 6023 PropertyDetails details = descriptors->GetDetails(i);
6020 if (details.type() != FIELD) continue; 6024 if (details.type() != FIELD) continue;
6021 int index = descriptors->GetFieldIndex(i); 6025 FieldIndex index = FieldIndex::ForDescriptor(copy->map(), i);
6022 Handle<Object> value(object->RawFastPropertyAt(index), isolate); 6026 Handle<Object> value(object->RawFastPropertyAt(index), isolate);
6023 if (value->IsJSObject()) { 6027 if (value->IsJSObject()) {
6024 ASSIGN_RETURN_ON_EXCEPTION( 6028 ASSIGN_RETURN_ON_EXCEPTION(
6025 isolate, value, 6029 isolate, value,
6026 VisitElementOrProperty(copy, Handle<JSObject>::cast(value)), 6030 VisitElementOrProperty(copy, Handle<JSObject>::cast(value)),
6027 JSObject); 6031 JSObject);
6028 } else { 6032 } else {
6029 Representation representation = details.representation(); 6033 Representation representation = details.representation();
6030 value = Object::NewStorageFor(isolate, value, representation); 6034 value = Object::NewStorageFor(isolate, value, representation);
6031 } 6035 }
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
6178 Handle<Object> result = isolate->factory()->undefined_value(); 6182 Handle<Object> result = isolate->factory()->undefined_value();
6179 if (lookup.IsFound() && !lookup.IsTransition()) { 6183 if (lookup.IsFound() && !lookup.IsTransition()) {
6180 switch (lookup.type()) { 6184 switch (lookup.type()) {
6181 case NORMAL: 6185 case NORMAL:
6182 result = GetNormalizedProperty( 6186 result = GetNormalizedProperty(
6183 Handle<JSObject>(lookup.holder(), isolate), &lookup); 6187 Handle<JSObject>(lookup.holder(), isolate), &lookup);
6184 break; 6188 break;
6185 case FIELD: 6189 case FIELD:
6186 result = FastPropertyAt(Handle<JSObject>(lookup.holder(), isolate), 6190 result = FastPropertyAt(Handle<JSObject>(lookup.holder(), isolate),
6187 lookup.representation(), 6191 lookup.representation(),
6188 lookup.GetFieldIndex().field_index()); 6192 lookup.GetFieldIndex());
6189 break; 6193 break;
6190 case CONSTANT: 6194 case CONSTANT:
6191 result = Handle<Object>(lookup.GetConstant(), isolate); 6195 result = Handle<Object>(lookup.GetConstant(), isolate);
6192 break; 6196 break;
6193 case CALLBACKS: 6197 case CALLBACKS:
6194 case HANDLER: 6198 case HANDLER:
6195 case INTERCEPTOR: 6199 case INTERCEPTOR:
6196 break; 6200 break;
6197 case NONEXISTENT: 6201 case NONEXISTENT:
6198 UNREACHABLE(); 6202 UNREACHABLE();
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
6412 6416
6413 for (int i = 0; i < size; i++) { 6417 for (int i = 0; i < size; i++) {
6414 PropertyDetails details = descs->GetDetails(i); 6418 PropertyDetails details = descs->GetDetails(i);
6415 Object* key = descs->GetKey(i); 6419 Object* key = descs->GetKey(i);
6416 if (!(details.IsDontEnum() || key->IsSymbol())) { 6420 if (!(details.IsDontEnum() || key->IsSymbol())) {
6417 storage->set(index, key); 6421 storage->set(index, key);
6418 if (!indices.is_null()) { 6422 if (!indices.is_null()) {
6419 if (details.type() != FIELD) { 6423 if (details.type() != FIELD) {
6420 indices = Handle<FixedArray>(); 6424 indices = Handle<FixedArray>();
6421 } else { 6425 } else {
6422 int field_index = descs->GetFieldIndex(i); 6426 FieldIndex field_index = FieldIndex::ForDescriptor(*map, i);
6423 if (field_index >= map->inobject_properties()) { 6427 int load_by_field_index = field_index.GetLoadByFieldIndex();
6424 field_index = -(field_index - map->inobject_properties() + 1); 6428 indices->set(index, Smi::FromInt(load_by_field_index));
6425 }
6426 field_index = field_index << 1;
6427 if (details.representation().IsDouble()) {
6428 field_index |= 1;
6429 }
6430 indices->set(index, Smi::FromInt(field_index));
6431 } 6429 }
6432 } 6430 }
6433 index++; 6431 index++;
6434 } 6432 }
6435 } 6433 }
6436 ASSERT(index == storage->length()); 6434 ASSERT(index == storage->length());
6437 6435
6438 Handle<FixedArray> bridge_storage = 6436 Handle<FixedArray> bridge_storage =
6439 isolate->factory()->NewFixedArray( 6437 isolate->factory()->NewFixedArray(
6440 DescriptorArray::kEnumCacheBridgeLength); 6438 DescriptorArray::kEnumCacheBridgeLength);
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
7124 return isolate->factory()->undefined_value(); 7122 return isolate->factory()->undefined_value();
7125 } 7123 }
7126 7124
7127 7125
7128 Object* JSObject::SlowReverseLookup(Object* value) { 7126 Object* JSObject::SlowReverseLookup(Object* value) {
7129 if (HasFastProperties()) { 7127 if (HasFastProperties()) {
7130 int number_of_own_descriptors = map()->NumberOfOwnDescriptors(); 7128 int number_of_own_descriptors = map()->NumberOfOwnDescriptors();
7131 DescriptorArray* descs = map()->instance_descriptors(); 7129 DescriptorArray* descs = map()->instance_descriptors();
7132 for (int i = 0; i < number_of_own_descriptors; i++) { 7130 for (int i = 0; i < number_of_own_descriptors; i++) {
7133 if (descs->GetType(i) == FIELD) { 7131 if (descs->GetType(i) == FIELD) {
7134 Object* property = RawFastPropertyAt(descs->GetFieldIndex(i)); 7132 Object* property =
7133 RawFastPropertyAt(FieldIndex::ForDescriptor(map(), i));
7135 if (descs->GetDetails(i).representation().IsDouble()) { 7134 if (descs->GetDetails(i).representation().IsDouble()) {
7136 ASSERT(property->IsHeapNumber()); 7135 ASSERT(property->IsHeapNumber());
7137 if (value->IsNumber() && property->Number() == value->Number()) { 7136 if (value->IsNumber() && property->Number() == value->Number()) {
7138 return descs->GetKey(i); 7137 return descs->GetKey(i);
7139 } 7138 }
7140 } else if (property == value) { 7139 } else if (property == value) {
7141 return descs->GetKey(i); 7140 return descs->GetKey(i);
7142 } 7141 }
7143 } else if (descs->GetType(i) == CONSTANT) { 7142 } else if (descs->GetType(i) == CONSTANT) {
7144 if (descs->GetConstant(i) == value) { 7143 if (descs->GetConstant(i) == value) {
(...skipping 10056 matching lines...) Expand 10 before | Expand all | Expand 10 after
17201 #define ERROR_MESSAGES_TEXTS(C, T) T, 17200 #define ERROR_MESSAGES_TEXTS(C, T) T,
17202 static const char* error_messages_[] = { 17201 static const char* error_messages_[] = {
17203 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 17202 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
17204 }; 17203 };
17205 #undef ERROR_MESSAGES_TEXTS 17204 #undef ERROR_MESSAGES_TEXTS
17206 return error_messages_[reason]; 17205 return error_messages_[reason];
17207 } 17206 }
17208 17207
17209 17208
17210 } } // namespace v8::internal 17209 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698