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

Side by Side Diff: src/objects.h

Issue 7390028: Implement `in' for proxies. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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
OLDNEW
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 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 // Returns the constructor name (the name (possibly, inferred name) of the 1387 // Returns the constructor name (the name (possibly, inferred name) of the
1388 // function that was used to instantiate the object). 1388 // function that was used to instantiate the object).
1389 String* constructor_name(); 1389 String* constructor_name();
1390 1390
1391 inline PropertyAttributes GetPropertyAttribute(String* name); 1391 inline PropertyAttributes GetPropertyAttribute(String* name);
1392 PropertyAttributes GetPropertyAttributeWithReceiver(JSReceiver* receiver, 1392 PropertyAttributes GetPropertyAttributeWithReceiver(JSReceiver* receiver,
1393 String* name); 1393 String* name);
1394 PropertyAttributes GetLocalPropertyAttribute(String* name); 1394 PropertyAttributes GetLocalPropertyAttribute(String* name);
1395 1395
1396 // Can cause a GC. 1396 // Can cause a GC.
1397 bool HasProperty(String* name) { 1397 inline bool HasProperty(String* name);
1398 return GetPropertyAttribute(name) != ABSENT; 1398 inline bool HasLocalProperty(String* name);
1399 }
1400
1401 // Can cause a GC.
1402 bool HasLocalProperty(String* name) {
1403 return GetLocalPropertyAttribute(name) != ABSENT;
1404 }
1405 1399
1406 // Return the object's prototype (might be Heap::null_value()). 1400 // Return the object's prototype (might be Heap::null_value()).
1407 inline Object* GetPrototype(); 1401 inline Object* GetPrototype();
1408 1402
1409 // Set the object's prototype (only JSReceiver and null are allowed). 1403 // Set the object's prototype (only JSReceiver and null are allowed).
1410 MUST_USE_RESULT MaybeObject* SetPrototype(Object* value, 1404 MUST_USE_RESULT MaybeObject* SetPrototype(Object* value,
1411 bool skip_hidden_prototypes); 1405 bool skip_hidden_prototypes);
1412 1406
1413 // Lookup a property. If found, the result is valid and has 1407 // Lookup a property. If found, the result is valid and has
1414 // detailed information. 1408 // detailed information.
(...skipping 5053 matching lines...) Expand 10 before | Expand all | Expand 10 after
6468 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalPropertyCell); 6462 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalPropertyCell);
6469 }; 6463 };
6470 6464
6471 6465
6472 // The JSProxy describes EcmaScript Harmony proxies 6466 // The JSProxy describes EcmaScript Harmony proxies
6473 class JSProxy: public JSReceiver { 6467 class JSProxy: public JSReceiver {
6474 public: 6468 public:
6475 // [handler]: The handler property. 6469 // [handler]: The handler property.
6476 DECL_ACCESSORS(handler, Object) 6470 DECL_ACCESSORS(handler, Object)
6477 6471
6472 // [padding]: The padding slot (unused, see below).
6473 DECL_ACCESSORS(padding, Object)
6474
6478 // Casting. 6475 // Casting.
6479 static inline JSProxy* cast(Object* obj); 6476 static inline JSProxy* cast(Object* obj);
6480 6477
6478 bool HasPropertyWithHandler(String* name);
6479
6481 MUST_USE_RESULT MaybeObject* SetPropertyWithHandler( 6480 MUST_USE_RESULT MaybeObject* SetPropertyWithHandler(
6482 String* name, 6481 String* name,
6483 Object* value, 6482 Object* value,
6484 PropertyAttributes attributes, 6483 PropertyAttributes attributes,
6485 StrictModeFlag strict_mode); 6484 StrictModeFlag strict_mode);
6486 6485
6487 MUST_USE_RESULT MaybeObject* DeletePropertyWithHandler( 6486 MUST_USE_RESULT MaybeObject* DeletePropertyWithHandler(
6488 String* name, 6487 String* name,
6489 DeleteMode mode); 6488 DeleteMode mode);
6490 6489
6491 MUST_USE_RESULT PropertyAttributes GetPropertyAttributeWithHandler( 6490 MUST_USE_RESULT PropertyAttributes GetPropertyAttributeWithHandler(
6492 JSReceiver* receiver, 6491 JSReceiver* receiver,
6493 String* name, 6492 String* name,
6494 bool* has_exception); 6493 bool* has_exception);
6495 6494
6495 // Turn this into an (empty) JSObject.
6496 void Fix();
6497
6496 // Dispatched behavior. 6498 // Dispatched behavior.
6497 #ifdef OBJECT_PRINT 6499 #ifdef OBJECT_PRINT
6498 inline void JSProxyPrint() { 6500 inline void JSProxyPrint() {
6499 JSProxyPrint(stdout); 6501 JSProxyPrint(stdout);
6500 } 6502 }
6501 void JSProxyPrint(FILE* out); 6503 void JSProxyPrint(FILE* out);
6502 #endif 6504 #endif
6503 #ifdef DEBUG 6505 #ifdef DEBUG
6504 void JSProxyVerify(); 6506 void JSProxyVerify();
6505 #endif 6507 #endif
6506 6508
6507 // Layout description. 6509 // Layout description. We add padding so that a proxy has the same
6510 // size as a virgin JSObject. This is essential for becoming a JSObject
6511 // upon freeze.
6508 static const int kHandlerOffset = HeapObject::kHeaderSize; 6512 static const int kHandlerOffset = HeapObject::kHeaderSize;
6509 static const int kSize = kHandlerOffset + kPointerSize; 6513 static const int kPaddingOffset = kHandlerOffset + kPointerSize;
6514 static const int kSize = kPaddingOffset + kPointerSize;
6515
6516 STATIC_CHECK(kSize == JSObject::kHeaderSize);
6510 6517
6511 typedef FixedBodyDescriptor<kHandlerOffset, 6518 typedef FixedBodyDescriptor<kHandlerOffset,
6512 kHandlerOffset + kPointerSize, 6519 kHandlerOffset + kPointerSize,
6513 kSize> BodyDescriptor; 6520 kSize> BodyDescriptor;
6514 6521
6515 private: 6522 private:
6516 DISALLOW_IMPLICIT_CONSTRUCTORS(JSProxy); 6523 DISALLOW_IMPLICIT_CONSTRUCTORS(JSProxy);
6517 }; 6524 };
6518 6525
6519 6526
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
7164 } else { 7171 } else {
7165 value &= ~(1 << bit_position); 7172 value &= ~(1 << bit_position);
7166 } 7173 }
7167 return value; 7174 return value;
7168 } 7175 }
7169 }; 7176 };
7170 7177
7171 } } // namespace v8::internal 7178 } } // namespace v8::internal
7172 7179
7173 #endif // V8_OBJECTS_H_ 7180 #endif // V8_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698