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

Side by Side Diff: src/objects.cc

Issue 10778011: Remove LookupTransitionOrDescriptor altogether. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: u Created 8 years, 5 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') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2132 matching lines...) Expand 10 before | Expand all | Expand 10 after
2143 TransitionArray* transition_array = transitions(); 2143 TransitionArray* transition_array = transitions();
2144 int number = transition_array->Search(name); 2144 int number = transition_array->Search(name);
2145 if (number != TransitionArray::kNotFound) { 2145 if (number != TransitionArray::kNotFound) {
2146 return result->TransitionResult(holder, number); 2146 return result->TransitionResult(holder, number);
2147 } 2147 }
2148 } 2148 }
2149 result->NotFound(); 2149 result->NotFound();
2150 } 2150 }
2151 2151
2152 2152
2153 void Map::LookupTransitionOrDescriptor(JSObject* holder,
2154 String* name,
2155 LookupResult* result) {
2156 // AccessorPairs containing both a Descriptor and a Transition are shared
2157 // between the DescriptorArray and the Transition array. This is why looking
2158 // up the AccessorPair solely in the DescriptorArray works.
2159 // TODO(verwaest) This should be implemented differently so the
2160 // DescriptorArray is free of transitions; and so we can freely share it.
2161 this->LookupDescriptor(holder, name, result);
2162 if (result->IsFound()) return;
2163 this->LookupTransition(holder, name, result);
2164 }
2165
2166
2167 static bool ContainsMap(MapHandleList* maps, Handle<Map> map) { 2153 static bool ContainsMap(MapHandleList* maps, Handle<Map> map) {
2168 ASSERT(!map.is_null()); 2154 ASSERT(!map.is_null());
2169 for (int i = 0; i < maps->length(); ++i) { 2155 for (int i = 0; i < maps->length(); ++i) {
2170 if (!maps->at(i).is_null() && maps->at(i).is_identical_to(map)) return true; 2156 if (!maps->at(i).is_null() && maps->at(i).is_identical_to(map)) return true;
2171 } 2157 }
2172 return false; 2158 return false;
2173 } 2159 }
2174 2160
2175 2161
2176 template <class T> 2162 template <class T>
(...skipping 2018 matching lines...) Expand 10 before | Expand all | Expand 10 after
4195 if (js_object->HasNamedInterceptor() && 4181 if (js_object->HasNamedInterceptor() &&
4196 !heap->isolate()->bootstrapper()->IsActive()) { 4182 !heap->isolate()->bootstrapper()->IsActive()) {
4197 result->InterceptorResult(js_object); 4183 result->InterceptorResult(js_object);
4198 return; 4184 return;
4199 } 4185 }
4200 4186
4201 js_object->LocalLookupRealNamedProperty(name, result); 4187 js_object->LocalLookupRealNamedProperty(name, result);
4202 } 4188 }
4203 4189
4204 4190
4205 void JSReceiver::Lookup(String* name, 4191 void JSReceiver::Lookup(String* name, LookupResult* result) {
4206 LookupResult* result) {
4207 // Ecma-262 3rd 8.6.2.4 4192 // Ecma-262 3rd 8.6.2.4
4208 Heap* heap = GetHeap(); 4193 Heap* heap = GetHeap();
4209 for (Object* current = this; 4194 for (Object* current = this;
4210 current != heap->null_value(); 4195 current != heap->null_value();
4211 current = JSObject::cast(current)->GetPrototype()) { 4196 current = JSObject::cast(current)->GetPrototype()) {
4212 JSReceiver::cast(current)->LocalLookup(name, result); 4197 JSReceiver::cast(current)->LocalLookup(name, result);
4213 if (result->IsFound()) return; 4198 if (result->IsFound()) return;
4214 } 4199 }
4215 result->NotFound(); 4200 result->NotFound();
4216 } 4201 }
(...skipping 8321 matching lines...) Expand 10 before | Expand all | Expand 10 after
12538 int number_of_allocated_fields = 12523 int number_of_allocated_fields =
12539 number_of_fields + unused_property_fields - inobject_props; 12524 number_of_fields + unused_property_fields - inobject_props;
12540 if (number_of_allocated_fields < 0) { 12525 if (number_of_allocated_fields < 0) {
12541 // There is enough inobject space for all fields (including unused). 12526 // There is enough inobject space for all fields (including unused).
12542 number_of_allocated_fields = 0; 12527 number_of_allocated_fields = 0;
12543 unused_property_fields = inobject_props - number_of_fields; 12528 unused_property_fields = inobject_props - number_of_fields;
12544 } 12529 }
12545 12530
12546 // Allocate the fixed array for the fields. 12531 // Allocate the fixed array for the fields.
12547 Object* fields; 12532 Object* fields;
12548 { MaybeObject* maybe_fields = 12533 MaybeObject* maybe_fields =
Sven Panne 2012/07/17 05:54:41 Even if it is too late, I'd like to comment on thi
12549 heap->AllocateFixedArray(number_of_allocated_fields); 12534 heap->AllocateFixedArray(number_of_allocated_fields);
12550 if (!maybe_fields->ToObject(&fields)) return maybe_fields; 12535 if (!maybe_fields->ToObject(&fields)) return maybe_fields;
12551 }
12552 12536
12553 // Fill in the instance descriptor and the fields. 12537 // Fill in the instance descriptor and the fields.
12554 int next_descriptor = 0; 12538 int next_descriptor = 0;
12555 int current_offset = 0; 12539 int current_offset = 0;
12556 for (int i = 0; i < capacity; i++) { 12540 for (int i = 0; i < capacity; i++) {
12557 Object* k = KeyAt(i); 12541 Object* k = KeyAt(i);
12558 if (IsKey(k)) { 12542 if (IsKey(k)) {
12559 Object* value = ValueAt(i); 12543 Object* value = ValueAt(i);
12560 // Ensure the key is a symbol before writing into the instance descriptor. 12544 // Ensure the key is a symbol before writing into the instance descriptor.
12561 String* key; 12545 String* key;
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
13117 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 13101 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
13118 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 13102 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
13119 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 13103 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
13120 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 13104 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
13121 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 13105 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
13122 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 13106 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
13123 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 13107 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
13124 } 13108 }
13125 13109
13126 } } // namespace v8::internal 13110 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698