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

Side by Side Diff: src/property.h

Issue 10784014: Removed transitions from the accessor pair descriptors. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments 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-inl.h ('k') | src/runtime.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 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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 ASSERT(IsFound()); 229 ASSERT(IsFound());
230 return IsTransition() || type() != NORMAL; 230 return IsTransition() || type() != NORMAL;
231 } 231 }
232 232
233 // Property callbacks does not include transitions to callbacks. 233 // Property callbacks does not include transitions to callbacks.
234 bool IsPropertyCallbacks() { 234 bool IsPropertyCallbacks() {
235 ASSERT(!(details_.type() == CALLBACKS && !IsFound())); 235 ASSERT(!(details_.type() == CALLBACKS && !IsFound()));
236 return details_.type() == CALLBACKS; 236 return details_.type() == CALLBACKS;
237 } 237 }
238 238
239 // Is callbacks contains both property callbacks and transitions to callbacks.
240 bool IsCallbacks() {
241 return IsPropertyCallbacks() ||
242 (IsTransition() && GetTransitionValue()->IsAccessorPair());
243 }
244
245 bool IsReadOnly() { 239 bool IsReadOnly() {
246 ASSERT(IsFound()); 240 ASSERT(IsFound());
247 ASSERT(!IsTransition()); 241 ASSERT(!IsTransition());
248 ASSERT(details_.type() != NONEXISTENT); 242 ASSERT(details_.type() != NONEXISTENT);
249 return details_.IsReadOnly(); 243 return details_.IsReadOnly();
250 } 244 }
251 245
252 bool IsField() { 246 bool IsField() {
253 ASSERT(!(details_.type() == FIELD && !IsFound())); 247 ASSERT(!(details_.type() == FIELD && !IsFound()));
254 return details_.type() == FIELD; 248 return details_.type() == FIELD;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 } 286 }
293 return value; 287 return value;
294 } 288 }
295 case CONSTANT_FUNCTION: 289 case CONSTANT_FUNCTION:
296 return GetConstantFunction(); 290 return GetConstantFunction();
297 default: 291 default:
298 return Smi::FromInt(0); 292 return Smi::FromInt(0);
299 } 293 }
300 } 294 }
301 295
302 Object* GetTransitionValue() { 296 Map* GetTransitionTarget() {
303 ASSERT(IsTransition()); 297 ASSERT(IsTransition());
304 TransitionArray* transitions = holder()->map()->transitions(); 298 TransitionArray* transitions = holder()->map()->transitions();
305 Object* value = transitions->GetValue(number_); 299 return transitions->GetTarget(number_);
306 return value;
307 } 300 }
308 301
309 PropertyDetails GetTransitionDetails(Map* map) { 302 PropertyDetails GetTransitionDetails(Map* map) {
310 ASSERT(IsTransition()); 303 ASSERT(IsTransition());
311 TransitionArray* transitions = map->transitions(); 304 TransitionArray* transitions = map->transitions();
312 return transitions->GetTargetDetails(number_); 305 return transitions->GetTargetDetails(number_);
313 } 306 }
314 307
315 PropertyDetails GetTransitionDetails() { 308 PropertyDetails GetTransitionDetails() {
316 return GetTransitionDetails(holder()->map()); 309 return GetTransitionDetails(holder()->map());
317 } 310 }
318 311
319 bool IsTransitionToField(Map* map) { 312 bool IsTransitionToField(Map* map) {
320 return IsTransition() && GetTransitionDetails(map).type() == FIELD; 313 return IsTransition() && GetTransitionDetails(map).type() == FIELD;
321 } 314 }
322 315
323 Map* GetTransitionMap() { 316 Map* GetTransitionMap() {
324 ASSERT(IsTransition()); 317 ASSERT(IsTransition());
325 return Map::cast(GetValue()); 318 return Map::cast(GetValue());
326 } 319 }
327 320
328 Map* GetTransitionMapFromMap(Map* map) { 321 Map* GetTransitionMapFromMap(Map* map) {
329 ASSERT(IsTransition()); 322 ASSERT(IsTransition());
330 return Map::cast(map->transitions()->GetValue(number_)); 323 return map->transitions()->GetTarget(number_);
331 } 324 }
332 325
333 int GetTransitionIndex() { 326 int GetTransitionIndex() {
334 ASSERT(IsTransition()); 327 ASSERT(IsTransition());
335 return number_; 328 return number_;
336 } 329 }
337 330
338 int GetFieldIndex() { 331 int GetFieldIndex() {
339 ASSERT(lookup_type_ == DESCRIPTOR_TYPE); 332 ASSERT(lookup_type_ == DESCRIPTOR_TYPE);
340 ASSERT(IsField()); 333 ASSERT(IsField());
(...skipping 15 matching lines...) Expand all
356 ASSERT(type() == CONSTANT_FUNCTION); 349 ASSERT(type() == CONSTANT_FUNCTION);
357 return JSFunction::cast(GetValue()); 350 return JSFunction::cast(GetValue());
358 } 351 }
359 352
360 JSFunction* GetConstantFunctionFromMap(Map* map) { 353 JSFunction* GetConstantFunctionFromMap(Map* map) {
361 ASSERT(type() == CONSTANT_FUNCTION); 354 ASSERT(type() == CONSTANT_FUNCTION);
362 return JSFunction::cast(GetValueFromMap(map)); 355 return JSFunction::cast(GetValueFromMap(map));
363 } 356 }
364 357
365 Object* GetCallbackObject() { 358 Object* GetCallbackObject() {
366 switch (lookup_type_) { 359 if (lookup_type_ == CONSTANT_TYPE) {
367 case CONSTANT_TYPE: 360 return HEAP->prototype_accessors();
368 return HEAP->prototype_accessors();
369 case TRANSITION_TYPE:
370 return GetTransitionValue();
371 default:
372 return GetValue();
373 } 361 }
362 ASSERT(!IsTransition());
363 return GetValue();
374 } 364 }
375 365
376 #ifdef OBJECT_PRINT 366 #ifdef OBJECT_PRINT
377 void Print(FILE* out); 367 void Print(FILE* out);
378 #endif 368 #endif
379 369
380 Object* GetValue() { 370 Object* GetValue() {
381 if (lookup_type_ == DESCRIPTOR_TYPE) { 371 if (lookup_type_ == DESCRIPTOR_TYPE) {
382 return GetValueFromMap(holder()->map()); 372 return GetValueFromMap(holder()->map());
383 } 373 }
(...skipping 27 matching lines...) Expand all
411 JSReceiver* holder_; 401 JSReceiver* holder_;
412 int number_; 402 int number_;
413 bool cacheable_; 403 bool cacheable_;
414 PropertyDetails details_; 404 PropertyDetails details_;
415 }; 405 };
416 406
417 407
418 } } // namespace v8::internal 408 } } // namespace v8::internal
419 409
420 #endif // V8_PROPERTY_H_ 410 #endif // V8_PROPERTY_H_
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698