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

Side by Side Diff: src/property.h

Issue 11554019: Object.observe: Make array length and other magic data properties work correctly. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing Michael's comments Created 8 years 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.cc ('k') | src/v8natives.js » ('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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 bool IsFound() { return lookup_type_ != NOT_FOUND; } 303 bool IsFound() { return lookup_type_ != NOT_FOUND; }
304 bool IsTransition() { return lookup_type_ == TRANSITION_TYPE; } 304 bool IsTransition() { return lookup_type_ == TRANSITION_TYPE; }
305 bool IsHandler() { return lookup_type_ == HANDLER_TYPE; } 305 bool IsHandler() { return lookup_type_ == HANDLER_TYPE; }
306 bool IsInterceptor() { return lookup_type_ == INTERCEPTOR_TYPE; } 306 bool IsInterceptor() { return lookup_type_ == INTERCEPTOR_TYPE; }
307 307
308 // Is the result is a property excluding transitions and the null descriptor? 308 // Is the result is a property excluding transitions and the null descriptor?
309 bool IsProperty() { 309 bool IsProperty() {
310 return IsFound() && !IsTransition(); 310 return IsFound() && !IsTransition();
311 } 311 }
312 312
313 bool IsDataProperty() {
314 switch (type()) {
315 case FIELD:
316 case NORMAL:
317 case CONSTANT_FUNCTION:
318 return true;
319 case CALLBACKS: {
320 Object* callback = GetCallbackObject();
321 return callback->IsAccessorInfo() || callback->IsForeign();
322 }
323 case HANDLER:
324 case INTERCEPTOR:
325 case TRANSITION:
326 case NONEXISTENT:
327 return false;
328 }
329 UNREACHABLE();
330 return false;
331 }
332
313 bool IsCacheable() { return cacheable_; } 333 bool IsCacheable() { return cacheable_; }
314 void DisallowCaching() { cacheable_ = false; } 334 void DisallowCaching() { cacheable_ = false; }
315 335
316 Object* GetLazyValue() { 336 Object* GetLazyValue() {
317 switch (type()) { 337 switch (type()) {
318 case FIELD: 338 case FIELD:
319 return holder()->FastPropertyAt(GetFieldIndex().field_index()); 339 return holder()->FastPropertyAt(GetFieldIndex().field_index());
320 case NORMAL: { 340 case NORMAL: {
321 Object* value; 341 Object* value;
322 value = holder()->property_dictionary()->ValueAt(GetDictionaryEntry()); 342 value = holder()->property_dictionary()->ValueAt(GetDictionaryEntry());
323 if (holder()->IsGlobalObject()) { 343 if (holder()->IsGlobalObject()) {
324 value = JSGlobalPropertyCell::cast(value)->value(); 344 value = JSGlobalPropertyCell::cast(value)->value();
325 } 345 }
326 return value; 346 return value;
327 } 347 }
328 case CONSTANT_FUNCTION: 348 case CONSTANT_FUNCTION:
329 return GetConstantFunction(); 349 return GetConstantFunction();
330 default: 350 case CALLBACKS:
351 case HANDLER:
352 case INTERCEPTOR:
353 case TRANSITION:
354 case NONEXISTENT:
331 return Isolate::Current()->heap()->the_hole_value(); 355 return Isolate::Current()->heap()->the_hole_value();
332 } 356 }
357 UNREACHABLE();
358 return NULL;
333 } 359 }
334 360
335 Map* GetTransitionTarget() { 361 Map* GetTransitionTarget() {
336 ASSERT(IsTransition()); 362 ASSERT(IsTransition());
337 TransitionArray* transitions = holder()->map()->transitions(); 363 TransitionArray* transitions = holder()->map()->transitions();
338 return transitions->GetTarget(number_); 364 return transitions->GetTarget(number_);
339 } 365 }
340 366
341 PropertyDetails GetTransitionDetails(Map* map) { 367 PropertyDetails GetTransitionDetails(Map* map) {
342 ASSERT(IsTransition()); 368 ASSERT(IsTransition());
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 JSReceiver* holder_; 473 JSReceiver* holder_;
448 int number_; 474 int number_;
449 bool cacheable_; 475 bool cacheable_;
450 PropertyDetails details_; 476 PropertyDetails details_;
451 }; 477 };
452 478
453 479
454 } } // namespace v8::internal 480 } } // namespace v8::internal
455 481
456 #endif // V8_PROPERTY_H_ 482 #endif // V8_PROPERTY_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/v8natives.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698