Cleaned up setting of accessors.

This CL is an intermediate step only, in the end we need to have a single
DefineOrRedefineAccessorProperty call for a single Object.defineProperty
call. Currently we can end up making two such calls, making the necessary access
checks extremely ugly and hard (impossible?) to get right for complete spec
conformance.

The bulk of the change is quite mechanical:

 * Prepare an AccessorPair *before* we add it to our data structures,
   eliminating the previous voodoo-like threading of a placeholder.

 * The previous item makes it possible to activate our check that we do not
   share AccessorPairs by accident.

 * Split a monster method into 2 quite unrelated methods.

 * Use templated To method in a few places.

Review URL: https://chromiumcodereview.appspot.com/9428026

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10788 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 4e0091be
......@@ -5081,9 +5081,7 @@ void Heap::Verify() {
lo_space_->Verify();
// TODO(svenpanne) We should enable this when our fast->slow->fast-mode dance
// for setting accessor properties is fixed.
// VerifyNoAccessorPairSharing();
VerifyNoAccessorPairSharing();
}
......
This diff is collapsed.
......@@ -2139,10 +2139,16 @@ class JSObject: public JSReceiver {
String* name,
Object* structure,
PropertyAttributes attributes);
MUST_USE_RESULT MaybeObject* DefineGetterSetter(
MUST_USE_RESULT MaybeObject* DefineElementAccessor(
uint32_t index,
bool is_getter,
Object* fun,
PropertyAttributes attributes);
MUST_USE_RESULT MaybeObject* DefinePropertyAccessor(
String* name,
bool is_getter,
Object* fun,
PropertyAttributes attributes);
void LookupInDescriptor(String* name, LookupResult* result);
// Returns the hidden properties backing store object, currently
......@@ -7837,6 +7843,15 @@ class AccessorPair: public Struct {
MUST_USE_RESULT MaybeObject* CopyWithoutTransitions();
// TODO(svenpanne) Evil temporary helper, will vanish soon...
void set(bool modify_getter, Object* value) {
if (modify_getter) {
set_getter(value);
} else {
set_setter(value);
}
}
#ifdef OBJECT_PRINT
void AccessorPairPrint(FILE* out = stdout);
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment