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

Side by Side Diff: src/property.h

Issue 12212011: Make __proto__ a foreign callback on Object.prototype. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added regression test for issue 2441. Created 7 years, 10 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.cc ('k') | test/cctest/test-api.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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 number_ = number; 194 number_ = number;
195 } 195 }
196 196
197 void TransitionResult(JSObject* holder, int number) { 197 void TransitionResult(JSObject* holder, int number) {
198 lookup_type_ = TRANSITION_TYPE; 198 lookup_type_ = TRANSITION_TYPE;
199 details_ = PropertyDetails(NONE, TRANSITION); 199 details_ = PropertyDetails(NONE, TRANSITION);
200 holder_ = holder; 200 holder_ = holder;
201 number_ = number; 201 number_ = number;
202 } 202 }
203 203
204 void ConstantResult(JSObject* holder) {
205 lookup_type_ = CONSTANT_TYPE;
206 holder_ = holder;
207 details_ =
208 PropertyDetails(static_cast<PropertyAttributes>(DONT_ENUM |
209 DONT_DELETE),
210 CALLBACKS);
211 number_ = -1;
212 }
213
214 void DictionaryResult(JSObject* holder, int entry) { 204 void DictionaryResult(JSObject* holder, int entry) {
215 lookup_type_ = DICTIONARY_TYPE; 205 lookup_type_ = DICTIONARY_TYPE;
216 holder_ = holder; 206 holder_ = holder;
217 details_ = holder->property_dictionary()->DetailsAt(entry); 207 details_ = holder->property_dictionary()->DetailsAt(entry);
218 number_ = entry; 208 number_ = entry;
219 } 209 }
220 210
221 void HandlerResult(JSProxy* proxy) { 211 void HandlerResult(JSProxy* proxy) {
222 lookup_type_ = HANDLER_TYPE; 212 lookup_type_ = HANDLER_TYPE;
223 holder_ = proxy; 213 holder_ = proxy;
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 ASSERT(type() == CONSTANT_FUNCTION); 410 ASSERT(type() == CONSTANT_FUNCTION);
421 return JSFunction::cast(GetValue()); 411 return JSFunction::cast(GetValue());
422 } 412 }
423 413
424 JSFunction* GetConstantFunctionFromMap(Map* map) { 414 JSFunction* GetConstantFunctionFromMap(Map* map) {
425 ASSERT(type() == CONSTANT_FUNCTION); 415 ASSERT(type() == CONSTANT_FUNCTION);
426 return JSFunction::cast(GetValueFromMap(map)); 416 return JSFunction::cast(GetValueFromMap(map));
427 } 417 }
428 418
429 Object* GetCallbackObject() { 419 Object* GetCallbackObject() {
430 if (lookup_type_ == CONSTANT_TYPE) { 420 ASSERT(type() == CALLBACKS && !IsTransition());
431 return HEAP->prototype_accessors();
432 }
433 ASSERT(!IsTransition());
434 return GetValue(); 421 return GetValue();
435 } 422 }
436 423
437 #ifdef OBJECT_PRINT 424 #ifdef OBJECT_PRINT
438 void Print(FILE* out); 425 void Print(FILE* out);
439 #endif 426 #endif
440 427
441 Object* GetValue() { 428 Object* GetValue() {
442 if (lookup_type_ == DESCRIPTOR_TYPE) { 429 if (lookup_type_ == DESCRIPTOR_TYPE) {
443 return GetValueFromMap(holder()->map()); 430 return GetValueFromMap(holder()->map());
(...skipping 15 matching lines...) Expand all
459 Isolate* isolate_; 446 Isolate* isolate_;
460 LookupResult* next_; 447 LookupResult* next_;
461 448
462 // Where did we find the result; 449 // Where did we find the result;
463 enum { 450 enum {
464 NOT_FOUND, 451 NOT_FOUND,
465 DESCRIPTOR_TYPE, 452 DESCRIPTOR_TYPE,
466 TRANSITION_TYPE, 453 TRANSITION_TYPE,
467 DICTIONARY_TYPE, 454 DICTIONARY_TYPE,
468 HANDLER_TYPE, 455 HANDLER_TYPE,
469 INTERCEPTOR_TYPE, 456 INTERCEPTOR_TYPE
470 CONSTANT_TYPE
471 } lookup_type_; 457 } lookup_type_;
472 458
473 JSReceiver* holder_; 459 JSReceiver* holder_;
474 int number_; 460 int number_;
475 bool cacheable_; 461 bool cacheable_;
476 PropertyDetails details_; 462 PropertyDetails details_;
477 }; 463 };
478 464
479 465
480 } } // namespace v8::internal 466 } } // namespace v8::internal
481 467
482 #endif // V8_PROPERTY_H_ 468 #endif // V8_PROPERTY_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698