OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 6457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6468 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalPropertyCell); | 6468 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalPropertyCell); |
6469 }; | 6469 }; |
6470 | 6470 |
6471 | 6471 |
6472 // The JSProxy describes EcmaScript Harmony proxies | 6472 // The JSProxy describes EcmaScript Harmony proxies |
6473 class JSProxy: public JSReceiver { | 6473 class JSProxy: public JSReceiver { |
6474 public: | 6474 public: |
6475 // [handler]: The handler property. | 6475 // [handler]: The handler property. |
6476 DECL_ACCESSORS(handler, Object) | 6476 DECL_ACCESSORS(handler, Object) |
6477 | 6477 |
| 6478 // [padding]: The padding slot (unused, see below). |
| 6479 DECL_ACCESSORS(padding, Object) |
| 6480 |
6478 // Casting. | 6481 // Casting. |
6479 static inline JSProxy* cast(Object* obj); | 6482 static inline JSProxy* cast(Object* obj); |
6480 | 6483 |
6481 MUST_USE_RESULT MaybeObject* SetPropertyWithHandler( | 6484 MUST_USE_RESULT MaybeObject* SetPropertyWithHandler( |
6482 String* name, | 6485 String* name, |
6483 Object* value, | 6486 Object* value, |
6484 PropertyAttributes attributes, | 6487 PropertyAttributes attributes, |
6485 StrictModeFlag strict_mode); | 6488 StrictModeFlag strict_mode); |
6486 | 6489 |
6487 MUST_USE_RESULT MaybeObject* DeletePropertyWithHandler( | 6490 MUST_USE_RESULT MaybeObject* DeletePropertyWithHandler( |
6488 String* name, | 6491 String* name, |
6489 DeleteMode mode); | 6492 DeleteMode mode); |
6490 | 6493 |
6491 MUST_USE_RESULT PropertyAttributes GetPropertyAttributeWithHandler( | 6494 MUST_USE_RESULT PropertyAttributes GetPropertyAttributeWithHandler( |
6492 JSReceiver* receiver, | 6495 JSReceiver* receiver, |
6493 String* name, | 6496 String* name, |
6494 bool* has_exception); | 6497 bool* has_exception); |
6495 | 6498 |
| 6499 // Turn this into an (empty) JSObject. |
| 6500 void Fix(); |
| 6501 |
6496 // Dispatched behavior. | 6502 // Dispatched behavior. |
6497 #ifdef OBJECT_PRINT | 6503 #ifdef OBJECT_PRINT |
6498 inline void JSProxyPrint() { | 6504 inline void JSProxyPrint() { |
6499 JSProxyPrint(stdout); | 6505 JSProxyPrint(stdout); |
6500 } | 6506 } |
6501 void JSProxyPrint(FILE* out); | 6507 void JSProxyPrint(FILE* out); |
6502 #endif | 6508 #endif |
6503 #ifdef DEBUG | 6509 #ifdef DEBUG |
6504 void JSProxyVerify(); | 6510 void JSProxyVerify(); |
6505 #endif | 6511 #endif |
6506 | 6512 |
6507 // Layout description. | 6513 // Layout description. We add padding so that a proxy has the same |
| 6514 // size as a virgin JSObject. This is essential for becoming a JSObject |
| 6515 // upon freeze. |
6508 static const int kHandlerOffset = HeapObject::kHeaderSize; | 6516 static const int kHandlerOffset = HeapObject::kHeaderSize; |
6509 static const int kSize = kHandlerOffset + kPointerSize; | 6517 static const int kPaddingOffset = kHandlerOffset + kPointerSize; |
| 6518 static const int kSize = kPaddingOffset + kPointerSize; |
| 6519 |
| 6520 STATIC_CHECK(kSize == JSObject::kHeaderSize); |
6510 | 6521 |
6511 typedef FixedBodyDescriptor<kHandlerOffset, | 6522 typedef FixedBodyDescriptor<kHandlerOffset, |
6512 kHandlerOffset + kPointerSize, | 6523 kHandlerOffset + kPointerSize, |
6513 kSize> BodyDescriptor; | 6524 kSize> BodyDescriptor; |
6514 | 6525 |
6515 private: | 6526 private: |
6516 DISALLOW_IMPLICIT_CONSTRUCTORS(JSProxy); | 6527 DISALLOW_IMPLICIT_CONSTRUCTORS(JSProxy); |
6517 }; | 6528 }; |
6518 | 6529 |
6519 | 6530 |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7164 } else { | 7175 } else { |
7165 value &= ~(1 << bit_position); | 7176 value &= ~(1 << bit_position); |
7166 } | 7177 } |
7167 return value; | 7178 return value; |
7168 } | 7179 } |
7169 }; | 7180 }; |
7170 | 7181 |
7171 } } // namespace v8::internal | 7182 } } // namespace v8::internal |
7172 | 7183 |
7173 #endif // V8_OBJECTS_H_ | 7184 #endif // V8_OBJECTS_H_ |
OLD | NEW |