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

Side by Side Diff: src/objects.h

Issue 9536010: Revert "Handle CALLBACKS correctly in IsProperty functions." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 9 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 | « no previous file | src/objects-inl.h » ('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 2571 matching lines...) Expand 10 before | Expand all | Expand 10 after
2582 2582
2583 // Are two DescriptorArrays equal? 2583 // Are two DescriptorArrays equal?
2584 bool IsEqualTo(DescriptorArray* other); 2584 bool IsEqualTo(DescriptorArray* other);
2585 #endif 2585 #endif
2586 2586
2587 // The maximum number of descriptors we want in a descriptor array (should 2587 // The maximum number of descriptors we want in a descriptor array (should
2588 // fit in a page). 2588 // fit in a page).
2589 static const int kMaxNumberOfDescriptors = 1024 + 512; 2589 static const int kMaxNumberOfDescriptors = 1024 + 512;
2590 2590
2591 private: 2591 private:
2592 // An entry in a DescriptorArray, represented as an (array, index) pair.
2593 class Entry {
2594 public:
2595 inline explicit Entry(DescriptorArray* descs, int index) :
2596 descs_(descs), index_(index) { }
2597
2598 inline PropertyType type() { return descs_->GetType(index_); }
2599 inline Object* GetCallbackObject() { return descs_->GetValue(index_); }
2600
2601 private:
2602 DescriptorArray* descs_;
2603 int index_;
2604 };
2605
2606 // Conversion from descriptor number to array indices. 2592 // Conversion from descriptor number to array indices.
2607 static int ToKeyIndex(int descriptor_number) { 2593 static int ToKeyIndex(int descriptor_number) {
2608 return descriptor_number+kFirstIndex; 2594 return descriptor_number+kFirstIndex;
2609 } 2595 }
2610 2596
2611 static int ToDetailsIndex(int descriptor_number) { 2597 static int ToDetailsIndex(int descriptor_number) {
2612 return (descriptor_number << 1) + 1; 2598 return (descriptor_number << 1) + 1;
2613 } 2599 }
2614 2600
2615 static int ToValueIndex(int descriptor_number) { 2601 static int ToValueIndex(int descriptor_number) {
(...skipping 5310 matching lines...) Expand 10 before | Expand all | Expand 10 after
7926 7912
7927 // TODO(svenpanne) Evil temporary helper, will vanish soon... 7913 // TODO(svenpanne) Evil temporary helper, will vanish soon...
7928 void set(bool modify_getter, Object* value) { 7914 void set(bool modify_getter, Object* value) {
7929 if (modify_getter) { 7915 if (modify_getter) {
7930 set_getter(value); 7916 set_getter(value);
7931 } else { 7917 } else {
7932 set_setter(value); 7918 set_setter(value);
7933 } 7919 }
7934 } 7920 }
7935 7921
7936 bool ContainsAccessor() {
7937 return IsJSAccessor(getter()) || IsJSAccessor(setter());
7938 }
7939
7940 #ifdef OBJECT_PRINT 7922 #ifdef OBJECT_PRINT
7941 void AccessorPairPrint(FILE* out = stdout); 7923 void AccessorPairPrint(FILE* out = stdout);
7942 #endif 7924 #endif
7943 #ifdef DEBUG 7925 #ifdef DEBUG
7944 void AccessorPairVerify(); 7926 void AccessorPairVerify();
7945 #endif 7927 #endif
7946 7928
7947 static const int kGetterOffset = HeapObject::kHeaderSize; 7929 static const int kGetterOffset = HeapObject::kHeaderSize;
7948 static const int kSetterOffset = kGetterOffset + kPointerSize; 7930 static const int kSetterOffset = kGetterOffset + kPointerSize;
7949 static const int kSize = kSetterOffset + kPointerSize; 7931 static const int kSize = kSetterOffset + kPointerSize;
7950 7932
7951 private: 7933 private:
7952 // Strangely enough, in addition to functions and harmony proxies, the spec
7953 // requires us to consider undefined as a kind of accessor, too:
7954 // var obj = {};
7955 // Object.defineProperty(obj, "foo", {get: undefined});
7956 // assertTrue("foo" in obj);
7957 bool IsJSAccessor(Object* obj) {
7958 return obj->IsSpecFunction() || obj->IsUndefined();
7959 }
7960
7961 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorPair); 7934 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorPair);
7962 }; 7935 };
7963 7936
7964 7937
7965 class AccessCheckInfo: public Struct { 7938 class AccessCheckInfo: public Struct {
7966 public: 7939 public:
7967 DECL_ACCESSORS(named_callback, Object) 7940 DECL_ACCESSORS(named_callback, Object)
7968 DECL_ACCESSORS(indexed_callback, Object) 7941 DECL_ACCESSORS(indexed_callback, Object)
7969 DECL_ACCESSORS(data, Object) 7942 DECL_ACCESSORS(data, Object)
7970 7943
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
8450 } else { 8423 } else {
8451 value &= ~(1 << bit_position); 8424 value &= ~(1 << bit_position);
8452 } 8425 }
8453 return value; 8426 return value;
8454 } 8427 }
8455 }; 8428 };
8456 8429
8457 } } // namespace v8::internal 8430 } } // namespace v8::internal
8458 8431
8459 #endif // V8_OBJECTS_H_ 8432 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « no previous file | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698